SlideShare a Scribd company logo
“Automated Design of a Single Cylinder Internal Combustion Engine
using interlinked analysis and simulation software”
Project by:
Bhavin Sampat
Siddhesh Sawant
Dhaval Prajapati
Rahul Goregaonkar
Gurpreet Singh Sandhu
ME 630: Computer Aided Mechanical Design
Prof. Stewart Prince
California State University, Northridge
Spring 2015
Abstract
An engineering design of any product consists of multiple stages like concept development,
planning, designing, modeling, material selection, testing, cost optimization, manufacturing, etc.
These processes are governed by many general as well as product specific considerations. One of
the prime considerations is of the product safety. It is vital to test the product for its performance
under various stresses it is probable to be subjected to, in its work environment. Often there are
several modifications required to be made in the design due to possibilities of failure realized
during testing. Computer aided design makes it easier and convenient to apply these modifications
and recheck the product’s performance.
The purpose of this study is to develop an interface for design engineers that interlinks
organizational applications like Microsoft Excel, design application like Solidworks and analytical
application like MATLAB, to enable the user to alter product features and study the effects of
these changes on the product’s performance automatically. In our study here, we will design a
single cylinder internal combustion engine, specifically its connecting rod and crankshaft using a
Visual Basic Application (VBA) code that connects these software. The VBA code will essentially
enable the user to make changes in the product model designed in Solidworks by merely editing
the model information stored in a Microsoft Excel spreadsheet. Not only will it modify the existing
Solidworks model with the edited features in Excel, but also automate the Solidworks to run an
existing motion study on the modified model. In addition, the VBA code will execute a MATLAB
program that calculates and generates plots for position, velocity and acceleration as a function of
engine rotation, to compare with those obtained from motion study in Solidworks. It will also
calculate and return various forces acting on the components throughout a motion cycle and enable
the user to run a static analysis on the model to determine a factor of safety.
In the overall study, we will:
(1) Design a single cylinder internal combustion engine, specifically the connecting rod and
crankshaft in such a way that their main features are easily manipulated,
(2) Perform a motion study on the assembly to yield force and motion information,
(3) Perform a stress simulation study in order to properly size components based on a desired,
factor of safety
(4) Automate the process.
1.0 Task Description
The illustration above depicts a single cylinder internal combustion engine (see included assembly
model). The main parts to be analyzed are: (1) engine block (2) crankshaft, (3) connecting rod, (4)
piston and (5) head assembly. The assembly can be modeled as a four bar slider crank
mechanism/machine. As the crankshaft rotates, the piston reciprocates, and the connecting rod
connects the two together. While the connecting rod is actually an assembly of its own, consisting
of the rod, endcap, bearings, and fasteners, it is treated as a single part here. The block acts as the
ground link. It is assumed the crankshaft rotates at constant angular velocity while the piston is
subjected to gas forces via cylinder pressure due to combustion, and that a constant speed torque
generator is attached to the left hand side of the crankshaft in order to create the constant speed.
Normally, the internal combustion engine components are sized based on static analysis of
components when subjected to the gas force. However, such analysis may lead to under-sizing of
components because inertia forces and torques may be significant at higher speeds and fatigue may
also be a factor.
The valve train cam rotates at ½ the speed of the crankshaft, and can be modeled as a gear driven
system with a gear mate. The cylinder head, valves (intake and exhaust), and return springs must
be modeled and analyzed as well.
1.1Analysis Tasks
1. Constrain the mechanism and design (prelim) the conrod.
2. Perform a motion simulation at 2000 rpm, with gas force neglected to get forces/torques as a function of
engine rotation. Verify your work with a Matlab simulation and compare position, velocity, acceleration,
forces between Motion and Matlab.
3. Import the necessary information into Simulation to perform a stress analysis study, multiple frame, to
redesign the conrod and crankshaft (static analysis), static FOS of 2.5.
4. Modify the crankshaft balance weights to reduce the shaking forces to an “acceptable” level.
5. Re-analyze to verify crank and connrod stresses are still within acceptable level.
6. Continue to iterate until shaking forces and stresses are acceptable.
7. Perform a design study on the conrod to maintain the FOS static to >2.5.
8. Create a realistic cylinder head, modeling the valves/cam and other needed items. Inlet valve diameter
taken as 45% of bore, exhaust valve diameter taken as 35% of bore. Lift of both valves to be 25% of valve
diameter. Cam profiles must follow proper protocol for opening the intake and exhaust valves based on an
assumed timing (research cam timing to find appropriate values).
9. Simulate the entire system and design the valve return springs, and add them to the model. Try to make
the entire engine assembly as realistic as possible. Create AVI simulation files to be included with results.
1.2 Automaton Tasks
Assuming the assembly exists with both a motion and simulation static study: Write a macro, launched
from Excel that:
1. Allows the user to alter the crank pin diameter
2. Creates part properties: DESCRIPTION, PARTNO, MATERIAL, WEIGHT, COST, and allows the user
to alter them from Excel
3. Runs an existing motion study
4. Runs an existing static stress study
5. Returns max von mises stress in connrod, FOS in part
6. Returns mass properties of connrod part
2.0 Introduction
The focus of our study here is to analyze the design of described internal combustion engine
to satisfy the ‘Von Mises Criterion’ and modify the design in case of material failure realized
during analysis. Further, we will optimize the design to obtain a suitable factor of safety with
minimization of shaking forces. Using computer applications and programing languages, we will
automate the processes and create a user friendly interface that enables the user to modify the
design easily and simulate the engine performance, to examine the results of these changes.
Need for Design Analysis:
 To verify the design for safety of the product and its users.
 To optimize the overall cost.
2.1 Theory
To understand the results obtained in FEA, it is necessary to have the theoretical knowledge
of the stresses developed in various loading conditions.
Von Mises Criterion for analyzing material safety
In an elastic, isotropic body subjected to 3D loads, a complex 3 dimensional system of
stresses is developed. At any point there are stresses acting in different directions, and the direction
and magnitude of stresses changes from point to point. A German-American applied
mathematician, Richard Von Mises found that, in ductile engineering materials, even though no
principal stress exceeds the yield stress, it is possible for yielding to result from a combination of
stresses. The combined equivalent stress, called the ‘Von Mises Stress’ is compared with the yield
strength of the material, setting a universal criterion for its failure. An engineer can say his design
will fail, if the maximum value of Von Mises stress induced in the material is more than the yield
strength of the material. This criterion is called the ‘Von Mises Criterion’. It is based on the
determination of distortion energy in a given material, i.e. energy associated with change in shape
of the material as opposed to change in its volume.
According to this criterion, a given structural material is safe as long as the maximum value
of distortion energy per unit volume in that same material remains smaller than the distortion
energy per unit volume required to cause yield in the same material. Distortion energy is the energy
required for shape deformation of a material. During pure distortion, the shape of the material
changes, but volume does not change. This is illustrated in the figure below.
Figure 1: Representation of a pure distortion case
Distortion energy required per unit volume, ‘Ud’ for a general 3 dimensional case is given in
terms of principal stress values as:
Distortion energy for simple tension case at the time of failure is given as:
The above 2 quantities can be connected using distortion energy failure theory, so the condition
of failure will be as follows.
The left hand side of the above equation is denoted as Von Mises stress ‘σv’, given as,
So as a failure criterion, the engineer can check whether Von Mises stress induced in the material
exceeds yield strength (for ductile material) of the material. The failure condition can be simplified
as:
Von Mises stress is widely used by designers to check whether their design will withstand a given
load condition.
2.2 Computer applications used in our study
Visual Basic for Applications (VBA)
Visual Basic for Applications (VBA) is an implementation
of Microsoft's event-driven programming language, Visual Basic, and its
associated integrated development environment (IDE).
Visual Basic for Applications enables building user-defined
functions (UDFs), automating processes and accessing Windows API and
other low-level functionality through dynamic-link libraries (DLLs). It
supersedes and expands on the abilities of earlier application-
specific macro programming languages such as Word's WordBasic. It can be used to control many
aspects of the host application, including manipulating user interface features, such as menus and
toolbars, and working with custom user forms or dialog boxes.
As its name suggests, VBA is closely related to Visual Basic and uses the Visual Basic Runtime
Library, but it can normally only run code within a host application rather than as a standalone
program. It can, however, be used to control one application from another via OLE Automation.
For example, it is used to automatically create a Word report from Excel data, which are
automatically collected by Excel from polled observation sensors. VBA has the ability to use (but
not create) (ActiveX/COM) DLLs, and later versions add support for class modules.
VBA is built into most Microsoft Office applications, including Office for Mac OS X and other
Microsoft applications such as Microsoft MapPoint and Microsoft Visio, as well as being at least
partially implemented in other applications such as ArcGIS, AutoCAD, SolidWorks,
CATIA, Corel Draw and WordPerfect.
Fig. 1. Typical Visual Basic environment
SolidWorks
SolidWorks is solid modeling CAD (computer-aided
design) software that runs on Microsoft Windows. SolidWorks
is a solid modeler, and utilizes a parametric feature-based
approach to create models and assemblies. The software is
written on Parasolid-kernel.
Parameters refer to constraints whose values determine the shape or geometry of the model or
assembly. Parameters can be either numeric parameters, such as line lengths or circle diameters,
or geometric parameters, such as tangent, parallel, concentric, horizontal or vertical, etc. Numeric
parameters can be associated with each other through the use of relations, which allows them to
capture design intent.
Design intent is how the creator of the part wants it to respond to changes and updates. For
example, you would want the hole at the top of a beverage can to stay at the top surface, regardless
of the height or size of the can. SolidWorks allows the user to specify that the hole is a feature on
the top surface, and will then honor their design intent no matter what height they later assign to
the can.
Features refer to the building blocks of the part. They are the shapes and operations that construct
the part. Shape-based features typically begin with a 2D or 3D sketch of shapes such as bosses,
holes, slots, etc. This shape is then extruded or cut to add or remove material from the part.
Operation-based features are not sketch-based, and include features such as fillets, chamfers,
shells, applying draft to the faces of a part, etc.
Drawings can be created either from parts or assemblies. Views are automatically generated from
the solid model, and notes, dimensions and tolerances can then be easily added to the drawing as
needed. The drawing module includes most paper sizes and standards (ANSI, ISO, DIN, GOST,
JIS, BSI and SAC).
Fig. 2. Typical SolidWorks environment
MATLAB
MATLAB (matrix laboratory) is a multi-paradigm numerical
computing environment and fourth-generation programming language.
Developed by MathWorks, MATLAB allows matrix manipulations,
plotting of functions and data, implementation of algorithms, creation
of user interfaces, and interfacing with programs written in other
languages, including C, C++, Java,Fortran and Python.
Although MATLAB is intended primarily for numerical computing, an
optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic
computing capabilities. An additional package, Simulink, adds graphical multi-domain simulation
and Model-Based Design for dynamic and embedded systems.
Structures
MATLAB has structure data types. Since all variables in MATLAB are arrays, a more adequate
name is "structure array", where each element of the array has the same field names. In addition,
MATLAB supports dynamic field names (field look-ups by name, field manipulations, etc.).
Function handles
MATLAB supports elements of lambda calculus by introducing function handles, or function
references, which are implemented either in .m files or anonymous /nested functions.
Classes
Although MATLAB has classes, the syntax and calling conventions are significantly different
from other languages. MATLAB has value classes and reference classes, depending on whether
the class has handle as a super-class (for reference classes) or not (for value classes).
MATLAB can call functions and subroutines written in the C programming language or Fortran.
A wrapper function is created allowing MATLAB data types to be passed and returned. The
dynamically loadable object files created by compiling such functions are termed "MEX-files" (for
MATLAB executable).
Libraries written in Perl, Java, ActiveX or .NET can be directly called from MATLAB, and many
MATLAB libraries (for example XML or SQL support) are implemented as wrappers around Java
or ActiveX libraries. Calling MATLAB from Java is more complicated, but can be done with a
MATLAB toolbox which is sold separately by MathWorks, or using an undocumented mechanism
called JMI (Java-to-MATLAB Interface), which should not be confused with the unrelated Java
Metadata Interface that is also called JMI).
As alternatives to the MuPAD based Symbolic Math Toolbox available from MathWorks,
MATLAB can be connected to Maple or Mathematica. Libraries also exist to import and export
MathML.
3.0 Analysis
3.1 Building the assembly
An assembly is a collection of parts and subassemblies that shows how parts fit together to
create the final product. All parts are positioned in an assembly with respect to each other using
mates. Mates are parametric (analog to sketch) relations used to control the degrees of freedom of
assembly components. Just as sketch relations define conditions such as tangency, parallelism, and
concentricity with respect to sketch geometry, assembly mates define equivalent relations with
respect to the individual parts or components, allowing the easy construction of assemblies.
In our our study here, we are essentially designing a pre-modelled internal combustion
engine for its optimum factor of safety. Using pre-modelled components in SolidWorks, we will
build the engine assembly and constrain it to perform a motion study for specified rotation speed.
The available models of engine components and built assembly are as shown in pictures
below.
Fig. 3. Available components of piston – crank assembly
Fig. 4. Piston – crank assembly for motion study
3.2 Motion Analysis
Constraining the assembly
To perform a motion study, we will need to constrain the assembly as a four bar linkage
with crankrod as the driver link. This can be achieved by rigidly mating the crankrod with the
crankshaft and mating the components’ end faces as desired. Further, the direction of crankshaft
rotation will be set as desired by selecting its cylindrical face when performing the motion study
in SolidWorks.
Parameters for Motion Study in SolidWorks
Motion studies are graphical simulations of motion for assembly models. They simulate
and animate the motion you prescribe for a model. You can use SolidWorks mates to restrict the
motion of components in an assembly when you model motion. SolidWorks motion analysis uses
the assembly mates along with part contacts and a robust physics-based solver to accurately
determine the physical movements of an assembly under load. With the assembly motion and
forces calculated, a structural analysis of the components can be performed to ensure product
performance.
Motion Analysis Overview
There are two types of motion analysis, kinematic and dynamic:
 Kinematic analysis studies how your design moves due to forces and motions drivers
