Declare flow (through) variable, which have to sum up to zero in connections
connector Pin Modelica.SIunits.Voltage v; flow Modelica.SIunits.Current i; end Pin; model A Pin p; end A; model Composition A a; A b; A c; equation connect(a.p, b.p); connect(a.p, c.p); end Composition;
From the connect statements in model Composition, the following connect equations are derived:
a.p.v = b.p.v; a.p.v = c.p.v; a.p.i + b.p.i + c.p.i = 0;
class_definition :
[ encapsulated ]
[ partial ]
( class | model | record | block | connector | type |
package | function )
IDENT class_specifier
class_specifier :
string_comment composition end IDENT
| "=" base_prefix name [ array_subscripts ] [ class_modification ] comment
| "=" enumeration "(" ( [enum_list] | ":" ) ")" comment
base_prefix :
type_prefix
composition :
element_list
{ public element_list |
protected element_list |
equation_clause |
algorithm_clause
}
[ external [ language_specification ]
[ external_function_call ] [ annotation ";" ]
[ annotation ";" ] ]
element_list :
{ element ";" | annotation ";" }
element :
import_clause |
extends_clause |
[ final ]
[ inner | outer ]
( ( class_definition | component_clause) |
replaceable ( class_definition | component_clause)
[constraining_clause comment])
component_clause:
type_prefix type_specifier [ array_subscripts ] component_list
type_prefix :
[ flow | stream ]
[ discrete | parameter | constant ] [ input | output ]
The flow prefix is used in order to generate equations for through variables, which sum up to zero in connections, whereas variables without the flow prefix are identical in a connection.