Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi there! I'm messing around with the start of a Mathcad Prime 3.0 model of a hydraulic valve and have built a set equations that partially define it. I stopped because there are several things happening that confuse me. Please take a look and see if you can explain the issues and help me work around them.
1. In my odesolve statement you'll see the one variable name turned green. I can change the variable's name and it still happens. Why??? And what does it indicate?
2. The A(t) formulas can't generated a negative value. The pi/2 vertical shift to atan forces its low limit to 0. Yet you'll see on the graph that this value dips negative
3. The initial values for the Q's don't show up correctly at x=0, but they calculate correctly further out in the x-axis
4. The A(t) plots (red and black) should be 180 degrees out of phase with each other. One's min should coincide with the other's max, but there's a shift. Think of it this way... The motion equation produces an x value that represents spool position, both A(t) equations reference the same x.
I'm so far removed from solving differential equations and even algebraic equation sets, so I'm going to guess there's operator error involved. But on the other hand, mixing ODE's with algebraic equations in a solve block does have complications from what I've read, perhaps I'm stumbling onto some of those???
Any help would be greatly appreciated!
Solved! Go to Solution.
1. Click in Q.in. On the math toolbar you will see that the label is set to "Constant". Change it to "Variable". I don't know why the automatic setting is making it a constant (a bug, perhaps?).
3. What makes you think they don't show correctly? They look fine to me.
2 and 4. The output of odesolve is a set of functions. The A.in, A.t, Q.in and Q.t returned by odesolve are not necessarily the same as the functions by the same name in the solve block. In fact, if you want them to be the same then there is no need to solve for them. Just solve for x, and then define functions for A.in, A.t, Q.in and Q.t. If you do that then A.in(0) and A.t(0) are what you expected. Q.in(0) and Q.t(0) are not. Looking at the formulas I suspect that's a unit issue. You have a couple of numerical constants in there that are probably only valid for specific units. It's probably this that is also forcing the A.in and A.t functions given by odesolve away from the A.in and A.t functions in the solve block.
Bullet 3 above... It was a units error. Since I'm not using them in the solve block, that was an easy oversight.
Travis Loewen wrote:
Bullet 3 above... It was a units error. Since I'm not using them in the solve block, that was an easy oversight.
Easy is not equal better.
Units can help find errors.
Now we can use units in the Odesolve function of Mathcad Prime!
Why do You not use units.
See one example (a diver)
1. Click in Q.in. On the math toolbar you will see that the label is set to "Constant". Change it to "Variable". I don't know why the automatic setting is making it a constant (a bug, perhaps?).
3. What makes you think they don't show correctly? They look fine to me.
2 and 4. The output of odesolve is a set of functions. The A.in, A.t, Q.in and Q.t returned by odesolve are not necessarily the same as the functions by the same name in the solve block. In fact, if you want them to be the same then there is no need to solve for them. Just solve for x, and then define functions for A.in, A.t, Q.in and Q.t. If you do that then A.in(0) and A.t(0) are what you expected. Q.in(0) and Q.t(0) are not. Looking at the formulas I suspect that's a unit issue. You have a couple of numerical constants in there that are probably only valid for specific units. It's probably this that is also forcing the A.in and A.t functions given by odesolve away from the A.in and A.t functions in the solve block.
Thanks for the responses Richard and Mr. "Anon" 😉 It looks like the out of phase issue is taken care of, and I still have one or two more things to check, but I'll add units to the entire sheet and see what I've got once they all match.
The reason, the Ain, At, and Qin are inside the solve block and not post processed is because of the next 5 equations that you haven't yet seen. These parameters are critical to defining how flow is split by the valve, and then the flow split helps to define the pressure response, and finally, the pressure output circles back and hit's the RHS of the motion equation as feedback. I didn't want to get too deep in and present something that would be hard for an outsider to quickly interpret and respond to.
I'll either post here again in a few days, or start and new conversation, once I hit my next road block(s).
Again, I appreciate the responses!
If you use units, you can solve for x(t) directly, then A and Q track.
I don't have enough information to put units to the entire problem.