Skip to content

Latest commit

 

History

History

README.md

Specification of ModECI v0.4

Note: the ModECI MDF specification is still in development! See here for ongoing discussions.

Model

The top level construct in MDF is Model, which may contain multiple Graph objects and model attribute(s)

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str A unique identifier for this Model
format str Information on the version of MDF used in this file
generating_application str Information on what application generated/saved this file
onnx_opset_version Optional The ONNX opset used for any ONNX functions in this model.

Allowed children

graphs List The collection of graphs that make up the MDF model.

Graph

A directed graph consisting of Nodes (with Parameters and Functions evaluated internally) connected via Edges.

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str A unique identifier for this Graph
parameters Optional Dictionary of global parameters for the Graph
conditions Optional The ConditionSet stored as dictionary for scheduling of the Graph

Allowed children

nodes List One or more Node(s) present in the graph
edges List Zero or more Edge(s) present in the graph

Node

A self contained unit of evaluation receiving input from other nodes on InputPort(s). The values from these are processed via a number of Function(s) and one or more final values are calculated on the OutputPort(s)

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str A unique identifier for the node.

Allowed children

input_ports List Dictionary of the InputPort objects in the Node
functions List The Function(s) for computation the node
parameters List Dictionary of Parameter(s) for the node
output_ports List The OutputPort(s) containing evaluated quantities from the node

InputPort

The InputPort is an attribute of a Node which allows external information to be input to the Node

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str The unique (for this Node) id of the input port,
default_value Union Value to set at this input port if no edge connected to it.
shape Optional The shape of the input port. This uses the same syntax as numpy ndarray shapes (e.g., numpy.zeros(shape) would produce an array with the correct shape
type Optional The data type of the input received at a port.
reduce Optional Specifies how to deal with multiple inputs to one port during a single timestep: add: add up all the values; multiply: multiply the values, overwrite: just use the last value supplied (default)

Function

A single value which is evaluated as a function of values on InputPort(s) and other Functions

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str The unique (for this Node) id of the function, which will be used in other Functions and the OutputPorts for its value
function Optional Which of the in-build MDF functions (linear, etc.). See supported functions: https://mdf.readthedocs.io/en/latest/api/MDFfunctionspecifications.html
args Optional Dictionary of values for each of the arguments for the Function, e.g. if the in-built function is linear(slope),the args here could be {"slope":3} or {"slope":"input_port_0 + 2"}
value Union If the function is a value expression, this attribute will contain the expression and the function and args attributes will be None.

Parameter

A parameter of the Node, which can be: 1) a specific fixed value (a constant (int/float) or an array) 2) a string expression for the value referencing other named Parameter(s). which may be stateful (i.e. can change value over multiple executions of the Node); 3) be evaluated by an inbuilt function with args; 4) or change from a default_initial_value with a time_derivative.

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str
value Union The next value of the parameter, in terms of the inputs, functions and PREVIOUS parameter values
default_initial_value Union The initial value of the parameter, only used when parameter is stateful.
time_derivative Optional How the parameter changes with time, i.e. ds/dt. Units of time are seconds.
function Optional Which of the in-build MDF functions (linear etc.) this uses, See https://mdf.readthedocs.io/en/latest/api/MDFfunctionspecifications.html
args Optional Dictionary of values for each of the arguments for the function of the parameter, e.g. if the in-build function is linear(slope), the args here could be {"slope": 3} or {"slope": "input_port_0 + 2"}

Allowed children

conditions List Parameter specific conditions

ParameterCondition

A condition to test on a Node's parameters, which if true, sets the value of this Parameter

Allowed parameters

id str A unique identifier for the ParameterCondition
test Union The boolean expression to evaluate
value Union The new value of the Parameter if the test is true

OutputPort

The OutputPort is an attribute of a Node which exports information to another Node connected by an Edge

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str Unique identifier for the output port.
value Optional The value of the OutputPort in terms of the InputPort, Function values, and Parameter values.
shape Optional The shape of the output port. This uses the same syntax as numpy ndarray shapes (e.g., numpy.zeros(shape) would produce an array with the correct shape
type Optional The data type of the output sent by a port.

Edge

An Edge is an attribute of a Graph that transmits computational results from a sender's OutputPort to a receiver's InputPort.

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
id str A unique string identifier for this edge.
sender str The id of the Node which is the source of the edge.
receiver str The id of the Node which is the target of the edge.
sender_port str The id of the OutputPort on the sender Node, whose value should be sent to the receiver_port
receiver_port str The id of the InputPort on the receiver Node
parameters Optional Dictionary of parameters for the edge.

Condition

A set of descriptors which specifies conditional execution of Nodes to meet complex execution requirements.

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
type str The type of Condition from the library
kwargs Optional The dictionary of keyword arguments needed to evaluate the Condition

ConditionSet

Specifies the non-default pattern of execution of Nodes

Allowed parameters

metadata Optional Optional metadata field, an arbitrary dictionary of string keys and JSON serializable values.
node_specific Optional A dictionary mapping nodes to any non-default run conditions
termination Optional A dictionary mapping time scales of model execution to conditions indicating when they end