Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#3 Tangent Spline Constraints

Show off your FreeCAD projects here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by Zolko »

ppemawm wrote: Wed Oct 26, 2022 3:44 pm The study included five different cam profiles and five types of followers all with the same follower rise-return-dwell profile as a function of the cam angle of rotation as shown in the following image.

CAM_Design_1.0.FCStd

My design study file is attached for reference.
wow !!!!!!!! Impressive, I've always wanted to do something like that but couldn't manage. Thank-you for the example file, I saved it for later usage.

For the very special case of a flat surface as follower, did you think about using the bounding-box of the cam as reference ? I'm not sure it can be used in the ExpressionEngine though
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by jnxd »

ppemawm wrote: Wed Oct 26, 2022 11:21 pm
jnxd wrote: Wed Oct 26, 2022 8:46 pm Would you be interested in testing this with your current work?
I will as soon as it is available. Or, feel free to adapt my file using the new spline tools.

Thanks for all your efforts.
Maybe I will do that. There is still a snap though if it takes time to merge.
My latest (or last) project: B-spline Construction Project.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by ppemawm »

Zolko wrote: Thu Oct 27, 2022 7:14 am For the very special case of a flat surface as follower, did you think about using the bounding-box of the cam as reference ? I'm not sure it can be used in the ExpressionEngine though
It can be used in expressions as shown in this post https://forum.freecadweb.org/viewtopic. ... 67#p632067, and others, but does not solve the problem except for followers wider than the cam.

phpBB [video]

phpBB [video]
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#1

Post by ppemawm »

In this example the task was to recreate a cam profile for an automotive camshaft given actual lifter data taken with a dial indicator as a function of the crankshaft degrees. Eventually this cam characteristic will be used to develop a valve train design and verify clearances between valves and clearances between valve and piston as a function of typical design values such as lobe-lobe separation, crankshaft phasing, valve stem length, valve diameter, etc.

A few brief comments about the cam design process using the methods previously developed are as follows in the image captions:

This a clip from an Excel file where the actual tappet lift data were recorded and plotted as a function of the cam degrees (5 deg increments) using the Excel Chart tool.  The data were taken from a flat faced tappet.<br /><br />Three different plots of the data were generated for the entrance, rise and fall, and the exit of the profile.  The data was broken into three sets in order to better fit the profile with polynomial equations using Chart Trendlines.<br /><br />The lift profile for the intake and exhaust cams are the same in this example.<br /><br />The polynomials can be used to calculate the lift at any crank or cam angle of rotation specifically for use in the cam sketch layouts and as assembly constraints as well as Assembly4 animation.<br />.
This a clip from an Excel file where the actual tappet lift data were recorded and plotted as a function of the cam degrees (5 deg increments) using the Excel Chart tool. The data were taken from a flat faced tappet.

Three different plots of the data were generated for the entrance, rise and fall, and the exit of the profile. The data was broken into three sets in order to better fit the profile with polynomial equations using Chart Trendlines.

The lift profile for the intake and exhaust cams are the same in this example.

The polynomials can be used to calculate the lift at any crank or cam angle of rotation specifically for use in the cam sketch layouts and as assembly constraints as well as Assembly4 animation.
.
Screenshot 2022-11-19 141340.jpg (252.47 KiB) Viewed 2624 times
This is simply a polar plot of the lift data using the cam angle as a variable.  If the follower or tappet was a knife edge the cam profile would be the same as this polar plot.  <br /><br />In our case, however, the tappet is a flat face follower which requires that a sketch layout be created to establish the cam profile B-spline using the process developed in the earlier posts.  As you will see in the next images, the profile is quite different than the polar plot of the lift.<br />.
This is simply a polar plot of the lift data using the cam angle as a variable. If the follower or tappet was a knife edge the cam profile would be the same as this polar plot.

