Skip to content

Commit

Permalink
v0.3.24. (1) Updare pysteps to fix bug when returning str in Python 3…
Browse files Browse the repository at this point in the history
…. (2) Add function to export shadowed or equivalent bus pair when export powerflow data with export_zero_impedance_line is false. (3) Fix bug when exporting powerflow data with export_zero_impedance_line is false by updating bus type of the equivalent bus.
  • Loading branch information
changgang committed Jul 23, 2019
1 parent 432a796 commit aaf5b4a
Show file tree
Hide file tree
Showing 20 changed files with 3,134 additions and 15 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,27 @@ Simulation Toolkit for Electrical Power Systems
Maintainer: Changgang Li <[email protected]>
Please go to http://steps.drli.group:380 for documentation.

How to build:
1) Select which LA solver is to be used
Open STEPS.cbp and go to header/basic/sparse_matrix_define.h. Comment the solver you don't want to use.
For example, if you want to keep only c_sparse, comment out umfpack and klu.
Then go to source/basic/sparse_matrix_klu.cpp and umfpack.cpp, disable 'compile' and 'link' options of the two files.
2) Go compile the LS solver.
For example, open csparse.cbp, and compile CSparse. The target should be 'static library'
3) Go compile the CppTest.
Open cpptest.cbp, and compile CppTest. The target should be 'static library'
4) Build STEPS
In the linker settings, you should include the above two static libraries libCSparse.a and libCpptest.a.
Then compile the STEPS.
5) If you want to build a 64bit version, use 64 bit MinGW and select the X64 version compiler.

If you want to compile a complete version, follow the steps:
1) Compile BLAS as static library
2) Compile UMFPACK as static library
3) Compile CSparse as static library
4) Compile CppTest as static library
5) Compile STEPS as dynamic library or exectuable file. Include libUMFPACK.a, libBLAS.a, libCSparse.a, and libCpptest.a. Put libBLAS.a after libUMFPACK.a.

When compiling in Windows, remove -no-pie and -lgfortran options and remove libKLU.a, libBLAS.a, libUMFPACK.a


4 changes: 4 additions & 0 deletions code/STEPS.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Add option="-O3" />
<Add option="-Wall" />
<Add option="-std=c++1z" />
<Add option="-m64" />
<Add directory="../code" />
<Add directory="thirdparty/SuiteSparse/UMFPACK/Include" />
<Add directory="thirdparty/SuiteSparse/CSparse/Include" />
Expand All @@ -30,6 +31,7 @@
<Linker>
<Add option="-static-libstdc++" />
<Add option="-static-libgcc" />
<Add option="-m64" />
<Add library="../build/bin/Release/libCSparse.a" />
<Add library="../build/bin/Release/libCpptest.a" />
</Linker>
Expand Down Expand Up @@ -419,10 +421,12 @@
<Unit filename="source/basic/sparse_matrix.cpp" />
<Unit filename="source/basic/sparse_matrix_csparse.cpp" />
<Unit filename="source/basic/sparse_matrix_klu.cpp">
<Option compile="0" />
<Option link="0" />
</Unit>
<Unit filename="source/basic/sparse_matrix_test.cpp" />
<Unit filename="source/basic/sparse_matrix_umfpack.cpp">
<Option compile="0" />
<Option link="0" />
</Unit>
<Unit filename="source/basic/terminal.cpp" />
Expand Down
19 changes: 9 additions & 10 deletions code/STEPS.depend
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,8 @@
"header/basic/inphno.h"
<string>

1553928358 c:\users\lichg\steps\code\header\basic\sparse_matrix_define.h
1563791982 c:\users\lichg\steps\code\header\basic\sparse_matrix_define.h
"header/basic/sparse_matrix_csparse.h"
"header/basic/sparse_matrix_umfpack.h"
"header/basic/sparse_matrix_klu.h"

1553928358 c:\users\lichg\steps\code\header\basic\sparse_matrix_csparse.h
"cs.h"
Expand Down Expand Up @@ -479,7 +477,7 @@
"header/device/hvdc.h"
<vector>

1561874701 c:\users\lichg\steps\code\header\data_imexporter\data_imexporter.h
1563870847 c:\users\lichg\steps\code\header\data_imexporter\data_imexporter.h
"header/power_system_database.h"
"header/basic/base.h"
<string>
Expand All @@ -503,7 +501,7 @@
"header/basic/utility.h"
"header/steps_namespace.h"

