Contents Previous Next Index

1 Getting Started with MapleSim


In this chapter:

1.1 Physical Modeling in MapleSim


Physical modeling, or physicsbased modeling, incorporates mathematics and physical laws to describe the behavior of an engineering component or a system of interconnected components. Since most engineering systems have associated dynamics, the behavior is typically defined with ordinary differential equations (ODEs).
To help you develop models quickly and easily, MapleSim provides the following features:

Topological or “Acausal” System Representation


The signalflow approach used by traditional modeling tools requires system inputs and outputs to be defined explicitly. In contrast, MapleSim allows you to use a topological representation to connect interrelated components without having to consider how signals flow between them.


Mathematical Model Formulation and Simplification


A topological representation maps readily to its mathematical representation and the symbolic capability of MapleSim automates the generation of system equations.
When MapleSim formulates the system equations, several mathematical simplification tools are applied to remove any redundant equations and multiplication by zero or one. The simplification tools then combine and reduce the expressions to get a minimal set of equations required to represent a system without losing fidelity.


Advanced Differential Algebraic Equation Solvers


Algebraic constraints are introduced in the topological approach to model definition. Problems that combine ODEs with these algebraic constraints are called Differential Algebraic Equations (DAEs). Depending on the nature of these constraints, the complexity of the DAE problem can vary. An index of the DAEs provides a measure of the complexity of the problem. Complexity increases with the index of the DAEs.
The development of generalized solvers for complex DAEs is the subject of much research in the symbolic computation field. With Maple as its computation engine, MapleSim uses advanced DAE solvers that incorporate leadingedge symbolic and numeric techniques for solving highindex DAEs.


Acausal and Causal Modeling


Real engineered assemblies, such as motors and powertrains, consist of a network of interacting physical components. They are commonly modeled in software by block diagrams. The lines connecting two blocks indicate that they are coupled by physical laws. When simulated by software, block diagrams can either be causal or acausal.

Causal Modeling


Many simulation tools are restricted to causal (or signalflow) modeling. In these tools, a unidirectional signal, which is essentially a timevarying number, flows into a block. The block then performs a welldefined mathematical operation on the signal and the result flows out of the other side. This approach is useful for modeling systems that are defined purely by signals that flow in a single direction, such as control systems and digital filters.

Figure 1.1: Causal Model Block Diagram



This approach is analogous to an assignment, where a calculation is performed on a known variable or set of variables on the right hand side and the result is assigned to another variable on the left:
$y\mathit{:=}f\left(x\right)$


Acausal Modeling


Modeling how real physical components interact requires a different approach. In acausal modeling, a signal from two connected blocks travels in both directions. The programming analogy would be a simple equality statement:
$y\mathit{\=}f\left(x\right)$
The signal includes information about which physical quantities (for example, energy, current, torque, heat and mass flows) must be conserved. The blocks contain information about which physical laws (represented by equations) they must obey and, hence, which physical quantities must be conserved.

Figure 1.2: Acausal Model Block Diagram



MapleSim allows you to use both approaches. You can simulate a physical system (with acausal modeling) together with the associated logic or control loop (with causal modeling) in a manner that suits either task best.


Through and Across Variables


When using the acausal modeling approach, it is useful to identify the through and across variables of the component you are modeling. In general terms, an across variable represents the driving force in a system and a through variable represents the flow of a conserved quantity. The through variable also establishes the flow direction for the sign convention of the conserved quantity.

Figure 1.3: Simple Through and Across Variable Model



For an example of sign convention and how arrow direction represents a force acting on the model, from the Help menu, select Examples > User's Guide Examples > Chapter 1, and then select the Constant Acceleration, Sign Convention and Arrow Convention examples.
In the following example, in an electrical circuit, the through variable, i, is the current and the across variable, V, is the voltage drop:

Figure 1.4: Simple Through and Across Variable Electrical Model



The following table lists some examples of through and across variables for other domains:
Table 1.1: Through and Across Variable Domain Types 
Domain

Through

Across

Electrical

Current (A)

Voltage (V)

Magnetic

Magnetic Flux (Wb)

MMF (A)

Mechanical (translational)

Force (N)

Velocity $\left(\frac{m}{s}\right)$

