Simulation State (cyclus.simstate)

Tools for representing and driving the simulation.

class cyclus.simstate.SimState(input_file=None, input_format=None, output_path=None, memory_backend=False, registry=True, schema_path=None, flat_schema=False, frequency=0.001, repeating_actions=None, heartbeat_frequency=5, debug=False)

Class that represents and drives the simulation state.


input_file : str, optional

The path to input file or a raw string of the input file.

input_format : str, optional

The format that the input file should be read in as, if it is a raw string.

output_path : str or None, optional

The path to the file system database, default (if None) is based on the input file path.

memory_backend : MemBack, bool, or None, optional

An in-memory backend, if specified.

registry : set, bool, or None, optional

The initial registry to start the in-memory backend with. Defaults is True, which stores all of the tables.

schema_path : str or None, optional:

The path to the cyclus master schema.

flat_schema : bool, optional

Whether or not to use the flat master simulation schema.

frequency : int or float, optional

The amount of time [sec] to sleep for in tight loops, default 1 ms.

repeating_actions : list or None, optional

A list of actions that should be added to the queue at the start of each timestep when the is called. If this is None, a new empty list is instantiated.

heartbeat_frequency : float or int, optional

The frequency with which to send heartbeat events.

debug : bool, optional

Whether the simulation should provide debugging information.


send_queue A queue for sending data over the TCP server.
action_queue A queue for pending actions.
monitor_queue A queue for pending monitoring actions.
rec (Recorder or None) A recorder instance, available after load.
file_backend (FullBackend or None) A file system based backend that is attached to the output path.
si (SimInit or None) The main simulation initializer object that then can be used to drive the simulation.
loop (event loop or None) The Python event loop the current simulation is running under.
executor (Executor or None,) The Python Executor that the simulation should use when running as a server. This is typically a thread pool.
tasks (dict) A str-keyed dictionary mapping to current tasks that may be shared among many actions.

A queue for pending actions.


Loads the simulation.


A queue for pending monitoring actions.


Starts running the simulation.


A queue for sending data over the TCP server. This is not instantiated until it is first accessed.


Ensures that the dynamic module library is closed at the end of the process.

cyclus.simstate.get_schema_path(flat_schema=False, schema_path=None)

Gets the schema path based on the given schema path an the flatness.