numerous.engine.system

Node

class numerous.engine.system.Node(tag=None, id=None)[source]
Top element in an items hierarchy. Contains fields to represent as uniques modelling object.
tag

Not unique tag that will be used in reports or printed output.

Type:string
id

UUID assigned to the node. Generated if not provided.

Type:string
get_id

returns: id – UUID of the element. :rtype: string

Item

class numerous.engine.system.Item(tag=None)[source]
Base class for items hierarchy. Contains fields and methods required to process item objects. An Item in a Numerous engine are represent any object needed for simulation model.
registered_namespaces

Dictionary of namespaces registered in the current item. All registered namespaces are although added to to the __dict__ of an object and can be referenced as a class attribute.

Type:dictionary of VariableNamespaceBase
add_callback(callback)[source]
Parameters:callback (func) – function to be run after each solver step.
create_namespace(tag)[source]

Creating a namespace.

Parameters:tag (string) – Name of a class:numerous.engine.VariableNamespace
Returns:new_namespace – Empty namespace with given name
Return type:class:numerous.engine.VariableNamespace
get_default_namespace()[source]

Returns a new namespace with name default for the current item. This namespace is not registered.

Returns:namespace – a default namespace.
Return type:VariableNamespaceBase

Examples

>>> item = Item('example')
>>> dn = item.get_default_namespace()
>>> print(dn.item is None )
True
>>> item.register_namespace(dn)
>>> print(dn.item is None )
False
get_item(item_path)[source]

Get an item using item path.

Parameters:item_path ('ItemPath') – hierarchical path to an item inside the subsystem
Returns:Item – returns an item found at given path or None
Return type:‘Item’
get_variables()[source]

Get variables from registered namespaces.

Returns:variables – all variables with corresponding registered namespace. In for of tuple (variable,namespace).
Return type:list of tuples
register_namespace(namespace)[source]

Registering an already existed namespace for item.

Parameters:namespace (VariableNamespace) – namespace to be registered.
Raises:ValueError – If namespace is already registered for this item.

ItemPath

class numerous.engine.system.ItemPath(path, delimiter='.')[source]
Represent a unique item path to item from the top of gierarchy..
path

path to item in string form

Type:string
delimiter

delimiter between item objects

Type:string
get_next_item_path()[source]
Returns:item_path – path to a nested items from the item.
Return type:‘ItemPath’
get_top_item()[source]
Returns:Item – a name of item on top of ItemPath
Return type:‘Item’

Connector

class numerous.engine.system.Connector(tag, **kw)[source]

Base class for representing connectors. Object that inherited connector can be used as a connection between items.

bindings

List of binding that connector have.

Type:dictionary of Binding
create_binding(binding_name)[source]

Creating a new binding inside the connector

Parameters:binding_name (string) – name of the new binding
Raises:ValueError – If binding_name is already registered in this connector.
static create_new_binding(binding_name)[source]

Creates a new Binding without registering it inside the connector.

Parameters:binding_name (string) – Name of a binding to be created.
Returns:binding – new binding with given name.
Return type:Binding
get_binded_items()[source]

Get items that are binded to the connector.

Returns:items – all items that are binded to the connector as one list.
Return type:list
update_bindings(list_of_eq, binding_name)[source]

Updating an existing binding with the equations that are expected to be in the binded items.

Parameters:
  • list_of_eq (list of numerous.multiphysics.Equation) – List of a Equation that are expected to be in binded items.
  • binding_name (string) – Name of a binding to be updated.

ConnectorItem

class numerous.engine.system.ConnectorItem(tag)[source]

Item that can be used as a connector.

bind(**kwargs)[source]

Method to bind item to the bindings in current item. Biding items creating all mappings that a linked to Binding.

Parameters:**kwargs (Item) – items to bind in form, binding_name = Item
create_namespace(namespace_name)[source]

Creating a namespace in item and all bindings.

Parameters:namespace_name (string) – Name of a VariableNamespace
Returns:new_namespace – Empty namespace with given name
Return type:VariableNamespace

Subsystem

class numerous.engine.system.Subsystem(tag)[source]

Hierarchical representation of a group of items. Subsystems contains a set of registered items, some of such items can be subsystems itself. This allow us to create Subsystems of any complexity.

add_port(port_tag, item)[source]

Creates a port for a subsystem. Ports can be used as an elements for binding.

Parameters:
get_item(item_path)[source]

Get an item using item path.

Parameters:item_path (numerous.engine.system.ItemPath) – hierarchical path to an item inside the subsystem
Returns:Item – returns an item found at given path or None
Return type:numerous.engine.system.Item
register_item(item)[source]
Parameters:item (numerous.engine.system.Item) – Item to register in the subsystem.
register_items(items)[source]
Parameters:items (list of numerous.engine.system.Item) – List of items to register in the subsystem.