cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Input is a function of a state variable

astevenson-2
1-Newbie

Input is a function of a state variable

I have a real life work problem I'm attempting to use MathCAD to solve. I'm computing the response time history of a coasting rotation inertia and at time zero reverse motor torque is applied. I have an 8th order state space model and I'm using Rkadapt to solve. The motor torque is a function of shaft speed and is thus a function of one of the state variables. I have the function as tabular data (lookup table). Any suggestions on how to formulate the motor torque?

1 ACCEPTED SOLUTION

Accepted Solutions

Andy Stevenson wrote:

I don't think it's that simple but I've been wrong before. As the numerical integration moves forward in time, the input torque is a function of one of the computed states. So to use interpolation, I'd have to integrate for a few milliseconds, interpolate a new torque value based on shaft speed at the end of the integration, restart the integration with the new torque value and so on.

It depends upon what you're doing and how you're trying to do, but, yes, you're right.  However, this isn't really a problem as far as Mathcad is concerned if you include the interpolation function in your DE, as in the example below.  If you have a reasonably good fit to your data from one of the fitting functions then you could improve the efficiency by explicitly writing the parameters into the generic fitted function (eg, write a polynomial function using the regress parameters in the case below); this should improve performance if this turns out to be an issue.

Stuart

View solution in original post

8 REPLIES 8

Andy Stevenson wrote:

I have a real life work problem I'm attempting to use MathCAD to solve. I'm computing the response time history of a coasting rotation inertia and at time zero reverse motor torque is applied. I have an 8th order state space model and I'm using Rkadapt to solve. The motor torque is a function of shaft speed and is thus a function of one of the state variables. I have the function as tabular data (lookup table). Any suggestions on how to formulate the motor torque?

You could look at the interpolation functions; look up interp in Help.

Stuart

I don't think it's that simple but I've been wrong before. As the numerical integration moves forward in time, the input torque is a function of one of the computed states. So to use interpolation, I'd have to integrate for a few milliseconds, interpolate a new torque value based on shaft speed at the end of the integration, restart the integration with the new torque value and so on.

Andy Stevenson wrote:

I don't think it's that simple but I've been wrong before. As the numerical integration moves forward in time, the input torque is a function of one of the computed states. So to use interpolation, I'd have to integrate for a few milliseconds, interpolate a new torque value based on shaft speed at the end of the integration, restart the integration with the new torque value and so on.

It depends upon what you're doing and how you're trying to do, but, yes, you're right.  However, this isn't really a problem as far as Mathcad is concerned if you include the interpolation function in your DE, as in the example below.  If you have a reasonably good fit to your data from one of the fitting functions then you could improve the efficiency by explicitly writing the parameters into the generic fitted function (eg, write a polynomial function using the regress parameters in the case below); this should improve performance if this turns out to be an issue.

Stuart

But of course. Why didn't I see that? I don't have the data in front of me presently to know whether I can fit a decent curve to it or not but the interpolation option is a viable backup plan. Thanks again.

Do you have any suggestions for modeling stiction? Seems life a similar approach would work but modeling the stiction as a piece wise linear function of shaft speed and direction with speeds around zero causing coefficient of friction to increase and then converting to sliding friction outside the "zero" speed window.

Andy Stevenson wrote:

Do you have any suggestions for modeling stiction? Seems life a similar approach would work but modeling the stiction as a piece wise linear function of shaft speed and direction with speeds around zero causing coefficient of friction to increase and then converting to sliding friction outside the "zero" speed window.

That should work.  I don't know anything about friction (having forgotten most of my O-Level physics!), but something like this?

Stuart

You rock dude!

Andy Stevenson wrote:

You rock dude!

True.

But you try telling that to the young folk of today, and they don't believe you!

Top Tags