Skip to content

Commit

Permalink
update SSA and more work needed to compress matrix before it is used …
Browse files Browse the repository at this point in the history
…for operation.
  • Loading branch information
changgang committed Mar 18, 2024
1 parent 8b9fa64 commit 374143f
Show file tree
Hide file tree
Showing 18 changed files with 347 additions and 31 deletions.
5 changes: 3 additions & 2 deletions code/steps/STEPS.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<Option compiler="gcc" />
<Build>
<Target title="release">
<Option output="../../build/bin/release/libSTEPS" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).def" prefix_auto="1" extension_auto="1" />
<Option output="../../build/bin/release/STEPS" prefix_auto="1" extension_auto="1" />
<Option object_output="../../build/obj/release/" />
<Option type="3" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Option parameters="--compiler " />
<Compiler>
<Add option="-O3" />
Expand Down
34 changes: 17 additions & 17 deletions code/steps/STEPS.depend
Original file line number Diff line number Diff line change
Expand Up @@ -2731,7 +2731,7 @@
"header/apis/steps_api_search_buffer.h"
<iostream>

1710517339 source:d:\steps\code\steps\source\apis\steps_api_search_devices.cpp
1710743277 source:d:\steps\code\steps\source\apis\steps_api_search_devices.cpp
<istream>
"header/apis/steps_api.h"
"header/apis/steps_api_common.h"
Expand Down Expand Up @@ -3622,7 +3622,7 @@
"header/steps_namespace.h"
"header/basic/utility.h"

1710077423 source:d:\steps\code\steps\source\block\differential_block.cpp
1710744533 source:d:\steps\code\steps\source\block\differential_block.cpp
"header/block/differential_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3639,7 +3639,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\first_order_block.cpp
1710744553 source:d:\steps\code\steps\source\block\first_order_block.cpp
"header/block/first_order_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3656,7 +3656,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\integral_block.cpp
1710744501 source:d:\steps\code\steps\source\block\integral_block.cpp
"header/block/integral_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3673,7 +3673,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\lead_lag_block.cpp
1710744567 source:d:\steps\code\steps\source\block\lead_lag_block.cpp
"header/block/lead_lag_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3690,7 +3690,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\pd_block.cpp
1710744578 source:d:\steps\code\steps\source\block\pd_block.cpp
"header/block/pd_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3707,7 +3707,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\pi_block.cpp
1710744587 source:d:\steps\code\steps\source\block\pi_block.cpp
"header/block/pi_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3724,7 +3724,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\pid_block.cpp
1710744597 source:d:\steps\code\steps\source\block\pid_block.cpp
"header/block/pid_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand All @@ -3741,7 +3741,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\proportional_block.cpp
1710744609 source:d:\steps\code\steps\source\block\proportional_block.cpp
"header/block/proportional_block.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -3774,7 +3774,7 @@
<cstring>
<cstdio>

1710077423 source:d:\steps\code\steps\source\block\second_order_block.cpp
1710744619 source:d:\steps\code\steps\source\block\second_order_block.cpp
"header/block/second_order_block.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand Down Expand Up @@ -4101,7 +4101,7 @@
<cstdio>
<cstdlib>

1710081458 source:d:\steps\code\steps\source\device\generator.cpp
1710745061 source:d:\steps\code\steps\source\device\generator.cpp
"header/device/generator.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -4678,7 +4678,7 @@
"header/basic/utility.h"
"header/steps_namespace.h"

1710076279 source:d:\steps\code\steps\source\model\load_model\ieel.cpp
1710743923 source:d:\steps\code\steps\source\model\load_model\ieel.cpp
"header/model/load_model/IEEL.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -5280,7 +5280,7 @@
"header/basic/utility.h"
"header/steps_namespace.h"

1710079008 source:d:\steps\code\steps\source\model\sg_models\exciter_model\sexs.cpp
1710744892 source:d:\steps\code\steps\source\model\sg_models\exciter_model\sexs.cpp
"header/model/sg_models/exciter_model/SEXS.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -5312,7 +5312,7 @@
<cstdio>
<cmath>

