diff --git a/README.md b/README.md index 00cb7f56..b47a77aa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Simulation Toolkit for Electrical Power Systems - Maintainer: Changgang Li from School of Electrical Engineering, Shandong University. - Documentation: [N/A] -- Date of Readme: Jan. 15, 2021 +- Date of Readme: Feb. 2, 2021 # Reference Please cite STEPS with the following paper: @@ -15,6 +15,7 @@ Though BPA dat format is supported, it will be supported in the future version i You are encourage to join us for further development. ## Major versions +- v1.5.1. Add new option export_full to functions of save_network_Y_matrix and APIs. stepspy is also updated. Start to add sequential parameters to STEPS. Released on Feb. 2, 2021. - v1.5.0. Add new function to get basic and user meter value in STEPS kernel and stepspy. Add additional parameter vbase to bus_name2number in case multi buses have the same bus name. Released on Dec. 22, 2020. - v1.4.1. Fix clear toolkit when reloading new powerflow data. Enable build initial zero Y matrix. Fix access violation in jacobian builder when updating seperate jacobian matrix. Add check of LU factorization failure. Special log file named 'blackhole' is supported to disable all log. Released on Dec. 7, 2020. - v1.4. add function to add default GENCLS model for generators without sync generator model when checking missing models. Fix bug in IEEEG1 in case T1 or T2 is not 0. Released on Sep. 27, 2020. diff --git a/code/steps/STEPS.depend b/code/steps/STEPS.depend index ef13a1c3..32d670ee 100644 --- a/code/steps/STEPS.depend +++ b/code/steps/STEPS.depend @@ -290,7 +290,7 @@ 1583938871 d:\steps\code\steps\header\model\load_relay_model\load_frequency_relay_model.h "header/model/load_relay_model/load_relay_model.h" -1607318983 d:\steps\code\steps\header\device\line.h +1611673743 d:\steps\code\steps\header\device\line.h "header/device/nonbus_device.h" "header/basic/device_id.h" "header/basic/rating.h" @@ -300,14 +300,14 @@ 1583938871 d:\steps\code\steps\header\basic\rating.h -1607318983 d:\steps\code\steps\header\device\transformer.h +1611674913 d:\steps\code\steps\header\device\transformer.h "header/device/nonbus_device.h" "header/basic/steps_enum.h" "header/basic/rating.h" -1607318983 d:\steps\code\steps\header\device\fixed_shunt.h +1611676471 d:\steps\code\steps\header\device\fixed_shunt.h "header/device/nonbus_device.h" @@ -390,7 +390,7 @@ "header/network/jacobian_builder.h" "header/basic/sparse_matrix_define.h" -1607318983 d:\steps\code\steps\header\network\network_matrix.h +1612239469 d:\steps\code\steps\header\network\network_matrix.h "header/power_system_database.h" "header/basic/sparse_matrix_define.h" "header/basic/inphno.h" @@ -953,7 +953,7 @@ "header/power_system_database.h" "header/STEPS.h" -1583938871 d:\steps\code\steps\header\device\transformer_test.h +1611675032 d:\steps\code\steps\header\device\transformer_test.h @@ -963,7 +963,7 @@ "header/power_system_database.h" "header/STEPS.h" -1598590744 d:\steps\code\steps\header\device\fixed_shunt_test.h +1611676525 d:\steps\code\steps\header\device\fixed_shunt_test.h @@ -2338,7 +2338,7 @@ "header/data_imexporter/psse_imexporter.h" "header/data_imexporter/bpa_imexporter.h" -1608619265 d:\steps\code\steps\header\apis\steps_api.h +1612240167 d:\steps\code\steps\header\apis\steps_api.h "header/basic/constants.h" @@ -2388,7 +2388,7 @@ "header/basic/utility.h" "header/steps_namespace.h" -1587536929 source:d:\steps\code\steps\source\apis\steps_api_powerflow.cpp +1612240184 source:d:\steps\code\steps\source\apis\steps_api_powerflow.cpp "header/apis/steps_api.h" "header/basic/utility.h" "header/steps_namespace.h" @@ -2405,7 +2405,7 @@ "header/apis/steps_api_search_buffer.h" -1608619265 source:d:\steps\code\steps\source\apis\steps_api_search_devices.cpp +1611548671 source:d:\steps\code\steps\source\apis\steps_api_search_devices.cpp "header/apis/steps_api.h" "header/apis/steps_api_common.h" @@ -2439,7 +2439,7 @@ "header/data_imexporter/psse_imexporter.h" "header/data_imexporter/bpa_imexporter.h" -1598590744 source:d:\steps\code\steps\source\apis\steps_api_set_get_fixed_shunt_parameters.cpp +1611676449 source:d:\steps\code\steps\source\apis\steps_api_set_get_fixed_shunt_parameters.cpp "header/apis/steps_api.h" "header/apis/steps_api_common.h" "header/basic/utility.h" @@ -2605,7 +2605,7 @@ "header/basic/utility.h" "header/steps_namespace.h" -1607318983 source:d:\steps\code\steps\source\basic\complex_sparse_matrix.cpp +1612241866 source:d:\steps\code\steps\source\basic\complex_sparse_matrix.cpp "header/basic/complex_sparse_matrix.h" "header/basic/constants.h" "header/basic/utility.h" @@ -3395,7 +3395,7 @@ -1598590744 source:d:\steps\code\steps\source\data_imexporter\bpa_powerflow_imexporter.cpp +1611676449 source:d:\steps\code\steps\source\data_imexporter\bpa_powerflow_imexporter.cpp "header/data_imexporter/bpa_imexporter.h" "header/basic/utility.h" "header/device/bus.h" @@ -3455,7 +3455,7 @@ -1585314815 source:d:\steps\code\steps\source\data_imexporter\psse_imexporter_test.cpp +1611676449 source:d:\steps\code\steps\source\data_imexporter\psse_imexporter_test.cpp "cpptest.h" "header/basic/test_macro.h" @@ -3468,7 +3468,7 @@ -1598590744 source:d:\steps\code\steps\source\data_imexporter\psse_powerflow_imexporter.cpp +1611676449 source:d:\steps\code\steps\source\data_imexporter\psse_powerflow_imexporter.cpp "header/data_imexporter/psse_imexporter.h" "header/data_imexporter/steps_imexporter.h" "header/basic/utility.h" @@ -3494,7 +3494,7 @@ -1585314815 source:d:\steps\code\steps\source\data_imexporter\steps_imexporter_test.cpp +1611676449 source:d:\steps\code\steps\source\data_imexporter\steps_imexporter_test.cpp "cpptest.h" "header/basic/test_macro.h" @@ -3507,7 +3507,7 @@ -1611360880 source:d:\steps\code\steps\source\data_imexporter\steps_powerflow_imexporter.cpp +1611676449 source:d:\steps\code\steps\source\data_imexporter\steps_powerflow_imexporter.cpp "header/data_imexporter/steps_imexporter.h" "header/basic/utility.h" "header/device/bus.h" @@ -3596,14 +3596,14 @@ -1607318983 source:d:\steps\code\steps\source\device\fixed_shunt.cpp +1611676484 source:d:\steps\code\steps\source\device\fixed_shunt.cpp "header/device/fixed_shunt.h" "header/basic/utility.h" "header/STEPS.h" -1598590744 source:d:\steps\code\steps\source\device\fixed_shunt_test.cpp +1611676601 source:d:\steps\code\steps\source\device\fixed_shunt_test.cpp "cpptest.h" "header/basic/test_macro.h" @@ -3616,7 +3616,7 @@ -1611360880 source:d:\steps\code\steps\source\device\generator.cpp +1611675979 source:d:\steps\code\steps\source\device\generator.cpp "header/device/generator.h" "header/basic/utility.h" "header/STEPS.h" @@ -3696,7 +3696,7 @@ -1611360880 source:d:\steps\code\steps\source\device\load.cpp +1611676030 source:d:\steps\code\steps\source\device\load.cpp "header/device/load.h" "header/basic/utility.h" "header/STEPS.h" @@ -3773,14 +3773,14 @@ -1607318983 source:d:\steps\code\steps\source\device\transformer.cpp +1611674947 source:d:\steps\code\steps\source\device\transformer.cpp "header/device/transformer.h" "header/basic/utility.h" "header/STEPS.h" -1598590744 source:d:\steps\code\steps\source\device\transformer_test.cpp +1611675763 source:d:\steps\code\steps\source\device\transformer_test.cpp "cpptest.h" "header/basic/test_macro.h" @@ -5393,7 +5393,7 @@ -1611360880 source:d:\steps\code\steps\source\network\jacobian_builder.cpp +1611676831 source:d:\steps\code\steps\source\network\jacobian_builder.cpp "header/network/jacobian_builder.h" "header/basic/utility.h" "header/steps_namespace.h" @@ -5410,7 +5410,7 @@ "header/steps_namespace.h" -1607318983 source:d:\steps\code\steps\source\network\network_matrix.cpp +1612241740 source:d:\steps\code\steps\source\network\network_matrix.cpp "header/network/network_matrix.h" "header/basic/utility.h" "header/STEPS.h" diff --git a/code/steps/header/apis/steps_api.h b/code/steps/header/apis/steps_api.h index 1966b337..5f4e5c4e 100644 --- a/code/steps/header/apis/steps_api.h +++ b/code/steps/header/apis/steps_api.h @@ -316,7 +316,7 @@ EXPORT_STEPS_DLL void api_build_decoupled_network_B_matrix(unsigned int toolkit_ EXPORT_STEPS_DLL void api_build_dc_network_B_matrix(unsigned int toolkit_index=INDEX_NOT_EXIST); EXPORT_STEPS_DLL void api_build_dynamic_network_Y_matrix(unsigned int toolkit_index=INDEX_NOT_EXIST); EXPORT_STEPS_DLL void api_build_network_Z_matrix(unsigned int toolkit_index=INDEX_NOT_EXIST); -EXPORT_STEPS_DLL void api_save_network_Y_matrix(char* file, unsigned int toolkit_index=INDEX_NOT_EXIST); +EXPORT_STEPS_DLL void api_save_network_Y_matrix(char* file, bool export_full=false, unsigned int toolkit_index=INDEX_NOT_EXIST); EXPORT_STEPS_DLL void api_save_decoupled_network_B_matrix(char* file, unsigned int toolkit_index=INDEX_NOT_EXIST); EXPORT_STEPS_DLL void api_save_dc_network_B_matrix(char* file, unsigned int toolkit_index=INDEX_NOT_EXIST); EXPORT_STEPS_DLL void api_save_dynamic_network_Y_matrix(char* file, unsigned int toolkit_index=INDEX_NOT_EXIST); diff --git a/code/steps/header/device/fixed_shunt.h b/code/steps/header/device/fixed_shunt.h index 4b1d3d15..6d423dbd 100644 --- a/code/steps/header/device/fixed_shunt.h +++ b/code/steps/header/device/fixed_shunt.h @@ -18,16 +18,20 @@ class FIXED_SHUNT : public NONBUS_DEVICE void set_identifier(string identifier); void set_name(string name); void set_status(bool status); - void set_nominal_impedance_shunt_in_MVA(complex s); + void set_nominal_positive_sequence_impedance_shunt_in_MVA(complex s); + void set_nominal_zero_sequence_impedance_shunt_in_MVA(complex s); unsigned int get_shunt_bus() const; BUS* get_bus_pointer() const; string get_identifier() const; string get_name() const; bool get_status() const; - complex get_nominal_impedance_shunt_in_MVA() const; + complex get_nominal_positive_sequence_impedance_shunt_in_MVA() const; complex get_nominal_impedance_shunt_in_pu() const; complex get_nominal_admittance_shunt_in_pu() const; + complex get_nominal_zero_sequence_impedance_shunt_in_MVA() const; + complex get_nominal_zero_sequence_impedance_shunt_in_pu() const; + complex get_nominal_zero_sequence_admittance_shunt_in_pu() const; virtual bool is_valid() const; virtual void check(); @@ -52,6 +56,7 @@ class FIXED_SHUNT : public NONBUS_DEVICE string identifier; string name; bool status; - complex nominal_impedance_shunt_in_MVA; + complex nominal_positive_sequence_impedance_shunt_in_MVA; + complex nominal_zero_squence_impedance_shunt_in_MVA; }; #endif // FIXED_SHUNT_H diff --git a/code/steps/header/device/fixed_shunt_test.h b/code/steps/header/device/fixed_shunt_test.h index 01e9ebf1..5695003a 100644 --- a/code/steps/header/device/fixed_shunt_test.h +++ b/code/steps/header/device/fixed_shunt_test.h @@ -30,7 +30,8 @@ class FIXED_SHUNT_TEST : public Test::Suite void test_set_get_identifier(); void test_set_get_name(); void test_set_get_status(); - void test_set_get_nominal_impedance_shunt(); + void test_set_get_nominal_positive_sequence_impedance_shunt(); + void test_set_get_nominal_zero_sequence_impedance_shunt(); void test_is_valid(); void test_clear(); diff --git a/code/steps/header/device/line.h b/code/steps/header/device/line.h index 4bc9ccf7..0af66222 100644 --- a/code/steps/header/device/line.h +++ b/code/steps/header/device/line.h @@ -116,9 +116,9 @@ class LINE : public NONBUS_DEVICE string name; bool sending_side_breaker_status, receiving_side_breaker_status; complex line_z_12, line_z_0, - line_y_12, line_y_0, - shunt_y_12_sending_side, shunt_y_0_sending_side, - shunt_y_12_receiving_side, shunt_y_0_receiving_side; + line_y_12, line_y_0, + shunt_y_12_sending_side, shunt_y_0_sending_side, + shunt_y_12_receiving_side, shunt_y_0_receiving_side; RATING rating; unsigned int meter_end_bus; double length; diff --git a/code/steps/header/device/transformer.h b/code/steps/header/device/transformer.h index 8b407526..5d4d3af8 100644 --- a/code/steps/header/device/transformer.h +++ b/code/steps/header/device/transformer.h @@ -44,6 +44,9 @@ class TRANSFORMER : public NONBUS_DEVICE void set_controlled_min_reactive_power_into_winding_in_MVar(TRANSFORMER_WINDING_SIDE winding, double q); void set_controlled_max_active_power_into_winding_in_MW(TRANSFORMER_WINDING_SIDE winding, double p); void set_controlled_min_active_power_into_winding_in_MW(TRANSFORMER_WINDING_SIDE winding, double p); + void set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding, complex z); + void set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(complex z); + void set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding1, TRANSFORMER_WINDING_SIDE winding2, complex z); @@ -75,6 +78,9 @@ class TRANSFORMER : public NONBUS_DEVICE double get_controlled_min_reactive_power_into_winding_in_MVar(TRANSFORMER_WINDING_SIDE winding) const; double get_controlled_max_active_power_into_winding_in_MW(TRANSFORMER_WINDING_SIDE winding) const; double get_controlled_min_active_power_into_winding_in_MW(TRANSFORMER_WINDING_SIDE winding) const; + complex get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding) const; + complex get_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu() const; + complex get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding1, TRANSFORMER_WINDING_SIDE winding2) const; virtual bool is_valid() const; @@ -157,7 +163,7 @@ class TRANSFORMER : public NONBUS_DEVICE RATING winding_rating_in_MVA[3]; complex zl_primary2secondary_in_pu, zl_secondary2tertiary_in_pu, - zl_primary2tertiary_in_pu, y_magnetizing_in_pu; + zl_primary2tertiary_in_pu, y_magnetizing_in_pu; double winding_turn_ratio_in_pu[3], winding_angle_shift_in_deg[3]; @@ -174,9 +180,13 @@ class TRANSFORMER : public NONBUS_DEVICE double winding_controlled_max_bus_voltage_in_pu[3], winding_controlled_min_bus_voltage_in_pu[3]; double controlled_max_reactive_power_into_winding_in_MVar[3], - controlled_min_reactive_power_into_winding_in_MVar[3]; + controlled_min_reactive_power_into_winding_in_MVar[3]; double controlled_max_active_power_into_winding_in_MW[3], - controlled_min_active_power_into_winding_in_MW[3]; + controlled_min_active_power_into_winding_in_MW[3]; + + complex z0_winding_ground_in_pu[3], z0_common_nutral_ground_in_pu; + complex z0_primary2secondary_in_pu, z0_secondary2tertiary_in_pu, + z0_primary2tertiary_in_pu; }; #endif // TRANSFORMER_H diff --git a/code/steps/header/device/transformer_test.h b/code/steps/header/device/transformer_test.h index 71837f12..4ede834b 100644 --- a/code/steps/header/device/transformer_test.h +++ b/code/steps/header/device/transformer_test.h @@ -45,6 +45,9 @@ class TRANSFORMER_TEST : public Test::Suite void test_set_get_winding_controlled_max_min_voltage(); void test_set_get_controlled_reactive_power_into_windings(); void test_set_get_controlled_active_power_into_windings(); + void test_set_get_winding_zero_sequence_impedance(); + void test_set_get_zero_sequence_impedance_between_windings(); + void test_set_get_common_zero_sequence_nutral_grouding_impedance(); void test_is_valid(); void test_clear(); diff --git a/code/steps/header/network/network_matrix.h b/code/steps/header/network/network_matrix.h index a8956328..5cc78bf1 100644 --- a/code/steps/header/network/network_matrix.h +++ b/code/steps/header/network/network_matrix.h @@ -76,7 +76,7 @@ class NETWORK_MATRIX void report_dynamic_network_matrix(); void report_physical_internal_bus_number_pair() const; - void save_network_Y_matrix_to_file(const string& filename); + void save_network_Y_matrix_to_file(const string& filename, bool export_full_matrix=true); void save_decoupled_network_B_matrix_to_file(const string& filename) const; void save_dc_network_B_matrix_to_file(const string& filename) const; void save_dynamic_network_Y_matrix_to_file(const string& filename); @@ -148,6 +148,7 @@ class NETWORK_MATRIX void report_network_matrix_common() const; void save_network_matrix_common(ofstream& file) const; + void save_full_network_matrix_common(ofstream& file) const; private: STEPS* toolkit; diff --git a/code/steps/source/apis/steps_api_powerflow.cpp b/code/steps/source/apis/steps_api_powerflow.cpp index 0bc8736e..32ac38ba 100644 --- a/code/steps/source/apis/steps_api_powerflow.cpp +++ b/code/steps/source/apis/steps_api_powerflow.cpp @@ -296,12 +296,12 @@ void api_build_network_Z_matrix(unsigned int toolkit_index) network_matrix.build_positive_sequence_network_Z_matrix(); } -void api_save_network_Y_matrix(char* file, unsigned int toolkit_index) +void api_save_network_Y_matrix(char* file, bool export_full, unsigned int toolkit_index) { STEPS& toolkit = get_toolkit(toolkit_index); POWERFLOW_SOLVER& solver = toolkit.get_powerflow_solver(); NETWORK_MATRIX& network_matrix = solver.get_network_matrix(); - network_matrix.save_network_Y_matrix_to_file(file); + network_matrix.save_network_Y_matrix_to_file(file, export_full); } void api_save_decoupled_network_B_matrix(char* file, unsigned int toolkit_index) diff --git a/code/steps/source/apis/steps_api_set_get_fixed_shunt_parameters.cpp b/code/steps/source/apis/steps_api_set_get_fixed_shunt_parameters.cpp index 55a1b53c..b1280dc3 100644 --- a/code/steps/source/apis/steps_api_set_get_fixed_shunt_parameters.cpp +++ b/code/steps/source/apis/steps_api_set_get_fixed_shunt_parameters.cpp @@ -57,10 +57,10 @@ double api_get_fixed_shunt_float_data(unsigned int bus, char* identifier, char* { string PARAMETER_NAME = string2upper(parameter_name); if(PARAMETER_NAME=="P0_MW" or PARAMETER_NAME=="NOMINAL RESISTANCE SHUNT IN MW") - return shuntptr->get_nominal_impedance_shunt_in_MVA().real(); + return shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA().real(); if(PARAMETER_NAME=="Q0_MVAR" or PARAMETER_NAME=="NOMINAL REACTANCE SHUNT IN MVAR") - return shuntptr->get_nominal_impedance_shunt_in_MVA().imag(); + return shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA().imag(); if(PARAMETER_NAME=="R_PU" or PARAMETER_NAME=="NOMINAL RESISTANCE SHUNT IN PU") return shuntptr->get_nominal_impedance_shunt_in_pu().real(); @@ -98,25 +98,25 @@ void api_set_fixed_shunt_float_data(unsigned int bus, char* identifier, char* pa string PARAMETER_NAME = string2upper(parameter_name); if(PARAMETER_NAME=="P0_MW" or PARAMETER_NAME=="NOMINAL RESISTANCE SHUNT IN MW") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(value, S.imag())); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(value, S.imag())); } if(PARAMETER_NAME=="Q0_MVAR" or PARAMETER_NAME=="NOMINAL REACTANCE SHUNT IN MVAR") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(S.real(), value)); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(S.real(), value)); } if(PARAMETER_NAME=="R_PU" or PARAMETER_NAME=="NOMINAL RESISTANCE SHUNT IN PU") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); if(S==0.0) { if(value==0.0) - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(0.0, 0.0)); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(0.0, 0.0)); else - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(1.0/value*sbase, 0.0)); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(1.0/value*sbase, 0.0)); } else { @@ -126,19 +126,19 @@ void api_set_fixed_shunt_float_data(unsigned int bus, char* identifier, char* pa Z = complex(value, Z.imag()); Y = 1.0/Z; S = Y*sbase; - return shuntptr->set_nominal_impedance_shunt_in_MVA(S); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(S); } } if(PARAMETER_NAME=="X_PU" or PARAMETER_NAME=="NOMINAL REACTANCE SHUNT IN PU") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); if(S==0.0) { if(value==0.0) - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(0.0, 0.0)); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(0.0, 0.0)); else - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(0.0, 1.0/value*sbase)); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(0.0, 1.0/value*sbase)); } else { @@ -148,20 +148,20 @@ void api_set_fixed_shunt_float_data(unsigned int bus, char* identifier, char* pa Z = complex(Z.real(),value); Y = 1.0/Z; S = Y*sbase; - return shuntptr->set_nominal_impedance_shunt_in_MVA(S); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(S); } } if(PARAMETER_NAME=="G_PU" or PARAMETER_NAME=="NOMINAL CONDUCTANCE SHUNT IN PU") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(value*sbase, S.imag())); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(value*sbase, S.imag())); } if(PARAMETER_NAME=="B_PU" or PARAMETER_NAME=="NOMINAL SUSCEPTANCE SHUNT IN PU") { - complex S = shuntptr->get_nominal_impedance_shunt_in_MVA(); - return shuntptr->set_nominal_impedance_shunt_in_MVA(complex(S.real(), -value*sbase)); + complex S = shuntptr->get_nominal_positive_sequence_impedance_shunt_in_MVA(); + return shuntptr->set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(S.real(), -value*sbase)); } show_parameter_not_supported_for_device_with_api(PARAMETER_NAME, did, __FUNCTION__); diff --git a/code/steps/source/basic/complex_sparse_matrix.cpp b/code/steps/source/basic/complex_sparse_matrix.cpp index 0d043fb4..94598709 100644 --- a/code/steps/source/basic/complex_sparse_matrix.cpp +++ b/code/steps/source/basic/complex_sparse_matrix.cpp @@ -50,7 +50,11 @@ int COMPLEX_SPARSE_MATRIX::get_column_number_of_entry_index(int index) const complex COMPLEX_SPARSE_MATRIX::get_entry_value(int row, int col) const { - return get_entry_value(get_entry_index(row, col)); + int index = get_entry_index(row, col); + if(index!=INDEX_NOT_EXIST) + return get_entry_value(index); + else + return 0.0; } complex COMPLEX_SPARSE_MATRIX::get_entry_value(int index) const diff --git a/code/steps/source/data_imexporter/bpa_powerflow_imexporter.cpp b/code/steps/source/data_imexporter/bpa_powerflow_imexporter.cpp index 236d34ca..aa34c82f 100644 --- a/code/steps/source/data_imexporter/bpa_powerflow_imexporter.cpp +++ b/code/steps/source/data_imexporter/bpa_powerflow_imexporter.cpp @@ -892,7 +892,7 @@ void BPA_IMEXPORTER::load_load_and_fixed_shunt_data() fshunt.set_shunt_bus(loads[i]->get_load_bus()); fshunt.set_identifier(loads[i]->get_identifier()); fshunt.set_status(true); - fshunt.set_nominal_impedance_shunt_in_MVA(S_z); + fshunt.set_nominal_positive_sequence_impedance_shunt_in_MVA(S_z); psdb.append_fixed_shunt(fshunt); DEVICE_ID did = loads[i]->get_device_id(); diff --git a/code/steps/source/data_imexporter/psse_imexporter_test.cpp b/code/steps/source/data_imexporter/psse_imexporter_test.cpp index 39c19a9e..a8154823 100644 --- a/code/steps/source/data_imexporter/psse_imexporter_test.cpp +++ b/code/steps/source/data_imexporter/psse_imexporter_test.cpp @@ -192,7 +192,7 @@ void PSSE_IMEXPORTER_TEST::test_load_fixed_shunt_data() TEST_ASSERT(shunt->get_shunt_bus()==151); TEST_ASSERT(shunt->get_identifier()=="F1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(5.0, 400.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(5.0, 400.0)); terminal.clear(); terminal.append_bus(201); @@ -202,7 +202,7 @@ void PSSE_IMEXPORTER_TEST::test_load_fixed_shunt_data() TEST_ASSERT(shunt->get_shunt_bus()==201); TEST_ASSERT(shunt->get_identifier()=="1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(3.67, 500.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(3.67, 500.0)); terminal.clear(); terminal.append_bus(3022); @@ -212,7 +212,7 @@ void PSSE_IMEXPORTER_TEST::test_load_fixed_shunt_data() TEST_ASSERT(shunt->get_shunt_bus()==3022); TEST_ASSERT(shunt->get_identifier()=="1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(0.0, -1080.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(0.0, -1080.0)); } void PSSE_IMEXPORTER_TEST::test_load_generator_data() diff --git a/code/steps/source/data_imexporter/psse_powerflow_imexporter.cpp b/code/steps/source/data_imexporter/psse_powerflow_imexporter.cpp index 573e7715..37612f9f 100644 --- a/code/steps/source/data_imexporter/psse_powerflow_imexporter.cpp +++ b/code/steps/source/data_imexporter/psse_powerflow_imexporter.cpp @@ -612,8 +612,8 @@ string PSSE_IMEXPORTER::export_fixed_shunt_data(const FIXED_SHUNT* shunt) const <get_status()<<", " - <get_nominal_impedance_shunt_in_MVA().real()<<", " - <get_nominal_impedance_shunt_in_MVA().imag()<get_nominal_positive_sequence_impedance_shunt_in_MVA().real()<<", " + <get_nominal_positive_sequence_impedance_shunt_in_MVA().imag()<get_shunt_bus()==151); TEST_ASSERT(shunt->get_identifier()=="F1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(5.0, 400.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(5.0, 400.0)); terminal.clear(); terminal.append_bus(201); @@ -203,7 +203,7 @@ void STEPS_IMEXPORTER_TEST::test_load_fixed_shunt_data() TEST_ASSERT(shunt->get_shunt_bus()==201); TEST_ASSERT(shunt->get_identifier()=="1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(3.67, 500.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(3.67, 500.0)); terminal.clear(); terminal.append_bus(3022); @@ -213,7 +213,7 @@ void STEPS_IMEXPORTER_TEST::test_load_fixed_shunt_data() TEST_ASSERT(shunt->get_shunt_bus()==3022); TEST_ASSERT(shunt->get_identifier()=="1"); TEST_ASSERT(shunt->get_status()==true); - TEST_ASSERT(shunt->get_nominal_impedance_shunt_in_MVA()==complex(0.0, -1080.0)); + TEST_ASSERT(shunt->get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(0.0, -1080.0)); } void STEPS_IMEXPORTER_TEST::test_load_generator_data() diff --git a/code/steps/source/data_imexporter/steps_powerflow_imexporter.cpp b/code/steps/source/data_imexporter/steps_powerflow_imexporter.cpp index b4c94721..8aa5ac76 100644 --- a/code/steps/source/data_imexporter/steps_powerflow_imexporter.cpp +++ b/code/steps/source/data_imexporter/steps_powerflow_imexporter.cpp @@ -494,7 +494,7 @@ void STEPS_IMEXPORTER::load_fixed_shunt_data() q=get_double_data(data[n],"0.0"); data.erase(data.begin()); } - shunt.set_nominal_impedance_shunt_in_MVA(complex(p,-q)); + shunt.set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(p,-q)); psdb.append_fixed_shunt(shunt); } @@ -2175,8 +2175,8 @@ string STEPS_IMEXPORTER::export_fixed_shunt_data() const <<"\""<<", " <get_status()<<", " - <get_nominal_impedance_shunt_in_MVA().real()<<", " - <get_nominal_impedance_shunt_in_MVA().imag()<get_nominal_positive_sequence_impedance_shunt_in_MVA().real()<<", " + <get_nominal_positive_sequence_impedance_shunt_in_MVA().imag()<status = status; } -void FIXED_SHUNT::set_nominal_impedance_shunt_in_MVA(complex s) +void FIXED_SHUNT::set_nominal_positive_sequence_impedance_shunt_in_MVA(complex s) { - nominal_impedance_shunt_in_MVA = s; + nominal_positive_sequence_impedance_shunt_in_MVA = s; +} + +void FIXED_SHUNT::set_nominal_zero_sequence_impedance_shunt_in_MVA(complex s) +{ + nominal_zero_squence_impedance_shunt_in_MVA = s; } unsigned int FIXED_SHUNT::get_shunt_bus() const @@ -93,14 +98,14 @@ bool FIXED_SHUNT::get_status() const return status; } -complex FIXED_SHUNT::get_nominal_impedance_shunt_in_MVA() const +complex FIXED_SHUNT::get_nominal_positive_sequence_impedance_shunt_in_MVA() const { - return nominal_impedance_shunt_in_MVA; + return nominal_positive_sequence_impedance_shunt_in_MVA; } complex FIXED_SHUNT::get_nominal_impedance_shunt_in_pu() const { - if (get_nominal_impedance_shunt_in_MVA() == 0.0) + if (get_nominal_positive_sequence_impedance_shunt_in_MVA() == 0.0) return complex(0.0, INFINITE_THRESHOLD); ostringstream osstream; @@ -109,17 +114,44 @@ complex FIXED_SHUNT::get_nominal_impedance_shunt_in_pu() const POWER_SYSTEM_DATABASE& psdb = toolkit.get_power_system_database(); double sbase = psdb.get_system_base_power_in_MVA(); - return conj(sbase/get_nominal_impedance_shunt_in_MVA()); + return conj(sbase/get_nominal_positive_sequence_impedance_shunt_in_MVA()); } complex FIXED_SHUNT::get_nominal_admittance_shunt_in_pu() const { - if (get_nominal_impedance_shunt_in_MVA() == 0.0) + if (get_nominal_positive_sequence_impedance_shunt_in_MVA() == 0.0) return 0.0; else return 1.0/get_nominal_impedance_shunt_in_pu(); } +complex FIXED_SHUNT::get_nominal_zero_sequence_impedance_shunt_in_MVA() const +{ + return nominal_zero_squence_impedance_shunt_in_MVA; +} + +complex FIXED_SHUNT::get_nominal_zero_sequence_impedance_shunt_in_pu() const +{ + if (get_nominal_zero_sequence_impedance_shunt_in_MVA() == 0.0) + return complex(0.0, INFINITE_THRESHOLD); + + ostringstream osstream; + + STEPS& toolkit = get_toolkit(); + POWER_SYSTEM_DATABASE& psdb = toolkit.get_power_system_database(); + + double sbase = psdb.get_system_base_power_in_MVA(); + return conj(sbase/get_nominal_zero_sequence_impedance_shunt_in_MVA()); +} + +complex FIXED_SHUNT::get_nominal_zero_sequence_admittance_shunt_in_pu() const +{ + if (get_nominal_zero_sequence_impedance_shunt_in_MVA() == 0.0) + return 0.0; + else + return 1.0/get_nominal_zero_sequence_impedance_shunt_in_pu(); +} + bool FIXED_SHUNT::is_valid() const { if(get_shunt_bus()!=0) @@ -140,7 +172,8 @@ void FIXED_SHUNT::clear() set_identifier(""); set_name(""); set_status(false); - set_nominal_impedance_shunt_in_MVA(0.0); + set_nominal_positive_sequence_impedance_shunt_in_MVA(0.0); + set_nominal_zero_sequence_impedance_shunt_in_MVA(0.0); } bool FIXED_SHUNT::is_connected_to_bus(unsigned int target_bus) const @@ -179,7 +212,7 @@ void FIXED_SHUNT::report() const { ostringstream osstream; osstream< FIXED_SHUNT::get_actual_impedance_shunt_in_MVA() const if(get_status() == true) { - complex S0 = get_nominal_impedance_shunt_in_MVA(); + complex S0 = get_nominal_positive_sequence_impedance_shunt_in_MVA(); STEPS& toolkit = get_toolkit(); POWER_SYSTEM_DATABASE& psdb = toolkit.get_power_system_database(); diff --git a/code/steps/source/device/fixed_shunt_test.cpp b/code/steps/source/device/fixed_shunt_test.cpp index 60618d3e..027e4025 100644 --- a/code/steps/source/device/fixed_shunt_test.cpp +++ b/code/steps/source/device/fixed_shunt_test.cpp @@ -25,7 +25,7 @@ FIXED_SHUNT_TEST::FIXED_SHUNT_TEST() : fixed_shunt(default_toolkit) TEST_ADD(FIXED_SHUNT_TEST::test_set_get_identifier); TEST_ADD(FIXED_SHUNT_TEST::test_set_get_name); TEST_ADD(FIXED_SHUNT_TEST::test_set_get_status); - TEST_ADD(FIXED_SHUNT_TEST::test_set_get_nominal_impedance_shunt); + TEST_ADD(FIXED_SHUNT_TEST::test_set_get_nominal_positive_sequence_impedance_shunt); TEST_ADD(FIXED_SHUNT_TEST::test_is_valid); TEST_ADD(FIXED_SHUNT_TEST::test_clear); @@ -68,7 +68,7 @@ void FIXED_SHUNT_TEST::test_constructor() TEST_ASSERT(fixed_shunt.get_identifier()==""); TEST_ASSERT(fixed_shunt.get_name()==""); TEST_ASSERT(fixed_shunt.get_status()==false); - TEST_ASSERT(fixed_shunt.get_nominal_impedance_shunt_in_MVA()==0.0); + TEST_ASSERT(fixed_shunt.get_nominal_positive_sequence_impedance_shunt_in_MVA()==0.0); } void FIXED_SHUNT_TEST::test_set_get_shunt_bus() @@ -107,17 +107,28 @@ void FIXED_SHUNT_TEST::test_set_get_status() TEST_ASSERT(fixed_shunt.get_status()==false); } -void FIXED_SHUNT_TEST::test_set_get_nominal_impedance_shunt() +void FIXED_SHUNT_TEST::test_set_get_nominal_positive_sequence_impedance_shunt() { show_test_information_for_function_of_class(__FUNCTION__,"FIXED_SHUNT_TEST"); complex s(10, 300); - fixed_shunt.set_nominal_impedance_shunt_in_MVA(s); - TEST_ASSERT(fixed_shunt.get_nominal_impedance_shunt_in_MVA()==s); + fixed_shunt.set_nominal_positive_sequence_impedance_shunt_in_MVA(s); + TEST_ASSERT(fixed_shunt.get_nominal_positive_sequence_impedance_shunt_in_MVA()==s); TEST_ASSERT(abs(fixed_shunt.get_nominal_impedance_shunt_in_pu()-conj(100.0/s)) s(10, 300); + fixed_shunt.set_nominal_zero_sequence_impedance_shunt_in_MVA(s); + TEST_ASSERT(fixed_shunt.get_nominal_zero_sequence_impedance_shunt_in_MVA()==s); + TEST_ASSERT(abs(fixed_shunt.get_nominal_zero_sequence_impedance_shunt_in_pu()-conj(100.0/s))(10.0, 300.0)); + fixed_shunt.set_nominal_positive_sequence_impedance_shunt_in_MVA(complex(10.0, 300.0)); FIXED_SHUNT fixed_shunt2 = fixed_shunt; @@ -157,7 +168,7 @@ void FIXED_SHUNT_TEST::test_copy_with_operator_equal() TEST_ASSERT(fixed_shunt2.get_identifier()=="1#"); TEST_ASSERT(fixed_shunt2.get_name()=="shunt-1#"); TEST_ASSERT(fixed_shunt2.get_status()==false); - TEST_ASSERT(fixed_shunt2.get_nominal_impedance_shunt_in_MVA()==complex(10.0, 300.0)); + TEST_ASSERT(fixed_shunt2.get_nominal_positive_sequence_impedance_shunt_in_MVA()==complex(10.0, 300.0)); } void FIXED_SHUNT_TEST::test_is_connected_to_bus() @@ -201,7 +212,7 @@ void FIXED_SHUNT_TEST::test_get_actual_impedance_shunt() fixed_shunt.set_shunt_bus(1); fixed_shunt.set_status(true); complex s_Z(10.0, 300.0); - fixed_shunt.set_nominal_impedance_shunt_in_MVA(s_Z); + fixed_shunt.set_nominal_positive_sequence_impedance_shunt_in_MVA(s_Z); POWER_SYSTEM_DATABASE& psdb = default_toolkit.get_power_system_database(); BUS* bus = psdb.get_bus(fixed_shunt.get_shunt_bus()); diff --git a/code/steps/source/device/generator.cpp b/code/steps/source/device/generator.cpp index c3f4fc9a..80103b06 100644 --- a/code/steps/source/device/generator.cpp +++ b/code/steps/source/device/generator.cpp @@ -556,6 +556,15 @@ GENERATOR& GENERATOR::operator=(const GENERATOR& gen) set_model(gen.get_stabilizer_model()); set_model(gen.get_turbine_governor_model()); set_model(gen.get_turbine_load_controller_model()); + + set_positive_sequence_resistance_in_pu(gen.get_positive_sequence_resistance_in_pu()); + set_positive_sequence_syncronous_reactance_in_pu(gen.get_positive_sequence_syncronous_reactance_in_pu()); + set_positive_sequence_transient_reactance_in_pu(gen.get_positive_sequence_transient_reactance_in_pu()); + set_positive_sequence_subtransient_reactance_in_pu(gen.get_positive_sequence_subtransient_reactance_in_pu()); + set_negative_sequence_resistance_in_pu(gen.get_negative_sequence_resistance_in_pu()); + set_negative_sequence_reactance_in_pu(gen.get_negative_sequence_reactance_in_pu()); + set_zero_sequence_resistance_in_pu(gen.get_zero_sequence_resistance_in_pu()); + set_zero_sequence_reactance_in_pu(gen.get_zero_sequence_reactance_in_pu()); return *this; } diff --git a/code/steps/source/device/load.cpp b/code/steps/source/device/load.cpp index 2f77f725..4930b434 100644 --- a/code/steps/source/device/load.cpp +++ b/code/steps/source/device/load.cpp @@ -270,6 +270,9 @@ LOAD& LOAD::operator=(const LOAD& load) set_model(load.get_load_voltage_relay_model()); set_model(load.get_load_frequency_relay_model()); + set_negative_sequence_load_in_MVA(load.get_negative_sequence_load_in_MVA()); + set_zero_sequence_load_in_MVA(load.get_zero_sequence_load_in_MVA()); + return *this; } diff --git a/code/steps/source/device/transformer.cpp b/code/steps/source/device/transformer.cpp index 4fa2d6a6..5ae43551 100644 --- a/code/steps/source/device/transformer.cpp +++ b/code/steps/source/device/transformer.cpp @@ -315,6 +315,37 @@ void TRANSFORMER::set_controlled_min_active_power_into_winding_in_MW(TRANSFORMER controlled_min_active_power_into_winding_in_MW[winding] = p; } +void TRANSFORMER::set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding, complex z) +{ + z0_winding_ground_in_pu[winding] = z; +} + +void TRANSFORMER::set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(complex z) +{ + z0_common_nutral_ground_in_pu = z; +} +void TRANSFORMER::set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding1, TRANSFORMER_WINDING_SIDE winding2, complex z) +{ + if((winding1==PRIMARY_SIDE and winding2==SECONDARY_SIDE) or + (winding1==SECONDARY_SIDE and winding2==PRIMARY_SIDE)) + { + z0_primary2secondary_in_pu = z; + return; + } + if((winding1==PRIMARY_SIDE and winding2==TERTIARY_SIDE) or + (winding1==TERTIARY_SIDE and winding2==PRIMARY_SIDE)) + { + z0_primary2tertiary_in_pu = z; + return; + } + if((winding1==TERTIARY_SIDE and winding2==SECONDARY_SIDE) or + (winding1==SECONDARY_SIDE and winding2==TERTIARY_SIDE)) + { + z0_secondary2tertiary_in_pu = z; + return; + } +} + string TRANSFORMER::get_identifier() const { return identifier; @@ -496,7 +527,29 @@ double TRANSFORMER::get_controlled_min_active_power_into_winding_in_MW(TRANSFORM return controlled_min_active_power_into_winding_in_MW[winding]; } +complex TRANSFORMER::get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding) const +{ + return z0_winding_ground_in_pu[winding]; +} +complex TRANSFORMER::get_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu() const +{ + return z0_common_nutral_ground_in_pu; +} + +complex TRANSFORMER::get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TRANSFORMER_WINDING_SIDE winding1, TRANSFORMER_WINDING_SIDE winding2) const +{ + if((winding1==PRIMARY_SIDE and winding2==SECONDARY_SIDE) or + (winding1==SECONDARY_SIDE and winding2==PRIMARY_SIDE)) + return z0_primary2secondary_in_pu; + if((winding1==PRIMARY_SIDE and winding2==TERTIARY_SIDE) or + (winding1==TERTIARY_SIDE and winding2==PRIMARY_SIDE)) + return z0_primary2tertiary_in_pu; + if((winding1==TERTIARY_SIDE and winding2==SECONDARY_SIDE) or + (winding1==SECONDARY_SIDE and winding2==TERTIARY_SIDE)) + return z0_secondary2tertiary_in_pu; + return 0.0; +} bool TRANSFORMER::is_valid() const { @@ -718,6 +771,16 @@ void TRANSFORMER::clear() set_controlled_min_active_power_into_winding_in_MW(SECONDARY_SIDE, 0.0); set_controlled_max_active_power_into_winding_in_MW(TERTIARY_SIDE, 0.0); set_controlled_min_active_power_into_winding_in_MW(TERTIARY_SIDE, 0.0); + + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE, 0.0); + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE, 0.0); + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE, 0.0); + + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE, 0.0); + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE, 0.0); + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE, 0.0); + + set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(0.0); } bool TRANSFORMER::is_connected_to_bus(unsigned int bus) const @@ -997,6 +1060,21 @@ TRANSFORMER& TRANSFORMER::operator=(const TRANSFORMER& transformer) if(transformer.is_three_winding_transformer()) set_controlled_min_active_power_into_winding_in_MW(TERTIARY_SIDE, transformer.get_controlled_min_active_power_into_winding_in_MW(TERTIARY_SIDE)); + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE, + transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE)); + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE, + transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE)); + set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TERTIARY_SIDE, PRIMARY_SIDE, + transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TERTIARY_SIDE, PRIMARY_SIDE)); + + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE, + transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE)); + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE, + transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE)); + set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE, + transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE)); + + set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(transformer.get_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu()); return *this; } diff --git a/code/steps/source/device/transformer_test.cpp b/code/steps/source/device/transformer_test.cpp index 56f33b05..96ebdf59 100644 --- a/code/steps/source/device/transformer_test.cpp +++ b/code/steps/source/device/transformer_test.cpp @@ -39,6 +39,9 @@ TRANSFORMER_TEST::TRANSFORMER_TEST() : transformer(default_toolkit) TEST_ADD(TRANSFORMER_TEST::test_set_get_winding_controlled_max_min_voltage); TEST_ADD(TRANSFORMER_TEST::test_set_get_controlled_reactive_power_into_windings); TEST_ADD(TRANSFORMER_TEST::test_set_get_controlled_active_power_into_windings); + TEST_ADD(TRANSFORMER_TEST::test_set_get_winding_zero_sequence_impedance); + TEST_ADD(TRANSFORMER_TEST::test_set_get_zero_sequence_impedance_between_windings); + TEST_ADD(TRANSFORMER_TEST::test_set_get_common_zero_sequence_nutral_grouding_impedance); TEST_ADD(TRANSFORMER_TEST::test_is_valid); TEST_ADD(TRANSFORMER_TEST::test_clear); @@ -172,6 +175,13 @@ void TRANSFORMER_TEST::test_constructor() TEST_ASSERT(transformer.get_controlled_min_active_power_into_winding_in_MW(PRIMARY_SIDE)==0.0); TEST_ASSERT(transformer.get_controlled_min_active_power_into_winding_in_MW(SECONDARY_SIDE)==0.0); TEST_ASSERT(transformer.get_controlled_min_active_power_into_winding_in_MW(TERTIARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE,SECONDARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE,TERTIARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(TERTIARY_SIDE,PRIMARY_SIDE)==0.0); + TEST_ASSERT(transformer.get_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu()==0.0); } void TRANSFORMER_TEST::test_set_get_winding_buses() @@ -499,6 +509,56 @@ void TRANSFORMER_TEST::test_set_get_controlled_active_power_into_windings() TEST_ASSERT(transformer.get_controlled_min_active_power_into_winding_in_MW(TERTIARY_SIDE)==60.0); } + +void TRANSFORMER_TEST::test_set_get_winding_zero_sequence_impedance() +{ + show_test_information_for_function_of_class(__FUNCTION__,"TRANSFORMER_TEST"); + + complex z; + + z = complex(0.1, 0.2); + transformer.set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(PRIMARY_SIDE)-z)(0.5, 0.9); + transformer.set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE)-z)(0.3, 0.7); + transformer.set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE)-z) z; + + z = complex(0.11, 0.22); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE)-z)(0.33, 0.44); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE)-z)(0.55, 0.66); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, TERTIARY_SIDE, z); + TEST_ASSERT(abs(transformer.get_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, TERTIARY_SIDE)-z) z; + + z = complex(0.101, 0.202); + transformer.set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(z); + TEST_ASSERT(abs(transformer.get_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu()-z)(0.1, 0.2)); + transformer.set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(SECONDARY_SIDE, complex(0.3, 0.4)); + transformer.set_winding_zero_sequence_impedance_based_on_winding_nominals_in_pu(TERTIARY_SIDE, complex(0.5, 0.6)); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, SECONDARY_SIDE, complex(0.101, 0.202)); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(SECONDARY_SIDE, TERTIARY_SIDE, complex(0.303, 0.404)); + transformer.set_zero_sequence_impedance_between_windings_based_on_winding_nominals_in_pu(PRIMARY_SIDE, TERTIARY_SIDE, complex(0.505, 0.606)); + transformer.set_common_zero_sequence_nutural_grounding_impedance_based_on_winding_nominals_in_pu(complex(0.7, 0.8)); + TRANSFORMER newtransformer(default_toolkit); @@ -611,6 +679,15 @@ void TRANSFORMER_TEST::test_copy_with_operator_equal() TEST_ASSERT(fabs(newtransformer.get_winding_min_turn_ratio_based_on_winding_nominal_voltage_in_pu(TERTIARY_SIDE)-0.8)(0.1, 0.2))(0.3, 0.4))(0.5, 0.6))(0.101, 0.202))(0.303, 0.404))(0.505, 0.606))(0.7, 0.8))get_power_system_database(); const STEPS_COMPLEX_SPARSE_MATRIX& Y = nw_db->get_network_Y_matrix(); - //unsigned int nbus = psdb.get_in_service_bus_count(); unsigned int nbus = Y.get_matrix_size(); double der; complex y; @@ -211,10 +209,8 @@ void JACOBIAN_BUILDER::update_jacobian_delta_p_over_voltage() if(is_network_matrix_set()) { NETWORK_MATRIX* nw_db = get_network_Y_matrix(); - POWER_SYSTEM_DATABASE& psdb = toolkit->get_power_system_database(); const STEPS_COMPLEX_SPARSE_MATRIX& Y = nw_db->get_network_Y_matrix(); - //unsigned int nbus = psdb.get_in_service_bus_count(); unsigned int nbus = Y.get_matrix_size(); double der; complex y; @@ -278,10 +274,8 @@ void JACOBIAN_BUILDER::update_jacobian_delta_q_over_angle() if(is_network_matrix_set()) { NETWORK_MATRIX* nw_db = get_network_Y_matrix(); - POWER_SYSTEM_DATABASE& psdb = toolkit->get_power_system_database(); const STEPS_COMPLEX_SPARSE_MATRIX& Y = nw_db->get_network_Y_matrix(); - //unsigned int nbus = psdb.get_in_service_bus_count(); unsigned int nbus = Y.get_matrix_size(); double der; complex y; @@ -345,10 +339,8 @@ void JACOBIAN_BUILDER::update_jacobian_delta_q_over_voltage() if(is_network_matrix_set()) { NETWORK_MATRIX* nw_db = get_network_Y_matrix(); - POWER_SYSTEM_DATABASE& psdb = toolkit->get_power_system_database(); const STEPS_COMPLEX_SPARSE_MATRIX& Y = nw_db->get_network_Y_matrix(); - //unsigned int nbus = psdb.get_in_service_bus_count(); unsigned int nbus = Y.get_matrix_size(); double der; complex y; diff --git a/code/steps/source/network/network_matrix.cpp b/code/steps/source/network/network_matrix.cpp index 0021080e..4f68b03d 100644 --- a/code/steps/source/network/network_matrix.cpp +++ b/code/steps/source/network/network_matrix.cpp @@ -3049,7 +3049,7 @@ void NETWORK_MATRIX::report_network_matrix_common() const } -void NETWORK_MATRIX::save_network_Y_matrix_to_file(const string& filename) +void NETWORK_MATRIX::save_network_Y_matrix_to_file(const string& filename, bool export_full_matrix) { ostringstream osstream; ofstream file(filename); @@ -3058,6 +3058,13 @@ void NETWORK_MATRIX::save_network_Y_matrix_to_file(const string& filename) set_this_Y_and_Z_matrix_as(network_Y1_matrix); save_network_matrix_common(file); file.close(); + + ofstream full_file("full_"+filename); + if(full_file.is_open()) + { + save_full_network_matrix_common(full_file); + full_file.close(); + } } else { @@ -3205,6 +3212,54 @@ void NETWORK_MATRIX::save_network_matrix_common(ofstream& file) const } +void NETWORK_MATRIX::save_full_network_matrix_common(ofstream& file) const +{ + unsigned int i, ibus; + unsigned int n = this_Y_matrix_pointer->get_matrix_size(); + complex y; + + file<<"internal,"; + for(i=0; iget_entry_value(i,j); + if(y==0.0) + { + file<<","; + } + else + { + if(y.imag()>=0.0) + { + if(y.real()!=0.0) + file<<","<=1.5.1. - 1.4.0. Dec. 22, 2020. Add new API get_basic/user_meter_value. Add default parameter vbase to API bus_name2number. STEPS kernel is also updated. - 1.3.1. Dec. 7, 2020. Rename the second "shed_generator" to "shed_wt_generator". - 1.3.0. Sep. 27, 2020. Add new API: get_generator_governor_pmax/pmin, get_generator_governor_up/down_spinning_reserve, get_generator_governor_total_up/down_spinning_reserve_with_constraints, get_generator_governor_total_pmax/pmin_with_constraints. diff --git a/python/stepspy-current/setup.py b/python/stepspy-current/setup.py index c760fc13..8fd86dfe 100644 --- a/python/stepspy-current/setup.py +++ b/python/stepspy-current/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="stepspy", - version="1.4.0", + version="1.4.1", author="Changgang Li", author_email="lichgang@sdu.edu.cn", description="Python module of Simulation Toolkit for Electrical Power Systems", diff --git a/python/stepspy-current/stepspy/libsteps/pylibsteps.py b/python/stepspy-current/stepspy/libsteps/pylibsteps.py index 6fe29b35..2716cc0d 100644 --- a/python/stepspy-current/stepspy/libsteps/pylibsteps.py +++ b/python/stepspy-current/stepspy/libsteps/pylibsteps.py @@ -560,7 +560,7 @@ def load_library(): libsteps.api_build_network_Z_matrix.restype = None libsteps.api_build_network_Z_matrix.argtypes = (c_uint, ) libsteps.api_save_network_Y_matrix.restype = None - libsteps.api_save_network_Y_matrix.argtypes = (c_char_p, c_uint) + libsteps.api_save_network_Y_matrix.argtypes = (c_char_p, c_bool, c_uint) libsteps.api_save_decoupled_network_B_matrix.restype = None libsteps.api_save_decoupled_network_B_matrix.argtypes = (c_char_p, c_uint) libsteps.api_save_dc_network_B_matrix.restype = None diff --git a/python/stepspy-current/stepspy/stepspy.py b/python/stepspy-current/stepspy/stepspy.py index b3449b18..44ff7388 100644 --- a/python/stepspy-current/stepspy/stepspy.py +++ b/python/stepspy-current/stepspy/stepspy.py @@ -4289,7 +4289,7 @@ def build_network_Z_matrix(self): STEPS_LIB.api_build_network_Z_matrix(self.toolkit_index) return - def save_network_Y_matrix(self, file): + def save_network_Y_matrix(self, file, export_full=False): """ Save newwork complex Y matrix to file. Args: @@ -4299,7 +4299,7 @@ def save_network_Y_matrix(self, file): """ global STEPS_LIB file = self.__get_c_char_p_of_string(file) - STEPS_LIB.api_save_network_Y_matrix(file, self.toolkit_index) + STEPS_LIB.api_save_network_Y_matrix(file, export_full, self.toolkit_index) return def save_decoupled_network_B_matrix(self, file):