In our case, however, the tappet is a flat face follower which requires that a sketch layout be created to establish the cam profile B-spline using the process developed in the earlier posts. As you will see in the next images, the profile is quite different than the polar plot of the lift.
.
Screenshot 2022-11-19 142722.jpg (58.32 KiB) Viewed 2624 times
For this example we introduce two new variables for the camshaft design:  The crankshaft angle and the lobe-lobe separation angle in cam degrees between the intake and exhaust cams.  In a four stroke engine, the camshaft revolves once for every two revolutions of the crankshaft.<br /><br />The dependent variable b_cam_angle is calculated from the independent ac_crank_angle variable as shown in the image.  Variable bb is the intake cam angle and bb_2 is the exhaust cam which lags the intake by the lobe-lobe separation of 110 deg.<br /><br />Note that a conditional statement is required to fully define the exhaust cam angle because the crank angle varies between 0 and 720 deg for one rotation of the camshaft.<br /><br />The polynomials from the Excel file are used to calculate the y6_lift and y6_lift_2 (intake and exhaust) for each portion of the cam profiles.  Using three polynomials greatly complicates the process as the multiple nested conditional statements attest. But it was necessary to get the required accuracy of curve fits for all cam angles.  The calculated lift (+/-0.02 mm) is well within the dial indicator accuracy and manufacturing tolerances.<br />.
For this example we introduce two new variables for the camshaft design: The crankshaft angle and the lobe-lobe separation angle in cam degrees between the intake and exhaust cams. In a four stroke engine, the camshaft revolves once for every two revolutions of the crankshaft.

The dependent variable b_cam_angle is calculated from the independent ac_crank_angle variable as shown in the image. Variable bb is the intake cam angle and bb_2 is the exhaust cam which lags the intake by the lobe-lobe separation of 110 deg.

Note that a conditional statement is required to fully define the exhaust cam angle because the crank angle varies between 0 and 720 deg for one rotation of the camshaft.

The polynomials from the Excel file are used to calculate the y6_lift and y6_lift_2 (intake and exhaust) for each portion of the cam profiles. Using three polynomials greatly complicates the process as the multiple nested conditional statements attest. But it was necessary to get the required accuracy of curve fits for all cam angles. The calculated lift (+/-0.02 mm) is well within the dial indicator accuracy and manufacturing tolerances.
.
Screenshot 2022-11-19 135854.jpg (342.16 KiB) Viewed 2624 times
The calculated lift is used to constrain the tappet and cam assembly.  The lift variable releases the vertical degree of freedom of the tappet as a function of the crank shaft angle using the Attachment Offset properties.  <br /><br />The background image is the lift profile as a function of the crankshaft angle (-360 to 360 deg) for the exhaust and intake tappets showing the lobe-lobe separation of 220 deg (110 deg camshaft angle).<br /><br />The cam rotation degree of freedom is released by the variables bb and bb_2 not shown in this image using the Attachment Offset Angle and Y-axis properties.<br />.
The calculated lift is used to constrain the tappet and cam assembly. The lift variable releases the vertical degree of freedom of the tappet as a function of the crank shaft angle using the Attachment Offset properties.

The background image is the lift profile as a function of the crankshaft angle (-360 to 360 deg) for the exhaust and intake tappets showing the lobe-lobe separation of 220 deg (110 deg camshaft angle).

The cam rotation degree of freedom is released by the variables bb and bb_2 not shown in this image using the Attachment Offset Angle and Y-axis properties.
.
Screenshot 2022-11-19 140456.jpg (286.52 KiB) Viewed 2624 times
.
The following video to demonstrate the lobe separation and phase angle with the crankshaft was generated using the Save feature of the Assembly4 animator as a function of the crankshaft angle 0-720 deg looped four times:

phpBB [video]


The Variables object in the Assembly4 workbench is a valuable tool for these kinds of tasks, much more convenient and responsive than a spreadsheet. These variables can also be easily set up as global variables using an Assembly4 master file for use in sketches, expressions, and placement or attachment properties by inserting the master file link in an assembly Model.

Stay tuned for Update#2 describing the development of a parametric sketch schematic for valve train design including crank, cam, tappet, push rod, rocker, and valve...

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.30922 (Git)
Build type: Release
Branch: master
Hash: 8ec1279ea8ee32a36fae683b42b5cfc5821734b5
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly4 0.12.4
  * fasteners 0.4.15
  * freecad.gears 1.0.0
  * QuickMeasure 2022.10.28
"It is a poor workman who blames his tools..." ;)
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#2--Valve Train Schematic

Post by ppemawm »