1710078994 source:d:\steps\code\steps\source\model\sg_models\stabilizer_model\iee2st.cpp
1710744922 source:d:\steps\code\steps\source\model\sg_models\stabilizer_model\iee2st.cpp
"header/model/sg_models/stabilizer_model/IEE2ST.h"
"header/basic/constants.h"
"header/STEPS.h"
Expand Down Expand Up @@ -5474,7 +5474,7 @@
<cstdio>
<cmath>

1710081532 source:d:\steps\code\steps\source\model\sg_models\sync_generator_model\gensal.cpp
1710744854 source:d:\steps\code\steps\source\model\sg_models\sync_generator_model\gensal.cpp
"header/model/sg_models/sync_generator_model/gensal.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -5546,7 +5546,7 @@
"header/basic/utility.h"
"header/steps_namespace.h"

1710079080 source:d:\steps\code\steps\source\model\sg_models\turbine_governors\ieeeg2.cpp
1710744912 source:d:\steps\code\steps\source\model\sg_models\turbine_governors\ieeeg2.cpp
"header/model/sg_models/turbine_governor_model/IEEEG2.h"
"header/basic/utility.h"
"header/STEPS.h"
Expand Down Expand Up @@ -6554,7 +6554,7 @@
"header/STEPS.h"
<iostream>

1710082082 source:d:\steps\code\steps\main_small_signal_analysis.cpp
1710744074 source:d:\steps\code\steps\main_small_signal_analysis.cpp
<istream>
<iostream>
"header/power_system_database.h"
Expand Down
2 changes: 1 addition & 1 deletion code/steps/main_small_signal_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main()
powerflow_solver.save_jacobian_matrix_to_file("9_bus_jacobian.csv");
powerflow_solver.save_extended_powerflow_result_to_file("9_bus.csv");

importer.load_dynamic_data("../../../bench/IEEE9.dyr");
importer.load_dynamic_data("IEEE9_ssa.dyr");

default_toolkit.set_dynamic_simulation_time_step_in_s(0.001);
simulator.set_allowed_max_power_imbalance_in_MVA(0.01);
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/differential_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ STEPS_SPARSE_MATRIX DIFFERENTIAL_BLOCK::get_linearized_matrix_A() const
double a = -1/get_T_in_s();

matrix.add_entry(0,0, a);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -319,6 +320,7 @@ STEPS_SPARSE_MATRIX DIFFERENTIAL_BLOCK::get_linearized_matrix_B() const
double b = get_K()/(get_T_in_s()*get_T_in_s());

matrix.add_entry(0,0, b);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -330,6 +332,7 @@ STEPS_SPARSE_MATRIX DIFFERENTIAL_BLOCK::get_linearized_matrix_C() const
double c = -1.0;

matrix.add_entry(0,0, c);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -341,6 +344,7 @@ STEPS_SPARSE_MATRIX DIFFERENTIAL_BLOCK::get_linearized_matrix_D() const
double d = get_K()/get_T_in_s();

matrix.add_entry(0,0, d);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/first_order_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ STEPS_SPARSE_MATRIX FIRST_ORDER_BLOCK::get_linearized_matrix_A() const

matrix.add_entry(0,0, a);
}
matrix.compress_and_merge_duplicate_entries();
return matrix;
}

Expand All @@ -509,6 +510,7 @@ STEPS_SPARSE_MATRIX FIRST_ORDER_BLOCK::get_linearized_matrix_B() const

matrix.add_entry(0,0, b);
}
matrix.compress_and_merge_duplicate_entries();
return matrix;
}

Expand All @@ -521,6 +523,7 @@ STEPS_SPARSE_MATRIX FIRST_ORDER_BLOCK::get_linearized_matrix_C() const

matrix.add_entry(0,0, c);
}
matrix.compress_and_merge_duplicate_entries();
return matrix;
}

Expand All @@ -533,6 +536,7 @@ STEPS_SPARSE_MATRIX FIRST_ORDER_BLOCK::get_linearized_matrix_D() const

matrix.add_entry(0,0, d);
}
matrix.compress_and_merge_duplicate_entries();
return matrix;
}

Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/integral_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ STEPS_SPARSE_MATRIX INTEGRAL_BLOCK::get_linearized_matrix_A() const
double a = 0.0;

matrix.add_entry(0,0, a);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -254,6 +255,7 @@ STEPS_SPARSE_MATRIX INTEGRAL_BLOCK::get_linearized_matrix_B() const
double b = 1/get_T_in_s();

