FromModelica Function
Use the FromModelica function to define parameter values of Activate Modelica components.
The FromModelica function gives you access to Modelica resources, which you can use to define the parameter values of Activate Modelica components. These resources include both data and functions available in Modelica libraries, and other Activate Modelica components present in the model.
Syntax
FromModelica(path [,opt1 [, opt2]])
Inputs
- path
 - Designates either an entity in a Modelica library or a component in the model.
 - opt1
 - Can be a string, representing a name, specifying an entity (an element of a record, an element of a package, a component parameter…), a struct, defining a modifier, or a cell containing the arguments of a function call. A struct is also used in case of function-calls with named arguments.
 - opt2
 - Can be a string, representing a name, specifying an entity (an element of a record, an element of a package, a component parameter…), a struct, defining a modifier, or a cell containing the arguments of a function call. A struct is also used in case of function-calls with named arguments.
 
Examples
In case of Modelica library access, path is an OML string
                designating a library element following the usual Modelica syntax, where the
                hierarchy is specified using “dot” notation, with “Modelica” as root in case of MSL
                for example. The path can designate a constant, a record, a function, a package,
                etc.
FromModelica(‘Modelica.Constants.T_zero’)
            record where M330_50A  is an
                element of Package
                    Modelica.Magnetic.FluxTubes.Material.HysteresisEverettParameter:
                FromModelica('Modelica.Magnetic.FluxTubes.Material.HysteresisEverettParameter.M330_50A')
            record where the name of the record is provided
                as the second argument of the function:
                FromModelica('Modelica.Magnetic.FluxTubes.Material.HysteresisEverettParameter’,’M330_50A')
            rec is an OML string defined in the workspace of the
                diagram containing the component, specifying the record selected in the package:
                FromModelica('Modelica.Magnetic.FluxTubes.Material.HysteresisEverettParameter’, rec)
            For example, rec can be conditionally defined in the diagram context
                as:
if cond, rec=’M330_50A’, else rec=’M270_50A’; end
            FromModelica('Modelica.Magnetic.FundamentalWave.Types','SalientReluctance',struct('d',12, 'q',14))
                The modifier above is specified by an optional argument of type OML structure. The
                argument struct(‘d’,12,’q’,14) corresponds to the Modelica
                modification (q=12, q=14). Note that the new values of d and
                    q record elements can be parameterized using OML
                expressions.Function calls in Modelica can be done both with and without named arguments. Named arguments can be considered specific modifiers and can be specified using OML as indicated previously. The positional argument passing is supported using a cell instead of a struct.
m=3:
                FromModelica('Modelica.Electrical.MultiPhase.Functions.symmetricOrientation’,struct(‘m’,3))
            m is the first (and unique) argument of the
                    symmetricOrientation function, the same result is obtained by
                the following example:
                FromModelica('Modelica.Electrical.MultiPhase.Functions.symmetricOrientation’, {3})
            FromModelica('Modelica.Electrical.MultiPhase.Functions.activePower’, {v,i})