-
Notifications
You must be signed in to change notification settings - Fork 19
Toolkit related APIs
Format: set_encode(encode)
Description: Set encoding name of the toolkit.
Args:
(1) encode: string, encoding name.
Rets: N/A
Example:
simulator.set_encode("utf-8")
simulator.set_encode("GB18030")
Format: get_encode()
Description: Get current encoding name of the toolkit.
Args: N/A
Rets:
(1) encode: string, encoding name.
Example:
encode = simulator.get_encode()
Format: set_toolkit_log_file(log_file="", log_file_append_mode=False)
Description: Set toolkit log file. The default mode is to write to new file.
Args:
(1) log_file: string, target log file name. If log_file="blackhole", all logs are disabled. If no file is set (""), the log will be exported to stdout.
(2) log_file_append_mode: boolean, log file append mode. True for writting to new file, False for appending to existing file. Default is False.
Rets: N/A
Example:
simulator.set_toolkit_log_file("caseA.log")
simulator.set_toolkit_log_file("caseB.log",True)
simulator.set_toolkit_log_file("blackhole") # disable all logs
Format: set_parallel_thread_number(num=1)
Description: Set parallel thread number for parallel simulation.
Args:
(1) num: integer, parallel thread number. If num=1, serial simulation is used. num should be < number of CPU physical cores.
Rets: N/A
Example:
np = 10
simulator.set_parallel_thread_number(np)
Format: get_parallel_thread_number()
Description: Set parallel thread number for parallel simulation.
Args: N/A
Rets:
(1) parallel thread number, integer
Example:
np = simulator.get_parallel_thread_number()
Format: clear_toolkit()
Description: Clear all data in the toolkit.
Args: N/A
Rets: N/A
Example:
simulator.clear_toolkit()
Format: get_toolkit_float_data(dataname)
Description: Get toolkit general float data.
Args:
(1) dataname: String of variable name. See function 'api_get_toolkit_float_data' in STEPS source for supported options.
Rets:
(1) Value of the variable. 0 if the variable name is invalid.
Example: N/A
Format: set_toolkit_float_data(dataname, value)
Description: Set toolkit general float data.
Args:
(1) dataname: String of variable name. See function 'api_set_toolkit_float_data' in STEPS source for supported options.
(2) value: Value to set.
Rets: N/A
Example: N/A
Format: get_toolkit_string_data(dataname)
Description: Get toolkit general string variable.
Args:
(1) dataname: String of variable name. See function 'api_get_toolkit_string_data' in STEPS source for supported options.
Rets:
(1) String to variable.
Example: N/A
Format: set_toolkit_string_data(dataname, value)
Description: Set toolkit general string variable.
Args:
(1) dataname: String of variable name. See function 'api_set_toolkit_string_data' in STEPS source for supported options.
(2) value: String to set.
Rets: N/A
Example: N/A
Format: get_toolkit_bool_data(dataname)
Description: Get toolkit general boolean data.
Args:
(1) dataname: String of variable name. See function 'api_get_toolkit_bool_data' in STEPS source for supported options.
Rets:
(1) Boolean value of given dataname. If data name is invalid, False is returned.
Example: N/A
Format: set_toolkit_bool_data(dataname, value)
Description: Set toolkit general boolean data.
Args:
(1) dataname: String of variable name. See function 'api_set_toolkit_bool_data' in STEPS source for supported options.
(2) value: Boolean value.
Rets: N/A
Example: N/A
Format: get_system_base_power_in_MVA()
Description: Get toolkit system base power.
Args: N/A
Rets:
(1) System base power in MVA.
Example:
sbase = simulator.get_system_base_power_in_MVA()
Format: set_system_base_power_in_MVA(sbase)
Description: Set toolkit system base power.
Args:
(1) sbase: System base power in MVA.
Rets: N/A
Example:
sbase = 100.0
simulator.set_system_base_power_in_MVA(sbase)
Format: get_case_information()
Description: Get case information string.
Args: N/A
Rets:
(1) String of case information.
Example:
case_info = simulator.get_case_information()
Format: get_case_additional_information()
Description: Get case additional information string.
Args: N/A
Rets:
(1) String of case additional information.
Example:
case_add_info = simulator.get_case_additional_information()
Format: set_case_information(value)
Description: Set case information.
Args:
(1) value: String of case information.
Rets: N/A
Example:
simulator.set_case_information("IEEE 9-bus model")
Format: set_case_additional_information(value)
Description: Set case additional information string.
Args:
(1) value: String of case additional information.
Rets: N/A
Example:
simulator.set_case_additional_information("A simplified model of WSCC system")
Format: get_toolkit_detailed_log_logic()
Description: Get toolkit detailed log logic.
Args: N/A
Rets:
(1) Boolean value of the detailed log logic. True if detailed log is enabled, False if otherwise.
Example:
simulator.get_toolkit_detailed_log_logic()
Format: set_toolkit_detailed_log_logic(logic)
Description: Set toolkit detailed log logic.
Args:
(1) logic: True to enable detailed log, False to disable detailed log.
Rets: N/A
Example:
simulator.set_toolkit_detailed_log_logic(True)
simulator.set_toolkit_detailed_log_logic(False)
Cite STEPS via: Changgang Li, Yue Wu, Hengxu Zhang, Hua Ye, Yutian Liu and Yilu Liu, "STEPS: A Portable Numerical Simulation Toolkit for Electrical Power System Dynamic Studies," in IEEE Transactions on Power Systems, doi: 10.1109/TPWRS.2020.3045102.