matrix.add_entry(0,0, b);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -265,6 +267,7 @@ STEPS_SPARSE_MATRIX INTEGRAL_BLOCK::get_linearized_matrix_C() const
double c = 1.0;

matrix.add_entry(0,0, c);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -276,6 +279,7 @@ STEPS_SPARSE_MATRIX INTEGRAL_BLOCK::get_linearized_matrix_D() const
double d = 0.0;

matrix.add_entry(0,0, d);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/lead_lag_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ STEPS_SPARSE_MATRIX LEAD_LAG_BLOCK::get_linearized_matrix_A() const
double a = -1/get_T2_in_s();

matrix.add_entry(0,0, a);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -385,6 +386,7 @@ STEPS_SPARSE_MATRIX LEAD_LAG_BLOCK::get_linearized_matrix_B() const
double b = get_K()/get_T2_in_s();

matrix.add_entry(0,0, b);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -396,6 +398,7 @@ STEPS_SPARSE_MATRIX LEAD_LAG_BLOCK::get_linearized_matrix_C() const
double c = 1-get_T1_in_s()/get_T2_in_s();

matrix.add_entry(0,0, c);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -407,6 +410,7 @@ STEPS_SPARSE_MATRIX LEAD_LAG_BLOCK::get_linearized_matrix_D() const
double d = get_K()*get_T1_in_s()/get_T2_in_s();

matrix.add_entry(0,0, d);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/pd_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ STEPS_SPARSE_MATRIX PD_BLOCK::get_linearized_matrix_A() const
double a = -1/get_Td_in_s();

matrix.add_entry(0,0, a);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -169,6 +170,7 @@ STEPS_SPARSE_MATRIX PD_BLOCK::get_linearized_matrix_B() const
double b = get_Kd()/(get_Td_in_s()*get_Td_in_s());

matrix.add_entry(0,0, b);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -180,6 +182,7 @@ STEPS_SPARSE_MATRIX PD_BLOCK::get_linearized_matrix_C() const
double c = -1.0;

matrix.add_entry(0,0, c);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -191,6 +194,7 @@ STEPS_SPARSE_MATRIX PD_BLOCK::get_linearized_matrix_D() const
double d = get_Kp()+get_Kd()/get_Td_in_s();

matrix.add_entry(0,0, d);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/pi_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ STEPS_SPARSE_MATRIX PI_BLOCK::get_linearized_matrix_A() const
double a = 0.0;

matrix.add_entry(0,0, a);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -177,6 +178,7 @@ STEPS_SPARSE_MATRIX PI_BLOCK::get_linearized_matrix_B() const
double b = get_Ki();

matrix.add_entry(0,0, b);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -188,6 +190,7 @@ STEPS_SPARSE_MATRIX PI_BLOCK::get_linearized_matrix_C() const
double c = 1.0;

matrix.add_entry(0,0, c);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -199,6 +202,7 @@ STEPS_SPARSE_MATRIX PI_BLOCK::get_linearized_matrix_D() const
double d = get_Kp();

matrix.add_entry(0,0, d);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
4 changes: 4 additions & 0 deletions code/steps/source/block/pid_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ STEPS_SPARSE_MATRIX PID_BLOCK::get_linearized_matrix_A() const
matrix.add_entry(0,1, a01);
matrix.add_entry(1,0, a10);
matrix.add_entry(1,1, a11);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -255,6 +256,7 @@ STEPS_SPARSE_MATRIX PID_BLOCK::get_linearized_matrix_B() const

matrix.add_entry(0,0, b00);
matrix.add_entry(1,0, b10);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -267,6 +269,7 @@ STEPS_SPARSE_MATRIX PID_BLOCK::get_linearized_matrix_C() const

matrix.add_entry(0,0, c00);
matrix.add_entry(0,1, c01);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand All @@ -278,6 +281,7 @@ STEPS_SPARSE_MATRIX PID_BLOCK::get_linearized_matrix_D() const
double d00=get_Kp()+get_Kd()/get_Td_in_s();

matrix.add_entry(0,0, d00);
matrix.compress_and_merge_duplicate_entries();

return matrix;
}
Expand Down
Loading

0 comments on commit 374143f

Please sign in to comment.