FromModelica

Takes diagram and a locked version of the history of the diagram and unlocks it.

Syntax

FromModelica(ActivatePath)

FromModelica(ActivatePath,paramname)

FromModelica(ActivatePath,args)

FromModelica(ActivatePath,paramname,args)

FromModelica(ModelicaPath)

FromModelica(ModelicaPath,paramname)

FromModelica(ModelicaPath,args)

FromModelica(ModelicaPath,paramname,args)

R = FromModelica(...)

Inputs

ActivatePath
Path with slash notation representing an Activate address of a component in a model. This path can be either relative or absolute, starting respectively with './' and '/'.
Type: string
ModelicaPath
Path with dot notation representing an object in the Modelica environment, following the standard Modelica syntax. For example, for object in MSL, the path starts with 'Modelica'.
Type: string
paramname
A name representing a parameter of a component, a record element, a package name, a function, etc. It may contain dots to allow recursive access of the element inside the object specified by the first argument of the function.
Type: string
args
Used to specify a Modelica modification or the arguments of a function. In case of modifiers and function call with named arguments, an OML struct is used. For positional function call, an OML cell is used.
Type: struct | cell

Examples

Retrieve a component in the model using '/':
FromModelica('/path/to/component')
Retrieve a component in the model using './':
FromModelica('./path/to/component')
Retrieve a library entity:
FromModelica('path.to.entity')
Retrieve an element/parameter of a component/entity using the second argument:
FromModelica('path','name')
Retrieve an element/parameter of a component/entity using the struct operator:
FromModelica('path').name
Retrieve a modified element:
FromModelica ('path',struct('pname',pvalue,…))
Retrieve a modified element:
FromModelica ('path','name',struct('pname',pvalue,…))
Retrieve a modified element:
FromModelica ('path')(struct('pname',pvalue,…))
Retrieve a modified element:
FromModelica ('path','name')(struct('pname',pvalue,…))
Retrieve a modified element:
FromModelica ('path').name(struct('pname',pvalue,…))
Retrieve an element of vector/matrix:
FromModelica(…)(i)
		FromModelica(…)(i,j)
Retrieve an element of vector/matrix using the struct operator:
FromModelica(…).name(i)
		FromModelica(…).name(i,j)
Retrieve the result of a function call (positional args) with a second argument:
FromModelica('funpath',{arg1,arg2,…})
Retrieve the result of a function call (positional args):
FromModelica('funpath')({arg1,arg2,…})
Retrieve the result of a function call (named args) with a second argument:
FromModelica('funpath',struct('arg1name',arg1,…))
Retrieve the result of a function call (named args):
FromModelica('funpath')( struct('arg1name',arg1,…))

Comments

The retrieved elements can also be used in simple OML expressions including OML variables defined in the diagram workspace. The retrieved values themselves can be assigned to OML variables in Diagram contexts and thus be available in the diagram workspace.

Denoting these OML variables retrieved by FromModelica modexpr1, modexpr2…, and regular OML variables in the workspace, var1, var2…, the following commands provides examples of supported OML expressions for the definition of component parameter values. They are chosen to illustrate what kind of operations are supported and do not correspond to real usages, where the expressions are in general much simpler.

- var1+4*modexpr1+3

- [var1,var2*modeexpr1,modexpr2,pi]

- sin(modexpr1*modeexpr2+var1)/FromModelica('Modelica.Constants.eps')

- FromModelica('Modelica.Electrical.MultiPhase.Functions.quasiRMS')({1:6})/var1+modexpr1

- FromModelica('./DD/BB',var1)(2)*cos(modexpr1)

- var1-[FromModelica('/DD/BB1').cc FromModelica('/DD/BB2').dd]