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

Online Help

All Products    Maple    MapleSim


CreateModel

create a MapleSim model from either a Modelica file or Modelica source

 

Calling Sequence

Parameters

Returns

Options

Description

Examples

Calling Sequence

MapleSim:-CreateModel(modelica, options)

CreateModel(modelica, options)

Parameters

modelica

-

string ; either the name of the file containing the Modelica code model or the Modelica source from which the MapleSim model is to be created. Use the file option to specify whether modelica is a file name or code.

options

-

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

Returns

• 

string ; the name of the created MapleSim file

Options

• 

file : true or false

  

Specifies whether modelica represents a file name or Modelica code. If file = true, then modelica represents a file name. If file = false, then modelica contains Modelica code. The default is true.

• 

output : string

  

Specifies the file name for the output MapleSim model (.msim).

  

Note: If file = false, the output file name must be specified. If file = true, the default name of the output file is the base name of modelica with the .msim file extension. For example, if modelica is sample.mo the output file name is sample.msim.

Description

• 

The CreateModel command creates a MapleSim model from a Modelica file.

• 

If modelica contains a model called Main, this model is used as the active model in MapleSim. That is, it is displayed on the modeling canvas when the model opens in MapleSim and calls to any API commands will operate on this model. All other models appear in the Components palette under the Definitions tab.

• 

If no Main model is defined in the Modelica file, the active model is empty.

• 

If modelica is an empty string and file = false, a MapleSim file is created consisting of an empty Main model.

• 

The CreateModel command is part of the MapleSim package.  You can access this command using the long form of the command name, MapleSim:-CreateModel, or by first executing with(MapleSim) and then using the short form of the command name, CreateModel.

Examples

withMapleSim:

msimfileCreateModelcatkerneloptstoolboxdir=MapleSim,/data/examples/BouncingBall.mo,output=catFileTools:-TemporaryDirectory,/example1.msim:

FileTools:-Existsmsimfile

true

(1)

ALinkModelfilename=msimfile:

A:-GetEquations

EG1_f_ctSM1_flange_a_ft_msim_noEventEG1_f_ctEG1_f_d2t<EG1_f_ctEG1_f_ctEG1_f_ct<EG1_f_d2tEG1_f_d2totherwiseEG1_contactt=true0otherwise=0&comma;EG1_f_ct=_msim_noEvent1000000EG1_s_relt320EG1_contactt=true0otherwise&comma;&DifferentialD;&DifferentialD;tEG1_s_relt=EG1_v_relt&comma;&DifferentialD;&DifferentialD;tEG1_v_relt=981100+SM1_flange_a_ftm&comma;EG1_contactt=EG1_s_relt<320&comma;EG1_f_d2t=50EG1_v_reltEG1_contactt=true0otherwise

(2)

momodel Main\nReal a=1;\nend Main;

momodel Main Real a=1; end Main;

(3)

msimfile2CreateModelmo&comma;file=false&comma;output=catFileTools:-TemporaryDirectory&comma;/example2.msim&colon;

FileTools:-Existsmsimfile2

true

(4)

See Also

GetEquations

LinkModel

MapleSim

Opening Modelica Models