2 Building a Model - MapleSim Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : MapleSim : User's Guide : MapleSimUserGuide/Chapter02

Contents     Previous     Next     Index

2 Building a Model

In this chapter:

• 

The MapleSim Component Library

• 

Browsing a Model

• 

Defining How Components Interact in a System

• 

Specifying Component Properties

• 

Creating and Managing Subsystems

• 

Global and Subsystem Parameters

• 

Attaching Files to a Model

• 

Creating and Managing Custom Libraries

• 

Annotating a Model

• 

Entering Text in 2-D Math Notation

• 

Creating a Data Set for an Interpolation Table Component

• 

Best Practices: Building a Model

2.1 The MapleSim Component Library

The MapleSim component library contains hundreds of components that you can use to build models. All of these components are organized in palettes according to their respective domains: electrical, magnetic, hydraulic, 1-D mechanical, multibody, signal blocks, and thermal. Most of these components are based on the Modelica Standard Library 3.2.3.  

Table 2.1: MapleSim Component Library

Library

Description

Signal Blocks

Components to manipulate or generate input and output signals.

Electrical

Components to model electrical analog circuits, single-phase and multiphase systems, and electric machines.

1-D Mechanical

Components to model 1-D translational and rotational systems.

Multibody

Components to model multibody mechanical systems, including force, motion, and joint components.

Hydraulics

Components to model hydraulic systems such as fluid power systems, cylinders, and actuators.

Thermal

Components to model heat flow and heat transfer.

Magnetic

Components to model magnetic circuits.

The library also contains sample models that you can view and simulate, for example, complete electrical circuits and filters. For more information about the MapleSim library structure and modeling components, see the MapleSim Component Library in the MapleSim Help system.

 

To extend the default library, you can create a custom modeling component from a mathematical model and add it to a custom library. For more information, see Creating Custom Modeling Components.

Viewing Help Topics for Components

To view Help topics in the MapleSim Help system, perform any of the following tasks:

• 

Right-click (Control-click for Mac) a modeling component in any of the palettes and select Help from the context menu.

• 

Search for the topic in the help search box in the main toolbar. Help topics related to your search term are listed in the Help Results section.

• 

Search for the help pages for components in the MapleSim Help system.

Updating Models Created in a Previous Release of MapleSim

In MapleSim 7 or earlier, components from the Modelica Standard Library 3.1 were included in the MapleSim Component Library. MapleSim 2015 was updated to use the Modelica Standard Library 3.2.1, MapleSim 2017 was updated to use the Modelica Standard Library 3.2.2, and MapleSim 2019 was updated to use the Modelica Standard Library 3.2.3.

 

If you created a model in an earlier version of MapleSim, you can open it in MapleSim 2017 or later. The model will be updated automatically to use equivalent components from the Modelica Standard Library 3.2.3. For more information including how to back up files created in MapleSim 7 or earlier, see Using MapleSim > Updating Models Created in a Previous Release of MapleSim in the MapleSim Help system.

2.2 Browsing a Model

Using the Model Tree or model navigation controls, you can browse your model to view hierarchical levels of components in the Model Workspace. You can browse to the top level for an overall view of your system. The top level is the highest level of your model: it represents the complete system, which can include individual modeling components and subsystem blocks that represent groups of components. You can also browse to sublevels in your model to view the contents of individual subsystems or components.

Model Tree

The Model Tree tab ( ) is located in the Palettes Pane. Use the Model Tree to browse through and optionally search for elements in your model. Nodes in the model tree can represent attachments, component types, components, parameters, or probes, depending on the model tree view. To change the model tree view, select a view from the list below the Find text box. The following figure shows the drop-down menu available for the 5 DoF Robot multibody example model.

Figure 2.1: Components view in the Model Tree

 

The following are of the model tree views you can select from.

• 

Attachments: This view shows the files attached to your model. Examples of attachments include worksheets, spreadsheets, and CAD drawings. Double-click an attachment to open the attachment in the appropriate program. Enter a term in Find to search for documents that match your term.

• 

