simulate a MapleSim model - MapleSim Help

Home : Support : Online Help : MapleSim : MapleSim Application Programming Interface : Deprecated Commands : MapleSim/RunSimulation(deprecated)

 Calling Sequence RunSimulation(MCodeStr, MName, duration, opts)

Parameters

 MCodeStr - string; the Modelica source file name or the Modelica code of the model to simulate MName - string; the name of the model to simulate duration - (optional) Or(realcons,realcons..realcons); the simulation duration opts - (optional) equation(s) of the form option = value; specify options for RunSimulation

Description

 • Important: The RunSimulation command has been deprecated.
 • The RunSimulation command simulates MapleSim models. It returns plots displaying simulation results, as determined by calls to dsolve/numeric, for the specified model.
 • The MCodeStr parameter specifies the Modelica source of the MapleSim model for which you want to view simulation graphs. You can either export an existing MapleSim model to a Modelica file (.mo) and specify the Modelica source file name, or create a string containing the Modelica code.
 If you want to create a string containing the Modelica code, you must also set the is_immediate input option to true; otherwise, if you want to specify the Modelica source file name, set the is_immediate option to false.
 For more information about exporting a MapleSim model to a Modelica file, see Exporting a Model to a Modelica File.
 • The MName parameter specifies which model or subsystem to simulate. You can simulate the top-level model or a subsystem defined in your model.
 • The optional duration parameter specifies the simulation time in seconds. If this parameter is of type/realcons, the start time is 0 and the duration value is the end time. The default value is 0..10 seconds.

Examples

 > $\mathrm{with}\left(\mathrm{MapleSim}\right):$

Run the BouncingBall.mo Modelica file located in the MapleSim example directory. The name of the model to simulate is Main.

 > $\mathrm{mofile}≔\mathrm{StringTools}:-\mathrm{Join}\left(\left[\mathrm{kernelopts}\left('\mathrm{toolboxdir}=\mathrm{MapleSim}'\right),"data","examples","BouncingBall.mo"\right],\mathrm{kernelopts}\left('\mathrm{dirsep}'\right)\right)$
 > $\mathrm{RunSimulation}\left(\mathrm{mofile},"Main",0..10\right)$

Create a Modelica source file as a string and use the is_immediate option. The name of the model is test.

 > $\mathrm{modelica}≔"model test annotation\left(probes=\left\{x,y\right\}\right); // specify the signals to plot Real x,y; equation // Create a delayed ramp. y = if time < 1 then 0 else time-1; der\left(x\right) = y; end test;":$
 > $\mathrm{RunSimulation}\left(\mathrm{modelica},"test",0..5,\mathrm{is_immediate}\right)$