UP | HOME

Table of Contents

Gravity with Simscape Models

Table of ContentsClose

We would like to include gravity in a Simscape multi-body model while starting the simulation at the equilibrium.

The basic idea is to first perform a simulation of the system until it goes at it rest position and save the rest position forces and deflection in each joint.

We can then think of three solutions to start a new simulation directly at the steady state position:

The three solutions are tested below.

1 Simulink

Copy
open 'gravity_test.slx'

simscape_model.png

Figure 1: Simscape model used for the simulations

2 Initial Simulation

Copy
g = -10; % [m/s^2] k = 1e3; % Stiffness [N/m] c = 10; % Damping [N/(m/s)] l0 = 0; % Initial wanted position [m] leq = 0; % equilibrium position [m] F_ext = 0; % External force [N] F_act = 0; % Actuator force [N]
Copy
out_init = sim('gravity_test.slx') out_init.d.Name = 'Displacement'; out_init.Fm.Name = 'Force Sensor';
Copy
figure; subplot(1,2,1) plot(out_init.d) title(''); subplot(1,2,2) plot(out_init.Fm) title('');
Copy
<<plt-matlab>>

sim_init.png

Figure 2: Initial Simulation (png, pdf)

3 Change the equilibrium position

Copy
l0 = 0; % Initial wanted position [m] leq = -out_init.Fm.Data(end)/k; % equilibrium position [m] F_ext = 0; % External force [N] F_act = 0; % Actuator force [N]
Copy
out = sim('gravity_test.slx'); out.d.Name = 'Displacement'; out.Fm.Name = 'Force Sensor';
Copy
figure; subplot(1,2,1) plot(out.d) title(''); subplot(1,2,2) plot(out.Fm) title('');
Copy
<<plt-matlab>>

sim_change_eq_position.png

Figure 3: Simulation after changing the equilibrium position of the joint (png, pdf)

4 Add external force

Copy
l0 = 0; % Initial wanted position [m] leq = 0; % equilibrium position [m] F_ext = -out_init.Fm.Data(end); % External force [N] F_act = 0; % Actuator force [N]
Copy
out = sim('gravity_test.slx'); out.d.Name = 'Displacement'; out.Fm.Name = 'Force Sensor';
Copy
figure; subplot(1,2,1) plot(out.d) title(''); subplot(1,2,2) plot(out.Fm) title('');
Copy
<<plt-matlab>>

sim_add_external_force.png

Figure 4: Simulater after adding an external force applied to the solid (png, pdf)

5 Change initial position

Copy
l0 = out_init.d.Data(end); % Initial wanted position [m] leq = 0; % equilibrium position [m] F_ext = 0; % External force [N] F_act = 0; % Actuator force [N]
Copy
out = sim('gravity_test.slx'); out.d.Name = 'Displacement'; out.Fm.Name = 'Force Sensor';
Copy
figure; subplot(1,2,1) plot(out.d) title(''); subplot(1,2,2) plot(out.Fm) title('');
Copy
<<plt-matlab>>

sim_change_initial_position.png

Figure 5: Simulation after changing the initial position of the joint (png, pdf)

6 Conclusion

Three techniques:

  • Change the equilibrium position
    • This does not change the equilibrium position of the system
  • Add external force
    • May not be physical
  • Change the initial position
    • The static position is not the same as the static position without gravity
    • Very easy to implement

Important

Changing the equilibrium position of each joint seem the most practical solution.

Author: Dehaeze Thomas

Created: 2020-11-12 jeu. 10:22