This information is part of the Modelica Standard Library maintained by the Modelica Association.
Define causality and/or block diagram connection semantic
(depending on context)
Examples
connector RealInput = input Real;
connector RealOutput = output Real;
block Integrator
RealInput u;
RealOutput y;
protected
Real x;
equation
der(x) = u;
y = x;
end Integrator;
Syntax
See section on type_prefix
in the Modelica Grammar.
Description
The prefixes input and output have a slightly different semantic meaning depending on the context where they are used:
- In functions, these prefixes define the computational causality of the
function body, i.e., given the variables declared as input,
the variables declared as output are computed in the function body.
- In simulation models and blocks (i.e., on the top level of a model or
block that shall be simulated), these prefixes define the interaction
with the environment where the simulation model or block is used.
Especially, the input prefix defines that values for such a variable
have to be provided from the simulation environment and the output
prefix defines that the values of the corresponding variable
can be directly utilized in the simulation environment.
- In component models and blocks, the input prefix defines that a
binding equation has to be provided for the corresponding variable
when the component is utilized in order to guarantee a locally
balanced model (i.e., the number of local equations is identical
to the local number of unknowns). Example:
block FirstOrder
input Real u;
...
end FirstOrder;
model UseFirstOrder
FirstOrder firstOrder(u=time); // binding equation for u
...
end UseFirstOrder;
The output prefix does not have a particular effect in a model
or block component and is ignored.
- In connectors, prefixes input and output define that the
corresponding connectors can only be connected according
to block diagram semantics (e.g., a connector with an output
variable can only be connected to a connector where the
corresponding variable is declared as input). There is the
restriction that connectors which have at least one variable
declared as input must be externally connected
(in order to get a locally balanced model, where the number
of local unknowns is identical to the number of unknown equations).
Together with the block diagram semantics rule this means,
that such connectors must be connected exactly once externally.
- In records, prefixes input and output are not allowed,
since otherwise a record could not be, e.g., passed as input
argument to a function.