Contents Previous Next Index
1 Getting Started with MapleSim
In this chapter:
Physical Modeling in MapleSim
The MapleSim Window
Basic Tutorial: Modeling an RLC Circuit and DC Motor
1.1 Physical Modeling in MapleSim
Physical modeling, or physics-based 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 signal-flow 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 leading-edge symbolic and numeric techniques for solving high-index 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.
Many simulation tools are restricted to causal (or signal-flow) modeling. In these tools, a unidirectional signal, which is essentially a time-varying number, flows into a block. The block then performs a well-defined 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:
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:
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:
Magnetic Flux (Wb)
Angular Velocity rads
Heat flow (W)
As a simple example, the form of the governing equation for a resistor is
This equation, in conjunction with Kirchhoff’s conservation of current law, allows a complete representation of a circuit.
R⋅ib=Vb−Va and ib+ia=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:
By applying Kirchhoff's current law, the following conservation equations are at points a, b, and c:
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)
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
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.
Contains tools for adding annotations and laying out objects.
The area in which you build and edit a model in a block diagram view.
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 domain-specific 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.
Add Apps or Templates (
): contains palettes with pre-built tools for model building and analysis.
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.
Contains controls for selecting the type of messages shown in the console (
Contains the following tabs:
): 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 3-D Workspace and the 3-D 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:
Build an RLC circuit model.
Set parameter values to specify component properties.
Add probes to identify values of interest for the simulation.
Simulate the RLC circuit model.
Modify the RLC circuit diagram to create a simple DC motor model.
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:
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.
From the Electrical > Analog > Passive menu, drag the Ground component to the Model Workspace.
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.
Drag the components in the arrangement shown below.
To rotate the Signal Voltage component clockwise, right-click (Control-click for Mac®) the Signal Voltage component in the Model Workspace and select Rotate Clockwise.
To flip the Signal Voltage component horizontally, right-click (Control-click for Mac) the component again and select Flip Horizontal. Make sure that the positive (blue) port is at the top.
To rotate the Capacitor component clockwise, right-click (Control-click 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.
Hover your mouse pointer over the Ground component port. The port is highlighted in green.
Click the Ground input port to start the connection line.
Hover your mouse pointer over the negative port of the Signal Voltage component.
Click the port once. The Ground component is connected to the Signal Voltage component.
Connect the remaining components in the arrangement shown below.
You can now add a source to your model. Expand the Signal Blocks palette, expand the Sources menu and then expand the Real submenu.
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.
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:
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.
In the R field, enter 24, and press Enter. The resistance changes to 24Ω..
Specify the following parameter values for the other components. You can specify units for a parameter by selecting a value from the drop-down menu found beside the parameter value field.
For the Inductor, specify an inductance of 160mH.
For the Capacitor, specify a capacitance of 200μF.
For the Step source, specify a T0 value of 0.1s.
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:
In the Model Workspace Toolbar, click Attach probe (
Hover your mouse pointer over the line that connects the Inductor and Capacitor components. The line is highlighted.
Click the line once. The probe appears in the Model Workspace.
Move the probe to an empty location on the Model Workspace, and then click the workspace to position the probe.
Select the probe. The probe properties appear under the Properties tab (
) to the right of the Model Workspace.
Under the Properties tab, select the Voltage check box to include the voltage quantity in the simulation graph.
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:
Click the Settings tab (
) on the right of the Parameters Pane and in the Simulation section, set the simulation duration time (td) to 0.5s.
In the Advanced Simulation section, clear the Compiler check box.
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
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:
In the Main toolbar, type EMF in the search bar. A drop-down list displays matches for your search results.
Hover over the EMF in the Library Components section of the drop-down list. The EMF component appears in a tool square beside the search field.
Drag the EMF component to the modeling workspace and place it to the right of the Capacitor component.
Enter Inertia in the search bar.
Drag the Inertia component to the Model Workspace and place it to the right of the EMF component.
Connect the components as shown below.
Figure 1.9: EMF and Inertia connections
Note: To connect the positive blue port of the EMF component, click the port once, drag your mouse pointer to the line connecting the capacitor and inductor, and then click the line.
In the Model Workspace, click the EMF component.
In the Properties tab (
), set the value of the transformation coefficient (k) to 10N⋅mA.
Click the Step component and change the value of the parameter, T0, to 1s.
Simulating the DC Motor Model
To simulate the DC motor:
In the Model Workspace, delete Probe1.
Hover your mouse pointer over the line that connects the EMF and Inertia components.
Click the line, and then click on an empty area of the workspace to position the probe.
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.
Rename the probe Output.
Click a blank area in the Model Workspace.
In the Settings tab (
), set the simulation duration time (td) to 5s.
Click Run Simulation (
) in the Main Toolbar.
Click Show Simulation Results (
). The following graphs appear.
Figure 1.10: Plots of DC Motor Torque and Speed
Save the model as DC_Motor1.msim.
Download Help Document
What kind of issue would you like to report? (Optional)