GetModelica

get the Modelica description of the MapleSim model

Parameters

 options - (optional) equation(s) of the form name = value

Returns

 • string : Modelica description of the model or active subsystem

Options

 • flat: true or false
 Specifies whether to return the flatten record of the active subsystem.  Default is false.
 • core: true or false
 If set to true the returned Modelica represents the core Modelica that describes the behavior of the model: all annotations including the experiment settings are removed; the timestamp when the Modelica was generated is not added; if any attachments are used in the model only their filenames are specified. Default is false. If the model to which the ModelObject is linked is a Modelica file (the LinkModel command was called with the modelica option) GetModelica returns the Modelica string provided in the file regardless of the setting of the core option.

Description

 • A:-GetModelica returns the Modelica description of the entire model.
 • The A := MapleSim:-LinkModel() statement needs to be run prior to successfully using any of the ModelObject A's export functions.

Notes

 • The returned Modelica has MapleSim specific annotations in it and may not display correctly in other tools.

Examples

 > $A≔\mathrm{MapleSim}:-\mathrm{LinkModel}\left('\mathrm{filename}'=\mathrm{cat}\left(\mathrm{kernelopts}\left('\mathrm{toolboxdir}'=\mathrm{MapleSim}\right),"/data/examples/RLCcircuit.msim"\right)\right):$

Getting the Modelica description of the model:

 > $A:-\mathrm{GetModelica}\left(\right)$
 (1)

Getting the core Modelica description of the model:

 > $A:-\mathrm{GetModelica}\left('\mathrm{core}'=\mathrm{true}\right)$
 ${"model Main import Modelica.Constants.inf; import Pi=Modelica.Constants.pi; import Modelica.Constants.pi; import Maplesoft.Constants.I; public Maplesoft.SignalBlocks.Sources.Sine S1\left(amplitude=1, freqHz=1, phase\left(displayUnit="deg"\right)=0, offset=0, startTime=0\right); public RLC_Parallel RLC\left(R=1, L=1, C=1\right); equation connect\left(S1.y, RLC.InputSignal\right); end Main; model RLC_Parallel import Modelica.Constants.inf; import Pi=Modelica.Constants.pi; import Modelica.Constants.pi; import Maplesoft.Constants.I; inner parameter Real R = 1; inner parameter Real L = 1; inner parameter Real C = 1; protected Modelica.Electrical.Analog.Interfaces.NegativePin NP1; public Maplesoft.Electrical.Analog.Passive.Capacitors.Capacitor C1\left(C=C\right); public Maplesoft.Electrical.Analog.Passive.Ground G2; protected Modelica.Electrical.Analog.Interfaces.PositivePin PP1; protected Modelica.Electrical.Analog.Interfaces.NegativePin NP2; public Maplesoft.Electrical.Analog.Passive.Resistors.Resistor R1\left(R=R, T_ref\left(displayUnit="degC"\right)=300.15, alpha=0, useHeatPort=false, T\left(displayUnit="degC"\right)=R1.T_ref\right); public Maplesoft.Electrical.Analog.Passive.Inductors.Inductor I1\left(L=L\right); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP2; public Maplesoft.Electrical.Analog.Sources.Current.SignalCurrent SC1; public Modelica.Blocks.Interfaces.RealInput InputSignal; public Maplesoft.Electrical.Analog.Sensors.PotentialSensor PS1\left(toUnit=Maplesoft.Conversions.VoltageDim.\text{'}V\text{'}\right); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP3; public Modelica.Blocks.Interfaces.RealOutput OutputSignal; equation connect\left(C1.n, NP2\right); connect\left(I1.n, NP2\right); connect\left(I1.p, PP1\right); connect\left(NP1, G2.p\right); connect\left(NP2, NP1\right); connect\left(PP1, PP3\right); connect\left(PP2, PP1\right); connect\left(PP3, C1.p\right); connect\left(PS1.p, PP3\right); connect\left(PS1.y, OutputSignal\right); connect\left(R1.n, NP1\right); connect\left(R1.p, PP2\right); connect\left(SC1.i, InputSignal\right); connect\left(SC1.n, PP2\right); connect\left(SC1.p, G2.p\right); end RLC_Parallel;"}$ (2)