RunSimulation(deprecated) - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MapleSim

  

RunSimulation(deprecated)

  

simulate a MapleSim model

 

Calling Sequence

Parameters

Options

Description

Examples

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

Options

Simulation options

• 

abserr = positive

  

The limit on the absolute error tolerance for a successful integration step if you are using an adaptive solver to run the simulation. You can specify a value for this option when the adaptiveStepSolver option is set to true.

• 

adaptiveStepSolver = truefalse

  

Specifies whether dsolve/numeric uses an adaptive solver or a fixed-step solver to determine sampling periods for the simulation. If this option is set to false, a fixed-step solver is used. The sampling periods are a uniform step size throughout the simulation. You can use the stepsize option to specify a step size. The maxfun option is also ignored. If this option is set to true, an adaptive solver is used. The sampling periods, as determined by the solver, vary throughout the simulation. The default value is true.

• 

evenlyspaced = truefalse

  

Specifies whether the time samples are spaced evenly in the simulation graphs. If this option is set to false, the start and end times of each subinterval corresponding to a particular configuration are included in the graphs. The default value is false.

• 

maxfun = nonnegint

  

The maximum number of function calls that an integrator can make. For more information, see dsolve/maxfun. The value 0 corresponds to no limit. This option is ignored if adaptiveStepSolver is set to true. The default value is 2*10^6.

• 

mbaumgarte = list(nonnegative,nonnegative)

The mbaumgarte keyword parameter specifies the value of the Baumgarte constraint stabilization parameters ([α, β]) applied to the multibody portion of the system. If the value is greater than 0, the position-level constraints are removed from the multibody system and replaced by Baumgarte stabilized acceleration constraints, effectively transforming the multibody DAEs to pure ODEs. The default value is [0,0].

• 

method = ck45, ck45_dae, rkf45, rkf45_dae, rosenbrock, rosenbrock_dae, rk2, rk3, rk4, feuler, or beuler.

Specifies which solver dsolve/numeric uses for integration. The default is ck45_dae.

• 

minpoints = posint

  

The minimum number of samples to plot in the simulation graphs. If evenlyspaced is false, this value is the exact number of samples that appear in the graphs; otherwise, samples at the boundaries of subintervals are also included. The default value is 200.

• 

relerr = positive

  

The limit on the relative error tolerance for a successful integration step if you are using an adaptive solver to run the simulation. You can specify a value for this option when the adaptiveStepSolver option is set to true.

• 

stepsize = positive

  

Uniform step size of the sampling periods if you are using a fixed-step solver to run the simulation. You can specify a value for this option when the adaptiveStepSolver option is set to false.

• 

stiffsolver = truefalse

  

The DAE solver used to calculate the simulation results. If this option is set to true, a stiff DAE solver (Rosenbrock method) is used. If this option is set to false, a non-stiff DAE solver (rkf45 method) is used. The default value is false.

Input options

• 

is_immediate = truefalse

  

If this option is set to true, the parameter MCodeStr is a string containing the Modelica source code (that is, not simply the name of the .mo file). The default value is false.

• 

use_library = truefalse

  

If this option is set to true, the Modelica library is loaded before parsing the source code. If the specified Modelica source does not use library components, this option can be set to false to generate simulation results more quickly. The default value is true.

Simplify options

• 

simplify = truefalse or tryhard

  

Specifies the degree to which system equations are manipulated before they are returned.

  

false - return the equations without any simplification.

  

true - simplify the system model by eliminating redundant variables and equations in the system.

  

tryhard - remove redundant variables and reduce the index of the system. The default value is tryhard.

Output options

• 

output = symbol or list

  

Specifies the output type. The value can either be one of the following symbols, or a list of those symbols. If a list is specified, a list is returned with the corresponding symbols replaced with their values. The default value is plot.

– 

plot - generate the simulation results in plots. The returned value for plot is NULL unless the environment variable _EnvMapleSimReturnPlots is set to true. If _EnvMapleSimReturnPlots is set to true, the corresponding value is either a sequence of plot structures, if output = plot, or a list of plot structures, if plot is an element of the list assigned to output.

– 

datapoint - generate the simulation results as an Array of data values. There is one column of data values per probe specified in the system model. Additional time data in the first column of the returned data array can be generated by setting the returnTimeData option to true (see below).

• 

returnTimeData = truefalse

  

When used with output=datapoint, the time data is added as the first column of the output Array. The default value is true.

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

withMapleSim:

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

mofileStringTools:-Joinkerneloptstoolboxdir=MapleSim,data,examples,BouncingBall.mo,kerneloptsdirsep

RunSimulationmofile,Main,0..10

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

modelica\nmodel test\n annotation(probes={x,y}); // specify the signals to plot\n Real x,y;\nequation\n // Create a delayed ramp.\n y = if time < 1 then 0 else time-1;\n der(x) = y;\nend test;&colon;

RunSimulationmodelica&comma;test&comma;0..5&comma;is_immediate

See Also

MapleSim