MV-1015: Using Spline3D to Model Combustion Forces in an Engine
In this tutorial you will learn how to use Spline3D to model an input which depends
on two independent variables.
For the tutorial, you will build a
Single Cylinder Engine model similar to the one in Figure 1. Figure 1.
What are Spline 3Ds?
Spline3Ds are reference data plotted in three-dimensional coordinates which
have two independent vectors or axis. These can be visualized as a number of
2D Splines (Curves) placed at regular intervals along a third axis. For
instance, a bushing is generally characterized by a Force versus the
Displacement curve. Let’s say, the Force versus displacement also varies
with temperature. Effectively, there are two independent variables for the
bushing force - Displacement and Temperature. Another example is the Engine
Pressure (or Force) versus the Crank angle map (popularly known as P-Theta
diagram). The P-theta map will vary at different engine speeds (or RPM).
Such a scenario can be modeled using Spline3D.
In this exercise, engine mechanism is simulated where the combustion force that
varies with regard crank angle and engine speed is modeled using
Spline3D.
Review the Model
In this step, you will load and review the model.
From the
mbd_modeling\interactive\spline3d folder, copy the files
SingleCylEngine.mdl and FTheta.csv to your
<working directory>.
Start a new MotionView session.
Click the (Open Model) icon to open the
SingleCylEngine.mdl model file.
Review the model.
The model is a piston cylinder mechanism with a flywheel.
The model has two systems: System Cyl1 and System Flywheel.
Review the System Flywheel.
The Flywheel (fixed to Crank) is driven by a velocity based motion
between markers. The markers refer to a curve (Crank_RPM) for
inputs.
Figure 2. Motion Panel - Connectivity TabFigure 3. Motion Panel - Properties Tab (with Expression referring to
the Curve using AKISPL function)
The curve Crank_RPM indicates the time history of crank speed during
the simulation. The speed ramps up to 500RPM and then 1000, 1500, and
2000 RPM.
Figure 4. Curve Crank_RPM
There are two solver variables: Crank_angle (deg) and Crank_RPM keep
track of the angular rotation (in degrees) and velocity (in RPM) of the
crank respectively.
Outputs are defined to measure the crank angle and RPM.
Review the System Cyl1.
The solver variables in System Flywheel are passed as attachments to
this system and carry the variable names
arg_Crank_angle_SolVar and
arg_Crank_RPM_SolVar. You will use these to
define the independent variables while defining the combustion force
using Spline3D.
A Cumbustion_ref marker exists as a reference for a combustion force
whose Z axis is aligned along the direction of travel of the
piston.
Add a Spline3D Entity
In this step you will learn how to add a combustion force to the piston using
Spline3D.
Add a Spline entity by dong one of the following:
From the Project Browser, right-click on
System Cyl1 and select Add > Reference Entity > Spline3D.Figure 5.
In the Project Browser, Select System
Cly1 and right-click the (Spline3D) icon.
In the dialog, enter F_ThetaSpline as the Label and
spl3d_F_ThetaSpline for the Variable.
Figure 6.
Click OK.
This will display the Spline3D panel with the Properties tab
active.
From the Type drop-down menu, select Value.
Note: The data for the spline can be defined using either the File or Value
methods. For the File type, a reference to an external file in
.csv format must be provided. In case of the Value
type, the values can be imported from a .CSV file (using Import) or they can
be entered in manually. In this tutorial, we will import the values from an
external file.
Click the Import button to display the Import Values
From File dialog.
From your <working directory>, browse to
FTheta.csv and click OK.
In the Warning dialog that appears, click
Yes.
The .csvfile that will be used as the source for Spline3D
needs to be in the format shown in Figure 7.
The first column must hold the X-axis values (shown in blue in Figure 7) which is
the first independent variable.
The top row holds the Z-axis values (shown in Figure 7) which is
the second independent variable.
The other columns must have the Y-axis values (shown in green in Figure 7) with each
column belonging to the particular Z-axis values heading that
column.
Figure 7. The same format is applicable when using the File input type.
Once imported, the values are populated in the panel.
In the Panel, you can review the values in the table by clicking the (Expansion) button
to open the Spline Values Table Data window.
Figure 8. Figure 9.
Note: When manually keying in the values, context menus
are available which allow you to Insert/Delete/Append row and column data.
You can access these menus by right-clicking on any of the row or column
headers. If the right-click is made on the last row/column, an Append option
will also be available.Figure 10. Figure 11.
Close the Spline Values Table Data
window.
Activate the Linear Extrapolation check box.
Figure 12. This will ensure that the values are extrapolated if the Solver starts
looking for values beyond the range of the user provided data.
Click the Show Spline button to visualize the spline
graphically.
Figure 13. You can view all three axes in an isometric view.
Click to Close the viewer.
The imported values are Combustion Force on Piston vs Theta (crank angle)
diagrams at different speeds (as shown in Figure 14). The F-Theta
profiles vary slightly at different engine or crank speeds. The same plot was
visualized in the Spline3D Viewer by placing the four
different plots along the Z-axis.Figure 14. Input Data for Spline3D
Add a Force Using Spline3D
In this step you will add a force to represent the combustion in the cylinder. You
will map it to the Spline3D added in Add a Spline3D Entity.
Add a force using one of the following methods:
From the Project Browser, right-click on
System Cyl1 and select Add > Force Entity > Force from the context menu.
Select System Cyl1 in the Project Browser and then right-click on the
(Force) icon on the Force Entity toolbar.
In the dialog, enter ThetaSpline Force as the Label and
enter a Variable name. Click OK.
From the Force panel, in the Connectivity tab use the Force menu to select
Action reaction.
Double click on the input collector ( and so on) and use the Model Tree.
Select the desired entity from the modeling window.
Figure 15.
Note: The Body 2 reference to Ground Body is through an attachment to the System
Cyl1 system.
From the Trans Properties tab, change the Fz type to
Spline3D.
Double click on the (Spline3D collector).
From the Select a Spline3D dialog, expand System Cyl1 in
the Model Tree and then select
F_ThetaSpline.
Figure 16.
Click OK.
In the Independent variable X field, enter the expression
`MOD({arg_Crank_angle_SolVar.VARVAL},720)`.
In the Independent variable Z field, enter
`{arg_Crank_RPM_SolVar.VARVAL}`.
On the Model check toolbar, click (Check Model).
Figure 17.
Note: The solver function MOD() used in Independent variable X refers to the
solver variable Crank_angle (deg) in System Flywheel (via attachment
arg_Crank_angle_SolVar to System Cyl1). This function calculates the
remainder of the division of first argument value (value of the solver
variable) by the second argument value (720); thereby resetting the value of
Independent variable X every 720 degrees.
To save the model, from the menu bar click File > Save As > Model.
Solve the Model
In this step, you will solve the model with MotionSolve.
On the General Actions toolbar, click (Run).
In the Run panel, enter an end time of 40 seconds and
change the print interval to 0.001.
Click the (Open File) icon and assign a name and location for
the MotionSolve XML file.
Figure 18.
Click the Run button.
This will invoke MotionSolve and solve the
model.
When the job is complete, Close the Solver
View window and the Message Log.
Post-Process the Results
In this step, you will post-process the MotionSolve results from your Spline3D model.
This will load your results in a HyperView window.
From the Animation toolbar, click the (Start/Pause Animation) button to animate the
model.
Visualize the forces on the Piston.
Click the (Vector) icon.
In the Vector panel, select the Piston graphics
for the Assemblies collector.
You can also set all graphics to be transparent. From the
Visualization toolbar, click WireFrame > Transparent Elements and Feature Lines.Figure 19.
From the Page Controls toolbar, click the (Add Page) icon.
In the Select Application drop-down menu, change the client to HyperGraph 2D.
In the Page Controls toolbar, click the arrow next to
(Page Window Layout) and click (3 window layout).
From the Build Plots panel, click to load
the .plt file from the MotionSolve run.
Plot the Crank_angle (deg).
Click in the first window (top left) to make it the active
window.
For Y Type, click User Defined.
For Y Request, click REQ/70000003 Crank_angle
(deg).
For Y Component, click f3.
Figure 20. Selections for plotting Crank_angle (deg)
Plot the CombustionForce in the Z direction.
Click in the second window (top right) to make it the active
window.
For Y Type, click Force.
For Y Request, click REQ/70000002 ThetaSpline Force on
Piston (ForceOnPiston).
For Y Component, click Z.
Figure 21. Selections for plotting CombustionForce
Plot the Force vs Theta plots at different speeds as applied on the
Piston.
This will demonstrate the usage of the Spline3D input used in the Add a Spline3D Entity step of this tutorial.
Click in the modeling window of the third
window (bottom) to make it the active window.
On the Curves toolbar, click on the (Define Curves)
icon.
Click the Add button.
In the Curve field, rename the curve 500
RPM.
Change the source to Math.
In the x field, enter the expression
p2w1c1.y[subrange(p2w1c1.x,6,7)]. In the y
field, enter the expression
p2w2c1.y[subrange(p2w2c1.x,6,7)]
Figure 22. Panel entries for plotting Force vs Theta
Click Apply.
Note:p2w1c1 refers to the Curve 1 plotted on
Page 2, Window 1. If for any reason the page, window, or curve
numbering is different, suitable modifications should be made to the
expression. The subrange function returns the
indices of the vector within a specified range. For more information
on the subrange function, please refer to the
Templex and Math Reference
Guide.
Add three more plots for 1000, 1500, and 2000 RPM. Use the expressions listed
in Table 1.
Table 1.
Curve Name
x expression
y expression
1000 RPM
p2w1c1.y[subrange(p2w1c1.x,16,17)]
p2w1c1.y[subrange(p2w1c1.x,16,17)]
1500 RPM
p2w1c1.y[subrange(p2w1c1.x,26,27)]
p2w1c1.y[subrange(p2w1c1.x,26,27)]
2000 RPM
p2w1c1.y[subrange(p2w1c1.x,36,37)]
p2w1c1.y[subrange(p2w1c1.x,36,37)]
Assign different colors to these curves in one of the following ways:
Click the (Curve Attributes) icon and
select from the color panel under Line Attribute.
In the Plot Browser, select each line and change the
color in the Properties tab.
Compare the finished plots with the input data for the Spline3D plot in Add a Spline3D Entity.
Figure 23. Validating the Spline3D used by the SolverFigure 24.