Mechanical (rotational)

Torque (N.m)

Angular Velocity $\left(\frac{\mathrm{rad}}{s}\right)$

Hydraulic

Flow $\left(\frac{{m}^{3}}{s}\right)$

Pressure $\left(\frac{N}{{m}^{2}}\right)$

Heat flow

Heat flow (W)

Temperature (K)


As a simple example, the form of the governing equation for a resistor is
$V\mathit{\=}R\mathit{\cdot}i$
This equation, in conjunction with Kirchhoff’s conservation of current law, allows a complete representation of a circuit.
$\mathit{}\mathit{}\mathit{}\mathit{}R\mathit{\cdot}{i}_{b}\mathit{equals;}{V}_{b}\mathit{}{V}_{a}$ and ${i}_{b}\mathit{\+}{i}_{a}\mathit{\=}\mathit{0}$
To extend this example, the following schematic diagram describes an RLC circuit, an electrical circuit consisting of a resistor, inductor, and a capacitor connected in series:

Figure 1.5: RLC Circuit



If you wanted to model this circuit manually, it can be represented with the following characteristic equations for the resistor, inductor, and capacitor respectively:
$R\mathit{\cdot}{i}_{R}\mathit{\=}{V}_{a}\mathit{}{V}_{b}$
$L\frac{d}{\mathrm{dt}}{i}_{L}\mathit{\=}\left({V}_{b}\mathit{}{V}_{c}\right)$
${i}_{c}\mathit{\=}C\mathit{\cdot}\frac{d}{\mathrm{dt}}{V}_{c}$
By applying Kirchhoff's current law, the following conservation equations are at points a, b, and c:
${i}_{V}\mathit{}{i}_{R}\mathit{\=}\mathit{0}$
${i}_{R}\mathit{}{i}_{L}\mathit{\=}\mathit{0}$
${i}_{L}\mathit{}{i}_{C}\mathit{\=}\mathit{0}$
These equations, along with a definition of the input voltage (defined as a transient going from 0 to 1 volt, 1 second after the simulation starts)
${V}_{a}\=\left\{\begin{array}{cc}0.0& 0.0\le t<1.0\\ 1.0& \mathrm{t}\ge 1.0\end{array}\right.$
provide enough information to define the model and solve for the voltages and currents through the circuit.
In MapleSim, all of these calculations are performed automatically; you only need to draw the circuit and provide the component parameters. These principles can be applied equally to all engineering domains in MapleSim and allow you to connect components in one domain with components in others easily.
In the Basic Tutorial: Modeling an RLC Circuit and DC Motor section of this chapter, you will model the RLC circuit described above and explore the capabilities of MapleSim to mix causal models with acausal models. The following figure shows how the RLC circuit diagram appears when it is built in MapleSim.

Figure 1.6: RLC MapleSim Circuit



For an another example of how a model can be represented using causal and acausal components, from the Help menu, select Examples > User's Guide Examples > Chapter 1, and then select the Double Mass Spring Damper example.




1.2 The MapleSim Window


The MapleSim window contains the following panes and components:

Figure 1.7: MapleSim Window



Table 1.2: MapleSim Window Components 
Component

Description

Main Toolbar

Contains tools for running a simulation, viewing simulation results, searching the MapleSim help system, and performing other common tasks.

Model Workspace Toolbar

Contains tools for browsing your model and subsystems hierarchically, changing the model view, viewing the corresponding Modelica code, grouping components, and adding probes.

Annotations Toolbar

Contains tools for adding annotations and laying out objects.

Model Workspace

The area in which you build and edit a model in a block diagram view.

Palettes Pane

Contains expandable menus with tools that you can use to build a model and manage your MapleSim project. This pane contains five tabs:
•

Library Components (
): contains palettes with sample models and domainspecific components that you can add to models.

•

Local Components (
): contains palettes of the subsystems and custom components in your model.

•

Model Tree (
): contains a model tree for navigation through your model.

•

Attached Files (
): contains attachments to your model, including documents, parameter sets, and CAD drawings.


Console

Use buttons on the Console Toolbar to display the following panes:
•

Console Output: displays progress messages indicating the status of the MapleSim engine during a simulation and allows you to clear the console using Clear Console (
).

•

Diagnostics Information: displays diagnostic messages for debugging as you build your model identifying the subsystem in which the errors are located.


Console Toolbar

Contains controls for selecting the type of messages shown in the console (
).

Parameters Pane

Contains the following tabs:
•

Properties (
): allows you to view and edit modeling component properties, such as names, parameter values, initial conditions, and probe settings.

•

Simulation Settings (
): allows you to specify simulation options such as the duration of the simulation and optional parameter values for the solver and simulation engine.

•

Multibody Settings (
): allows you to specify options for visualizing multibody components in the 3D Workspace and the 3D Playback Window.

The contents of this pane change depending on your selection in the Model Workspace.




1.3 Basic Tutorial: Modeling an RLC Circuit and DC Motor


This tutorial introduces you to the modeling components and basic tools in MapleSim. It illustrates the ability to mix causal models with acausal models.
In this tutorial, you will perform the following tasks:
1.

Build an RLC circuit model.

2.

Set parameter values to specify component properties.

3.

Add probes to identify values of interest for the simulation.

4.

Simulate the RLC circuit model.

5.

Modify the RLC circuit diagram to create a simple DC motor model.

6.

Simulate the DC motor model using different parameters.

For an example of the RLC Circuit model, from the Help menu, select Examples > User's Guide Examples > Chapter 1, and then select the RLC Circuit example. The model you build is identical to the RLC Circuit model.

Building an RLC Circuit Model


To build the RLC circuit, you add components in the Model Workspace and connect them in a system to form a diagram. In this example, the RLC circuit model contains ground, resistor, inductor, capacitor, and signal voltage source components from the Electrical component library. It also contains a step input source, which is a signal generator that drives the input voltage level in the circuit.
To build an RLC circuit:
1.

In the Library Components tab (
) at the left of the Model Workspace, click the triangle beside Electrical to expand the palette. In the same way, expand the Analog menu, and then expand the Passive submenu.

2.

From the Electrical > Analog > Passive menu, drag the Ground component to the Model Workspace.

3.

Add the following electrical components to the Model Workspace.

•

From the Electrical > Analog > Passive> Resistors menu, add the Resistor component.

•

From the Electrical > Analog > Passive > Inductors menu, add the Inductor component.

•

From the Electrical > Analog > Passive > Capacitors menu, add the Capacitor component.

•

From the Electrical > Analog > Sources > Voltage menu, add the Signal Voltage component.

4.

Drag the components in the arrangement shown below.

5.

To rotate the Signal Voltage component clockwise, rightclick (Controlclick for Mac®) the Signal Voltage component in the Model Workspace and select Rotate Clockwise.

6.

To flip the Signal Voltage component horizontally, rightclick (Controlclick for Mac) the component again and select Flip Horizontal. Make sure that the positive (blue) port is at the top.

7.

To rotate the Capacitor component clockwise, rightclick (Controlclick for Mac) the Capacitor icon in the Model Workspace and select Rotate Clockwise.

You can now connect the modeling components to define interactions in your system.
8.

Hover your mouse pointer over the Ground component port. The port is highlighted in green.

9.

Click the Ground input port to start the connection line.

10.

Hover your mouse pointer over the negative port of the Signal Voltage component.

11.

Click the port once. The Ground component is connected to the Signal Voltage component.

12.

Connect the remaining components in the arrangement shown below.

13.

You can now add a source to your model. Expand the Signal Blocks palette, expand the Sources menu and then expand the Real submenu.

14.

From the palette, drag the Step source and place it to the left of the Signal Voltage component in the Model Workspace. The step source has a specific signal flow, represented by the arrows on the connections. This flow causes the circuit to respond to the input signal.

15.

Connect the Step source to the Signal Voltage component. The complete RLC circuit model is shown below.



Specifying Component Properties


To specify component properties, you can set parameter values for components in your model.
To specifying component properties:
1.

In the Model Workspace, click the Resistor component. The Properties tab (
) at the right of the Model Workspace displays the name and parameter values of the resistor.

2.

In the R field, enter 24, and press Enter. The resistance changes to 24$\mathrm{\Ω}$..

3.

Specify the following parameter values for the other components. You can specify units for a parameter by selecting a value from the dropdown menu found beside the parameter value field.

•

For the Inductor, specify an inductance of 160$mH$.

•

For the Capacitor, specify a capacitance of 200$\mathrm{\μ}F$.

•

For the Step source, specify a T_{0} value of 0.1$s$.



Adding a Probe


To specify data values for a simulation, you can attach probes to lines or ports to the model. In this example, you will measure the voltage of the RLC circuit.
To add a probe:
1.

In the Model Workspace Toolbar, click Attach probe (
).

2.

Hover your mouse pointer over the line that connects the Inductor and Capacitor components. The line is highlighted.

3.

Click the line once. The probe appears in the Model Workspace.

4.

Move the probe to an empty location on the Model Workspace, and then click the workspace to position the probe.

5.

Select the probe. The probe properties appear under the Properties tab (
) to the right of the Model Workspace.

6.

Under the Properties tab, select the Voltage check box to include the voltage quantity in the simulation graph.

7.

To display a custom name for this quantity in the Model Workspace, enter Voltage as shown below and press Enter.

The probe with the custom name is added to the connection line.
For another example of how to use a probe value in a simulation, from the Help menu, select Examples > User's Guide Examples > Chapter 1, and then select the Sensors and Probes example.


Simulating the RLC Circuit Model


Before simulating your model, you can specify the simulation duration run time.
To simulate the RLC circuit:
1.

Click the Settings tab (
) on the right of the Parameters Pane and in the Simulation section, set the simulation duration time (t_{d}) to 0.5$s$.

2.

In the Advanced Simulation section, clear the Compiler check box.

3.

Click Run Simulation (
) in the Main Toolbar. MapleSim generates the system equations and simulates the response to the step input.

When the simulation is complete, the voltage response is plotted in a graph.

Figure 1.8: Voltage Response Plot



4.

Save the model as RLC_Circuit1.msim. The probes and modified parameter values are saved as part of the model.



Building a Simple DC Motor Model


You will now add an electromotive force (EMF) component and a mechanical inertia component to the RLC circuit model to create a DC motor model. In this example, you will add components to the RLC circuit model using the search feature.
To build a simple DC motor:
1.

In the Main toolbar, type EMF in the search bar. A dropdown list displays matches for your search results.

2.

Hover over the Rotational EMF in the Library Components section of the dropdown list. The Rotational EMF component appears in a tool square beside the search field.

3.

Drag the Rotational EMF component to the modeling workspace and place it to the right of the Capacitor component.

4.

Enter Inertia in the search bar.

5.

Drag the Inertia component to the Model Workspace and place it to the right of the Rotational EMF component.

6.

Connect the components as shown below.


Figure 1.9: EMF and Inertia connections



Note: To connect the positive blue port of the Rotational EMF component, click the port once, drag your mouse pointer to the line connecting the capacitor and inductor, and then click the line.
7.

In the Model Workspace, click the Rotational EMF component.

8.

In the Properties tab (
), set the value of the transformation coefficient (k) to 10$\frac{N\mathit{\cdot}m}{A}$.

9.

Click the Step component and change the value of the parameter, T_{0}, to 1$s$.



Simulating the DC Motor Model


To simulate the DC motor:
1.

In the Model Workspace, delete Probe1.

2.

In the Model Workspace Toolbar, click Attach probe (
).

3.

Hover your mouse pointer over the line that connects the Rotational EMF and Inertia components.

4.

Click the line, and then click on an empty area of the workspace to position the probe.

5.

Select the probe, and in the Properties tab (
), select the Speed and Torque check boxes and then clear the Angle check box. The probe, with an arrow indicating the direction of the conserved quantity flow, is added to the model. The direction of the conserved quantity flow (Torque) can be reversed by selecting the probe and then clicking on Reverse Probe (
) in the Properties tab.

6.

Rename the probe Output.

7.

Click a blank area in the Model Workspace.

8.

In the Settings tab (
), set the simulation duration time (t_{d}) to 5$s$.

9.

Click Run Simulation (
) in the Main Toolbar.

10.

Click Show Simulation Results (
). The following graphs appear.


Figure 1.10: Plots of DC Motor Torque and Speed



11.

Save the model as DC_Motor1.msim.




Contents Previous Next Index