applied to the assembly. The key results of interest are the assembly range of motion and
determining part displacements, velocities, and accelerations.
 Dynamic motion analysis evaluates the forces generated by movement, as well as the
movement itself.
Motion analysis can be solved using two different solution paradigms, time based motion and
event based motion:
 In a time-based analysis, external actions occur at a pre-set time irrespective of the
assembly motion.
 In an event based motion analysis, the motion of the assembly triggers the external action.
From a motion study, the Motion Manager can be used to create simulations of various
complexities. It is a timeline-based interface that includes the following motion study tools:
 Animation
 Basic Motion and
 Motion Analysis
The first two options are always available in SolidWorks. SolidWorks Motion is an add‐in
program, and must be activated before it can be used.
Animation (available in core SolidWorks)
Animation allows the simulation of the motion when virtual motors are applied to drive one or
more of the components at specified velocities. We can use Animation to animate the motion of
assemblies. Animation uses interpolation to define the motion of assembly components between
key points.
Basic Motion (available in core SolidWorks)
Basic Motion allows the addition of gravity and springs, as well as contact between components
to the model. We can use Basic Motion for approximating the effects of motors, springs, contact,
and gravity on assemblies. Basic Motion takes mass into account in calculating motion. Its
computation is relatively fast, so we can use this for creating presentation-worthy animations using
physics-based simulations.
Motion Analysis (available with the SolidWorks Motion add-in to SolidWorks)
Motion Analysis (SolidWorks Motion) allows for the calculation of velocities, accelerations, and
forces for components during the motion. It also allows for forces to be applied to the model. We
can use Motion Analysis for accurately simulating and analyzing the effects of motion elements
(including forces, springs, dampers, and friction ) on an assembly. Motion Analysis uses
computationally strong kinematic solvers, and accounts for material properties as well as mass and
inertia in the computations. We can also use Motion Analysis to plot simulation results for further
analysis.
In our study, to get the forces/torques as a function of engine rotation, we will perform the motion
simulation using ‘Motion Analysis’ tool from the ‘Motion Manager’. Accordingly, we will follow
the steps below:
1. Click on the “Motion Study 1” tab near
the lower left corner, which opens the
MotionManager across the lower portion of
screen.
2. From the main menu, select Tools: Add‐
Ins. Click the check box to the left of
SolidWorks Motion.
3. Select Motion Analysis from the
simulation options pull‐down menu.
4. Select the Motor icon. In the
PropertyManager, set the velocity to 2000
rpm. Click on the cylindrical face of the
Crank shast to apply the motor, and click the
checkmark.
5. Click and drag the simulation key from
the default five seconds to one second
(0:00:01). Since we set the motor’s velocity
to 60 rpm, a one‐ second simulation will
include one full revolution of the Crank.
6. Click the Motion Study Properties
Tool. Under the Motion Analysis tab, set
the number of frames to 100 (frames per
second), and click the check mark. This
setting will produce a smooth simulation.
Choose SolidWorks Motion from the pull‐
down menu, and press the Calculator icon to
run the simulation.
7. Click the Results and Plots Tools. In the PropertyManager, set the type of the result to
Displacement/ Velocity/Acceleration: Trace Path. Click on the edge of the open hole of the
Connector. Play back the simulation to see the open hole’s path over the full revolution of the
Crank
Fig 5. Displacement analysis from SolidWorks
Fig. 6 Velocity analysis from SolidWorks
Fig. 7 Acceleration analysis from SolidWorks
Fig 8. Force Analysis from SolidWorks
Verifying the results with MATLAB
MATLAB, as described earlier, is a numerical computing environment and programing
language that allows mathematical operations like matrix manipulations and plotting
of functions and data The results of Motion Study performed in SolidWorks can be verified by
calculating the position, velocity, accleration and forces using MATLAB. A typical program
written in the language syntax to facilitate this is as shown below. The input parameters to calculate
the values can be either defined in MATLAB or received from Solidworks using a corresponding
program.
------------------------------------------Defining input parameters-----------------------------------------
m2 = 3.254/386;%crank mass
m3 = 0.751/386;%conn rod mass
mpiston=1.11/386;%piston mass
J2 = 15.198/386;% crank inertia
J3 = 7.489/386;% conn inertia
r2 = 3.150;%crank length
r2cg = -.1;%crank cg length
r3 = 8.268;%conn length
r3cg = 2.316%conn cg length
AV2 = 1000;%crank rpm
w2 = (2*pi)*(AV2/60);%crank rad/sec
%angular acc of crank is zero
alpha2=0;
ang2=0*ones(360,1);
%no gas force for now
gasforce=0*ones(360,1);
force=0*ones(360,8);
---------------------------------------------------MATLAB Analysis-----------------------------------------
for i = 1:360%.01
ang2(i)= 2*pi/360*(i-1);
%---------------------------------------------------------------------
%position analysis
ang3(i) = asin(((-r2 * sin(ang2(i)))/ r3));
ra(i) = r2 * cos(ang2(i)) + r3 * cos(ang3(i));
%---------------------------------------------------------------------
%velocity analysis
w3(i) = (-r2 * w2 * cos(ang2(i)))/(r3 * cos(ang3(i)));
va(i)=-r2*w2*sin(ang2(i))-r3*w3(i)*sin(ang3(i));
%---------------------------------------------------------------------
%acceleration analysis
alpha3(i)=(r2*w2^2*sin(ang2(i))+r3*w3(i)^2*sin(ang3(i)))/(r3*cos(ang3(i)));
Apiston(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3.*cos(ang3(i))+r3*alpha3(i)*sin(ang3(i)));
%---------------------------------------------------------------------
%cg analysis for links 2 and 3
r2cgx(i)= r2cg*cos(ang2(i));
r2cgy(i)= r2cg*sin(ang2(i));
v2cgx(i)=-w2*r2cg*sin(ang2(i));
v2cgy(i)= w2*r2cg*cos(ang2(i));
a2cgx(i)=-w2^2*r2cg*cos(ang2(i));
a2cgy(i)=-w2^2*r2cg*sin(ang2(i));
r3cgx(i)=r3cg*cos(ang3(i))+r2*cos(ang2(i));
r3cgy(i)=r3cg*sin(ang3(i))+r2*sin(ang2(i));
v3cgx(i)=-w2*r2*sin(ang2(i))-w3(i)*r3cg*sin(ang3(i));
v3cgy(i)=w2*r2*cos(ang2(i))+w3(i)*r3cg*cos(ang3(i));
a3cgx(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3cg*cos(ang3(i))+r3cg*alpha3(i)*sin(ang3(i)));
a3cgy(i)=-w2^2*r2*sin(ang2(i))-w3(i)^2*r3cg*sin(ang3(i))+r3cg*alpha3(i)*cos(ang3(i));
%set up r matrix
rmatrix(1,1)=1;
rmatrix(1,3)=-1;
rmatrix(2,2)=1;
rmatrix(2,4)=-1;
rmatrix(3,3)=r2*sin(ang2(i));
rmatrix(3,4)=-r2*cos(ang2(i));
rmatrix(3,8)=1;
rmatrix(4,3)=1;
rmatrix(4,5)=-1;
rmatrix(5,4)=1;
rmatrix(5,6)=-1;
rmatrix(6,5)=r3*sin(ang3(i));
rmatrix(6,6)=-r3*cos(ang3(i));
rmatrix(7,5)=1;
rmatrix(8,6)=1;
rmatrix(8,7)=1;
%set up b matrix
bmatrix(1)=m2*a2cgx(i);
bmatrix(2)=m2*a2cgy(i);
bmatrix(3)=J2*alpha2+r2cgx(i)*m2.*a2cgy(i)-r2cgy(i)*m2.*a2cgx(i);
bmatrix(4)=m3*a3cgx(i);
bmatrix(5)=m3*a3cgy(i);
bmatrix(6)=J3*alpha3(i)+r3cgx(i)*m3.*a3cgy(i)-r3cgy(i)*m3.*a3cgx(i);
bmatrix(7)=mpiston*Apiston(i)+gasforce(i);
bmatrix(8)=0;
%calc force matrix
% F12X F12Y F23X F23Y F34X F34Y F14Y TORQUE
fmatrix=inv(rmatrix)*transpose(bmatrix);
force(i,1:8)=fmatrix;
end
%example plots
%plot(ang2,force(:,1))
%grid on
plot(force(:,1), force(:,2)+force(:,7))
grid on
title('Shaking forces on engine block')
xlabel('Forcex (N)')
ylabel('Forcey (N)')
%finished
------------------------------------------------Program End---------------------------------------------------
Executing the above program in MATLAB produces results shown below.
Fig. 9 Force analysis from MATLAB
3.3 Importing information to perform Stress Analysis
Linear stress analysis with SolidWorks Simulation enables designers and engineers to
quickly and efficiently validate quality, performance, and safety - all while creating their design.
With SolidWorks Simulation added in, we can perform stress, factor of safety, or deformation
analysis of components without setting up loads and boundary conditions. The required loads are
obtained automatically from a calculated Motion Analysis study. We can use the stress analysis
results to display the effects of motion loads on deformations and stresses for one or more
components. We can calculate results for isolated times and time ranges. The stress analysis results
do not change the motion study results.
Linear stress analysis calculates the stresses and deformations of geometry given three basic
assumptions:
1. The part or assembly under load deforms with small rotations and displacements
2. The product loading is static (ignores inertia) and constant over time
3. The material has a constant stress strain relationship (Hooke’s law)
SOLIDWORKS Simulation uses finite element analysis (FEA) methods to discretize
design components into solid, shell, or beam elements and uses linear stress analysis to determine
the response of parts and assemblies due to the effect of:
 Forces
 Pressures
 Accelerations
 Temperatures
 Contact between components