This example is the end result of the cam design study which uses the tappet lift profile to actuate a schematic (sketch) of a complete valve train including the crankshaft, cams, tappets, rocker arms, and valves for the intake and exhaust of a one cylinder IC engine. The main purpose of this valve train schematic was to study the valve clearances between valves, head, and the piston as a function of the crank angle of rotation as shown in the following images. A few brief comments about the work process are in the captions.

This is the valve train schematic or sketch that was saved to an Assembly4 Model.  It was generated with the PartDesign workbench sketcher.  In addition, the cam and tappet from the cam design study are assembled (attached) to the LCS origin of the Model and offset according to the sketch dimensions for reference purposes.<br /><br />The sketch includes a simplified schematic of all the moving parts (less springs) of a valve train and two reference lines representing the surface of the head.<br /><br />Several new variables include the phase angle between the crank shaft and intake cam and dimensions for the valve lengths and diameters.  The property view in the image shows how the variables from the cam design file were transferred or linked to the valve train file.  These variables were used in the sketch and attachment offsets of the cams and tappets.
This is the valve train schematic or sketch that was saved to an Assembly4 Model. It was generated with the PartDesign workbench sketcher. In addition, the cam and tappet from the cam design study are assembled (attached) to the LCS origin of the Model and offset according to the sketch dimensions for reference purposes.

The sketch includes a simplified schematic of all the moving parts (less springs) of a valve train and two reference lines representing the surface of the head.

Several new variables include the phase angle between the crank shaft and intake cam and dimensions for the valve lengths and diameters. The property view in the image shows how the variables from the cam design file were transferred or linked to the valve train file. These variables were used in the sketch and attachment offsets of the cams and tappets.
Screenshot 2022-11-22 112137.jpg (245.69 KiB) Viewed 2497 times
This nightmare of a sketch is what it takes to represent the valve train and all of its variables.  In retrospect I probably should have created three simpler sketches for each of the intake and exhaust valve trains and one for the crankshaft all of which would have been easier to create and maintain.<br /><br />The property view shows all of the named variables used in the sketch.  The blue reference dimensions on the sketch are the valve clearances and valve opening/closing that we want to study as the crank is rotated.<br /><br />The parametric sketch is fully constrained.  The push rod is constrained to the tappet sketch as a pin joint or point on object and the rocker as a tangent or slider constraint.  The valve is constrained to the centerline of the cylinder with point on object and the rocker as a tangent constraint to simulate a typical spherical interface.<br /><br />All of the hard to see orange dimensions are variables that can be changed within a limited range without upsetting the sketch.  Even though the sketch is needlessly complicated I had no trouble with sketch flipping over the 720 deg rotation of the crank variable.<br /><br />The names of the variable dimensions of interest can be shown by setting the Edit &gt; Preferences &gt; Sketcher &gt; Display &gt; Show dimensional constraint name...
This nightmare of a sketch is what it takes to represent the valve train and all of its variables. In retrospect I probably should have created three simpler sketches for each of the intake and exhaust valve trains and one for the crankshaft all of which would have been easier to create and maintain.

The property view shows all of the named variables used in the sketch. The blue reference dimensions on the sketch are the valve clearances and valve opening/closing that we want to study as the crank is rotated.

The parametric sketch is fully constrained. The push rod is constrained to the tappet sketch as a pin joint or point on object and the rocker as a tangent or slider constraint. The valve is constrained to the centerline of the cylinder with point on object and the rocker as a tangent constraint to simulate a typical spherical interface.

All of the hard to see orange dimensions are variables that can be changed within a limited range without upsetting the sketch. Even though the sketch is needlessly complicated I had no trouble with sketch flipping over the 720 deg rotation of the crank variable.

The names of the variable dimensions of interest can be shown by setting the Edit > Preferences > Sketcher > Display > Show dimensional constraint name...
Screenshot 2022-11-22 112642.jpg (451.29 KiB) Viewed 2497 times
You can hide all dimensions and constraints except for the reference dimensions as shown in the image.  It makes it much easier to study the sketch as the crank is rotated through its four cycles.<br /><br />The independent variable is the crankshaft angle of rotation from the cam design file.  Top dead center (TDC) is 75 deg. in this sketch.<br /><br />The timing between the intake cam and the crankshaft is constrained by the variables timing_REF_angle and cam1_phase_angle which are related to TDC.  TDC in this sketch is dependent upon how the cam and lift profiles were defined in the reference file.  If the cam sketch layouts were rotated 90 deg then TDC would have been 0 deg in the valve train sketch.
You can hide all dimensions and constraints except for the reference dimensions as shown in the image. It makes it much easier to study the sketch as the crank is rotated through its four cycles.

