Simulation Sets#

class mhi.pscad.SimulationSet(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

Simulation Set

A container of Project and External Simulation Set Tasks

Management#

SimulationSet.name(new_name: str | None = None) str#

Get or set the simulation set name.

Parameters:

new_name (str) – New name for the simulation set (optional)

Returns:

The name of the simulation set

Tasks#

SimulationSet.tasks() List[ProjectTask]#

List projects included in the simulation set.

Returns:

The tasks included in the simulation set.

Return type:

List[ProjectTask]

SimulationSet.list_tasks() List[str]#

List task names included in the simulation set.

Returns:

The names of the tasks in the simulation set.

Return type:

List[str]

SimulationSet.add_tasks(*tasks: str | Project) None#

Add one or more tasks (projects) to the simulation set.

Parameters:

*tasks – The tasks (projects) to add to the simulation set.

SimulationSet.remove_tasks(*tasks: str | Project | ProjectTask | ExternalTask) None#

Remove one or more tasks (projects) from the simulation set.

Parameters:

*tasks – The tasks (projects) to remove from the simulation set.

SimulationSet.task(name: str) ProjectTask#

Retrieve an individual task in the simulation set.

Parameters:

name (str) – Name of task

Returns:

The identified task

Return type:

ProjectTask

Build & Run#

SimulationSet.run(consumer=None) None#

Run this simulation set.

Parameters:

consumer – handler for events generated by the build/run (optional).

Simulation Tasks#

Project Task#

class mhi.pscad.ProjectTask(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

Project Simulation Set Task

ProjectTask.name#

Name of this project task

ProjectTask.namespace() str#

Get the namespace of the task

ProjectTask.simulation_set#

Simulation set the task is part of

ProjectTask.parameters(parameter=value, ...)#

Get/set simulation set task parameters

Project Task Parameters#

Param Name

Type

Description

namespace

str

Namespace of project (read-only)

name

str

Display Name

ammunition

int

Task count

volley

int

Maximum Volley

affinity

int

Trace Affinity

rank_snap

bool

Specify snapshot file by rank #?

substitutions

str

Substitution set

clean

bool

Force Re-Build

ProjectTask.layers(layer_name=state, ...)#

Get / set layer overrides for this Simulation Task.

Each layer can be forced into state different from the project’s default state.

Layer State Overrides#

State

Description

None

Inherit from the project’s layer state

True

Force the layer to be enabled

False

Force the layer to be disabled

"Custom"

Force the layer into the configuration named “Custom”

Returns:

The current simulation task’s layer overrides.

Return type:

dict

Example:

# When this simulation set task runs, force the "region1" layer
# to be enabled, the "region2" layer to be disabled, and the
# "region3" layer into a custom layer configuration.  Remove any
# override that was previously applied to "region4" in this task.

task.layers(region1=True, region2=False, region3="Special",
            region4=None)
ProjectTask.overrides(parameter=value, ...)#

Get / set override parameters for this Simulation Task.

Project Task Override Parameters#

Parameter Name

Type

Description

duration

float

Duration of run (sec)

time_step

float

Simulation time-step (µs)

plot_step

float

Output channel plot step

start_method

int

Startup Method. 0=Standard, 1=From Snapshot

startup_inputfile

str

Input filename

save_channels_file

str

Output filename

save_channels

int

0=Do not save, 1=Legacy Format (*.out), 2=Advanced Format (*.psout)

timed_snapshots

int

0=None, 1=Single, 2=Incremental (Same File), 3=Incremental (Many Files)

snapshot_file

str

Snapshot filename

snap_time

float

Snapshot time

run_config

int

0=Standalone, 1=Master, 2=Slave

run_count

int

Number of runs

remove_snapshot_offset

bool

Remove snapshot time offset

only_in_use_channels

bool

Only send “in use” channels

state_animation

bool

Enable animation

manual_start

bool

Manual Start

For each of the above parameters, there is an additional parameter, prefixed with override_, which controls whether this parameter is used. It is automatically set to "true" if a value other than None is given, and to "false" if the None value is given.

External Task#

class mhi.pscad.ExternalTask(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

External Simulation Set Task