Skip to main content
1-Visitor
Aug 27, 2015 6:52 PM UTC
Solved

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?

23-Emerald V
Aug 27, 2015 9:05 PM UTC

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

8 replies

23-Emerald V
Aug 27, 2015 7:10 PM UTC

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

Translate
1-Visitor
Aug 27, 2015 7:18 PM UTC

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.

Translate
23-Emerald V
Aug 27, 2015 9:05 PM UTC

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

Translate