In order to carry out stress analysis, component material data must be known. The standard
SolidWorks CAD material database is pre-populated with materials that can be used by
SolidWorks Simulation, and the database is easily customizable to include your particular material
requirements.
To set up stress analysis on one or more components:
1. Click Simulation Setup (MotionManager toolbar).
2. In the graphics area, select a component on which to perform the stress analysis.
The component is listed under Selection in the PropertyManager.
3. Enter the Start Time and End Time for the analysis.
 To enter an isolated time value, enter the same value for Start Time and End Time.
 You can also select time values from the MotionManager timeline.
4. Click Add Time.
The time range is listed in the PropertyManager.
5. Repeat Steps 3 - 4 to compute stress analysis on other time intervals.
Click Advanced to modify the mesh density used in the stress analysis calculation for the selected
part.
Stress analysis computes stress, deformation, and factor of safety results for a component by
discretizing component geometry into a mesh of points at which to compute values.
The mesh density is represented by a scaling factor that is applied to a default computed mesh size.
The scaling factor ranges from 2.0, coarsest, to 5.0, finest. A finer mesh density gives more
accuracy in the simulation results, but requires more computation time. When setting up stress
analysis results, you can modify the mesh density and check that the density does not produce
errors.
To modify and check the mesh density in the Simulation Setup PropertyManager:
a. Click Advanced and hover over the slider to view the current mesh density.
b. Drag the slider from Course to Fine to modify the mesh density.
c. Click Check Mesh to make certain that the new mesh density does not produce errors.
The number of time steps used in the mesh density calculation depends on your Frames per
second setting in the Motion Study Properties PropertyManager.
A progress dialog appears, indicating the computed time steps.
6. Do one:
 Click OK to close the PropertyManager
 Click Keep Visible before clicking OK to set up stress analysis for other
components
To calculate stress analysis results on selected components, click Calculate Simulation Results
.
To display stress analysis results click a plot type (Motion Manager Toolbar) to display:
 Stress Plot
 Deformation Plot
 Factor of Safety Plot
