Define specialized class record
record States Modelica.SIunits.Position s; Modelica.SIunits.Velocity v; end States; record System parameter Modelica.SIunits.Mass m=1; parameter Modelica.SIunits.Force f=1; Modelica.SIunits.Acceleration a; States states; end System; model SlidingMass System sys; equation der(sys.states.s) = sys.states.v; der(sys.states.v) = sys.a; sys.m*sys.a = sys.f; end SlidingMass;
[ encapsulated ][ partial ] record IDENT class_specifier class_specifier : string_comment composition end IDENT | "=" base_prefix name [ array_subscripts ] [ class_modification ] comment | "=" enumeration "(" ( [enum_list] | ":" ) ")" comment
See Modelica Language Specification for further details.
The keyword record is used to define records which are generally used in order to group variables. Only public sections are allowed in the definition or in any of its components (i.e., equation, algorithm, initial equation, initial algorithm and protected sections are not allowed). May not be used in connections. The elements of a record may not have prefixes input, output, inner, outer, or flow. Enhanced with implicitly available record constructor function. Additionally, record components can be used as component references in expressions and in the left hand side of assignments, subject to normal type compatibility rules.