Reference manual
Simulation components
Base class for the simulator
Source code in pypsse\simulator.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
|
__init__(settings, export_settings=None, psse_version=PSSE_VERSIONS.PSSE35.value)
Load a valid PyPSSE project and sets up simulation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
SimulationSettings
|
simulation settings |
required |
export_settings |
Union[ExportFileOptions, None]
|
export settings |
None
|
psse_path |
Union[str, Path]
|
Path to python environment within the PSS/e install directory |
required |
Source code in pypsse\simulator.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
build_contingencies()
Builds user defined contengingies
Returns:
Type | Description |
---|---|
List[Union[BusTripObject, BusFaultObject, LineTripObject, LineFaultObject, MachineTripObject]]
|
List[Union[BusFault, LineFault, LineTrip, BusTrip, MachineTrip]]: List of contingencies |
Source code in pypsse\simulator.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
|
define_bus_subsystems()
Defines a bussystem in the loaded PSSE model
Raises:
Type | Description |
---|---|
LookupError
|
Failed to create bus subsystem chosen buses. |
ValueError
|
Number of subsystems can not be more that 12. See PSSE documentation |
RuntimeError
|
Failed to add buses to bus subsystem |
Returns:
Name | Type | Description |
---|---|---|
dict |
(dict, list)
|
mapping of bus subsystems to buses |
list |
(dict, list)
|
List of bus subsystems |
Source code in pypsse\simulator.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
|
dump_settings(dest_dir, simulation_file=SIMULATION_SETTINGS_FILENAME, export_file=EXPORTS_SETTINGS_FILENAME)
Dumps simulation settings to a provided path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dest_dir |
Path
|
Directory where settins are dumped |
required |
simulation_file |
str
|
simulation filename. Defaults to SIMULATION_SETTINGS_FILENAME. |
SIMULATION_SETTINGS_FILENAME
|
export_file |
str
|
export setting filename. Defaults to EXPORTS_SETTINGS_FILENAME. |
EXPORTS_SETTINGS_FILENAME
|
Source code in pypsse\simulator.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
force_psse_halt()
forces cleaup of pypss imort
Source code in pypsse\simulator.py
520 521 522 523 |
|
from_setting_files(simulation_settiings_file, export_Settings_file=None)
classmethod
build 'Simulator' from toml settings files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation_settiings_file |
Path
|
simulation settings |
required |
export_Settings_file |
Path
|
export settings |
None
|
Source code in pypsse\simulator.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
get_bus_ids()
Returns bus IDs
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
Array of bus numbers |
Source code in pypsse\simulator.py
354 355 356 357 358 359 360 361 362 363 |
|
get_bus_indices()
Returns bus indices for bus subsystems
Returns:
Name | Type | Description |
---|---|---|
BusSubsystems |
BusSubsystems
|
Bus subsystem model |
Source code in pypsse\simulator.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
get_results(params)
Returns queried simulation results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
Union[ExportAssetTypes, dict]
|
description |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
simulation results |
Source code in pypsse\simulator.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
|
init()
Initializes the model
Source code in pypsse\simulator.py
228 229 230 231 232 233 234 235 236 237 |
|
inject_contingencies_external(contigencies)
Inject external contingencies.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
contigencies |
Contingencies
|
Contigencies Object |
required |
Source code in pypsse\simulator.py
501 502 503 504 505 506 507 508 |
|
parse_gic_file()
Parses the GIC file (if included in the project)
Returns:
Name | Type | Description |
---|---|---|
Graph |
Graph
|
Networkx graph representation for the model |
Source code in pypsse\simulator.py
239 240 241 242 243 244 245 246 247 |
|
publish_data()
Updates publications (co-simulation mode only)
Source code in pypsse\simulator.py
448 449 450 451 |
|
run()
Launches the simulation
Source code in pypsse\simulator.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
start_simulation()
Starts a loaded simulation
Raises:
Type | Description |
---|---|
Exception
|
Please pass a RAW or SAV file in the settings dictionary |
Source code in pypsse\simulator.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
status()
returns current simulation status
Returns:
Name | Type | Description |
---|---|---|
SimulationStatus |
SimulationStatus
|
state of the simulator |
Source code in pypsse\simulator.py
473 474 475 476 477 478 479 |
|
step(t)
Steps through a single simulation time step. Is called iteratively to increment the simualtion
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t |
float
|
time step for the simulation |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
results from the current timestep |
Source code in pypsse\simulator.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
|
update_contingencies(t)
Updates contingencies during the simualtion run
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t |
float
|
simulation time in seconds |
required |
Source code in pypsse\simulator.py
510 511 512 513 514 515 516 517 518 |
|
update_federate_time(t)
Makes a time request to teh HELICS broker (co-simulation mode only)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t |
float
|
simulation time in seconds |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
(float, float)
|
requested time in seconds |
float |
(float, float)
|
current simualtion time in seconds |
Source code in pypsse\simulator.py
434 435 436 437 438 439 440 441 442 443 444 445 446 |
|
update_result_container(t)
Updates the result container with results from the current time step
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t |
float
|
simulation time in seconds |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
simulation reults from the current time step |
Source code in pypsse\simulator.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
|
update_subscriptions()
Updates subscriptions (co-simulation mode only)
Source code in pypsse\simulator.py
429 430 431 432 |
|
This class defines the structure of a PyPSSE project
Source code in pypsse\project.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
create(parent_path, project_name, psse_folder, simulation_settings_file, export_settings_file, profile_store_file, profile_mapping_file, overwrite=True, autofill=True)
The methods creates a new PyPSSE project
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent_path |
Path
|
path to new pypsse project |
required |
project_name |
str
|
project name |
required |
psse_folder |
Path
|
description |
required |
simulation_settings_file |
Path
|
simulation settings toml file path |
required |
export_settings_file |
Path
|
export settings toml file path |
required |
profile_store_file |
Path
|
path to a valid Profiles.hdf5 file (Contains profiles for time series simulations) |
required |
profile_mapping_file |
Path
|
path to a valid Profile_mapping.toml file (used to map profile to PSSE elements) |
required |
overwrite |
bool
|
Attempt to auto fill settings. (Verify manually settings file is correct). Defaults to True. |
True
|
autofill |
bool
|
Overwrite project is it already exists. Defaults to True. |
True
|
Source code in pypsse\project.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
Class defination for the simulation result container
Source code in pypsse\result_container.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
__init__(settings, export_settings)
Sets up the result container object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
SimulationSettings
|
description |
required |
export_settings |
ExportAssetTypes
|
description |
required |
Source code in pypsse\result_container.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
export_results()
exports all results stored to an external file
Source code in pypsse\result_container.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
get_export_variables()
Queries and return results from the current timestep
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
mapping of export variables to values |
Source code in pypsse\result_container.py
85 86 87 88 89 90 91 92 |
|
update(bus_data, _, time, has_converged)
Updates the results cotainer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bus_data |
dict
|
mapping of vairables to values |
required |
_ |
_type_
|
description |
required |
time |
datetime
|
simulation time |
required |
has_converged |
bool
|
flag showing if simulation converged |
required |
Source code in pypsse\result_container.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
update_export_variables(params)
Updates the container with current system state. Method is called iteratively to store results as a simulation executes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
Union[ExportAssetTypes, dict]
|
description |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
mapping of export variables to values |
Source code in pypsse\result_container.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
Profile management
ProfileManager
Implentation for the profile manager for PyPSSE. Enables attacheing profilse to all PSSE objects and associated properties
Source code in pypsse\profile_manager\profile_store.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
__init__(solver, settings, mode='r+')
Creates an instance of the profile manager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
solver |
Union[ProductionCostModel, Snap, Static, Dynamic]
|
instance of simulation controller |
required |
settings |
SimulationSettings
|
simulation settings |
required |
mode |
str
|
file update mode. Defaults to "r+". |
'r+'
|
Source code in pypsse\profile_manager\profile_store.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
add_profiles(name, data, p_type, start_time, resolution_sec=900, units='', info='')
adds a profile to the profile manager
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
profile name |
required |
data |
object
|
profile data object |
required |
p_type |
ProfileTypes
|
profile type |
required |
start_time |
date
|
profile start time |
required |
resolution_sec |
float
|
profile resolution in seconds. Defaults to 900. |
900
|
units |
str
|
profile units. Defaults to "". |
''
|
info |
str
|
profile into. Defaults to "". |
''
|
Raises:
Type | Description |
---|---|
InvalidParameterError
|
raised if start_time not a datetime object |
InvalidParameterError
|
raised if invalid profile type passed |
Source code in pypsse\profile_manager\profile_store.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
|
add_profiles_from_csv(csv_file, name, p_type, start_time, resolution_sec=900, units='', info='')
enables profiles from existing csv files
Parameters:
Name | Type | Description | Default |
---|---|---|---|
csv_file |
Path
|
path to profiles in a csv file |
required |
name |
str
|
profile name |
required |
p_type |
ProfileTypes
|
profile type |
required |
start_time |
date
|
profile start time |
required |
resolution_sec |
float
|
profile resolution in seconds. Defaults to 900. |
900
|
units |
str
|
profile units. Defaults to "". |
''
|
info |
str
|
profile into. Defaults to "". |
''
|
Raises:
Type | Description |
---|---|
ValueError
|
rasied if invalid profile name passed |
ValueError
|
rasied if invalid profile type passed |
Source code in pypsse\profile_manager\profile_store.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
create_dataset(dname, p_type, data, start_time, resolution, units, info)
Create new profile datasets
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dname |
str
|
dateset name |
required |
p_type |
ProfileTypes
|
profile type |
required |
data |
DataFrame
|
data |
required |
start_time |
datetime
|
profile start time |
required |
resolution |
float
|
profile resolution |
required |
_ |
_type_
|
description |
required |
info |
str): profile description |
required |
Raises:
Type | Description |
---|---|
Exception
|
raised if dataset already exists |
Source code in pypsse\profile_manager\profile_store.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
create_metadata(d_set, start_time, resolution, data, units, info, p_type)
adds a metadata to a new profile
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d_set |
str
|
dataset name |
required |
start_time |
date
|
profile start time |
required |
resolution |
float
|
profile resolution |
required |
data |
object
|
profile data object |
required |
units |
str
|
profile units |
required |
info |
str
|
profile info |
required |
p_type |
ProfileTypes
|
profile type |
required |
Source code in pypsse\profile_manager\profile_store.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
df_to_sarray(df)
Enables data converson
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
description |
required |
Raises:
Type | Description |
---|---|
SystemError
|
raised if unable to convert |
Returns:
Type | Description |
---|---|
[str, str]
|
[str, str]: returns column name and datatype |
Source code in pypsse\profile_manager\profile_store.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
load_data(file_path)
Load in external profile data
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
Path
|
path to profile mapping file |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
profile mapping dictionary |
Source code in pypsse\profile_manager\profile_store.py
51 52 53 54 55 56 57 58 59 60 61 62 |
|
setup_profiles()
sets up all profiles in the profile manager
Raises:
Type | Description |
---|---|
Exception
|
raised if mapped object not found in profile DB |
Source code in pypsse\profile_manager\profile_store.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
update()
returns data for the current timestep for all mapped profiles
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
values for profiles at the current time step |
Source code in pypsse\profile_manager\profile_store.py
287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
Profile
Class defination fora single profile
Source code in pypsse\profile_manager\profile.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
fill_missing_values(value)
Fixes issues in profile data
Source code in pypsse\profile_manager\profile.py
72 73 74 75 76 |
|
update(update_object_properties=True)
Returns value at the current timestep in the given profile
Source code in pypsse\profile_manager\profile.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
Simulation modes
Dynamic
Bases: AbstractMode
, DynamicUtils
Class defination for dynamic simulation mode (uses dyr and raw files)
Source code in pypsse\modes\dynamic.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
get_step_size_cec()
Returns simulation timestep resolution
Source code in pypsse\modes\dynamic.py
163 164 165 |
|
get_time()
Returns current simulator time
Source code in pypsse\modes\dynamic.py
153 154 155 156 |
|
get_total_seconds()
Returns total simulation time
Source code in pypsse\modes\dynamic.py
158 159 160 161 |
|
init(bus_subsystems)
Initializes the simulation
Source code in pypsse\modes\dynamic.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
read_subsystems(quantities, subsystem_buses, ext_string2_info=None, mapping_dict=None)
Queries the result container for current results
Source code in pypsse\modes\dynamic.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
|
resolve_step(t)
Resolves the current time step
Source code in pypsse\modes\dynamic.py
146 147 148 149 150 151 |
|
step(t)
Increments the simulation
Source code in pypsse\modes\dynamic.py
116 117 118 119 120 121 |
|
Snap
Bases: AbstractMode
, DynamicUtils
Class defination for snapshat simulation mode (uses snp and sav files)
Source code in pypsse\modes\snap.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
get_load_indices(bus_subsystems)
Returns load indices
Source code in pypsse\modes\snap.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
get_step_size_cec()
Returns simulation timestep resolution
Source code in pypsse\modes\snap.py
125 126 127 |
|
get_time()
Returns current simulator time
Source code in pypsse\modes\snap.py
117 118 119 |
|
get_total_seconds()
Returns total simulation time
Source code in pypsse\modes\snap.py
121 122 123 |
|
init(bus_subsystems)
Initializes the simulation
Source code in pypsse\modes\snap.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
read_subsystems(quantities, subsystem_buses, ext_string2_info=None, mapping_dict=None)
Queries the result container for current results
Source code in pypsse\modes\snap.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
resolve_step(t)
Resolves the current time step
Source code in pypsse\modes\snap.py
92 93 94 95 |
|
step(t)
Increments the simulation
Source code in pypsse\modes\snap.py
86 87 88 89 90 |
|
Static
Bases: AbstractMode
Source code in pypsse\modes\static.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
__init__(psse, dyntools, settings, export_settings, subsystem_buses, raw_data)
Class defination for steady-state simulation mode
Source code in pypsse\modes\static.py
11 12 13 14 15 16 17 |
|
export()
Exports simulation results
Source code in pypsse\modes\static.py
54 55 56 57 58 59 60 |
|
get_step_size_cec()
Returns simulation timestep resolution
Source code in pypsse\modes\static.py
50 51 52 |
|
get_time()
Returns current simulator time
Source code in pypsse\modes\static.py
42 43 44 |
|
get_total_seconds()
Returns total simulation time
Source code in pypsse\modes\static.py
46 47 48 |
|
resolve_step()
Resolves the current time step
Source code in pypsse\modes\static.py
34 35 36 37 38 39 40 |
|
step(_)
Increments the simulation
Source code in pypsse\modes\static.py
23 24 25 26 27 28 29 30 31 32 |
|
sim_controller(psse, dyntools, settings, export_settings, subsystem_buses, raw_data)
sets up an appropriate simualtion controller based on user input
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
dyntools |
object
|
psse dyntools instance |
required |
settings |
SimulationSettings
|
simulation settings |
required |
export_settings |
ExportFileOptions
|
export settings |
required |
subsystem_buses |
dict
|
mapping of bus subsystems to buses |
required |
raw_data |
Reader
|
instance of model reader |
required |
Returns:
Type | Description |
---|---|
Union[Dynamic, ProductionCostModel, Snap, Static]
|
Union[Dynamic, ProductionCostModel, Snap, Static]: simulator controller instance |
Source code in pypsse\simulation_controller.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
Model parsers
GICParser
parser for the psse GIC file
Source code in pypsse\parsers\gic_parser.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
__init__(settings)
create GIC parser object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
SimulationSettings
|
simulation settings |
required |
Source code in pypsse\parsers\gic_parser.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
create_graph()
creates graph representation
Source code in pypsse\parsers\gic_parser.py
56 57 58 59 60 61 62 |
|
get_bus_coordinates()
parses bus coordinates
Source code in pypsse\parsers\gic_parser.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
parse_branch_data()
parses branch data
Source code in pypsse\parsers\gic_parser.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
parse_substation_data()
parses substation data
Source code in pypsse\parsers\gic_parser.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
parse_transformer_data()
parses transformer data
Source code in pypsse\parsers\gic_parser.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
Reader
Parser for indexing all PSSE model assets
Source code in pypsse\parsers\reader.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
__init__(psse_instance)
creates pypsse model reader
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse_instance |
object
|
simulator instance |
required |
Source code in pypsse\parsers\reader.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
__str__()
overrides default 'print' behavior
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
summary of model assets |
Source code in pypsse\parsers\reader.py
70 71 72 73 74 75 76 77 78 79 |
|
get_data(func_name, tails=[], strings=[], flags=[])
returns list of assets matching signature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func_name |
str
|
description |
required |
tails |
list
|
method tail. Defaults to []. |
[]
|
strings |
list
|
data types. Defaults to []. |
[]
|
flags |
List[int]
|
list of flags for filtering. Defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
list of asset names |
Source code in pypsse\parsers\reader.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
Command line interface
CLI to run a PyDSS project
create_profiles(project_path, csv_file_path, profile_folder, profile_name, profile_type, start_time, profile_res, profile_info)
Creates profiles for PyPSSE project.
Source code in pypsse\cli\create_profiles.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
CLI to create a new PyPSSE project
create_project(path=None, project=None, psse_project_folder=None, simulation_file=None, export_settings_file=None, profile_store=None, profile_mapping=None, overwrite=None, autofill=None)
Create a new PyPSSE project.
Source code in pypsse\cli\create_project.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
CLI to run a PyDSS project
run(project_path, simulations_file=None)
Runs a valid PyPSSE simulation.
Source code in pypsse\cli\run.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
CLI to run the PyDSS server
serve(host_ip='127.0.0.1', port=9090)
Run a PyPSSE RESTful API server.
Source code in pypsse\cli\serve.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Data interfaces
DataWriter
Data writer class defination
Source code in pypsse\data_writers\data_writer.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
__init__(log_dir, formatnm, column_length, filename_prefix)
Sets up a data writer as per user input
Source code in pypsse\data_writers\data_writer.py
23 24 25 |
|
write(currenttime, powerflow_output, convergence)
Enables incremental write to the data writer object
Source code in pypsse\data_writers\data_writer.py
27 28 29 |
|
CSVWriter
Class that handles writing simulation results to csv files.
Source code in pypsse\data_writers\csv.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
__init__(log_dir, column_length, filename_prefix='')
Constructor for csv writer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_dir |
Path
|
output path (dirctory) |
required |
column_length |
int
|
number of data columns |
required |
Source code in pypsse\data_writers\csv.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
write(currenttime, powerflow_output)
Writes the status of assets at a particular timestep to a csv file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
currenttime |
datetime
|
simulator time step |
required |
powerflow_output |
dict
|
simulation results |
required |
Source code in pypsse\data_writers\csv.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
JSONWriter
Class that handles writing simulation results to json files.
Source code in pypsse\data_writers\json.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
__init__(log_dir, column_length, filename_prefix='')
Constructor for json writer
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_dir |
Path
|
output path (dirctory) |
required |
column_length |
int
|
number of data columns |
required |
Source code in pypsse\data_writers\json.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
write(currenttime, powerflow_output, _=None)
Writes the status of assets at a particular timestep to a json file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
currenttime |
datetime
|
simulator time step |
required |
powerflow_output |
dict
|
simulation results |
required |
Source code in pypsse\data_writers\json.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
Utility functions
DynamicUtils
Utility functions for dynamic simulations
Source code in pypsse\utils\dynamic_utils.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
break_loads(loads=None, components_to_replace=[])
Implements the load split logic
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loads |
list
|
list of coupled loads. Defaults to None. |
None
|
components_to_replace |
List[str]
|
components to be simulated on distribution side. Defaults to []. |
[]
|
Source code in pypsse\utils\dynamic_utils.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
disable_generation_for_coupled_buses()
Disables generation of coupled buses (co-simulation mode only)
Source code in pypsse\utils\dynamic_utils.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
disable_load_models_for_coupled_buses()
Disables loads of coupled buses (co-simulation mode only)
Source code in pypsse\utils\dynamic_utils.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
poll_channels()
Polls all channels adde during the setup process
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
mapping of polled channels to values |
Source code in pypsse\utils\dynamic_utils.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
setup_all_channels()
Sets up all user-defined channels for a project
Source code in pypsse\utils\dynamic_utils.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
setup_bus_channels(buses, properties)
Sets up bus channels
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buses |
list
|
list of buses |
required |
properties |
dict
|
list of bus properties |
required |
Source code in pypsse\utils\dynamic_utils.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
setup_load_channels(loads)
Sets up load channels
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loads |
list
|
list of loads |
required |
Source code in pypsse\utils\dynamic_utils.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
setup_machine_channels(machines, properties)
sets up machine channels
Parameters:
Name | Type | Description | Default |
---|---|---|---|
machines |
dict
|
mapping machine to connected bus |
required |
properties |
list
|
list of machine properties |
required |
Source code in pypsse\utils\dynamic_utils.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
Contincency interface
This module manages contingency modeling in PyPSSE
BaseFault
Base class defination for all fault types
Source code in pypsse\contingencies.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
disable_fault()
disables a fault event
Source code in pypsse\contingencies.py
92 93 94 95 96 97 98 99 100 101 102 |
|
enable_fault()
enables a fault event
Source code in pypsse\contingencies.py
80 81 82 83 84 85 86 87 88 89 90 |
|
is_enabled()
Returns enabled status
Returns:
Name | Type | Description |
---|---|---|
_type_ |
rue if the fault object is enabled else false |
Source code in pypsse\contingencies.py
104 105 106 107 108 109 110 |
|
is_tripped()
Returns trip status
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
true if the fault object is tripped else false |
Source code in pypsse\contingencies.py
112 113 114 115 116 117 118 |
|
update(t)
updates a fault event
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t |
float
|
simuation time in seconds |
required |
Source code in pypsse\contingencies.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
BusFaultObject
Bases: BaseFault
Class defination for a bus fault
Source code in pypsse\contingencies.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
__init__(psse, settings, contingency_type)
bus fault object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator type |
required |
settings |
BusFault
|
bus fault object |
required |
contingency_type |
str
|
contingency type |
required |
Source code in pypsse\contingencies.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
BusTripObject
Bases: BaseFault
Class defination for a bus trip
Source code in pypsse\contingencies.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
__init__(psse, settings, contingency_type)
Bus trip contingency
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
settings |
BusTrip
|
bus trip model |
required |
contingency_type |
str
|
type of contingency |
required |
Source code in pypsse\contingencies.py
191 192 193 194 195 196 197 198 199 200 201 |
|
LineFaultObject
Bases: BaseFault
Class defination for a line fault
Source code in pypsse\contingencies.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__init__(psse, settings, contingency_type)
line fault model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
settings |
LineFault
|
line fault model |
required |
contingency_type |
str
|
contingecy type |
required |
Source code in pypsse\contingencies.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
LineTripObject
Bases: BaseFault
Class defination for a line trip
Source code in pypsse\contingencies.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
__init__(psse, settings, contingency_type)
line trip model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
settings |
LineTrip
|
line trip model |
required |
contingency_type |
str
|
contingency type |
required |
Source code in pypsse\contingencies.py
172 173 174 175 176 177 178 179 180 181 182 183 |
|
MachineTripObject
Bases: BaseFault
Class defination for a machine fault
Source code in pypsse\contingencies.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
__init__(psse, settings, contingency_type)
Machine trip contingency
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
settings |
MachineTrip
|
machine trip model |
required |
contingency_type |
str
|
type of contingency |
required |
Source code in pypsse\contingencies.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
add_contingency(contingency, cont_dict, dt, system_contingencies)
Adds a new contingency
Source code in pypsse\contingencies.py
21 22 23 24 25 26 27 28 29 30 31 |
|
build_contingencies(psse, contingencies_)
Builds all contingencies defined in the settings file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
psse |
object
|
simulator instance |
required |
settings |
SimulationSettings
|
simulation settings |
required |
Returns:
Type | Description |
---|---|
List[Union[BusFaultObject, BusTripObject, LineFaultObject, LineTripObject, MachineTripObject]]
|
List[Union[BusFaultObject, BusTripObject, LineFaultObject, LineTripObject, MachineTripObject]]: list of contingencies |
Source code in pypsse\contingencies.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|