Fig. Static Stress analysis of connecting rod before balancing
3.4 Balancing for acceptable shaking forces
3.5 Static Study of connecting rod after balancing
Fig. Static stress analysis of connecting rod after balancing
3.6 Valve Train Assembly
4.0 Automation
One of the first things we use as a SolidWorks user are parameters. That's why the software
is called "parametric". Design tables are a great way to use Microsoft Excel's spreadsheet
functionality to drive these parameters. In order to enable the user to modify an existing component
in SolidWorks through an Excel Spreadsheet that holds all the part information including
dimensions,
4.1 Updating crank pin diameter through Excel
The easiest things to control through the API are dimension values. The VBA code to
modify the crank pin diameter of the engine through an Excel Spreadsheet is as shown below.
---------------------------------------------------------------------------------------------------------------------
Set swApp = CreateObject("sldworks.application")
Set swmodel = swApp.ActiveDoc
swmodel.Parameter("D_Cpin@Sketch4@Crankshaft.swmodel").SystemValue = _
Excel.Range("A2") * 0.0254
swmodel.EditRebuild
---------------------------------------------------------------------------------------------------------------------
4.2 Creating part properties: DESCRIPTION, PARTNO, MATERIAL, WEIGHT, COST,
and allowing the user to alter them from Excel
Sub main1()
Set swApp = CreateObject("sldworks.application")
swApp.Visible = True
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name
(*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
Selects the crank shaft diameter defined in
Sketch4 of the model in SolidWorks and sets
its value to that provided in the cell “A2” in
the Excel Spreadsheet.
swApp.OpenDoc fileName, 1
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
If fileName = "Connecting Rod" Then
With Range("e4").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Sheet1!E7:E12"
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Dim MyProp(1, 4) As String
'Property names
MyProp(0, 0) = "Description"
MyProp(0, 1) = "PartNo"
MyProp(0, 2) = "Material"
MyProp(0, 3) = "Weight"
MyProp(0, 4) = "Cost"
'Property values
MyProp(1, 0) = [c4].value
MyProp(1, 1) = [d4].value
MyProp(1, 2) = [e4].value
MyProp(1, 3) = [f4].value
MyProp(1, 4) = [g4].value
Dim m As Integer
For m = 0 To 4
retVal = Part.AddCustomInfo3("Default", MyProp(0, m), 30, _
MyProp(1, m))
Next m
Else
With Range("e5").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Sheet1!E7:E12"
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
'Property names
MyProp(0, 0) = "Description"
MyProp(0, 1) = "PartNo"
MyProp(0, 2) = "Material"
MyProp(0, 3) = "Weight"
MyProp(0, 4) = "Cost"
'Property values
MyProp(1, 0) = [c5].value
MyProp(1, 1) = [d5].value
MyProp(1, 2) = [e5].value
MyProp(1, 3) = [f5].value
MyProp(1, 4) = [g5].value
For m = 0 To 4
retVal = Part.AddCustomInfo3("Single", MyProp(0, m), 30, _
MyProp(1, m))
Next m
End If
End Sub
4.3 Running an existing Motion Study
------------------------------------------------------------------------------------------------------------------------------------------
Sub main2()
Set swApp = CreateObject("sldworks.application")
swApp.Visible = True
'Loading Motion Add-in on start up
addin = swApp.LoadAddIn(address)
'asking for file location
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name
(*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
swApp.OpenDoc fileName, 2
Set swmodel = swApp.ActiveDoc
'accessing motion study manager
Set swModelExt = swmodel.Extension
boolstatus = swmodel.EditRebuild3()
Set motionStudyMgr = swModelExt.GetMotionStudyManager()
Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1")
boolstatus = myMotionStudy.Calculate()
Accesses the Motion Study Manger
Sets the Motion Study name as
“Motion Study 1”
End Sub
---------------------------------------------------------------------------------------------------------------------
4.4 Running an existing Static Stress Study
------------------------------------------------------------------------------------------------------------------------------------------
Set CWMesh = Study.Mesh
CWMesh.Quality = 1
Call CWMesh.GetDefaultElementSizeAndTolerance(0, el, tl)
errCode = Study.CreateMesh(0, el, tl)
errCode = Study.RunAnalysis
---------------------------------------------------------------------------------------------------------------------
4.5 Retrieving Max and Min Factor of Safety of connecting rod from SolidWorks to Excel
---------------------------------------------------------------------------------------------------------------------
Set CWResult = Study.Results
FOS = CWResult.GetMinMaxFactorOfSafety(True, Nothing, 4, 4, 0)
Range("K4").FormulaArray = FOS
---------------------------------------------------------------------------------------------------------------------
4.6 Retrieving Max Von Mises Stress in connecting rod from SolidWorks to Excel
Set CWResult = Study.Results
conrodstress = CWResult.GetMinMaxStress(9, 0, 1, Nothing, 0, errCode)
Range("M4:N4").FormulaArray = conrodstress
---------------------------------------------------------------------------------------------------------------------
Conclusion
 We have optimized the engine using specific values.
 We have used software's like solid works, mat lab and VBA to analyze our model.
 Done automation of the system and completed the loop.
 Reduced the shaking forces by adding balancing masses
 FOS comes out to be under permissible limits.
Appendix A
VBA code for changing mass properties
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Filter As String
Dim fileName As String
Dim fileConfig As String
Dim fileDispName As String
Dim fileOptions As Long
Sub main1()
Set swApp = CreateObject("sldworks.application")
swApp.Visible = True
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name
(*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
swApp.OpenDoc fileName, 1
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
If fileName = "Connecting Rod" Then
With Range("e4").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Sheet1!E7:E12"
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
Dim MyProp(1, 4) As String
'Property names
MyProp(0, 0) = "Description"
MyProp(0, 1) = "PartNo"
MyProp(0, 2) = "Material"
MyProp(0, 3) = "Weight"
MyProp(0, 4) = "Cost"
'Property values
MyProp(1, 0) = [c4].value
MyProp(1, 1) = [d4].value
MyProp(1, 2) = [e4].value
MyProp(1, 3) = [f4].value
MyProp(1, 4) = [g4].value
Dim m As Integer
For m = 0 To 4
retVal = Part.AddCustomInfo3("Default", MyProp(0, m), 30, _
MyProp(1, m))
Next m
Else
With Range("e5").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=Sheet1!E7:E12"
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
'Property names
MyProp(0, 0) = "Description"
MyProp(0, 1) = "PartNo"
MyProp(0, 2) = "Material"
MyProp(0, 3) = "Weight"
MyProp(0, 4) = "Cost"
'Property values
MyProp(1, 0) = [c5].value
MyProp(1, 1) = [d5].value
MyProp(1, 2) = [e5].value
MyProp(1, 3) = [f5].value
MyProp(1, 4) = [g5].value
For m = 0 To 4
retVal = Part.AddCustomInfo3("Single", MyProp(0, m), 30, _
MyProp(1, m))
Next m
End If
End Sub
Appendix B
VBA code for running existing motion study
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelExt As SldWorks.ModelDocExtension
Dim motionStudyMgr As SwMotionStudy.MotionStudyManager
Dim myMotionStudy As SwMotionStudy.MotionStudy
Dim Filter As String
Dim fileName As String
Dim fileConfig As String
Dim fileDispName As String
Dim fileOptions As Long
Dim addin As Long
Const address As String = "C:Program FilesSOLIDWORKS
CorpSOLIDWORKSMotioncmotionsw.dll"
Sub main2()
Set swApp = CreateObject("sldworks.application")
swApp.Visible = True
'Loading Motion Add-in on start up
addin = swApp.LoadAddIn(address)
'asking for file location
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name
(*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
swApp.OpenDoc fileName, 2
Set swModel = swApp.ActiveDoc
'accessing motion study manager
Set swModelExt = swModel.Extension
boolstatus = swModel.EditRebuild3()
Set motionStudyMgr = swModelExt.GetMotionStudyManager()
Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1")
boolstatus = myMotionStudy.Calculate()
End Sub
.
Appendix C
VBA code for running existing stress study and returning
max Von Mises Stress and static F.O.S
Dim el As Double
Dim tl As Double
Dim L2Sy, L3Sy As Double
Dim errCode As Long
Dim FOS() As Variant
Dim conrodstress As Variant
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim CWObject As CosmosWorksLib.CwAddincallback
Dim COSMOS As CosmosWorksLib.CosmosWorks
Dim ActDoc As Object
Dim CosmosWorks As CosmosWorksLib.CosmosWorks
Dim CWMesh As CosmosWorksLib.CWMesh
Dim CWResult As CosmosWorksLib.CWResults
Dim Filter As String
Dim fileName As String
Dim fileConfig As String
Dim fileDispName As String
Dim fileOptions As Long
Dim addin As Long
Const address As String = "C:Program FilesSOLIDWORKS
CorpSOLIDWORKSSimulationcosworks.dll"
Dim swComp As SldWorks.Component2
Dim swCompModel As SldWorks.ModelDoc2
Dim swCompBody As SldWorks.Body2
Dim vMassProps As Variant
Dim nDensity As Double
Dim bRet As Boolean
Sub runSims()
Set swApp = CreateObject("sldworks.application")
swApp.Visible = True
addin = swApp.LoadAddIn(address)
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter
name (*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
swApp.OpenDoc fileName, 1
Set swModel = swApp.ActiveDoc
Set swModelExt = swModel.Extension
' Set swSelMgr = swmodel.SelectionManager
Set CWObject = swApp.GetAddInObject("CosmosWorks.CosmosWorks")
Set CosmosWorks = CWObject.CosmosWorks
Set ActDoc = CosmosWorks.ActiveDoc()
Set StudyMngr = ActDoc.StudyManager()
Set Study = StudyMngr.GetStudy(0)
Set swModel = swApp.ActiveDoc
If fileName = Crankshaft Then
swModel.Parameter("Dia_Cpin@Sketch4@Crankshaft.swmodel").SystemValue = _
Excel.Range("B4") * 0.0254
Else
swModel.Parameter("D1@Sketch2@Crankshaft.swmodel").SystemValue = _
Excel.Range("B4") * 0.0254
End If
swModel.EditRebuild
Set CWMesh = Study.Mesh
CWMesh.Quality = 1
Call CWMesh.GetDefaultElementSizeAndTolerance(0, el, tl)
errCode = Study.CreateMesh(0, el, tl)
errCode = Study.RunAnalysis
Set CWResult = Study.Results
FOS = CWResult.GetMinMaxFactorOfSafety(True, Nothing, 4, 4, 0)
conrodstress = CWResult.GetMinMaxStress(9, 0, 1, Nothing, 0, errCode)
'Sheets("sheet1").Activate
'ActiveSheet.Cells.Clear
Range("K4").FormulaArray = FOS
Range("M4:N4").FormulaArray = conrodstress
swModel.EditRebuild
End Sub
Appendix D
VBA code for returning mass properties
Public Enum swMassPropertiesStatus_e
swMassPropertiesStatus_OK = 0
swMassPropertiesStatus_UnknownError = 1
swMassPropertiesStatus_NoBody = 2
End Enum
Public Enum swUserPreferenceToggle_e
swUpdateMassPropsDuringSave = 30
End Enum
Sub Conrod()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelExt As SldWorks.ModelDocExtension
Dim swAssy As SldWorks.AssemblyDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swComp As SldWorks.Component2
Dim nStatus As Long
Dim vMassProp As Variant
Set swApp = CreateObject("SldWorks.Application")
swApp.Visible = True
Set swModel = swApp.ActiveDoc
Dim Filter As String
Dim fileName As String
Dim fileConfig As String
Dim fileDispName As String
Dim fileOptions As Long
Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter
name (*.fil)|*.fil|All Files (*.*)|*.*|"
fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig,
fileDispName)
If TypeName(fileName) = "Boolean" Then Exit Sub
swApp.OpenDoc fileName, 1
Set swModel = swApp.ActiveDoc
Set swModelExt = swModel.Extension
vMassProp = swModelExt.GetMassProperties(1, nStatus)
Debug.Print "ModelDocExtension::GetMassProperties(" + swModel.GetPathName + ")"
Debug.Print " Status = " & nStatus
Debug.Print ""
If Not IsEmpty(vMassProp) Then
Range("l8").value = vMassProp(5) * 2.2
Range("l10").value = vMassProp(3) * 61023.7
Range("l11").value = vMassProp(4) * 1550
End If
End Sub
Appendix E
MATLAB code for motion and force analysis
------------------------------------------Defining input parameters-----------------------------------------
m2 = 3.254/386;%crank mass
m3 = 0.751/386;%conn rod mass
mpiston=1.11/386;%piston mass
J2 = 15.198/386;% crank inertia
J3 = 7.489/386;% conn inertia
r2 = 3.150;%crank length
r2cg = -.1;%crank cg length
r3 = 8.268;%conn length
r3cg = 2.316%conn cg length
AV2 = 1000;%crank rpm
w2 = (2*pi)*(AV2/60);%crank rad/sec
%angular acc of crank is zero
alpha2=0;
ang2=0*ones(360,1);
%no gas force for now
gasforce=0*ones(360,1);
force=0*ones(360,8);
---------------------------------------------------MATLAB Analysis-----------------------------------------
for i = 1:360%.01
ang2(i)= 2*pi/360*(i-1);
%---------------------------------------------------------------------
%position analysis
ang3(i) = asin(((-r2 * sin(ang2(i)))/ r3));
ra(i) = r2 * cos(ang2(i)) + r3 * cos(ang3(i));
%---------------------------------------------------------------------
%velocity analysis
w3(i) = (-r2 * w2 * cos(ang2(i)))/(r3 * cos(ang3(i)));
va(i)=-r2*w2*sin(ang2(i))-r3*w3(i)*sin(ang3(i));
%---------------------------------------------------------------------
%acceleration analysis
alpha3(i)=(r2*w2^2*sin(ang2(i))+r3*w3(i)^2*sin(ang3(i)))/(r3*cos(ang3(i)));
Apiston(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3.*cos(ang3(i))+r3*alpha3(i)*sin(ang3(i)));
%---------------------------------------------------------------------
%cg analysis for links 2 and 3
r2cgx(i)= r2cg*cos(ang2(i));
r2cgy(i)= r2cg*sin(ang2(i));
v2cgx(i)=-w2*r2cg*sin(ang2(i));
v2cgy(i)= w2*r2cg*cos(ang2(i));
a2cgx(i)=-w2^2*r2cg*cos(ang2(i));
a2cgy(i)=-w2^2*r2cg*sin(ang2(i));
r3cgx(i)=r3cg*cos(ang3(i))+r2*cos(ang2(i));
r3cgy(i)=r3cg*sin(ang3(i))+r2*sin(ang2(i));
v3cgx(i)=-w2*r2*sin(ang2(i))-w3(i)*r3cg*sin(ang3(i));
v3cgy(i)=w2*r2*cos(ang2(i))+w3(i)*r3cg*cos(ang3(i));
a3cgx(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3cg*cos(ang3(i))+r3cg*alpha3(i)*sin(ang3(i)));
a3cgy(i)=-w2^2*r2*sin(ang2(i))-w3(i)^2*r3cg*sin(ang3(i))+r3cg*alpha3(i)*cos(ang3(i));
%set up r matrix
rmatrix(1,1)=1;
rmatrix(1,3)=-1;
rmatrix(2,2)=1;
rmatrix(2,4)=-1;
rmatrix(3,3)=r2*sin(ang2(i));
rmatrix(3,4)=-r2*cos(ang2(i));
rmatrix(3,8)=1;
rmatrix(4,3)=1;
rmatrix(4,5)=-1;
rmatrix(5,4)=1;
rmatrix(5,6)=-1;
rmatrix(6,5)=r3*sin(ang3(i));
rmatrix(6,6)=-r3*cos(ang3(i));
rmatrix(7,5)=1;
rmatrix(8,6)=1;
rmatrix(8,7)=1;
%set up b matrix
bmatrix(1)=m2*a2cgx(i);
bmatrix(2)=m2*a2cgy(i);
bmatrix(3)=J2*alpha2+r2cgx(i)*m2.*a2cgy(i)-r2cgy(i)*m2.*a2cgx(i);
bmatrix(4)=m3*a3cgx(i);
bmatrix(5)=m3*a3cgy(i);
bmatrix(6)=J3*alpha3(i)+r3cgx(i)*m3.*a3cgy(i)-r3cgy(i)*m3.*a3cgx(i);
bmatrix(7)=mpiston*Apiston(i)+gasforce(i);
bmatrix(8)=0;
%calc force matrix
% F12X F12Y F23X F23Y F34X F34Y F14Y TORQUE
fmatrix=inv(rmatrix)*transpose(bmatrix);
force(i,1:8)=fmatrix;
end
%example plots
%plot(ang2,force(:,1))
%grid on
plot(force(:,1), force(:,2)+force(:,7))
grid on
title('Shaking forces on engine block')
xlabel('Forcex (N)')
ylabel('Forcey (N)')
%finished
------------------------------------------------Program End---------------------------------------------------
Appendix F
Hand Calculations
630 project
630 project

More Related Content

What's hot

Mechanical Vibrations all slides
Mechanical Vibrations all slidesMechanical Vibrations all slides
Mechanical Vibrations all slides
Ebrahim Hanash
 

What's hot (20)

Strength of materials by A.Vinoth Jebaraj
Strength of materials by A.Vinoth JebarajStrength of materials by A.Vinoth Jebaraj
Strength of materials by A.Vinoth Jebaraj
 
Structures and Materials- Section 6 Axially Loaded Structural Members
Structures and Materials- Section 6 Axially Loaded Structural MembersStructures and Materials- Section 6 Axially Loaded Structural Members
Structures and Materials- Section 6 Axially Loaded Structural Members
 
Strength of Materials
Strength of MaterialsStrength of Materials
Strength of Materials
 
Theories of Failure
Theories of FailureTheories of Failure
Theories of Failure
 
Mechanical Vibrations all slides
Mechanical Vibrations all slidesMechanical Vibrations all slides
Mechanical Vibrations all slides
 
ASTM E8-E8M
ASTM E8-E8MASTM E8-E8M
ASTM E8-E8M
 
Static Force Analysis
Static Force AnalysisStatic Force Analysis
Static Force Analysis
 
Approximate Methods
Approximate MethodsApproximate Methods
Approximate Methods
 
Kinematic Synthesis
Kinematic SynthesisKinematic Synthesis
Kinematic Synthesis
 
Mechanics Of Solids- Stress Transformation in 3D
Mechanics Of Solids- Stress Transformation in 3DMechanics Of Solids- Stress Transformation in 3D
Mechanics Of Solids- Stress Transformation in 3D
 
Finite Element Analysis - UNIT-4
Finite Element Analysis - UNIT-4Finite Element Analysis - UNIT-4
Finite Element Analysis - UNIT-4
 
mechanics of solid
mechanics of solidmechanics of solid
mechanics of solid
 
Fatigue Failure Slides
Fatigue Failure SlidesFatigue Failure Slides
Fatigue Failure Slides
 
ME6603 - FINITE ELEMENT ANALYSIS
ME6603 - FINITE ELEMENT ANALYSIS ME6603 - FINITE ELEMENT ANALYSIS
ME6603 - FINITE ELEMENT ANALYSIS
 
Design against fluctuating load
Design against fluctuating loadDesign against fluctuating load
Design against fluctuating load
 
Vibration Isolation and Base Excitation
Vibration Isolation and Base ExcitationVibration Isolation and Base Excitation
Vibration Isolation and Base Excitation
 
sliding and rolling contact bearings
sliding and rolling contact bearingssliding and rolling contact bearings
sliding and rolling contact bearings
 
Failure Theories - Static Loads
Failure Theories - Static LoadsFailure Theories - Static Loads
Failure Theories - Static Loads
 
Finite Element Analysis - UNIT-1
Finite Element Analysis - UNIT-1Finite Element Analysis - UNIT-1
Finite Element Analysis - UNIT-1
 
Unit 4 Forced Vibration
Unit 4 Forced VibrationUnit 4 Forced Vibration
Unit 4 Forced Vibration
 

Similar to 630 project

Dd3210971099
Dd3210971099Dd3210971099
Dd3210971099
IJMER
 
Paper id 242014124
Paper id 242014124Paper id 242014124
Paper id 242014124
IJRAT
 
Design evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobileDesign evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobile
eSAT Journals
 
Design evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobileDesign evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobile
eSAT Publishing House
 
Thermo coupled stress analysis of exhaust manifold assemblage using abaqus
Thermo coupled stress analysis of exhaust manifold assemblage using abaqusThermo coupled stress analysis of exhaust manifold assemblage using abaqus
Thermo coupled stress analysis of exhaust manifold assemblage using abaqus
INFOGAIN PUBLICATION
 
Mbd 05 analysis of drive system for powder compation_sci_tech
Mbd 05 analysis of drive system for powder compation_sci_techMbd 05 analysis of drive system for powder compation_sci_tech
Mbd 05 analysis of drive system for powder compation_sci_tech
Anand Kumar Chinni
 

Similar to 630 project (20)

Dd3210971099
Dd3210971099Dd3210971099
Dd3210971099
 
Gs3311771183
Gs3311771183Gs3311771183
Gs3311771183
 
Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)Welcome to International Journal of Engineering Research and Development (IJERD)
Welcome to International Journal of Engineering Research and Development (IJERD)
 
PORTFOLIO_MJ
PORTFOLIO_MJPORTFOLIO_MJ
PORTFOLIO_MJ
 
jana_resume1.wiz
jana_resume1.wizjana_resume1.wiz
jana_resume1.wiz
 
C012551318
C012551318C012551318
C012551318
 
IRJET- Design Analysis & Optimization of Two Wheeler Handlebar
IRJET- Design Analysis & Optimization of Two Wheeler HandlebarIRJET- Design Analysis & Optimization of Two Wheeler Handlebar
IRJET- Design Analysis & Optimization of Two Wheeler Handlebar
 
G012534551
G012534551G012534551
G012534551
 
IRJET-Design Analysis & Optimization of two Wheeler Handlebar
IRJET-Design Analysis & Optimization of two Wheeler HandlebarIRJET-Design Analysis & Optimization of two Wheeler Handlebar
IRJET-Design Analysis & Optimization of two Wheeler Handlebar
 
OptimizedCranktrainDesignSupportedbyCAE (1).pdf
OptimizedCranktrainDesignSupportedbyCAE (1).pdfOptimizedCranktrainDesignSupportedbyCAE (1).pdf
OptimizedCranktrainDesignSupportedbyCAE (1).pdf
 
IRJET- Design, Analysis and Optimisation of Shock Absorber
IRJET- Design, Analysis and Optimisation of Shock AbsorberIRJET- Design, Analysis and Optimisation of Shock Absorber
IRJET- Design, Analysis and Optimisation of Shock Absorber
 
Af36188193
Af36188193Af36188193
Af36188193
 
Paper id 242014124
Paper id 242014124Paper id 242014124
Paper id 242014124
 
Design evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobileDesign evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobile
 
Design evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobileDesign evaluation and optimization of steering yoke of an automobile
Design evaluation and optimization of steering yoke of an automobile
 
Thermo coupled stress analysis of exhaust manifold assemblage using abaqus
Thermo coupled stress analysis of exhaust manifold assemblage using abaqusThermo coupled stress analysis of exhaust manifold assemblage using abaqus
Thermo coupled stress analysis of exhaust manifold assemblage using abaqus
 
Finite Element Based Analysis of Rotating Robot Pedestal
Finite Element Based Analysis of Rotating Robot PedestalFinite Element Based Analysis of Rotating Robot Pedestal
Finite Element Based Analysis of Rotating Robot Pedestal
 
Motion_Sim_and_FEA
Motion_Sim_and_FEAMotion_Sim_and_FEA
Motion_Sim_and_FEA
 
Mbd 05 analysis of drive system for powder compation_sci_tech
Mbd 05 analysis of drive system for powder compation_sci_techMbd 05 analysis of drive system for powder compation_sci_tech
Mbd 05 analysis of drive system for powder compation_sci_tech
 
Automotive Control Module under Various loading Failure mode analysis
Automotive Control Module under Various loading Failure mode analysisAutomotive Control Module under Various loading Failure mode analysis
Automotive Control Module under Various loading Failure mode analysis
 

More from Siddhesh Sawant (15)

ME 630 Final
ME 630 FinalME 630 Final
ME 630 Final
 
ME 515 Design Project
ME 515 Design ProjectME 515 Design Project
ME 515 Design Project
 
Paper Journal_Final
Paper Journal_FinalPaper Journal_Final
Paper Journal_Final
 
project ppt
project pptproject ppt
project ppt
 
Project2Report.docx
Project2Report.docxProject2Report.docx
Project2Report.docx
 
Project1
Project1Project1
Project1
 
Tension Lab Report editting
Tension Lab Report edittingTension Lab Report editting
Tension Lab Report editting
 
Stress Concentration Lab
Stress Concentration LabStress Concentration Lab
Stress Concentration Lab
 
MSE527LImpact (Editted)
MSE527LImpact (Editted)MSE527LImpact (Editted)
MSE527LImpact (Editted)
 
Fracture Toughness Lab
Fracture Toughness LabFracture Toughness Lab
Fracture Toughness Lab
 
SID Report
SID ReportSID Report
SID Report
 
ME 485
ME 485ME 485
ME 485
 
SiddheshCorrosion
SiddheshCorrosionSiddheshCorrosion
SiddheshCorrosion
 
Project 2- Overaging of Al 7075
Project 2-  Overaging of Al 7075Project 2-  Overaging of Al 7075
Project 2- Overaging of Al 7075
 
SidExtracirricular
SidExtracirricularSidExtracirricular
SidExtracirricular
 

630 project

  • 1. “Automated Design of a Single Cylinder Internal Combustion Engine using interlinked analysis and simulation software” Project by: Bhavin Sampat Siddhesh Sawant Dhaval Prajapati Rahul Goregaonkar Gurpreet Singh Sandhu ME 630: Computer Aided Mechanical Design Prof. Stewart Prince California State University, Northridge Spring 2015
  • 2. Abstract An engineering design of any product consists of multiple stages like concept development, planning, designing, modeling, material selection, testing, cost optimization, manufacturing, etc. These processes are governed by many general as well as product specific considerations. One of the prime considerations is of the product safety. It is vital to test the product for its performance under various stresses it is probable to be subjected to, in its work environment. Often there are several modifications required to be made in the design due to possibilities of failure realized during testing. Computer aided design makes it easier and convenient to apply these modifications and recheck the product’s performance. The purpose of this study is to develop an interface for design engineers that interlinks organizational applications like Microsoft Excel, design application like Solidworks and analytical application like MATLAB, to enable the user to alter product features and study the effects of these changes on the product’s performance automatically. In our study here, we will design a single cylinder internal combustion engine, specifically its connecting rod and crankshaft using a Visual Basic Application (VBA) code that connects these software. The VBA code will essentially enable the user to make changes in the product model designed in Solidworks by merely editing the model information stored in a Microsoft Excel spreadsheet. Not only will it modify the existing Solidworks model with the edited features in Excel, but also automate the Solidworks to run an existing motion study on the modified model. In addition, the VBA code will execute a MATLAB program that calculates and generates plots for position, velocity and acceleration as a function of engine rotation, to compare with those obtained from motion study in Solidworks. It will also calculate and return various forces acting on the components throughout a motion cycle and enable the user to run a static analysis on the model to determine a factor of safety. In the overall study, we will: (1) Design a single cylinder internal combustion engine, specifically the connecting rod and crankshaft in such a way that their main features are easily manipulated, (2) Perform a motion study on the assembly to yield force and motion information, (3) Perform a stress simulation study in order to properly size components based on a desired, factor of safety (4) Automate the process.
  • 3. 1.0 Task Description The illustration above depicts a single cylinder internal combustion engine (see included assembly model). The main parts to be analyzed are: (1) engine block (2) crankshaft, (3) connecting rod, (4) piston and (5) head assembly. The assembly can be modeled as a four bar slider crank mechanism/machine. As the crankshaft rotates, the piston reciprocates, and the connecting rod connects the two together. While the connecting rod is actually an assembly of its own, consisting of the rod, endcap, bearings, and fasteners, it is treated as a single part here. The block acts as the ground link. It is assumed the crankshaft rotates at constant angular velocity while the piston is subjected to gas forces via cylinder pressure due to combustion, and that a constant speed torque generator is attached to the left hand side of the crankshaft in order to create the constant speed. Normally, the internal combustion engine components are sized based on static analysis of components when subjected to the gas force. However, such analysis may lead to under-sizing of components because inertia forces and torques may be significant at higher speeds and fatigue may also be a factor. The valve train cam rotates at ½ the speed of the crankshaft, and can be modeled as a gear driven system with a gear mate. The cylinder head, valves (intake and exhaust), and return springs must be modeled and analyzed as well.
  • 4. 1.1Analysis Tasks 1. Constrain the mechanism and design (prelim) the conrod. 2. Perform a motion simulation at 2000 rpm, with gas force neglected to get forces/torques as a function of engine rotation. Verify your work with a Matlab simulation and compare position, velocity, acceleration, forces between Motion and Matlab. 3. Import the necessary information into Simulation to perform a stress analysis study, multiple frame, to redesign the conrod and crankshaft (static analysis), static FOS of 2.5. 4. Modify the crankshaft balance weights to reduce the shaking forces to an “acceptable” level. 5. Re-analyze to verify crank and connrod stresses are still within acceptable level. 6. Continue to iterate until shaking forces and stresses are acceptable. 7. Perform a design study on the conrod to maintain the FOS static to >2.5. 8. Create a realistic cylinder head, modeling the valves/cam and other needed items. Inlet valve diameter taken as 45% of bore, exhaust valve diameter taken as 35% of bore. Lift of both valves to be 25% of valve diameter. Cam profiles must follow proper protocol for opening the intake and exhaust valves based on an assumed timing (research cam timing to find appropriate values). 9. Simulate the entire system and design the valve return springs, and add them to the model. Try to make the entire engine assembly as realistic as possible. Create AVI simulation files to be included with results. 1.2 Automaton Tasks Assuming the assembly exists with both a motion and simulation static study: Write a macro, launched from Excel that: 1. Allows the user to alter the crank pin diameter 2. Creates part properties: DESCRIPTION, PARTNO, MATERIAL, WEIGHT, COST, and allows the user to alter them from Excel 3. Runs an existing motion study 4. Runs an existing static stress study 5. Returns max von mises stress in connrod, FOS in part 6. Returns mass properties of connrod part
  • 5. 2.0 Introduction The focus of our study here is to analyze the design of described internal combustion engine to satisfy the ‘Von Mises Criterion’ and modify the design in case of material failure realized during analysis. Further, we will optimize the design to obtain a suitable factor of safety with minimization of shaking forces. Using computer applications and programing languages, we will automate the processes and create a user friendly interface that enables the user to modify the design easily and simulate the engine performance, to examine the results of these changes. Need for Design Analysis:  To verify the design for safety of the product and its users.  To optimize the overall cost. 2.1 Theory To understand the results obtained in FEA, it is necessary to have the theoretical knowledge of the stresses developed in various loading conditions. Von Mises Criterion for analyzing material safety In an elastic, isotropic body subjected to 3D loads, a complex 3 dimensional system of stresses is developed. At any point there are stresses acting in different directions, and the direction and magnitude of stresses changes from point to point. A German-American applied mathematician, Richard Von Mises found that, in ductile engineering materials, even though no principal stress exceeds the yield stress, it is possible for yielding to result from a combination of stresses. The combined equivalent stress, called the ‘Von Mises Stress’ is compared with the yield strength of the material, setting a universal criterion for its failure. An engineer can say his design will fail, if the maximum value of Von Mises stress induced in the material is more than the yield strength of the material. This criterion is called the ‘Von Mises Criterion’. It is based on the determination of distortion energy in a given material, i.e. energy associated with change in shape of the material as opposed to change in its volume. According to this criterion, a given structural material is safe as long as the maximum value of distortion energy per unit volume in that same material remains smaller than the distortion energy per unit volume required to cause yield in the same material. Distortion energy is the energy required for shape deformation of a material. During pure distortion, the shape of the material changes, but volume does not change. This is illustrated in the figure below. Figure 1: Representation of a pure distortion case
  • 6. Distortion energy required per unit volume, ‘Ud’ for a general 3 dimensional case is given in terms of principal stress values as: Distortion energy for simple tension case at the time of failure is given as: The above 2 quantities can be connected using distortion energy failure theory, so the condition of failure will be as follows. The left hand side of the above equation is denoted as Von Mises stress ‘σv’, given as, So as a failure criterion, the engineer can check whether Von Mises stress induced in the material exceeds yield strength (for ductile material) of the material. The failure condition can be simplified as: Von Mises stress is widely used by designers to check whether their design will withstand a given load condition.
  • 7. 2.2 Computer applications used in our study Visual Basic for Applications (VBA) Visual Basic for Applications (VBA) is an implementation of Microsoft's event-driven programming language, Visual Basic, and its associated integrated development environment (IDE). Visual Basic for Applications enables building user-defined functions (UDFs), automating processes and accessing Windows API and other low-level functionality through dynamic-link libraries (DLLs). It supersedes and expands on the abilities of earlier application- specific macro programming languages such as Word's WordBasic. It can be used to control many aspects of the host application, including manipulating user interface features, such as menus and toolbars, and working with custom user forms or dialog boxes. As its name suggests, VBA is closely related to Visual Basic and uses the Visual Basic Runtime Library, but it can normally only run code within a host application rather than as a standalone program. It can, however, be used to control one application from another via OLE Automation. For example, it is used to automatically create a Word report from Excel data, which are automatically collected by Excel from polled observation sensors. VBA has the ability to use (but not create) (ActiveX/COM) DLLs, and later versions add support for class modules. VBA is built into most Microsoft Office applications, including Office for Mac OS X and other Microsoft applications such as Microsoft MapPoint and Microsoft Visio, as well as being at least partially implemented in other applications such as ArcGIS, AutoCAD, SolidWorks, CATIA, Corel Draw and WordPerfect. Fig. 1. Typical Visual Basic environment
  • 8. SolidWorks SolidWorks is solid modeling CAD (computer-aided design) software that runs on Microsoft Windows. SolidWorks is a solid modeler, and utilizes a parametric feature-based approach to create models and assemblies. The software is written on Parasolid-kernel. Parameters refer to constraints whose values determine the shape or geometry of the model or assembly. Parameters can be either numeric parameters, such as line lengths or circle diameters, or geometric parameters, such as tangent, parallel, concentric, horizontal or vertical, etc. Numeric parameters can be associated with each other through the use of relations, which allows them to capture design intent. Design intent is how the creator of the part wants it to respond to changes and updates. For example, you would want the hole at the top of a beverage can to stay at the top surface, regardless of the height or size of the can. SolidWorks allows the user to specify that the hole is a feature on the top surface, and will then honor their design intent no matter what height they later assign to the can. Features refer to the building blocks of the part. They are the shapes and operations that construct the part. Shape-based features typically begin with a 2D or 3D sketch of shapes such as bosses, holes, slots, etc. This shape is then extruded or cut to add or remove material from the part. Operation-based features are not sketch-based, and include features such as fillets, chamfers, shells, applying draft to the faces of a part, etc. Drawings can be created either from parts or assemblies. Views are automatically generated from the solid model, and notes, dimensions and tolerances can then be easily added to the drawing as needed. The drawing module includes most paper sizes and standards (ANSI, ISO, DIN, GOST, JIS, BSI and SAC). Fig. 2. Typical SolidWorks environment
  • 9. MATLAB MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java,Fortran and Python. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing capabilities. An additional package, Simulink, adds graphical multi-domain simulation and Model-Based Design for dynamic and embedded systems. Structures MATLAB has structure data types. Since all variables in MATLAB are arrays, a more adequate name is "structure array", where each element of the array has the same field names. In addition, MATLAB supports dynamic field names (field look-ups by name, field manipulations, etc.). Function handles MATLAB supports elements of lambda calculus by introducing function handles, or function references, which are implemented either in .m files or anonymous /nested functions. Classes Although MATLAB has classes, the syntax and calling conventions are significantly different from other languages. MATLAB has value classes and reference classes, depending on whether the class has handle as a super-class (for reference classes) or not (for value classes). MATLAB can call functions and subroutines written in the C programming language or Fortran. A wrapper function is created allowing MATLAB data types to be passed and returned. The dynamically loadable object files created by compiling such functions are termed "MEX-files" (for MATLAB executable). Libraries written in Perl, Java, ActiveX or .NET can be directly called from MATLAB, and many MATLAB libraries (for example XML or SQL support) are implemented as wrappers around Java or ActiveX libraries. Calling MATLAB from Java is more complicated, but can be done with a MATLAB toolbox which is sold separately by MathWorks, or using an undocumented mechanism called JMI (Java-to-MATLAB Interface), which should not be confused with the unrelated Java Metadata Interface that is also called JMI). As alternatives to the MuPAD based Symbolic Math Toolbox available from MathWorks, MATLAB can be connected to Maple or Mathematica. Libraries also exist to import and export MathML.
  • 10. 3.0 Analysis 3.1 Building the assembly An assembly is a collection of parts and subassemblies that shows how parts fit together to create the final product. All parts are positioned in an assembly with respect to each other using mates. Mates are parametric (analog to sketch) relations used to control the degrees of freedom of assembly components. Just as sketch relations define conditions such as tangency, parallelism, and concentricity with respect to sketch geometry, assembly mates define equivalent relations with respect to the individual parts or components, allowing the easy construction of assemblies. In our our study here, we are essentially designing a pre-modelled internal combustion engine for its optimum factor of safety. Using pre-modelled components in SolidWorks, we will build the engine assembly and constrain it to perform a motion study for specified rotation speed. The available models of engine components and built assembly are as shown in pictures below. Fig. 3. Available components of piston – crank assembly
  • 11. Fig. 4. Piston – crank assembly for motion study
  • 12. 3.2 Motion Analysis Constraining the assembly To perform a motion study, we will need to constrain the assembly as a four bar linkage with crankrod as the driver link. This can be achieved by rigidly mating the crankrod with the crankshaft and mating the components’ end faces as desired. Further, the direction of crankshaft rotation will be set as desired by selecting its cylindrical face when performing the motion study in SolidWorks. Parameters for Motion Study in SolidWorks Motion studies are graphical simulations of motion for assembly models. They simulate and animate the motion you prescribe for a model. You can use SolidWorks mates to restrict the motion of components in an assembly when you model motion. SolidWorks motion analysis uses the assembly mates along with part contacts and a robust physics-based solver to accurately determine the physical movements of an assembly under load. With the assembly motion and forces calculated, a structural analysis of the components can be performed to ensure product performance. Motion Analysis Overview There are two types of motion analysis, kinematic and dynamic:  Kinematic analysis studies how your design moves due to forces and motions drivers applied to the assembly. The key results of interest are the assembly range of motion and determining part displacements, velocities, and accelerations.  Dynamic motion analysis evaluates the forces generated by movement, as well as the movement itself. Motion analysis can be solved using two different solution paradigms, time based motion and event based motion:  In a time-based analysis, external actions occur at a pre-set time irrespective of the assembly motion.  In an event based motion analysis, the motion of the assembly triggers the external action. From a motion study, the Motion Manager can be used to create simulations of various complexities. It is a timeline-based interface that includes the following motion study tools:  Animation  Basic Motion and  Motion Analysis The first two options are always available in SolidWorks. SolidWorks Motion is an add‐in program, and must be activated before it can be used.
  • 13. Animation (available in core SolidWorks) Animation allows the simulation of the motion when virtual motors are applied to drive one or more of the components at specified velocities. We can use Animation to animate the motion of assemblies. Animation uses interpolation to define the motion of assembly components between key points. Basic Motion (available in core SolidWorks) Basic Motion allows the addition of gravity and springs, as well as contact between components to the model. We can use Basic Motion for approximating the effects of motors, springs, contact, and gravity on assemblies. Basic Motion takes mass into account in calculating motion. Its computation is relatively fast, so we can use this for creating presentation-worthy animations using physics-based simulations. Motion Analysis (available with the SolidWorks Motion add-in to SolidWorks) Motion Analysis (SolidWorks Motion) allows for the calculation of velocities, accelerations, and forces for components during the motion. It also allows for forces to be applied to the model. We can use Motion Analysis for accurately simulating and analyzing the effects of motion elements (including forces, springs, dampers, and friction ) on an assembly. Motion Analysis uses computationally strong kinematic solvers, and accounts for material properties as well as mass and inertia in the computations. We can also use Motion Analysis to plot simulation results for further analysis. In our study, to get the forces/torques as a function of engine rotation, we will perform the motion simulation using ‘Motion Analysis’ tool from the ‘Motion Manager’. Accordingly, we will follow the steps below: 1. Click on the “Motion Study 1” tab near the lower left corner, which opens the MotionManager across the lower portion of screen. 2. From the main menu, select Tools: Add‐ Ins. Click the check box to the left of SolidWorks Motion.
  • 14. 3. Select Motion Analysis from the simulation options pull‐down menu. 4. Select the Motor icon. In the PropertyManager, set the velocity to 2000 rpm. Click on the cylindrical face of the Crank shast to apply the motor, and click the checkmark. 5. Click and drag the simulation key from the default five seconds to one second (0:00:01). Since we set the motor’s velocity to 60 rpm, a one‐ second simulation will include one full revolution of the Crank. 6. Click the Motion Study Properties Tool. Under the Motion Analysis tab, set the number of frames to 100 (frames per second), and click the check mark. This setting will produce a smooth simulation. Choose SolidWorks Motion from the pull‐ down menu, and press the Calculator icon to run the simulation.
  • 15. 7. Click the Results and Plots Tools. In the PropertyManager, set the type of the result to Displacement/ Velocity/Acceleration: Trace Path. Click on the edge of the open hole of the Connector. Play back the simulation to see the open hole’s path over the full revolution of the Crank Fig 5. Displacement analysis from SolidWorks
  • 16. Fig. 6 Velocity analysis from SolidWorks Fig. 7 Acceleration analysis from SolidWorks
  • 17. Fig 8. Force Analysis from SolidWorks
  • 18. Verifying the results with MATLAB MATLAB, as described earlier, is a numerical computing environment and programing language that allows mathematical operations like matrix manipulations and plotting of functions and data The results of Motion Study performed in SolidWorks can be verified by calculating the position, velocity, accleration and forces using MATLAB. A typical program written in the language syntax to facilitate this is as shown below. The input parameters to calculate the values can be either defined in MATLAB or received from Solidworks using a corresponding program. ------------------------------------------Defining input parameters----------------------------------------- m2 = 3.254/386;%crank mass m3 = 0.751/386;%conn rod mass mpiston=1.11/386;%piston mass J2 = 15.198/386;% crank inertia J3 = 7.489/386;% conn inertia r2 = 3.150;%crank length r2cg = -.1;%crank cg length r3 = 8.268;%conn length r3cg = 2.316%conn cg length AV2 = 1000;%crank rpm w2 = (2*pi)*(AV2/60);%crank rad/sec %angular acc of crank is zero alpha2=0; ang2=0*ones(360,1); %no gas force for now gasforce=0*ones(360,1); force=0*ones(360,8); ---------------------------------------------------MATLAB Analysis----------------------------------------- for i = 1:360%.01 ang2(i)= 2*pi/360*(i-1);
  • 19. %--------------------------------------------------------------------- %position analysis ang3(i) = asin(((-r2 * sin(ang2(i)))/ r3)); ra(i) = r2 * cos(ang2(i)) + r3 * cos(ang3(i)); %--------------------------------------------------------------------- %velocity analysis w3(i) = (-r2 * w2 * cos(ang2(i)))/(r3 * cos(ang3(i))); va(i)=-r2*w2*sin(ang2(i))-r3*w3(i)*sin(ang3(i)); %--------------------------------------------------------------------- %acceleration analysis alpha3(i)=(r2*w2^2*sin(ang2(i))+r3*w3(i)^2*sin(ang3(i)))/(r3*cos(ang3(i))); Apiston(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3.*cos(ang3(i))+r3*alpha3(i)*sin(ang3(i))); %--------------------------------------------------------------------- %cg analysis for links 2 and 3 r2cgx(i)= r2cg*cos(ang2(i)); r2cgy(i)= r2cg*sin(ang2(i)); v2cgx(i)=-w2*r2cg*sin(ang2(i)); v2cgy(i)= w2*r2cg*cos(ang2(i)); a2cgx(i)=-w2^2*r2cg*cos(ang2(i)); a2cgy(i)=-w2^2*r2cg*sin(ang2(i)); r3cgx(i)=r3cg*cos(ang3(i))+r2*cos(ang2(i)); r3cgy(i)=r3cg*sin(ang3(i))+r2*sin(ang2(i)); v3cgx(i)=-w2*r2*sin(ang2(i))-w3(i)*r3cg*sin(ang3(i)); v3cgy(i)=w2*r2*cos(ang2(i))+w3(i)*r3cg*cos(ang3(i)); a3cgx(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3cg*cos(ang3(i))+r3cg*alpha3(i)*sin(ang3(i))); a3cgy(i)=-w2^2*r2*sin(ang2(i))-w3(i)^2*r3cg*sin(ang3(i))+r3cg*alpha3(i)*cos(ang3(i)); %set up r matrix rmatrix(1,1)=1;
  • 20. rmatrix(1,3)=-1; rmatrix(2,2)=1; rmatrix(2,4)=-1; rmatrix(3,3)=r2*sin(ang2(i)); rmatrix(3,4)=-r2*cos(ang2(i)); rmatrix(3,8)=1; rmatrix(4,3)=1; rmatrix(4,5)=-1; rmatrix(5,4)=1; rmatrix(5,6)=-1; rmatrix(6,5)=r3*sin(ang3(i)); rmatrix(6,6)=-r3*cos(ang3(i)); rmatrix(7,5)=1; rmatrix(8,6)=1; rmatrix(8,7)=1; %set up b matrix bmatrix(1)=m2*a2cgx(i); bmatrix(2)=m2*a2cgy(i); bmatrix(3)=J2*alpha2+r2cgx(i)*m2.*a2cgy(i)-r2cgy(i)*m2.*a2cgx(i); bmatrix(4)=m3*a3cgx(i); bmatrix(5)=m3*a3cgy(i); bmatrix(6)=J3*alpha3(i)+r3cgx(i)*m3.*a3cgy(i)-r3cgy(i)*m3.*a3cgx(i); bmatrix(7)=mpiston*Apiston(i)+gasforce(i); bmatrix(8)=0; %calc force matrix % F12X F12Y F23X F23Y F34X F34Y F14Y TORQUE fmatrix=inv(rmatrix)*transpose(bmatrix); force(i,1:8)=fmatrix;
  • 21. end %example plots %plot(ang2,force(:,1)) %grid on plot(force(:,1), force(:,2)+force(:,7)) grid on title('Shaking forces on engine block') xlabel('Forcex (N)') ylabel('Forcey (N)') %finished ------------------------------------------------Program End--------------------------------------------------- Executing the above program in MATLAB produces results shown below.
  • 22.
  • 23. Fig. 9 Force analysis from MATLAB
  • 24. 3.3 Importing information to perform Stress Analysis Linear stress analysis with SolidWorks Simulation enables designers and engineers to quickly and efficiently validate quality, performance, and safety - all while creating their design. With SolidWorks Simulation added in, we can perform stress, factor of safety, or deformation analysis of components without setting up loads and boundary conditions. The required loads are obtained automatically from a calculated Motion Analysis study. We can use the stress analysis results to display the effects of motion loads on deformations and stresses for one or more components. We can calculate results for isolated times and time ranges. The stress analysis results do not change the motion study results. Linear stress analysis calculates the stresses and deformations of geometry given three basic assumptions: 1. The part or assembly under load deforms with small rotations and displacements 2. The product loading is static (ignores inertia) and constant over time 3. The material has a constant stress strain relationship (Hooke’s law) SOLIDWORKS Simulation uses finite element analysis (FEA) methods to discretize design components into solid, shell, or beam elements and uses linear stress analysis to determine the response of parts and assemblies due to the effect of:  Forces  Pressures  Accelerations  Temperatures  Contact between components In order to carry out stress analysis, component material data must be known. The standard SolidWorks CAD material database is pre-populated with materials that can be used by SolidWorks Simulation, and the database is easily customizable to include your particular material requirements. To set up stress analysis on one or more components: 1. Click Simulation Setup (MotionManager toolbar). 2. In the graphics area, select a component on which to perform the stress analysis. The component is listed under Selection in the PropertyManager. 3. Enter the Start Time and End Time for the analysis.  To enter an isolated time value, enter the same value for Start Time and End Time.  You can also select time values from the MotionManager timeline.
  • 25. 4. Click Add Time. The time range is listed in the PropertyManager. 5. Repeat Steps 3 - 4 to compute stress analysis on other time intervals. Click Advanced to modify the mesh density used in the stress analysis calculation for the selected part. Stress analysis computes stress, deformation, and factor of safety results for a component by discretizing component geometry into a mesh of points at which to compute values. The mesh density is represented by a scaling factor that is applied to a default computed mesh size. The scaling factor ranges from 2.0, coarsest, to 5.0, finest. A finer mesh density gives more accuracy in the simulation results, but requires more computation time. When setting up stress analysis results, you can modify the mesh density and check that the density does not produce errors. To modify and check the mesh density in the Simulation Setup PropertyManager: a. Click Advanced and hover over the slider to view the current mesh density. b. Drag the slider from Course to Fine to modify the mesh density. c. Click Check Mesh to make certain that the new mesh density does not produce errors. The number of time steps used in the mesh density calculation depends on your Frames per second setting in the Motion Study Properties PropertyManager. A progress dialog appears, indicating the computed time steps. 6. Do one:  Click OK to close the PropertyManager  Click Keep Visible before clicking OK to set up stress analysis for other components To calculate stress analysis results on selected components, click Calculate Simulation Results . To display stress analysis results click a plot type (Motion Manager Toolbar) to display:  Stress Plot  Deformation Plot  Factor of Safety Plot
  • 26. Fig. Static Stress analysis of connecting rod before balancing
  • 27. 3.4 Balancing for acceptable shaking forces
  • 28. 3.5 Static Study of connecting rod after balancing Fig. Static stress analysis of connecting rod after balancing
  • 29. 3.6 Valve Train Assembly
  • 30. 4.0 Automation One of the first things we use as a SolidWorks user are parameters. That's why the software is called "parametric". Design tables are a great way to use Microsoft Excel's spreadsheet functionality to drive these parameters. In order to enable the user to modify an existing component in SolidWorks through an Excel Spreadsheet that holds all the part information including dimensions, 4.1 Updating crank pin diameter through Excel The easiest things to control through the API are dimension values. The VBA code to modify the crank pin diameter of the engine through an Excel Spreadsheet is as shown below. --------------------------------------------------------------------------------------------------------------------- Set swApp = CreateObject("sldworks.application") Set swmodel = swApp.ActiveDoc swmodel.Parameter("D_Cpin@Sketch4@Crankshaft.swmodel").SystemValue = _ Excel.Range("A2") * 0.0254 swmodel.EditRebuild --------------------------------------------------------------------------------------------------------------------- 4.2 Creating part properties: DESCRIPTION, PARTNO, MATERIAL, WEIGHT, COST, and allowing the user to alter them from Excel Sub main1() Set swApp = CreateObject("sldworks.application") swApp.Visible = True Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub Selects the crank shaft diameter defined in Sketch4 of the model in SolidWorks and sets its value to that provided in the cell “A2” in the Excel Spreadsheet.
  • 31. swApp.OpenDoc fileName, 1 Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView If fileName = "Connecting Rod" Then With Range("e4").Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:="=Sheet1!E7:E12" .InCellDropdown = True .ShowInput = True .ShowError = True End With Dim MyProp(1, 4) As String 'Property names MyProp(0, 0) = "Description" MyProp(0, 1) = "PartNo" MyProp(0, 2) = "Material" MyProp(0, 3) = "Weight"
  • 32. MyProp(0, 4) = "Cost" 'Property values MyProp(1, 0) = [c4].value MyProp(1, 1) = [d4].value MyProp(1, 2) = [e4].value MyProp(1, 3) = [f4].value MyProp(1, 4) = [g4].value Dim m As Integer For m = 0 To 4 retVal = Part.AddCustomInfo3("Default", MyProp(0, m), 30, _ MyProp(1, m)) Next m Else With Range("e5").Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:="=Sheet1!E7:E12" .InCellDropdown = True .ShowInput = True
  • 33. .ShowError = True End With 'Property names MyProp(0, 0) = "Description" MyProp(0, 1) = "PartNo" MyProp(0, 2) = "Material" MyProp(0, 3) = "Weight" MyProp(0, 4) = "Cost" 'Property values MyProp(1, 0) = [c5].value MyProp(1, 1) = [d5].value MyProp(1, 2) = [e5].value MyProp(1, 3) = [f5].value MyProp(1, 4) = [g5].value For m = 0 To 4 retVal = Part.AddCustomInfo3("Single", MyProp(0, m), 30, _ MyProp(1, m)) Next m End If End Sub
  • 34. 4.3 Running an existing Motion Study ------------------------------------------------------------------------------------------------------------------------------------------ Sub main2() Set swApp = CreateObject("sldworks.application") swApp.Visible = True 'Loading Motion Add-in on start up addin = swApp.LoadAddIn(address) 'asking for file location Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub swApp.OpenDoc fileName, 2 Set swmodel = swApp.ActiveDoc 'accessing motion study manager Set swModelExt = swmodel.Extension boolstatus = swmodel.EditRebuild3() Set motionStudyMgr = swModelExt.GetMotionStudyManager() Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1") boolstatus = myMotionStudy.Calculate() Accesses the Motion Study Manger Sets the Motion Study name as “Motion Study 1”
  • 35. End Sub --------------------------------------------------------------------------------------------------------------------- 4.4 Running an existing Static Stress Study ------------------------------------------------------------------------------------------------------------------------------------------ Set CWMesh = Study.Mesh CWMesh.Quality = 1 Call CWMesh.GetDefaultElementSizeAndTolerance(0, el, tl) errCode = Study.CreateMesh(0, el, tl) errCode = Study.RunAnalysis --------------------------------------------------------------------------------------------------------------------- 4.5 Retrieving Max and Min Factor of Safety of connecting rod from SolidWorks to Excel --------------------------------------------------------------------------------------------------------------------- Set CWResult = Study.Results FOS = CWResult.GetMinMaxFactorOfSafety(True, Nothing, 4, 4, 0) Range("K4").FormulaArray = FOS --------------------------------------------------------------------------------------------------------------------- 4.6 Retrieving Max Von Mises Stress in connecting rod from SolidWorks to Excel Set CWResult = Study.Results conrodstress = CWResult.GetMinMaxStress(9, 0, 1, Nothing, 0, errCode) Range("M4:N4").FormulaArray = conrodstress ---------------------------------------------------------------------------------------------------------------------
  • 36. Conclusion  We have optimized the engine using specific values.  We have used software's like solid works, mat lab and VBA to analyze our model.  Done automation of the system and completed the loop.  Reduced the shaking forces by adding balancing masses  FOS comes out to be under permissible limits.
  • 37. Appendix A VBA code for changing mass properties Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim Filter As String Dim fileName As String Dim fileConfig As String Dim fileDispName As String Dim fileOptions As Long Sub main1() Set swApp = CreateObject("sldworks.application") swApp.Visible = True Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub swApp.OpenDoc fileName, 1 Set Part = swApp.ActiveDoc Dim myModelView As Object Set myModelView = Part.ActiveView
  • 38. If fileName = "Connecting Rod" Then With Range("e4").Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:="=Sheet1!E7:E12" .InCellDropdown = True .ShowInput = True .ShowError = True End With Dim MyProp(1, 4) As String 'Property names MyProp(0, 0) = "Description" MyProp(0, 1) = "PartNo" MyProp(0, 2) = "Material" MyProp(0, 3) = "Weight" MyProp(0, 4) = "Cost" 'Property values MyProp(1, 0) = [c4].value
  • 39. MyProp(1, 1) = [d4].value MyProp(1, 2) = [e4].value MyProp(1, 3) = [f4].value MyProp(1, 4) = [g4].value Dim m As Integer For m = 0 To 4 retVal = Part.AddCustomInfo3("Default", MyProp(0, m), 30, _ MyProp(1, m)) Next m Else With Range("e5").Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _ Operator:=xlBetween, Formula1:="=Sheet1!E7:E12" .InCellDropdown = True .ShowInput = True .ShowError = True End With 'Property names
  • 40. MyProp(0, 0) = "Description" MyProp(0, 1) = "PartNo" MyProp(0, 2) = "Material" MyProp(0, 3) = "Weight" MyProp(0, 4) = "Cost" 'Property values MyProp(1, 0) = [c5].value MyProp(1, 1) = [d5].value MyProp(1, 2) = [e5].value MyProp(1, 3) = [f5].value MyProp(1, 4) = [g5].value For m = 0 To 4 retVal = Part.AddCustomInfo3("Single", MyProp(0, m), 30, _ MyProp(1, m)) Next m End If End Sub
  • 41. Appendix B VBA code for running existing motion study Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swModelExt As SldWorks.ModelDocExtension Dim motionStudyMgr As SwMotionStudy.MotionStudyManager Dim myMotionStudy As SwMotionStudy.MotionStudy Dim Filter As String Dim fileName As String Dim fileConfig As String Dim fileDispName As String Dim fileOptions As Long Dim addin As Long Const address As String = "C:Program FilesSOLIDWORKS CorpSOLIDWORKSMotioncmotionsw.dll" Sub main2() Set swApp = CreateObject("sldworks.application") swApp.Visible = True 'Loading Motion Add-in on start up addin = swApp.LoadAddIn(address) 'asking for file location
  • 42. Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub swApp.OpenDoc fileName, 2 Set swModel = swApp.ActiveDoc 'accessing motion study manager Set swModelExt = swModel.Extension boolstatus = swModel.EditRebuild3() Set motionStudyMgr = swModelExt.GetMotionStudyManager() Set myMotionStudy = motionStudyMgr.GetMotionStudy("Motion Study 1") boolstatus = myMotionStudy.Calculate() End Sub .
  • 43. Appendix C VBA code for running existing stress study and returning max Von Mises Stress and static F.O.S Dim el As Double Dim tl As Double Dim L2Sy, L3Sy As Double Dim errCode As Long Dim FOS() As Variant Dim conrodstress As Variant Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swModelExt As SldWorks.ModelDocExtension Dim swSelMgr As SldWorks.SelectionMgr Dim CWObject As CosmosWorksLib.CwAddincallback Dim COSMOS As CosmosWorksLib.CosmosWorks Dim ActDoc As Object Dim CosmosWorks As CosmosWorksLib.CosmosWorks Dim CWMesh As CosmosWorksLib.CWMesh Dim CWResult As CosmosWorksLib.CWResults Dim Filter As String Dim fileName As String Dim fileConfig As String
  • 44. Dim fileDispName As String Dim fileOptions As Long Dim addin As Long Const address As String = "C:Program FilesSOLIDWORKS CorpSOLIDWORKSSimulationcosworks.dll" Dim swComp As SldWorks.Component2 Dim swCompModel As SldWorks.ModelDoc2 Dim swCompBody As SldWorks.Body2 Dim vMassProps As Variant Dim nDensity As Double Dim bRet As Boolean Sub runSims() Set swApp = CreateObject("sldworks.application") swApp.Visible = True addin = swApp.LoadAddIn(address) Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub swApp.OpenDoc fileName, 1
  • 45. Set swModel = swApp.ActiveDoc Set swModelExt = swModel.Extension ' Set swSelMgr = swmodel.SelectionManager Set CWObject = swApp.GetAddInObject("CosmosWorks.CosmosWorks") Set CosmosWorks = CWObject.CosmosWorks Set ActDoc = CosmosWorks.ActiveDoc() Set StudyMngr = ActDoc.StudyManager() Set Study = StudyMngr.GetStudy(0) Set swModel = swApp.ActiveDoc If fileName = Crankshaft Then swModel.Parameter("Dia_Cpin@Sketch4@Crankshaft.swmodel").SystemValue = _ Excel.Range("B4") * 0.0254 Else swModel.Parameter("D1@Sketch2@Crankshaft.swmodel").SystemValue = _ Excel.Range("B4") * 0.0254 End If swModel.EditRebuild Set CWMesh = Study.Mesh CWMesh.Quality = 1 Call CWMesh.GetDefaultElementSizeAndTolerance(0, el, tl) errCode = Study.CreateMesh(0, el, tl)
  • 46. errCode = Study.RunAnalysis Set CWResult = Study.Results FOS = CWResult.GetMinMaxFactorOfSafety(True, Nothing, 4, 4, 0) conrodstress = CWResult.GetMinMaxStress(9, 0, 1, Nothing, 0, errCode) 'Sheets("sheet1").Activate 'ActiveSheet.Cells.Clear Range("K4").FormulaArray = FOS Range("M4:N4").FormulaArray = conrodstress swModel.EditRebuild End Sub
  • 47. Appendix D VBA code for returning mass properties Public Enum swMassPropertiesStatus_e swMassPropertiesStatus_OK = 0 swMassPropertiesStatus_UnknownError = 1 swMassPropertiesStatus_NoBody = 2 End Enum Public Enum swUserPreferenceToggle_e swUpdateMassPropsDuringSave = 30 End Enum Sub Conrod() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swModelExt As SldWorks.ModelDocExtension Dim swAssy As SldWorks.AssemblyDoc Dim swSelMgr As SldWorks.SelectionMgr Dim swComp As SldWorks.Component2 Dim nStatus As Long Dim vMassProp As Variant
  • 48. Set swApp = CreateObject("SldWorks.Application") swApp.Visible = True Set swModel = swApp.ActiveDoc Dim Filter As String Dim fileName As String Dim fileConfig As String Dim fileDispName As String Dim fileOptions As Long Filter = "SolidWorks Files (*.sldprt; *.sldasm; *.slddrw)|*.sldprt;*.sldasm;*.slddrw|Filter name (*.fil)|*.fil|All Files (*.*)|*.*|" fileName = swApp.GetOpenFilename("File To Attach", "", Filter, fileOptions, fileConfig, fileDispName) If TypeName(fileName) = "Boolean" Then Exit Sub swApp.OpenDoc fileName, 1 Set swModel = swApp.ActiveDoc Set swModelExt = swModel.Extension vMassProp = swModelExt.GetMassProperties(1, nStatus)
  • 49. Debug.Print "ModelDocExtension::GetMassProperties(" + swModel.GetPathName + ")" Debug.Print " Status = " & nStatus Debug.Print "" If Not IsEmpty(vMassProp) Then Range("l8").value = vMassProp(5) * 2.2 Range("l10").value = vMassProp(3) * 61023.7 Range("l11").value = vMassProp(4) * 1550 End If End Sub
  • 50. Appendix E MATLAB code for motion and force analysis ------------------------------------------Defining input parameters----------------------------------------- m2 = 3.254/386;%crank mass m3 = 0.751/386;%conn rod mass mpiston=1.11/386;%piston mass J2 = 15.198/386;% crank inertia J3 = 7.489/386;% conn inertia r2 = 3.150;%crank length r2cg = -.1;%crank cg length r3 = 8.268;%conn length r3cg = 2.316%conn cg length AV2 = 1000;%crank rpm w2 = (2*pi)*(AV2/60);%crank rad/sec %angular acc of crank is zero alpha2=0; ang2=0*ones(360,1); %no gas force for now gasforce=0*ones(360,1); force=0*ones(360,8); ---------------------------------------------------MATLAB Analysis----------------------------------------- for i = 1:360%.01 ang2(i)= 2*pi/360*(i-1); %--------------------------------------------------------------------- %position analysis ang3(i) = asin(((-r2 * sin(ang2(i)))/ r3));
  • 51. ra(i) = r2 * cos(ang2(i)) + r3 * cos(ang3(i)); %--------------------------------------------------------------------- %velocity analysis w3(i) = (-r2 * w2 * cos(ang2(i)))/(r3 * cos(ang3(i))); va(i)=-r2*w2*sin(ang2(i))-r3*w3(i)*sin(ang3(i)); %--------------------------------------------------------------------- %acceleration analysis alpha3(i)=(r2*w2^2*sin(ang2(i))+r3*w3(i)^2*sin(ang3(i)))/(r3*cos(ang3(i))); Apiston(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3.*cos(ang3(i))+r3*alpha3(i)*sin(ang3(i))); %--------------------------------------------------------------------- %cg analysis for links 2 and 3 r2cgx(i)= r2cg*cos(ang2(i)); r2cgy(i)= r2cg*sin(ang2(i)); v2cgx(i)=-w2*r2cg*sin(ang2(i)); v2cgy(i)= w2*r2cg*cos(ang2(i)); a2cgx(i)=-w2^2*r2cg*cos(ang2(i)); a2cgy(i)=-w2^2*r2cg*sin(ang2(i)); r3cgx(i)=r3cg*cos(ang3(i))+r2*cos(ang2(i)); r3cgy(i)=r3cg*sin(ang3(i))+r2*sin(ang2(i)); v3cgx(i)=-w2*r2*sin(ang2(i))-w3(i)*r3cg*sin(ang3(i)); v3cgy(i)=w2*r2*cos(ang2(i))+w3(i)*r3cg*cos(ang3(i)); a3cgx(i)=-(w2^2*r2*cos(ang2(i))+w3(i)^2*r3cg*cos(ang3(i))+r3cg*alpha3(i)*sin(ang3(i))); a3cgy(i)=-w2^2*r2*sin(ang2(i))-w3(i)^2*r3cg*sin(ang3(i))+r3cg*alpha3(i)*cos(ang3(i)); %set up r matrix rmatrix(1,1)=1; rmatrix(1,3)=-1; rmatrix(2,2)=1; rmatrix(2,4)=-1;
  • 52. rmatrix(3,3)=r2*sin(ang2(i)); rmatrix(3,4)=-r2*cos(ang2(i)); rmatrix(3,8)=1; rmatrix(4,3)=1; rmatrix(4,5)=-1; rmatrix(5,4)=1; rmatrix(5,6)=-1; rmatrix(6,5)=r3*sin(ang3(i)); rmatrix(6,6)=-r3*cos(ang3(i)); rmatrix(7,5)=1; rmatrix(8,6)=1; rmatrix(8,7)=1; %set up b matrix bmatrix(1)=m2*a2cgx(i); bmatrix(2)=m2*a2cgy(i); bmatrix(3)=J2*alpha2+r2cgx(i)*m2.*a2cgy(i)-r2cgy(i)*m2.*a2cgx(i); bmatrix(4)=m3*a3cgx(i); bmatrix(5)=m3*a3cgy(i); bmatrix(6)=J3*alpha3(i)+r3cgx(i)*m3.*a3cgy(i)-r3cgy(i)*m3.*a3cgx(i); bmatrix(7)=mpiston*Apiston(i)+gasforce(i); bmatrix(8)=0; %calc force matrix % F12X F12Y F23X F23Y F34X F34Y F14Y TORQUE fmatrix=inv(rmatrix)*transpose(bmatrix); force(i,1:8)=fmatrix; end %example plots %plot(ang2,force(:,1))
  • 53. %grid on plot(force(:,1), force(:,2)+force(:,7)) grid on title('Shaking forces on engine block') xlabel('Forcex (N)') ylabel('Forcey (N)') %finished ------------------------------------------------Program End---------------------------------------------------