00001
00002
00003
00004 #ifndef _RELAY_TEST_H
00005 #define _RELAY_TEST_H
00006
00007 #include <stdlib.h>
00008 #include "relay.h"
00009
00010 #ifndef _NO_CPPUNIT
00011
00012 #ifdef VALIDATE_TOLERANCE
00013 #undef VALIDATE_TOLERANCE
00014 #endif
00015 #define VALIDATE_TOLERANCE 0.04
00016
00017 class relay_tests : public powerflow_test_helper
00018 {
00019 void test_three_phase_ganged_switch(bool status, set phases)
00020 {
00021 relay *test_relay = create_object<relay>("relay");
00022 test_relay->status = status;
00023 test_relay->reclose_time = 5;
00024 test_relay->phases = phases;
00025
00026 const complex bs_V2_in[3] = {complex(2442.6, -109.21),
00027 complex(-1315.1, -2123.6),
00028 complex(-1137.7, 2156)};
00029 const complex bs_I2_in[3] = {complex(64.32, -49.78),
00030 complex(-57.1, -21.81),
00031 complex(10.38, 61.85)};
00032 const complex bs_I1_out[3] = {
00033 status && (phases & PHASE_A) ? bs_I2_in[0] : 0.0,
00034 status && (phases & PHASE_B) ? bs_I2_in[1] : 0.0,
00035 status && (phases & PHASE_C) ? bs_I2_in[2] : 0.0};
00036
00037 const complex fs_V1_in[3] = {complex(2442.6, -109.21),
00038 complex(-1315.1, -2123.6),
00039 complex(-1137.7, 2156)};
00040 const complex fs_I2_in[3] = {complex(64.32, -49.78),
00041 complex(-57.1, -21.81),
00042 complex(10.38, 61.85)};
00043 const complex fs_V2_out[3] = {
00044 status && (phases & PHASE_A) ? bs_V2_in[0] : 0.0,
00045 status && (phases & PHASE_B) ? bs_V2_in[1] : 0.0,
00046 status && (phases & PHASE_C) ? bs_V2_in[2] : 0.0};
00047
00048 test_powerflow_link(test_relay, VALIDATE_TOLERANCE, PHASE_ABC, PHASE_ABC,
00049 bs_V2_in, bs_I2_in, bs_I1_out, fs_V1_in, fs_I2_in, fs_V2_out);
00050 }
00051
00052 void test_three_phase_ganged_switch_ABC_closed() {
00053 test_three_phase_ganged_switch(LS_CLOSED, PHASE_ABC);
00054 }
00055
00056 void test_three_phase_ganged_switch_ABC_open() {
00057 test_three_phase_ganged_switch(LS_OPEN, PHASE_ABC);
00058 }
00059
00060 void test_three_phase_ganged_switch_A_closed() {
00061 test_three_phase_ganged_switch(LS_CLOSED, PHASE_A);
00062 }
00063
00064 void test_three_phase_ganged_switch_A_open() {
00065 test_three_phase_ganged_switch(LS_OPEN, PHASE_A);
00066 }
00067
00068 void test_three_phase_ganged_switch_B_closed() {
00069 test_three_phase_ganged_switch(LS_CLOSED, PHASE_B);
00070 }
00071
00072 void test_three_phase_ganged_switch_B_open() {
00073 test_three_phase_ganged_switch(LS_OPEN, PHASE_B);
00074 }
00075
00076 void test_three_phase_ganged_switch_C_closed() {
00077 test_three_phase_ganged_switch(LS_CLOSED, PHASE_C);
00078 }
00079
00080 void test_three_phase_ganged_switch_C_open() {
00081 test_three_phase_ganged_switch(LS_OPEN, PHASE_C);
00082 }
00083
00084
00085
00086
00087
00088
00089 CPPUNIT_TEST_SUITE(relay_tests);
00090
00091
00092
00093
00094
00095
00096 CPPUNIT_TEST(test_three_phase_ganged_switch_ABC_closed);
00097 CPPUNIT_TEST(test_three_phase_ganged_switch_ABC_open);
00098 CPPUNIT_TEST(test_three_phase_ganged_switch_A_closed);
00099 CPPUNIT_TEST(test_three_phase_ganged_switch_A_open);
00100 CPPUNIT_TEST(test_three_phase_ganged_switch_B_closed);
00101 CPPUNIT_TEST(test_three_phase_ganged_switch_B_open);
00102 CPPUNIT_TEST(test_three_phase_ganged_switch_C_closed);
00103 CPPUNIT_TEST(test_three_phase_ganged_switch_C_open);
00104 CPPUNIT_TEST_SUITE_END();
00105 };
00106
00107 #endif
00108 #endif