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