Skip to main content
1-Visitor
August 27, 2015
Solved

Input is a function of a state variable

  • August 27, 2015
  • 1 reply
  • 2699 views

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?

Best answer by StuartBruff

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

1 reply

23-Emerald V
August 27, 2015

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

1-Visitor
August 27, 2015

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.

23-Emerald V
August 27, 2015

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