1561874546 source:c:\users\lichg\steps\code\source\apis\steps_api_data_import_export.cpp
1563873761 source:c:\users\lichg\steps\code\source\apis\steps_api_data_import_export.cpp
"header/apis/steps_api.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand Down Expand Up @@ -2068,8 +2066,9 @@
<iostream>
<fstream>

1561861274 source:c:\users\lichg\steps\code\source\data_imexporter\data_imexporter.cpp
1563872516 source:c:\users\lichg\steps\code\source\data_imexporter\data_imexporter.cpp
"header/data_imexporter/data_imexporter.h"
"header/STEPS.h"
<cstdio>
"header/basic/utility.h"

Expand Down Expand Up @@ -2154,7 +2153,7 @@
"header/data_imexporter/psse_imexporter.h"
"header/STEPS.h"

1563243177 source:c:\users\lichg\steps\code\source\data_imexporter\psse_powerflow_imexporter.cpp
1563873156 source:c:\users\lichg\steps\code\source\data_imexporter\psse_powerflow_imexporter.cpp
"header/data_imexporter/psse_imexporter.h"
"header/data_imexporter/steps_imexporter.h"
"header/basic/utility.h"
Expand Down Expand Up @@ -4202,7 +4201,7 @@
"header/model/wtg_models/wt_electrical_model/wind_turbine_power_speed_lookup_table.h"
"header/basic/utility.h"

1561097477 source:c:\users\lichg\steps\code\source\model\wtg_models\wt_electrical_model\wt3e0.cpp
1563799901 source:c:\users\lichg\steps\code\source\model\wtg_models\wt_electrical_model\wt3e0.cpp
"header/model/wtg_models/wt_electrical_model/wt3e0.h"
"header/device/wt_generator.h"
"header/power_system_database.h"
Expand Down Expand Up @@ -4841,7 +4840,7 @@
"header/toolkit/dynamic_simulator/dynamic_simulator.h"
<fstream>

1563678595 source:c:\users\lichg\steps\code\source\toolkit\powerflow_solver\powerflow_solver.cpp
1563709170 source:c:\users\lichg\steps\code\source\toolkit\powerflow_solver\powerflow_solver.cpp
"header/toolkit/powerflow_solver/powerflow_solver.h"
"header/basic/utility.h"
"header/steps_namespace.h"
Expand Down Expand Up @@ -5292,7 +5291,7 @@
"header/toolkit/powerflow_solver/powerflow_solver.h"
"header/toolkit/dynamic_simulator/dynamic_simulator.h"

1561086121 source:c:\users\lichg\steps\code\source\apis\steps_api_utilities.cpp
1563873638 source:c:\users\lichg\steps\code\source\apis\steps_api_utilities.cpp
"header/apis/steps_api.h"
"header/apis/steps_api_common.h"
"header/basic/utility.h"
Expand Down
4 changes: 4 additions & 0 deletions code/cpptest.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
<Add option="-Wall" />
<Add option="-std=c++1z" />
<Add option="-fPIC" />
<Add option="-m64" />
<Add directory="../code" />
<Add directory="thirdparty/SuiteSparse/UMFPACK/Include" />
<Add directory="thirdparty/SuiteSparse/CSparse/Include" />
</Compiler>
<Linker>
<Add option="-m64" />
</Linker>
</Target>
</Build>
<Compiler>
Expand Down
4 changes: 4 additions & 0 deletions code/csparse.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
<Compiler>
<Add option="-O3" />
<Add option="-Wall" />
<Add option="-m64" />
<Add directory="../code" />
<Add directory="thirdparty/SuiteSparse/CSparse/Include" />
<Add directory="thirdparty/cpptest" />
<Add directory="thirdparty/SuiteSparse/UMFPACK/Include" />
<Add directory="thirdparty/SuiteSparse/SuiteSparse_config" />
<Add directory="thirdparty/SuiteSparse/AMD/Include" />
</Compiler>
<Linker>
<Add option="-m64" />
</Linker>
</Target>
</Build>
<Compiler>
Expand Down
161 changes: 161 additions & 0 deletions code/csparse.depend
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,164 @@
1544403720 source:/home/changgang/steps/code/thirdparty/SuiteSparse/CSparse/Source/cs_utsolve.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_add.c
"cs.h"

