Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
The article you are trying to access is permanently deleted.
In my mathCAD sheet, I've solved this four bar linkeage for any user input of crank position, but what I'd like to do now is develop equations to describe the motion of the links (and particularly a point in question) through out the entire 360 degree range of my crank arm. This sheet uses scalar position equations and Given / Find solve blocks to solve for link arm angle, angular velocity, and angular acceleration based on the user input of crank angle, which in my sheet is θ2.
I would like to make θ2 a range variable, or a matrix of values from 0 - 360 degrees so I can output and then plot the motion of the point I'm looking for, but I'm stuck. The Given / Find block fails, and then obviously the rest of the sheet fails. If I'm approaching this incorrectly from a programming stand point, please let me know.
Solved! Go to Solution.
Additional notes:
If you do the same thing with your other solve blocks, you will run into severe performance problems - things really will get sloooow! This is because later solve blocks will call previous solve blocks multiple times in just one iteration und those solve blocks again call previous ones multiple times, etc.
Lets take for example your solveblock for VelSoln1 which calculates omega3 and omega4.
One iteration in this solveblock will call the solveblock for PosSoln1 four(!) times and if the solve block for VelSoln1 needs 100 iterations to get its values, the block for PosSoln1 is evaluated 400 times (and gets the very same values every time!).
So lets improve the situation up to the point, where the previous block is not called 400 times but just once:
The previous block is called once and the second solve block function gets the calculated values as additional arguments.
That way things are speeded up significantly.
LT
You may turn the solve block into a function dependable on theta2:
Thank you so much, Leopold.
Additional notes:
If you do the same thing with your other solve blocks, you will run into severe performance problems - things really will get sloooow! This is because later solve blocks will call previous solve blocks multiple times in just one iteration und those solve blocks again call previous ones multiple times, etc.
Lets take for example your solveblock for VelSoln1 which calculates omega3 and omega4.
One iteration in this solveblock will call the solveblock for PosSoln1 four(!) times and if the solve block for VelSoln1 needs 100 iterations to get its values, the block for PosSoln1 is evaluated 400 times (and gets the very same values every time!).
So lets improve the situation up to the point, where the previous block is not called 400 times but just once:
The previous block is called once and the second solve block function gets the calculated values as additional arguments.
That way things are speeded up significantly.
LT
Can you explain the underbar operator? What is the gist of this correction, and how does it change the performance problem?
The underbar is not an operator, just a part of the name of the variables and functions. I needed different names but wanted names similiar to the original variables, so I added the underline character.
As you can see, the solve block function (the one with the undrline at the end) has three arguemnts. It would not have been necessary to add the underline at the additional two arguments but I thought it would be clearer that way.
So this solve block never calls one of the other solve blocks. It gets all it needs either by predefined constants (r2,r3,r4) or via function arguments.
Next I created the function VelSoln() with just one argument, theta2. Here in the first step I calculate the values for theta3 and theta4 corresponding to theta2 and then called the solveblock fucntion with those values as arguments. Note that I did not use the single functions theta3(theta2) and theta4(theta2) becuase doing so would call the previous solveblock twice. The way I did it needs just one call to that previous solve block.
Now, when you call VelSoln() Mathcad performs an iteration, evaluating the two equations every time with slightly different values of omega3 and omega4. In the fiorst version of this function, for every step of this iteration theta3 and theta4 would have been calculated again and again by calling the previous solve block. So each step of the iteration resulted in calling the previous solve block four times. This was time consuming, especially as you have other solve blocks which would call the last one the same way and so unneccessray calls are cascaded.
With the new function the previous solve block is called once and the results are used for every iteration. The previous solve block is not called a single time during the iteration process.
I know that its tedious to rewrite the sheet and turn all necessary variables into functions of theta2.
It is a long standing wish from the community to create a way to turn a whole Mathcad sheet into a function but I guess we better dont'n bet on this to happen some day.
LT
LT,
I went through the sheet and updated my solve blocks with this programming style (both for the velocity equations and extrapolated that into the acceleration equations as well), and have everything working as I require. I also tried a version that used my previous and less efficient method - that took a while to compile! This programming method / advice was a real help to me, I just wanted to thank you for your input.
- Ryan
LT, we would now like to be able to input a range, or set of data into this worksheet to use instead of the constant velocity motor speed. The data will be suggested servo-motor velocity which I will input as an excel file to my ω2 (input motor speed) variable, making it a single column vector of velocities (output from the servo driver as an excel file). I also have the corresponding crank arm acceleration as well as the jerk for each time step of the motor, so I'll have to do this more than once for each section of the linkage analysis.
I've tried dropping the file into my worksheet, but I think the fact that my input is now a vector is screwing with the Solve Block. It makes sense to put the "velocity" solve block into a while loop, and give exactly as many increments as there are rows in my file, and reference the row of angular velocity, but I don't know how to accomplish this, or even if it's the syntax that would work.
Attached is the updated version of the file we started this discussion with, and to recap, I'm interested in changing the motor input speed from a static value (ω2=400 rpm) to a table - referenced set of values so we can determine how the system would respond with a different servo-motor drive profile. I left my ω2 variable in place and vectorized it, and changed the solve block, but it failed.
If you change the "Velocity Equations" solve block back to ω2 instead of ωin it will compile appropriately. I've included the input excel file.
Why not make omega2 a second argument of the functions in question ?
YOu should not vectorize in the solve block. The solve block should be setup using single values. Later you can vectorize the call to the solve block.
LT