I have problem with derivative of an Input to Simulink-PS Converter

14 次查看(过去 30 天)
I am trying to use a sinusoidal function as an input to a prismatic joint in simscape. The sinusoidal function is to feed through Simulink-PS converter to a Prismatic joint. The Simulink-PS converter include input and the first two derivatives. In case if I only have the first derivative (velocity) of the sinusoidal function as input to Simulink-PS converter, the position is to be calculated by integration and the second derivative (acceleration) is to be calculated by derivation. I noticed that when I use the derivative block with Simulink-PS converter, the second derivative (acceleration) is little different from the expected acceleration. It seems there is a delay between the real acceleration and the one which is derived from the derivative block and S-PS converter.
Could you please suggest how to correct this issue? I really appreciate your suggestions.

回答(2 个)

Sebastian Castro
Sebastian Castro 2017-9-11
The Derivative block is very sensitive to the time steps your simulation is taking, and is usually not recommended.
I'd suggest changing the Simulink-PS Converter block to use the "Filter input, derivatives calculated" option. Then you pass in the position and let the block calculate smooth, filtered derivatives with a time constant that makes sense for your application.
- Sebastian

Brandon Eidson
Brandon Eidson 2017-9-11
Sebastian's comments are important. I'd like to also add that the difference in the derivatives is expected. Simulink's solver solves for states and outputs sequentially from block-to-block while Simscape compiles all the states/equations and solves simultaneously. This is why the Simscape derivative output appears to be able to "look ahead" to have the correct derivative a time-step sooner.
I have attached a model that illustrates this difference. In the "StopFcn" callback, a plot is created of the Simscape Position, Simulink Velocity (i.e., the output of the "Derivative" block), and the Simscape Velocity. I have used a fixed-time step of 0.1 seconds so the values easy to compare. Notice that at time = 0.1 seconds, the output of the Simulink Derivative block is simply (Position(0.1) - Position(0))/0.1. This is due to the sequential nature of Simulink's solver. But the Simscape solver simultaneously solves for the position and velocity using other model equations/states (like force/acceleration). This allows it to pinpoint the correct velocity at 0.1 seconds.

类别

Help CenterFile Exchange 中查找有关 Simulation Setup 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by