ModelicaAllTypes.AST_AddClass()
This method allows you to create of a new class into an existing Modelica
class.
-
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iType
|
In |
|
String
|
Type of the class: model, record, block,
package, function, connector |
iName
|
In |
|
String
|
Name of the class |
oCreatedClass
|
Out |
|
ModelicaAllTypes
|
Created class |
ReturnType
Boolean
The method returns true if succeeded, false otherwise.
Example
let aPackage(ModelicaAllTypes)
let newClass(ModelicaAllTypes)
aPackage.AST_AddClass("model", "MyNewClass", newClass)
ModelicaAllTypes.AST_GetComponentModifiers()
This method retrieves the parameters as a list of String for a component.
-
Signature
ModelicaAllTypes.AST_GetComponentModifiers(iComponentName : String, oModifiers : List) : Boolean
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iComponentName
|
In |
|
String
|
Component name |
oModifiers
|
Out |
|
List
|
List of modifiers for this component |
Example
In this example, the method retrieves the modifier of the
ramp component.
let aModel(ModelicaAllTypes)
let modifiers(list)
aModel.AST_GetComponentModifiers("ramp", modifiers) //model contains component ‘ramp’
let msg(String)
let str(String)
let i(integer)
i=1
for i while i<= modifiers.Size()
{
str = modifiers.GetItem(i)
msg = msg + "|" + str
i = i+1
}
Message(msg)
ModelicaAllTypes.AST_GetModelicaParameters()
This method provides the top-level parameters in the model.
-
Signature
ModelicaAllTypes.AST_GetModelicaParameters(oNames : List, oDescriptions : List, oValues : List) : Boolean
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
oNames
|
Out |
|
List
|
Name of the parameters |
oDescriptions
|
Out |
|
List
|
Description of the parameters |
oValues
|
Out |
|
List
|
Value of the parameters |
Example
In this example, the method displays all the parameters' values of the model
(amodel).
let aModel(ModelicaAllTypes)
let names(list)
let descriptions(list)
let values(list)
aModel.AST_GetModelicaParameters(names,descriptions,values)
let msg(String)
let i(integer)
i=1
for i while i<= names.Size()
{
str = names.GetItem(i)
msg = msg + "|" + str
str = values.GetItem(i)
msg = msg + "=" + str
i = i+1
}
Message(msg)
ModelicaAllTypes.AST_SetComponentModifiers()
This method valuates the parameters as a list of String of a component.
-
Signature
ModelicaAllTypes.AST_SetComponentModifiers(iComponentName : String, iModifiers : List) : Boolean
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iComponentName
|
In |
|
String
|
Component name |
iModifiers
|
In |
|
List
|
List of modifiers for the component |
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
In the example, the method valuates the ramp component
with the startTime
height and offset duration value.
let aModel(ModelicaAllTypes)
let modifiers(list)
modifiers.Append("duration=duration":String)
modifiers.Append("height=10":String)
modifiers.Append("offset=0":String)
modifiers.Append("startTime=0.01":String)
aModel.AST_SetComponentModifiers("ramp", modifiers)
ModelicaAllTypes.AST_SetModelicaParameter()
This function valuates the top-level parameters in the model.
-
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iName
|
In |
|
String
|
The name of the parameter in the Modelica
class |
iValue
|
In |
|
String
|
The value of the parameter to be given to the
parameter |
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
In this example, the method valuates the p parameter with
the 3.14 value on the model.
let aModel(ModelicaAllTypes)
aModel.AST_SetModelicaParameter("p","3.14")
ModelicaAllTypes.GetSimulationResult()
This method retrieves the result of the previous simulation for a variable.
-
Signature
ModelicaAllTypes.GetSimulationResult(iVarName : String, oResult : List) : Boolean
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iVarName
|
In |
|
String
|
Variable Name |
oResult
|
Out |
|
List
|
List of the result values |
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
In this example, the method simulates a model with the
SimulateBehaviorModel method and retrieves time and a
variable result.
MyModel->SimulateBehaviorModel(0,3)
let resultTime(List)
let result(List)
MyModel->GetSimulationResult("Time",resultTime)
MyModel->GetSimulationResult("MainModel.doublePendulum.revolute1.phi",result)
ModelicaAllTypes.SimulateBehaviorModel()
This method starts a simulation on a logical or functional or Modelica model.
-
Signature
ModelicaAllTypes.SimulateBehaviorModel([iStartTime : Real, iStopTime : Real]) : Boolean
Arguments
Name |
Input/Output |
Required? |
Type |
Comment |
iStartTime
|
In |
|
Real
|
The start time of the simulation. The default
value is 0. |
iStopTime
|
In |
|
Real
|
The stop time of the simulation. The default
value is 1. |
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
In this example, this method simulates the MyLogical model
between 0 and 1 second.
MyLogical->SimulateBehaviorModel(0,1)
ModelicaPackage.GenerateBehaviorModelFromMechanism()
This method generates a Modelica model corresponding to a
Physical mechanism.
-
Signature
ModelicaPackage.GenerateBehaviorModelFromMechanism(iMechFeature : Feature, iDestClassName : String [, iIncludeMotors : Boolean]) : Boolean
Arguments
Name
|
Input/Output
|
Required?
|
Type
|
Comment
|
iMechFeature
|
In
|
|
Feature
|
The mechanism
|
iDestClassName
|
In
|
|
String
|
Name of the output class in this package
|
iIncludeMotors
|
In
|
|
Boolean
|
Indicates if the motors are included or
not
|
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
MyPackage->GenerateBehaviorModelFromMechanism(myMechanism,"OutputClass")
ModelicaPackage.GenerateBehaviorModelFromPiping()
This method generates a Modelica model corresponding to a
Piping Physical product.
-
Signature
ModelicaPackage.GenerateBehaviorModelFromPiping(iPipingProduct : ProductOccurrence, iDestClassName : String [, iMappingToUse : String]) : Boolean
Arguments
Name
|
Input/Output
|
Required?
|
Type
|
Comment
|
iPipingProduct
|
In
|
|
ProductOccurrence
|
Product occurrence to be generated
|
iDestClassName
|
In
|
|
String
|
Name of output class in this package
|
iMappingToUse
|
In
|
|
String
|
name of mapping variant to use (default
mapping is used otherwise)
|
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
MyPackage->GenerateBehaviorModelFromPiping("OutputClass", myPipingProduct)
ModelicaPackage.GenerateBehaviorModelFromSinglePipingObject()
This method generates a Modelica model corresponding to one
Piping object.
-
Signature
ModelicaPackage.GenerateBehaviorModelFromSinglePipingObject(iPipingProduct : ProductOccurrence, iDestClassName : String [, iMappingToUse : String]) : Boolean
Arguments
Name
|
Input/Output
|
Required?
|
Type
|
Comment
|
iPipingProduct
|
In
|
|
ProductOccurrence
|
Product to be used as an input
|
iDestClassName
|
In
|
|
String
|
Name of the output class in this package
|
iMappingToUse
|
In
|
|
String
|
Name of the mapping variant to be used.
The default mapping is used otherwise.
|
ReturnType
Boolean
True if the generation succeeds and false is the case of failure.
Example
MyPackage->GenerateBehaviorModelFromSinglePipingObject("OutputClass", myPipingObject)
|