Component Types: This view organizes the model tree view according to the type of component or subsystem. Component and subsystem nodes are identified by their type followed by their name. Enter a term in Find to search for component types that match your term (the component's name is ignored in the search).

• 

Components: This view organizes the model tree view according to the Name of each component or subsystem. Component and subsystem nodes are identified by their name followed by their type (see Figure 2.1). Enter a term in Find to search for component and subsystem names that match your term (the component type is ignored in the search). This is the default model tree view.

• 

Parameters: This view shows the parameter definitions in your model. Parameter definitions can come from parameter tables, parameter blocks, Modelica Records, or To Variable components. Enter a term in Find to search for parameters names that match your term. For more information about the parameters view (including how to find all references to a parameter), see Using MapleSim > Building a Model > Navigating and Searching with the Model Tree > Parameters View in the MapleSim Help system.

• 

Probes: This view shows all the probes in your model. The full path to the probe is given in brackets after the name of the probe. Enter a term in Find to search for probes with names that match your term.

To view the parameters associated with a component or subsystem, navigate the model tree to the component node and then select the node. This highlights the element in the Model Workspace, changes the Model Workspace view to display the element, and populates the Properties tab ( ) with the configurable parameters for that element. See Figure 2.2 for an illustration of component selection.

Figure 2.2: Component selection using the Model Tree

 

If you select more than one component from the model tree, the Properties tab displays all the common configurable parameters for the components. If you change a parameter in the Properties tab, this updates the parameter for all of the selected components.

To explore a component or subsystem, you can either double-click the node in the model tree or expand the node and then select one of its children. The Model Workspace view changes to the appropriate level to explore the component or subsystem.

Figure 2.3: Exploring a subsystem

 

For more information on the Model Tree and how to manage complex models, see the Using MapleSim > Building a Model > Navigating and Searching with the Model Tree section of the MapleSim Help system.

Model Navigation Controls

Alternatively, you can use the model navigation controls located in the Model Workspace Toolbar to browse between modeling components, subsystems, and hierarchical levels in a diagram displayed in the Model Workspace.

 

Figure 2.4: Model Navigational Controls

 

The following table summarizes what these controls do and gives the keyboard shortcuts associated with them.

 

Table 2.2: Model Navigation Controls

Control

Keyboard Shortcut

Description

Home

Return to the Main level of your model.

Ctrl+Up Arrow

Command+Up Arrow (Mac)

Navigate to the parent component.

Ctrl+Down Arrow

Command+Down Arrow (Mac)

Display the contents (or children) of the selected component.

2.3 Defining How Components Interact in a System

To define interactions between modeling components, you connect them in a system. In the Model Workspace, you can draw a connection line between two connection ports.

You can also draw a connection line between a port and another connection line.

MapleSim permits connections between compatible domains only. By default, each line type appears in a domain-specific color.

 

Table 2.3: Domain-Specific Connection Line Colors

Domain

Line Color

Mechanical 1-D rotational

Black

Mechanical 1-D translational

Green

Mechanical multibody

Black

Electrical analog

Blue

Electrical multiphase

Blue

Magnetic

Orange

Digital logic

Purple

Boolean signal

Pink

Causal signal

Navy blue

Integer signal

Orange

Thermal

Red

The connection ports for each domain are also displayed in specific colors and shapes. For more information about connection ports, see the MapleSim Component Library > Connectors Overview in the MapleSim Help system.

Components can have either scalar or vector connection ports. A scalar port has only one quantity associated with it while a vector port can have more than one quantity (or dimension) associated with it. Connections between ports with different dimensions are difficult to manage because what quantities are physically connected is not obvious in the Model Workspace. The Connections Manager simplifies these types of connections by letting you examine which ports are connected and change them if necessary.To access the Connections Manager, select a connection line in the Model Workspace and then select the Properties tab ( ). For more information, see Using MapleSim > Building a Model > Using the Connection Manager in the MapleSim Help system.

2.4 Specifying Component Properties

To specify component properties, you can set parameter values for components in your model. When you select a component in the Model Workspace, the configurable parameter values for that component appear in the Properties tab ( ) located on the right side of the MapleSim window.

 

Note: Not all components provide editable parameter values.

 

You can enter parameter values in 2-D math notation, which is a formatting option that allows you to add mathematical text such as superscripts, subscripts, and Greek characters. For more information, see Entering Text in 2-D Math Notation.

 

Note: Most parameters in the MapleSim Component Library have default values. However, for some parameters, these default values are simply placeholders that may not represent realistic values for use in a simulation. These placeholder values use a blue font to distinguish them from other parameter values. You should replace these values with values that are more suitable for your simulation.  For more information, see Using MapleSim> Building a Model > Specifying Parameters in the MapleSim Help system.

Specifying Parameter Units

You can use the drop-down menus beside parameter fields with dimensions to specify units for parameter values. For example, the image below displays the configurable parameter fields for a Mass component. You can optionally specify the mass in kg, lbm, g, or slug, and the length in m, cm, mm, ft, or in.

When you simulate a model, MapleSim automatically converts all parameter units to the International System of Units (SI). You can, therefore, select more than one system of units for parameter values throughout a model.

 

If you want to convert the units of a signal, use the Conversion Block component from the Signal Converters menu in the Signal Blocks palette. This component allows you to perform conversions in dimensions such as time, temperature, velocity, pressure, and volume. In the following example, a Conversion Block component is connected between a translational Position Sensor and a Feedback component to convert the units of an output signal.

Figure 2.5: Specifying Units using the Conversion Block

 

If you include an electrical, 1-D mechanical, hydraulic, or thermal sensor in your model, you can also select the units in which to generate an output signal.

Specifying Initial Conditions

You can set parameter values to specify initial conditions for components from all domains in MapleSim. When you select a component that contains state variables in the Model Workspace, the available initial condition fields appear in the Properties tab, along with the other configurable parameter values for that component.

 

For example, the image below displays the initial position and initial velocity fields that you can set for a Mass component.

Figure 2.6: Initial Conditions

 

 

Specifying How Initial Conditions are Enforced

You can determine how the initial conditions that you specified for a particular component are enforced. The options are ignore ( ), guess ( ), and enforce ( ). You can select these options for initial condition parameters individually by clicking the buttons beside the applicable initial condition fields.

 

If you select the ignore option, the parameter value that you enter in the initial condition field is ignored and the solver uses a default value for the initial condition, typically zero. This option is the default setting for all of the initial condition fields.

 

If you select the guess option, the solver treats the parameter value you entered in the initial condition field as a best guess value. In other words, the best guess value is a starting point for determining the initial configuration of the system for which there is a solution to the set of equations that describe the system. The solver initially computes a solution to the system of equations using this best guess value; however, if no solution is found, the solver computes a solution to the system of equations using an initial condition value that is close to the best guess value.

 

If you select the enforce option, the solver uses the parameter value that you enter in the initial condition field as a start value for the simulation. Similar to the guess option, the solver searches for a solution to the system of equations using the parameter value you entered in the initial condition field. However, unlike the guess option, if there is no solution, no other value is substituted, and an error message appears.

 

For more information about selecting these options, see Best Practices: Enforcing Initial Conditions.

For an example of how initial conditions are enforced, from the Help menu, select Examples > User's Guide Examples > Chapter 2, and then select the Relative Positions example.

2.5 Creating and Managing Subsystems

A subsystem (or compound component) is a set of modeling components that are grouped in a single block component. A simple DC motor subsystem is shown below.

Figure 2.7: Subsystem Group

 

You can create a subsystem to group components that form a complete system, for example, a tire or DC motor. You can also create a subsystem to improve the layout of a diagram in the Model Workspace, add multiple copies of a system to a model, analyze a component group in Maple or to quickly assign parameters and variables. You can organize your model hierarchically by creating subsystems within other subsystems.

After you create a subsystem you will be able to assign parameters and variables to all components in that subsystem using the Advanced Parameter Settings and Advanced Variable Settings tools in the Properties tab ( ).

 

For best practices on creating subsystems in MapleSim, see Best Practices: Laying Out and Creating Subsystems.

Example: Creating a Subsystem

In the following example, you will group the electrical components of a DC motor model into a subsystem.

To create a subsystem

1. 

From the Help menu, select Examples > User's Guide Examples > Chapter 2, and then select the Simple DC Motor example.

2. 

Draw a box around the electrical components by dragging your mouse over them.

 

Figure 2.8: Creating a Subsystem

 

3. 

From the Edit menu, select Create Subsystem (or right-click the boxed area and select Create Subsystem).

4. 

In the dialog box, enter DC Motor.

5. 

Click OK. A white block, which represents the DC motor, appears in the Model Workspace.

In this example, you created a standalone subsystem, which can be edited and manipulated independently of other subsystems in your model. If you want to add multiple copies of the same subsystem to your model and edit those subsystems as a group, you can create a subsystem definition. For more information, see Adding Multiple Copies of a Subsystem to a Model.

Viewing the Contents of a Subsystem

To view the contents of a subsystem, double-click the subsystem icon in the Model Workspace. The detailed view of a subsystem appears.  

 

 

In this view, a broken line indicates the subsystem boundary. You can edit the connection lines and components within the boundary, add and connect components outside of the boundary, and add subsystem ports to connect the subsystem to other components. If you want to resize the boundary, click the broken line and drag one of the sizing handles displayed around the box.

 

To browse to the top level of the model or to other subsystems, use the Model Navigation controls in the Model Workspace Toolbar. For details on Model Navigation controls, see  Best Practices: Laying Out and Creating Subsystems.

 

 

Adding Multiple Copies of a Subsystem to a Model

If you plan to add multiple copies of a subsystem to a model and want all of the copies to have the same configuration, you can create a subsystem definition. A subsystem definition is the base subsystem that defines the attributes and configuration that you want a series of subsystems to share.

 

For example, if you want to add three DC motor subsystems that all have identical components and resistance values in your model, you would perform the following tasks:

 

1. 

Build a DC motor subsystem with the desired configuration in the Model Workspace.

2. 

Use that subsystem configuration to create a subsystem definition and add it to the Components palette under the Local Components tab.

3. 

Add copies of the DC motor subsystem to your model using the subsystem definition as a source.

 

To add copies of the DC motor subsystem to your model, you can drag the DC Motor subsystem definition icon from Components palette under the Local Components tab ( ) and place it in the Model Workspace. The copies that you add to the Model Workspace will then share a configuration that is identical to the subsystem definition in the Local Components tab; the copies in the Model Workspace are called shared subsystems because they share and refer to the configuration specified in their corresponding subsystem definition.

Figure 2.9: Creating Multiple Subsystems

 

 

Shared subsystems that are copied from the same subsystem definition are linked, which means that changes you make to one shared subsystem will be reflected in all of the other shared subsystems that were created from the same subsystem definition. The changes are also reflected in the subsystem definition entry in the Local Components tab.  A shared subsystem is indicated on the model workspace by the icon .

 

Using the example shown above, if you change the resistance parameter of the Resistor component in the DC Motor2 shared subsystem from 24W to 10W, the resistance value of the Resistor component in the DC Motor1 and DC Motor3 shared subsystems and the DC Motor subsystem definition in the Local Components tab will also be changed to 10W.

 

For more information, see Editing Subsystem Definitions and Shared Subsystems.

Example: Adding Subsystem Definitions and Shared Subsystems to a Model

In the following example, you will create a DC Motor subsystem definition and add multiple shared subsystems to your model.

Adding a Subsystem Definition to the Local Components Tab

To add a subsystem definition

1. 

In the Model Workspace, right-click (Control-click for Mac) the standalone DC motor subsystem that you created in Example: Creating a Subsystem.

2. 

From the context menu, select Convert to Shared Subsystem.

3. 

Enter DC Motor as the name for the subsystem definition and click OK.

4. 

Under the Local Components tab ( ) on the left side of the Model Workspace, expand the Components palette.

 

Figure 2.10: Subsystem Definition

 

 

The subsystem definition is added to the Components palette and the subsystem in the Model Workspace is converted into a shared subsystem called DC Motor1. This shared subsystem is linked to the DC Motor subsystem definition.

5. 

Save this model as DCMotorSubsystem.msim. You will be building on this model in Example: Editing Shared Subsystems that are Linked to the Same Subsystem Definition.

 

You can now use this subsystem definition to add multiple DC motor shared subsystems to your MapleSim model.

 

Tip: If you want to use a subsystem definition in another model, add the subsystem definition to a custom library. For more information, see Creating and Managing Custom Libraries.

 

Adding Multiple DC Motor Shared Subsystems to a Model

To add multiple DC Motor shared subsystems to a model, drag the DC Motor subsystem definition icon from the Local Components tab and place it in the Model Workspace.

 

Figure 2.11: Adding Multiple Subsystems to a Model

 

 

When you create a new standalone subsystem or add shared subsystems to a model, a unique subscript number is appended to the subsystem name displayed in the Model Workspace. As shown in the image above, subscript numbers are appended to the names of each DC Motor shared subsystem. These numbers can help you to identify multiple subsystem copies in your model.

 

Editing Subsystem Definitions and Shared Subsystems

If you edit a shared subsystem in the Model Workspace, your changes will be reflected in the subsystem definition that is linked to the shared subsystem, as well as other shared subsystems that were copied from the same subsystem definition.

Example: Editing Shared Subsystems that are Linked to the Same Subsystem Definition

In this example, you will create a model that contains two DC Motor shared subsystems, and then edit the resistance values and icons for the shared subsystems. These shared subsystems are linked to the DC Motor shared subsystem definition that was created in Example: Adding Subsystem Definitions and Shared Subsystems to a Model. You will verify that when you change one of the component values and the icon for one DC Motor shared subsystem, the other DC Motor shared subsystems in your model--as well as any new DC Motor shared subsystems that you add in the future--will contain the changes.

 

Note: Before doing this example, you should have already gone through and stored the results from Example: Adding Subsystem Definitions and Shared Subsystems to a Model.

To use shared subsystems:

1. 

In MapleSim, open the DCMotorSubsystem.msim file that you created in Example: Adding Subsystem Definitions and Shared Subsystems to a Model.

2. 

Under the Local Components tab ( ), expand the Components palette, and then drag a second DC Motor shared subsystem on to the workspace, placing it below the existing DC Motor shared subsystem.

3. 

Under the Library Components tab ( ), expand the 1-D Mechanical > Rotational > Common menu, and then drag a second Inertia component on to the workspace, placing it below the existing Inertia component.

4. 

Make the following connections between the newly added components and the existing components in the model.

5. 

In the Model Workspace, double-click the DC Motor1 shared subsystem. The detailed view of the shared subsystem appears.

 

Figure 2.12: DC Motor Subsystem

 

 

Note that a heading with the shared subsystem name (DC Motor_1) followed by the subsystem definition name (DC Motor) appears at the top of the Model Workspace. In the detailed view of all shared subsystems, this heading also appears to help you identify multiple subsystem copies in your model. Also, when you select a shared subsystem, its subsystem definition name appears in the Type field in the Properties tab ( ).

 

6. 

Select the Resistor component (R1) and, in the Properties tab, click Parameters.  Change the resistance value to 50.

 

 

7. 

In the Model Workspace Toolbar, click Icon ( ).

8. 

Using the Rectangle Tool ( ) in the Model Workspace Toolbar, click and drag your mouse pointer to draw a shape in the box.

 

 

9. 

In the Model Workspace Toolbar, click Diagram ( ).

10. 

Click Main ( ) in the Model Workspace Toolbar to browse to the top level of the model. Both of the DC Motor shared subsystems now display the square that you drew.

 

 

11. 

Under the Local Components tab on the left side of the MapleSim window, expand the Components palette. As shown in the image below, your changes are also reflected in the DC Motor entry in this palette.

 

 

If you double-click the DC Motor subsystems in the Model Workspace and select their Resistor components, you will see that both of the shared subsystems now have a resistance value of 50W.

12. 

From the Local Components tab, drag a new copy of the DC Motor subsystem and place it anywhere in the Model Workspace. Verify that the new copy displays the square that you drew and its resistance value is also 50W, and then delete it from the workspace.

13. 

Save this model as DCMotorSharedSubsystem.msim. You will be building on this model in Example: Removing the Link Between a Shared Subsystem and its Subsystem Definition.

Example: Removing the Link Between a Shared Subsystem and its Subsystem Definition

If your model contains multiple shared subsystems that are linked and you want to edit one copy only, you can remove the link between a shared subsystem and its subsystem definition, and edit that subsystem without affecting others in the Model Workspace.

Note: Before doing this example, you should have already gone through and stored the results from Example: Editing Shared Subsystems that are Linked to the Same Subsystem Definition and saved the results from that example.

To remove shared subsystem link:

1. 

Open the DCMotorSharedSubsystem.msim model that you created in Example: Editing Shared Subsystems that are Linked to the Same Subsystem Definition.

2. 

In the Model Workspace, right-click (Control-click for Mac) the DC Motor1 shared subsystem.

3. 

Select Convert to Standalone Subsystem. The DC Motor1 subsystem is no longer linked to the DC Motor subsystem definition in the Local Components tab; it is now called copy of DC Motor.

4. 

Double-click the DC Motor1 shared subsystem.

5. 

Click Icon ( ).

6. 

Using the Rectangle Tool ( ), click and drag your mouse pointer to draw a shape in the box in the Model Workspace.

7. 

Click Diagram ( ), and then click Main ( ) to browse to the top level of the model. Your change is shown in the DC Motor1 shared subsystem in the Model Workspace and the DC Motor subsystem definition in the Local Components tab. Note that your change is not shown in the copy of DC Motor subsystem that is no longer linked to the DC Motor subsystem definition.

 

Tip: When you convert a shared subsystem to a standalone subsystem, it is a good practice to assign the standalone subsystem a meaningful name that clearly distinguishes it from existing shared subsystems and subsystem definitions.

Working with Standalone Subsystems

Standalone subsystems are subsystems that are not linked to a subsystem definition. You can create a standalone subsystem in two ways: by creating a new subsystem as shown in Example: Creating a Subsystem or by converting a shared subsystem to a standalone subsystem as shown in Example: Removing the Link Between a Shared Subsystem and its Subsystem Definition. Standalone subsystems can be edited independently without affecting other subsystems in the Model Workspace.

 

To identify a subsystem as a standalone subsystem, select a subsystem in the Model Workspace and examine the Properties tab ( ). If that subsystem is a standalone subsystem, the Type field reads Standalone Subsystem.

 

 

Standalone subsystems will not show the shared subsystem icon ( ) on the Model Workspace. Also, if you double-click a standalone subsystem to browse to its detailed view, no heading is shown for the subsystem in the Model Workspace.

 

When you copy and paste a standalone subsystem in the Model Workspace, you can optionally convert that subsystem into a shared subsystem and create a new subsystem definition. For more information, see Example: Copying and Pasting a Standalone Subsystem.

Example: Resolving Warning Messages in the Debugging Console

When you convert a shared subsystem into a standalone subsystem, the subsystem is highlighted in the Model Workspace and a warning message appears, informing you that the link to the subsystem definition has been removed.

 

Note: This example is an extension of Example: Removing the Link Between a Shared Subsystem and its Subsystem Definition.

To resolve a warning message

1. 

Click Diagnostic Information ( ) at the bottom of the MapleSim window to display the debugging console. The following warning message appears in the console.

 

 

2. 

To work with the copy of DC Motor subsystem as a standalone subsystem, right-click (Control-click for Mac) the warning message and select Ignore duplication warnings for 'copy for DC Motor' to hide the warning message from the debugging console.

 

Tip: If you want to view warning messages that you hid from the debugging console, click Reset Ignored Warnings ( ) above the console. All of the warning messages that you previously hid will appear in the debugging console again.

 

Alternatively, if you want to link the copy of DC Motor standalone subsystem to the DC Motor subsystem definition again, you can right-click (Control-click for Mac) the warning message and select Update 'copy of DC Motor' to use the shared subsystem 'DC Motor'.

Example: Copying and Pasting a Standalone Subsystem

Note: This example is an extension of Example: Removing the Link Between a Shared Subsystem and its Subsystem Definition.

To copy and paste a standalone subsystem:

1. 

In the Model Workspace, copy and paste the copy of DC Motor  standalone subsystem. A dialog box appears.  (See Figure 2.13.)

2. 

Select Convert the above stand-alone subsystem to a shared subsystem (Recommended). A new subsystem definition called SharedSubsystem_1 is added to the Components palette in the Local Components tab ( ).

Figure 2.13: Copy Subsystem Dialog

 

 

In the Model Workspace, the copy of DC Motor standalone subsystem has been converted to a shared subsystem called copy of DC Motor and another copy of that shared subsystem called copy of DC Motor1 has been added to the Model Workspace. Both the copy of DC Motor and copy of DC Motor1 shared subsystems are linked to the new SharedSubsystem_1 subsystem definition. Therefore, if you edit either copy of DC Motor or copy of DC Motor1 in the Model Workspace, your changes will not be reflected in subsystems that are linked to the original DC Motor subsystem definition.

 

Note: Alternatively, you can select Replicate the above stand-alone subsystem as a new stand-alone subsystem to add another standalone subsystem that can be edited independently without affecting the other subsystems in the Model Workspace.

2.6 Global and Subsystem Parameters

MapleSim lets you define global and subsystem parameter values, and assign them to components using the Add or Change Parameters editor, parameter blocks, parameter sets, and the Advanced Parameter Settings and Advanced Variable Settings in the Properties tab.

Global Parameters

If your model contains multiple components that share a common parameter value, you can create a global parameter. A global parameter allows you to define a common parameter value in one location and then assign that common value to multiple components in your model.

 

The following example describes how to define and assign a global parameter. To view a more detailed example, see Tutorial 1: Modeling a DC Motor with a Gearbox in Chapter 6 of this guide.   

Example: Defining and Assigning a Global Parameter

If your model contains multiple Resistor components that have a common resistance value, you can define a global parameter for the resistance value in the parameter editor view.

To define and assign a global parameter:

1. 

In the Library Components tab ( ), expand the Electrical palette, expand the Analog menu, expand the Passive menu, and then expand the Resistors menu.

2. 

From the palette, drag three copies of the Resistor component into the Model Workspace.

3. 

In the Model Workspace Toolbar, click Parameters ( ), or click the workspace and from the Properties tab ( ), click Add or Change Parameters. The Main subsystem default settings screen appears. You will use this screen to define the global parameter and assign it to the Resistor components in your model.

4. 

Click the first field under the Name column in the Main subsystem default settings table.

5. 

Enter GlobalResistance as the global parameter name and press Enter.

6. 

Under Type, select Resistance[[ W ]] and specify a default value of 2.

7. 

Enter Global resistance variable as the description and press Enter.

The global parameter for the resistance value is now defined. You can now assign the common GlobalResistance parameter value to the individual Resistor components that you added to the Model Workspace.

8. 

In the R1 component table and R2 component table, enter GlobalResistance as the resistance value.

The resistance value of the parameter GlobalResistance (2, as defined in the Main subsystem default settings table) has now been assigned to the resistance parameters of the R1 and R2 components.

 

The R1 and R2 components will now inherit any changes made to the GlobalResistance parameter value in the Main subsystem default settings table. For example, if you change the default value of the GlobalResistance parameter to 5 in the Main subsystem default settings table, the resistance parameters of the R1 and R2 components will also be changed to 5. Any change to the GlobalResistance parameter value will not apply to the R3 component because it has not been assigned GlobalResistance as a parameter value.

Subsystem Parameters

You can create a subsystem parameter if you want to create a common parameter value to share with multiple components in a subsystem. Similar to global parameters, a subsystem parameter is a common value that you define in the parameter editor view and assign to components.

 

There are two ways to assign subsystem parameters; one is by clicking Parameters ( ) and the other is by using the Advanced Parameter Settings tool in the Properties tab ( ).  Parameters can only be assigned to components in the subsystem in which they are defined. If you select a subsystem in the Model Workspace, click Parameters ( ) or Advanced Parameter Settings, and define a parameter in the parameter editor view, the parameter that you define is assigned to components in the subsystem that you selected and any nested subsystems.

 

To view an example, see Tutorial 3: Modeling a Nonlinear Damper in Chapter 6 of this guide.

 

Note: If you create a parameter within a subsystem and assign its value to a component at the top level, the component at the top level will not inherit the parameter value.

 

Example: Assigning a Subsystem Parameter to a Shared Subsystem

If you assign a subsystem parameter to a shared subsystem in your model, the default subsystem parameter will also be assigned to other shared subsystems that are linked to it. However, after the default subsystem parameter is assigned, you can edit the subsystem parameter value for each shared subsystem separately without affecting other parameter values in the model.

To assign a subsystem parameter to a shared subsystem

1. 

From the Help menu, select Examples > Physical Domains > Multibody, and then select the Double Pendulum model. This model contains two shared subsystems, L1 and L2, which are linked to a subsystem definition called L.

2. 

Double-click the L1 shared subsystem.

3. 

Click Parameters ( ).

4. 

In the L subsystem default settings table, click the empty field at the bottom of the table.

5. 

Enter c as the parameter name, keep the default value as 1, and press Enter.

6. 

Click Diagram ( ). The new subsystem parameter, c, appears in the Properties tab ( ) for the L1 shared subsystem.

7. 

Click Main ( ), select the L2 subsystem, and then examine the Properties tab. The new subsystem parameter is also displayed for the L2 shared subsystem.

8. 

In the Properties tab, change the value of c to 50.

9. 

Click the L1 shared subsystem in the Model Workspace and examine the Properties tab. Note that the value of its parameter, c, remains the same.

Creating Parameter Blocks

As an alternative to defining subsystem parameters using the methods described above, you can create a parameter block to define a set of subsystem parameters and assign them to components in your model. Parameter blocks allow you to apply parameters in multiple models at the top level of the Model Workspace.

 

The following image shows a parameter block that has been added to the Model Workspace.

When you double-click this block, the parameter editor view appears. This view allows you to define parameter values for the block.

After defining parameter values, you can assign those values to the component parameters in your model.

 

To use parameter values in another model, you can add a parameter block to a custom library. For more information about custom libraries, see Creating and Managing Custom Libraries.

 

Notes:

• 

Parameter blocks must be placed in the same subsystem as the components to which you want to assign the parameter value.

• 

Parameter blocks at the same hierarchical level in a model cannot have the same parameter names. For example, two separate parameter blocks in the same subsystem cannot each contain a parameter called mass.

Example: Creating and Using a Parameter Block

In this example, you will create a set of parameters that can be shared by multiple components in your model. By creating a parameter block, you only need to edit parameter values in one location to compare results when you run multiple simulations.

To create and use a parameter block:

1. 

From the Help menu, select Examples > Physical Domains > 1-D Mechanical, and then select the PreLoad example.

2. 

Under the Settings tab ( ), enter 0.012 seconds for td, the simulation duration time.

3. 

Click the SM1 Mass component on the workspace, and then click the Properties tab ( ). You will be using a parameter block to set values for the following parameters: m, L, s0, and v0.

4. 

From the Model Workspace Toolbar, click Add a parameter block ( ), and then click on a blank area in the Model Workspace.

5. 

Click the Properties tab and enter the name SlidingMassParams for the parameter block.

6. 

Double-click the SlidingMassParams parameter block in the Model Workspace. The parameter editor view appears.

7. 

Click the first field in the table and define a new symbolic parameter called MASS.

8. 

Press Enter. The remaining fields for this row are activated.

9. 

From the Type drop-down menu, select Mass [[ kg ]].

10. 

Enter a default value of 5.

11. 

From the Default Units drop-down menu, select kg.

12. 

Enter Mass of the sliding mass for the Description field.

13. 

In the same way, define the following parameters and values in the Parameters subsystem default settings table.

Name

Type

Default Value

Default Units

Description

LENGTH

Length m

2

m

Length of the sliding mass

V0

Velocity ms

1

ms

Initial velocity of the sliding mass

S0

Position m

1

m

Initial position of the sliding mass

 

The parameter editor view appears as follows when the values are defined.

14. 

Click Diagram ( ). When you select the parameter block in the Model Workspace, the defined parameters appear in the Properties tab on the right side of the MapleSim window.

 

 

15. 

In the Model Workspace, select the SM1 mass component in the diagram.

16. 

In the Properties tab, assign the following values and press Enter.

 

 

The parameters of this Mass component now inherit the numeric values that you defined in the parameter block.

17. 

In the same way, assign the same values to the parameters of the SM2 and SM3 mass components in the model.

18. 

In the Model Workspace, delete the probe labeled Input.

19. 

Select the probe labeled Output.

20. 

In the Properties tab, clear the check box beside Velocity.