Module Simantics/Simulation

This module is undocumented. This is a list of its definitions.

DISPOSED :: ExperimentState

The states of a running experiment: INITIALIZING while the experiment is being started, RUNNING while it simulates, STOPPED when it is loaded but not simulating, and DISPOSED after it has been shut down.

INITIALIZING :: ExperimentState

The states of a running experiment: INITIALIZING while the experiment is being started, RUNNING while it simulates, STOPPED when it is loaded but not simulating, and DISPOSED after it has been shut down.

RUNNING :: ExperimentState

The states of a running experiment: INITIALIZING while the experiment is being started, RUNNING while it simulates, STOPPED when it is loaded but not simulating, and DISPOSED after it has been shut down.

STOPPED :: ExperimentState

The states of a running experiment: INITIALIZING while the experiment is being started, RUNNING while it simulates, STOPPED when it is loaded but not simulating, and DISPOSED after it has been shut down.

activateExperiment :: Resource -> <WriteGraph> Resource

Creates a new run for the given experiment resource, activates it and returns it. This is createExperimentRun performed in the memory persistent virtual graph that holds experiment activations, so the activation does not survive a restart of the platform.

activateExperimentAction :: Resource -> <Proc> ()

Activates the given experiment in a write transaction and discards the run that gets created. This is the implementation of the modelled ACTIONS.ActivateExperiment action.

activateRun :: Resource -> <WriteGraph> ()

Marks the given experiment run as the active one and removes the active mark from the run that was active before it.

createExperimentRun :: Resource -> <WriteGraph> Resource

Creates a new run of the given experiment, activates it and returns it. The experiment must already exist in the model. The type of the run is taken from the type of the experiment, which must have exactly one SIMU.RunType as its part; the call fails if the experiment has no unique type or its type has no unique run type.

createExperimentRunWithType :: Resource -> Resource -> <WriteGraph> Resource

createExperimentRunWithType experiment runType creates a new run of the given runType under the given experiment, activates it and returns it. Use this instead of createExperimentRun when the run type cannot be deduced from the type of the experiment.

disposeExperiment :: IExperiment -> <Proc> ()

Shuts the given experiment down and removes the active mark from its run. Does nothing if the experiment is not a dynamic one.

experimentFromRun :: Variable -> <ReadGraph> IExperiment

Returns the running experiment of the given experiment run variable, that is, the value of its SIMU.Run.iExperiment property. Fails if the run has no such value, which is the case when the run is not currently running.

getExperimentState :: IExperiment -> <ReadGraph> ExperimentState

Returns the current state of the given experiment.

possibleActiveRunVariable :: Resource -> <ReadGraph> Maybe Variable

Returns the variable of the experiment run that is currently active in the given model, or Nothing if no run of the model is active.

refreshExperiment :: IExperiment -> <ReadGraph> ()

Synchronizes the running experiment with the configuration it was started from, so that changes made to the model since then are taken into account.

simulate :: Boolean -> <Proc> ()

Starts or stops the simulation of the experiment that is currently active in the project, depending on the flag. Does nothing if no experiment is active or if the active one is not a dynamic experiment.

simulateExperiment :: IExperiment -> Boolean -> <Proc> ()

Starts or stops the continuous simulation of the given experiment, depending on the flag. Does nothing if the experiment is not a dynamic one.

stepExperiment :: IExperiment -> Double -> <Proc> ()

stepExperiment experiment duration simulates the given experiment forward by duration units of simulation time and stops again. Does nothing if the experiment is not a dynamic one.