The independent variable is the crankshaft angle of rotation from the cam design file. Top dead center (TDC) is 75 deg. in this sketch.

The timing between the intake cam and the crankshaft is constrained by the variables timing_REF_angle and cam1_phase_angle which are related to TDC. TDC in this sketch is dependent upon how the cam and lift profiles were defined in the reference file. If the cam sketch layouts were rotated 90 deg then TDC would have been 0 deg in the valve train sketch.
Screenshot 2022-11-22 113041.jpg (382.3 KiB) Viewed 2497 times
.
The following video was generated by the Assembly4 Animator from the cam design file using the crank angle as the independent variable. The video represents 720 deg crank rotation looped four times. The cams rotate once for two revolutions of the crank in a four cycle engine.

phpBB [video]

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.21.30922 (Git)
Build type: Release
Branch: master
Hash: 8ec1279ea8ee32a36fae683b42b5cfc5821734b5
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly4 0.12.4
  * fasteners 0.4.15
  * freecad.gears 1.0.0
  * QuickMeasure 2022.10.28
  * Render 2022.2.0
"It is a poor workman who blames his tools..." ;)
freedman
Veteran
Posts: 3441
Joined: Thu Mar 22, 2018 3:02 am
Location: Washington State, USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#2

Post by freedman »

Amazing work!.
Depending on how far you want to go, have you thought about adding in the performance of the hydraulic lifter?

For reference:
I'm sure some folks don't know the ends of lifters are cupped so the cam spins them around their major axis as they move up/down, and as the hydraulic lifter travels up/down the oil pressure is applied and removed so they act like a shock absorber. These features modify the valve timing (just a bit) by applying a soft landing on the valve seat.

Thanks for the pics.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#2

Post by ppemawm »

freedman wrote: Mon Dec 19, 2022 6:36 am ...have you thought about adding in the performance of the hydraulic lifter?
I have not but it sounds like an interesting proposition. A shock absorber is fairly straight forward to include in the valve timing sketch. It would take a bit of research to study the design and performance analysis of hydraulic lifters. I have always preferred solid lifters due to their inherent higher RPM response.

I am off on another tangent at the moment...

Thanks for your comments.
"It is a poor workman who blames his tools..." ;)
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4

Post by jnxd »

jnxd wrote: Thu Oct 27, 2022 10:40 am
ppemawm wrote: Wed Oct 26, 2022 11:21 pm
jnxd wrote: Wed Oct 26, 2022 8:46 pm Would you be interested in testing this with your current work?
I will as soon as it is available. Or, feel free to adapt my file using the new spline tools.

Thanks for all your efforts.
Maybe I will do that. There is still a snap though if it takes time to merge.
@ppemawm I didn't yet get to trying to adapt the file(s), but now the knot position and tangent constraints are available in the main. So you can give it a try as well.
My latest (or last) project: B-spline Construction Project.
User avatar
ppemawm
Veteran
Posts: 1240
Joined: Fri May 17, 2013 3:54 pm
Location: New York NY USA

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#2

Post by ppemawm »

jnxd wrote: Sun Dec 25, 2022 12:20 pm ...now the knot position and tangent constraints are available in the main.
What a nice Christmas present for us all. I'll check it out.

BTW I have another use case: https://forum.freecadweb.org/viewtopic. ... 30#p649130 for point-onto-object constraint for a periodic spline.
"It is a poor workman who blames his tools..." ;)
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Cam Design with V0.21 PartDesign and Assembly4 V0.12.4--Update#2

Post by jnxd »

ppemawm wrote: Sun Dec 25, 2022 2:41 pm
BTW I have another use case: https://forum.freecadweb.org/viewtopic. ... 30#p649130 for point-onto-object constraint for a periodic spline.
That's nice. Basically a roller coaster. For now, I suppose you could try with ellipses, though I don't believe it will work if the "train" itself is a loop.
My latest (or last) project: B-spline Construction Project.
Post Reply