numerous.engine.model

Model

class numerous.engine.model.Model(system=None, historian=None, assemble=True, validate=False)[source]

The model object traverses the system to collect all information needed to pass to the solver for computation – the model also back-propagates the numerical results from the solver into the system, so they can be accessed as variable values there.

add_callback(callback_class: numerous.utils.numba_callback.NumbaCallbackBase) → None[source]
add_event(name, event_function, callbacks=None)[source]

Creating and adding Event callback.

Parameters:
  • name (string) – name of the event
  • event_function (callable) –
callbacks : list of callable
callback associated with event
add_event_callback(event_name, event_callback)[source]

Adding the callback to existing event

Parameters:
  • event_name (string) – name of the registered event
  • event_callback (callable) – callback associated with event
assemble()[source]

Assembles the model.

create_alias(variable_name, alias)[source]
Parameters:
  • variable_name
  • alias
get_states()[source]
Returns:states – list of all states.
Return type:list of states
restore_state(timestep=-1)[source]
Parameters:
  • timestep (time) – timestep that should be restored in the model. Default last known state is restored.
  • last saved state from the historian. (Restores) –
save_variables_schedule(period, filename)[source]

Save data to file on given period.

Parameters:
  • period (timedelta) – timedelta of saving history to file
  • filename (string) – Name of a file
search_items(item_tag)[source]

Search an item in items registered in the model by a tag

Returns:items – set of items with given tag
Return type:list of numerous.engine.system.Item
states_as_vector

Returns current states values.

Returns:state_values
Return type:array of state values
synchornize_variables()[source]

Updates all the values of all Variable instances stored in self.variables with the values stored in self.scope_vars_3d.

validate()[source]

Checks that all bindings are fulfilled.