1553928359 c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\include\cs.h
<stdlib.h>
<limits.h>
<math.h>
<stdio.h>
<stddef.h>
"mex.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_amd.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_chol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_cholsol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_compress.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_counts.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_cumsum.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_dfs.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_dmperm.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_droptol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_dropzeros.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_dupl.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_entry.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_ereach.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_etree.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_fkeep.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_gaxpy.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_happly.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_house.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_ipvec.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_leaf.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_load.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_lsolve.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_ltsolve.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_lu.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_lusol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_malloc.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_maxtrans.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_multiply.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_norm.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_permute.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_pinv.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_post.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_print.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_pvec.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_qr.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_qrsol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_randperm.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_reach.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_scatter.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_scc.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_schol.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_spsolve.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_sqr.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_symperm.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_tdfs.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_transpose.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_updown.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_usolve.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_util.c
"cs.h"

1553928359 source:c:\users\lichg\steps\code\thirdparty\suitesparse\csparse\source\cs_utsolve.c
"cs.h"

4 changes: 2 additions & 2 deletions code/header/basic/sparse_matrix_define.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "header/basic/sparse_matrix_csparse.h"
#include "header/basic/sparse_matrix_umfpack.h"
#include "header/basic/sparse_matrix_klu.h"
//#include "header/basic/sparse_matrix_umfpack.h"
//#include "header/basic/sparse_matrix_klu.h"

#define STEPS_SPARSE_MATRIX SPARSE_MATRIX_CSPARSE
//#define STEPS_SPARSE_MATRIX SPARSE_MATRIX_UMFPACK
Expand Down
2 changes: 2 additions & 0 deletions code/header/data_imexporter/data_imexporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class DATA_IMEXPORTER : public BASE
bool get_export_zero_impedance_line_logic() const;
bool get_export_out_of_service_bus_logic() const;

void export_shadowed_bus_pair(string file) const;

virtual void load_powerflow_data(string pf_source) = 0;
virtual void load_dynamic_data(string dy_source) = 0;
virtual void load_sequence_data(string sq_source) = 0;
Expand Down
4 changes: 2 additions & 2 deletions code/source/apis/steps_api_data_import_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void api_save_powerflow_data_to_file(char* file, char* file_type, bool export_ze
PSSE_IMEXPORTER exporter;
exporter.set_toolkit(toolkit);
exporter.set_export_out_of_service_bus_logic(export_out_of_service_bus);
exporter.export_powerflow_data(file);
exporter.export_powerflow_data(file, export_zero_impedance_line);
}
else
{
Expand All @@ -43,7 +43,7 @@ void api_save_powerflow_data_to_file(char* file, char* file_type, bool export_ze
BPA_IMEXPORTER exporter;
exporter.set_toolkit(toolkit);
exporter.set_export_out_of_service_bus_logic(export_out_of_service_bus);
exporter.export_powerflow_data(file);
exporter.export_powerflow_data(file, export_zero_impedance_line);
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions code/source/apis/steps_api_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ double api_get_toolkit_float_data(char* parameter_name, size_t toolkit_index)
string PARAMETER_NAME = string2upper(parameter_name);
if(PARAMETER_NAME=="SBASE")
return psdb.get_system_base_power_in_MVA();
if(PARAMETER_NAME=="ZERO IMPEDANCE THRESHOLD IN PU")
return psdb.get_zero_impedance_threshold_in_pu();

show_parameter_not_supported_with_api(PARAMETER_NAME, __FUNCTION__);
return 0.0;
Expand All @@ -59,6 +61,8 @@ void api_set_toolkit_float_data(char* parameter_name, double value, size_t toolk
string PARAMETER_NAME = string2upper(parameter_name);
if(PARAMETER_NAME=="SBASE")
return psdb.set_system_base_power_in_MVA(value);
if(PARAMETER_NAME=="ZERO IMPEDANCE THRESHOLD IN PU")
return psdb.set_zero_impedance_threshold_in_pu(value);

show_parameter_not_supported_with_api(PARAMETER_NAME, __FUNCTION__);
}
Expand Down
Loading

0 comments on commit aaf5b4a

Please sign in to comment.