Creating Parameter Blocks with the Modelica Custom Component Template - MapleSim Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : Using MapleSim : Building a Model : Using Parameter Sets : Creating Parameter Blocks with the Modelica Custom Component Template

Creating Parameter Blocks with the Modelica Code Editor

You can define a parameter block with the Modelica Code Editor. This is done by declaring a Modelica record that contains the declarations for your parameters then generating a custom component. The custom component is similar to a parameter block, but it has some added advantages like making it easier to reuse parameter definitions and allowing you to create parameter blocks programmatically from a Maple worksheet.

To create a parameter block with the Modelica Custom Component template:

1. 

Click Show Modelica Code Editor ( ). This will open the Modelica Code Editor window.

2. 

Click Create a New Modelica Custom Component ( ).

3. 

Delete all of the sample code in the Modelica Code Editor.

4. 

Type the following Modelica code:

record MyParameterBlock

   parameter <ParameterType> <ParameterName> = <ParameterValue> annotation(__Maplesoft_SystemParameter=true);

   annotation(__Maplesoft_isParameterBlock=true);

end MyParameterBlock;

In the preceding Modelica code, the first line with the last two lines define a Modelica record that represents the parameter block. The body of the record contains a parameter declaration, where:

• 

<ParameterType> is the parameter's type (for example, Real or Integer)

• 

<ParameterName> is the name of the parameter

• 

<ParameterValue> is the value of the parameter

Replace <ParameterType>, <ParameterName>, and <ParameterValue> with the appropriate values for your parameter.

5. 

Add as many parameter declarations as you need to the body of the record you created in step 5.

6. 

Click Save Modelica custom component ( ).

  

In MapleSim, a MyParameterBlock custom component appears in the Components palette under the Local Components tab ( ). Drag this component onto the Model Workspace and use it as you would a parameter block. When you select the component in the Model Workspace, the parameters you defined are listed under the Properties tab ( ).

7. 

Save your model.

 

You can now assign the values defined in the parameter block as a variable or function of a variable to components in your model.

See Also

Creating Parameter Blocks

Specifying Parameter Values

Specifying Parameters for Multiple Components

Assigning Global Parameters

Adding Components to a Custom Library

Running a Simulation

Saving and Applying Parameter Sets

Deleting a Parameter Set

Renaming a Parameter Set

Comparing Parameter Sets

 


Download Help Document