I have problem with derivative of an Input to Simulink-PS Converter
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zohreh Keshavarz Bagheri
el 8 de Sept. de 2017
Respondida: Brandon Eidson
el 11 de Sept. de 2017
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.
0 comentarios
Respuestas (2)
Sebastian Castro
el 11 de Sept. de 2017
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
0 comentarios
Brandon Eidson
el 11 de Sept. de 2017
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.
0 comentarios
Ver también
Categorías
Más información sobre Simulation Setup en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!