Integrator block: Deriving velocity from acceleration

2 views (last 30 days)
Hello,
I am implementing a simple vehicle dynamic model in Simulink. From a co-simulation I have the torque input into the model and using equations I have derived the acceleration of the vehicle. In order to find out the current velocity of the vehicle, I will have to integrate the acceleration. I tried using the continuous-time integrator block, but it does not give me desired results. The velocity just keeps rising to unfeasible values. If I have to use a limited integral, what would be the limits and what about the initial condition for the integrator? If anyone has done a similar model, could you please help me out? Thanks in advance.

Answers (1)

Andy Bartlett
Andy Bartlett on 28 Jul 2022
Edited: Andy Bartlett on 28 Jul 2022
Let me describe a systematic way to get from
Your knowledge of the physical equations describing your system
to
Simulink model representing those physical equations
First write down the physical equations of your system with the derivatives of variables on the left by themselves and all the math to compute that derivative on the right.
foo_derivative = 7 * foo + 11 * goo + 6 * input1
goo_derivative = 0.1 * foo - 7.3 * goo + 4 * input2
As a side note, if everything is linear and time-invariant (LTI), then this boils down to the famous LTI state space equations
x_vector_derivative = A_matrix * x_vector + B_matrix * u_vector % State equation
y_vector = C_matrix * x_vector + D_matrix * u_vector % Output equation
Once you have the equations written with the derivatives of "states" on the left, drop in a continuous-time integrator for each state.
Drag a wire for the output of each integrator and label that with the name of the state such as "foo", "goo", ...
Drag a wire from the input of each integrator and label that as the derivative of the output such as "foo_derivative", "goo_derivative", ...
If input signals are not already on your model, then add those signals.
Next put labels on all the signals corresponding to inputs with text like "input1", "input2", or whatever was used in your system of equations.
Next for each of your equations like
foo_derivative = 7 * foo + 11 * goo + 6 * input1
drop in the necessary blocks and wiring such that the integrator input labeled "foo_derivative" agrees with your equation. If you've labelled each signal wire with a name from your system equations, then this part should be straightforward.
Finally, you can add other variables such as outputs that are derived from inputs and states using simple algebraic equations like
y_output1 = 3 * foo + 9 * goo - 4 * input2
For example, drop in an outport block, drag out its input wire and label it "y_output1" or whatever is used in your system of equations. Wire up the necessary blocks such that "y_output1" is calculated according to the algebraic equation from your system of equations. Again if you've labelled each signal wire with a name from your system equations, then this part should be straightforward.
HTH

Community Treasure Hunt

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

Start Hunting!

Translated by