CreateModel - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : MapleSim Application Programming Interface : API Commands : MapleSim/CreateModel

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:

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

FileTools:-Existsmsimfile

true

(1)

ALinkModel'filename'=msimfile:

A:-GetEquations

EG1_f_ctSM1_flange_a_ft_msim_noEvent&lcub;&lcub;EG1_f_ctEG1_f_d2t<EG1_f_ct&lcub;EG1_f_ctEG1_f_ct<EG1_f_d2tEG1_f_d2totherwiseotherwiseEG1_contactt&equals;true0otherwise&equals;0&comma;EG1_f_ct&equals;_msim_noEvent&lcub;1000000EG1_s_relt320EG1_contactt&equals;true0otherwise&comma;&DifferentialD;&DifferentialD;tEG1_s_relt&equals;EG1_v_relt&comma;&DifferentialD;&DifferentialD;tEG1_v_relt&equals;981100&plus;SM1_flange_a_ftm&comma;EG1_contactt&equals;EG1_s_relt<320&comma;EG1_f_d2t&equals;&lcub;50EG1_v_reltEG1_contactt&equals;true0otherwise

(2)

momodel Main Real a=1; end Main;

mo:=model Main Real a=1; end Main;

(3)

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

FileTools:-Existsmsimfile2

true

(4)

See Also

GetEquations

LinkModel

MapleSim

Opening Modelica Models

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam