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