GetModelica
get the Modelica description of the MapleSim model
Calling Sequence
Parameters
Returns
Options
Description
Notes
Examples
A := MapleSim:-LinkModel();
A:-GetModelica(options)
options
-
(optional) equation(s) of the form name = value
string : Modelica description of the model or active subsystem
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.
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.
The returned Modelica has MapleSim specific annotations in it and may not display correctly in other tools.
Linking to a MapleSim model (located in .msim file):
A≔MapleSim:-LinkModel⁡filename=cat⁡kernelopts⁡toolboxdir=MapleSim,/data/examples/RLCcircuit.msim:
Getting the Modelica description of the model:
A:-GetModelica⁡
/* Generated by MapleSim (www.maplesoft.com) - 02:37:03 12-06-2024 build 1831054 */ 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(amplitude=1, f=1, phase(displayUnit="deg")=0, offset=0, startTime=0) annotation(Placement(transformation(origin={73.0,249.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=0))); public RLC_Parallel RLC(R=1, L=1, C=1) annotation(Placement(transformation(origin={181.5595703125,248.37116241455078},extent={{-20.0,-19.99999237060547},{20.0,19.99999237060547}},rotation=0))); equation connect(S1.y, RLC.InputSignal) annotation(Line(points={{95.0,249.0},{162.0,249.0}},color={0,0,127},smooth=Smooth.None)); annotation( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{500.0,500.0}}),graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{200.0,200.0}}),graphics={Rectangle(extent={{0,0},{200.0,200.0}},lineColor={0,0,0})}), uses(Modelica(version="4.0.0")), experiment( StartTime = 0, __Maplesoft_startTimeDisplayUnit = "s", StopTime = 10.0, __Maplesoft_stopTimeDisplayUnit = "s", __Maplesoft_solver = "rkf45", __Maplesoft_adaptive = true, Tolerance = 0.10e-6, __Maplesoft_tolerance_abs = 0.10e-6, __Maplesoft_step_size = 0.1e-2, __Maplesoft_min_step_size = 0, __Maplesoft_max_step_size = 0, __Maplesoft_plot_points = 200, __Maplesoft_numeric_jacobian = false, __Maplesoft_constraint_iterations = 50, __Maplesoft_event_iterations = 100, __Maplesoft_algebraic_error_control = false, __Maplesoft_algebraic_error_relaxation_factor = 1, __Maplesoft_rate_hysteresis = 0.1e-9, __Maplesoft_reduce_events = false, __Maplesoft_integration_diagnostics = false, __Maplesoft_compiler = false, __Maplesoft_scale_method = "none", __Maplesoft_plot_event_points = true ), __MapleSim_version( MapleSim = "2020.1.0", Modelica = "3.2.3" ), __Maplesoft_probes={ Probe( name="Probe1", quantities={ Quantity( variable=RLC.OutputSignal, displayName="Vout" ) }, gui="probe(bounds = [237.0, 244.0, 14.0, 14.0], color = [0, 0, 0], fill = [221, 221, 255], thickness = 1.0, probename = \"Probe1\", all = [[\"\", \"Real\", \"\", false, \"Vout\"]], probed = [[\"\", \"Real\", \"\", false, \"Vout\"]], pin1 = \"RLC.OutputSignal\", pin2 = \"\", reversed = false, probeEasy5 = false, connectionName = \"RLC.OutputSignal\", context = \"\")" )} ); 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 annotation(Placement(transformation(origin={128.0,43.0},extent={{-2.0,-2.0},{2.0,2.0}},rotation=0))); public Maplesoft.Electrical.Analog.Passive.Capacitors.Capacitor C1(C=C) annotation(Placement(transformation(origin={217.0,98.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=-90))); public Maplesoft.Electrical.Analog.Passive.Ground G2 annotation(Placement(transformation(origin={60.0,24.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=0))); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP1 annotation(Placement(transformation(origin={166.0,144.0},extent={{-2.0,-2.0},{2.0,2.0}},rotation=0))); protected Modelica.Electrical.Analog.Interfaces.NegativePin NP2 annotation(Placement(transformation(origin={167.0,43.0},extent={{-2.0,-2.0},{2.0,2.0}},rotation=0))); public Maplesoft.Electrical.Analog.Passive.Resistors.Resistor R1(R=R, T_ref(displayUnit="degC")=300.15, alpha=0, useHeatPort=false, T(displayUnit="degC")=R1.T_ref) annotation(Placement(transformation(origin={127.0,97.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=-90))); public Maplesoft.Electrical.Analog.Passive.Inductors.Inductor I1(L=L) annotation(Placement(transformation(origin={166.0,98.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=-90))); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP2 annotation(Placement(transformation(origin={127.0,144.0},extent={{-2.0,-2.0},{2.0,2.0}},rotation=0))); public Maplesoft.Electrical.Analog.Sources.Current.SignalCurrent SC1 annotation(Placement(transformation(origin={60.0,97.0},extent={{20.0,20.0},{-20.0,-20.0}},rotation=-90))); public Modelica.Blocks.Interfaces.RealInput InputSignal annotation(Placement(transformation(origin={0.0,98.0},extent={{-10.0,-10.0},{10.0,10.0}},rotation=0),iconTransformation(origin={0.0,101.03088929481112},extent={{-10.0,-10.0},{10.0,10.0}},rotation=0))); public Maplesoft.Electrical.Analog.Sensors.PotentialSensor PS1(toUnit=Maplesoft.Conversions.VoltageDim.'V') annotation(Placement(transformation(origin={228.0,169.0},extent={{-20.0,-20.0},{20.0,20.0}},rotation=0))); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP3 annotation(Placement(transformation(origin={191.0,144.0},extent={{-2.0,-2.0},{2.0,2.0}},rotation=0))); public Modelica.Blocks.Interfaces.RealOutput OutputSignal annotation(Placement(transformation(origin={277.455078125,97.99609375},extent={{-10.0,-10.0},{10.0,10.0}},rotation=0),iconTransformation(origin={200.3285762635379,101.02686223449166},extent={{-10.0,-10.0},{10.0,10.0}},rotation=0))); equation connect(C1.n, NP2) annotation(Line(points={{217.0,78.0},{217.0,43.0},{201.0,43.0},{167.0,43.0}},color={0,0,255},smooth=Smooth.None)); connect(I1.n, NP2) annotation(Line(points={{166.0,78.0},{166.0,43.0},{167.0,43.0}},color={0,0,255},smooth=Smooth.None)); connect(I1.p, PP1) annotation(Line(points={{166.0,118.0},{166.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(NP1, G2.p) annotation(Line(points={{128.0,43.0},{60.0,43.0},{60.0,44.0},{60.0,44.0}},color={0,0,255},smooth=Smooth.None)); connect(NP2, NP1) annotation(Line(points={{167.0,43.0},{128.0,43.0}},color={0,0,255},smooth=Smooth.None)); connect(PP1, PP3) annotation(Line(points={{166.0,144.0},{191.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(PP2, PP1) annotation(Line(points={{127.0,144.0},{166.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(PP3, C1.p) annotation(Line(points={{191.0,144.0},{217.0,144.0},{217.0,118.0}},color={0,0,255},smooth=Smooth.None)); connect(PS1.p, PP3) annotation(Line(points={{208.0,169.0},{191.0,169.0},{191.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(PS1.y, OutputSignal) annotation(Line(points={{250.0,169.0},{249.0,169.0},{249.0,96.0},{277.0,96.0},{277.0,98.0}},color={0,0,127},smooth=Smooth.None)); connect(R1.n, NP1) annotation(Line(points={{127.0,77.0},{127.0,43.0},{128.0,43.0}},color={0,0,255},smooth=Smooth.None)); connect(R1.p, PP2) annotation(Line(points={{127.0,117.0},{127.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(SC1.i, InputSignal) annotation(Line(points={{46.0,97.0},{0.0,97.0},{0.0,98.0}},color={0,0,127},smooth=Smooth.None)); connect(SC1.n, PP2) annotation(Line(points={{60.0,117.0},{60.0,144.0},{127.0,144.0}},color={0,0,255},smooth=Smooth.None)); connect(SC1.p, G2.p) annotation(Line(points={{60.0,77.0},{60.0,44.0}},color={0,0,255},smooth=Smooth.None)); annotation( Diagram(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{277.0,194.0}}),graphics), Icon(coordinateSystem(preserveAspectRatio=true, extent={{0,0},{200.0,199.99992}}),graphics={Rectangle(extent={{0,0},{200.0,199.99992}},lineColor={0,0,0}),Rectangle(extent={{0.0,-1.52587890625E-5},{200.0,199.9999237060547}})}) ); end RLC_Parallel;
Getting the core Modelica description of the model:
A:-GetModelica⁡core=true
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(amplitude=1, f=1, phase(displayUnit="deg")=0, offset=0, startTime=0); public RLC_Parallel RLC(R=1, L=1, C=1); equation connect(S1.y, RLC.InputSignal); 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(C=C); 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(R=R, T_ref(displayUnit="degC")=300.15, alpha=0, useHeatPort=false, T(displayUnit="degC")=R1.T_ref); public Maplesoft.Electrical.Analog.Passive.Inductors.Inductor I1(L=L); 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(toUnit=Maplesoft.Conversions.VoltageDim.'V'); protected Modelica.Electrical.Analog.Interfaces.PositivePin PP3; public Modelica.Blocks.Interfaces.RealOutput OutputSignal; equation connect(C1.n, NP2); connect(I1.n, NP2); connect(I1.p, PP1); connect(NP1, G2.p); connect(NP2, NP1); connect(PP1, PP3); connect(PP2, PP1); connect(PP3, C1.p); connect(PS1.p, PP3); connect(PS1.y, OutputSignal); connect(R1.n, NP1); connect(R1.p, PP2); connect(SC1.i, InputSignal); connect(SC1.n, PP2); connect(SC1.p, G2.p); end RLC_Parallel;
See Also
MapleSim
MapleSim[LinkModel]
Download Help Document