The idea behind the Simulink model is to create a digital representation of the real system capable to simulate the dynamic behaviour of the strongback being moved by the 5 actuators. The real interest for our problem is the kinematic behavior of the whole assembly.

This page describes how the Simulink model is defined to represent the behaviour of the real system properly.

Location

The models are located in project_root/Models

The model

There are 2 available models:

  • SCU_FULL.slx located in project_root/Models. This represents the full 5 DOF system
  • SCU_3_DOF.slx located in project_root/Models. This represents the simplified system with 3 DOF used during the phase 1

The system is composed of several blocks, connected through joints. Each block has connectors physically located at the geometrical point of a connection point. The block also contains a CAD model of the represented entity that is further used to compute the mechanical properties such as mass, center of mass, and inertia required by the solver to better simulate the dynamical behavior.

Blocks overview

Rods

Let's look inside the small_rod_bottom:

PMC1 (physical model connection port) represents the coordinates of the point that is located at the center of the rod's top connection. This is the center of the spherical joint that connects the rods with the center link. The same description applies to PMC2 for the bottom connection of the linkage. There are several Rigid Transforms (RT) that are involved: all the cad models, indeed, are exported to a predefined reference frame. A big effort spent during the model creation was to measure the relative positions between the joints (PMC) and the reference frame and save that information inside a file.  

This is an example of a rigid transform. The offset is not hardcoded but is defined through a workspace variable. All the geometric variables are defined in a MATLAB script that SHALL be defined inside the model. (Here is the how-to)

Small_rod_bottom is a file solid and it contains the cad model (STL) used to visually and dynamically represent the object defined by the block. In our case, it shows the small vertical rod shape.

All the rods and the central link are very similar to the small rod bottom.

Joints

Both the FULL and 3_DOF models utilize spherical joints exclusively. While this is a significant simplification—given that the actual system does not contain any spherical joints—this approach strikes a balance between model fidelity and computational efficiency.

Strongback

The strongback block represents the hanging strongback and its interface points PMC to the rest of the world. 

  • A1_top and A1_bottom are the connection points to the small rods that are then connected to the horizontal lever arm connected at the center, through a small rod, to actuator A1.
  • A2 and A3 are directly connected, through a long rod, to the 2 top actuators.
  • A4 and A5 are directly connected, through a long horizontal rod, to the 2 horizontal actuators

The joint actuation of A1, A2, and A3 permits the control of the following degree of freedom: Y, PITCH, and ROLL.

A4 and A5 controls YAW and X dof


Actuators

  • In the real system, as in our model, we might have three or five linear actuators. Each actuator features two physical PMC components: one connected to the rigid frame side and the other to the rod extending linear motion down to the strongback. Simulink offers a powerful feature that allows for changing subsystem behavior based on a label value. This functionality can be used to switch the control mode of the linear actuator, which can operate in one of two ways:

    1. Position Control: In this mode, the actuator moves the rod to the specified position with infinite acceleration, ignoring the electrical and mechanical properties of the actuator. This approach is not accurate for characterizing the dynamic performance of the entire mechatronic system.

    2. Force Control: This mode mirrors the real system's control method. Here, force is the output of any servo system-based application. The force translates to acceleration based on the inertial properties of the joint system (actuator + load). Together with external forces, this determines the velocity and ultimately the position. Implementing this control mode requires incorporating a PID controller to close the position loop and provide a current output to the actuator.

    By leveraging Simulink's subsystem behavior-switching feature, we can accurately replicate and control the linear actuators' behavior, aligning the model closely with real-world dynamics.

The above picture shows that the actual selected control mode is position-based. 

The setting for changing the variant is defined inside the model explorer.

The position-based control is implemented by using a prismatic joint that is actuated through position and the force is automatically computed. The GoTo block propagates the position from an external, workspace-defined variable, up to the joint. All the physical quantities related to that actuator, are then sent to a GoTo block. This enables the visibility of such physical parameters to the upper layer of the model. 

TO-DO: A must-have functionality is to use a lead screw joint driven by a revolute joint controlled in position. It is also important to implement a force-based input actuator with the associated controller.

This is an example of how the forces from all the actuators are gathered through a goto and plotted within a scope

Quadrupole position and orientation

The primary objective of the SCU motion control system is to accurately position and orient the reference frame representing the quadrupole in space. This frame is centered at the quadrupole's magnetic center, measured using a stretched wire. The axes are defined using the left-hand rule: the Z-axis is parallel to the quadrupole's magnetic axis, with positive Z pointing in the beam direction, and the Y-axis pointing upward in the direction of +g (where g is the local gravity vector). The X-axis is derived according to the left-hand convention.

Both quadrupole position and orientation are measured through the very helpful transform sensor.

One side of the sensor is connected to the ground reference frame, while the other is linked to the quadrupole's reference frame. The sensor outputs the following data:

  • The quadrupole's absolute position (X, Y, Z) relative to the fixed reference frame
  • The quadrupole's Euler angles (in Z-Y-X sequence)
  • The quadrupole's quaternion

Model's interface

INPUT VALUES:

  • Ax_position (1<= x <= number DOF): array 2 x m where the first column is the time (in seconds) and the second is the position of the x_th actuator in mm
  • Ax_initial_state (1<= x <= number DOF): double. This is the x-th actuator starting position 

OUTPUT VALUES:

  • simOut.yout.getElement('Quadrupole position').Values. The output quadrupole's position

  • simOut.yout.getElement('Quadrupole orientation').Values. The output quadrupole's orientation

  • simOut.yout.getElement('Joint Forces').Values. The joints' forces


How to

Execute the model inside a script

To execute the model inside a matlab script few steps shall be done:

  1. Define the simulation time variable (simulation_time) and the number of points 
  2. Create the time array
  3. Create and initialize the Ax_position arrays 
  4. Launch the simulation: 

    simOut = sim(sim_file_path, 'StopTime', string(simulation_time));


  5. Enjoy the results

To inhibit the Mechanics explorer output just execute, before calling the sim function,

set_param('model_name', 'SimMechanicsOpenEditorOnUpdate', 'off');


How to load the workspace  

Go to Simulink/Modeling Tab/Model Explorer

Then click on "Model Workspace" and, under Workspace data, insert the script name that contains all the workspace variables required for the model to properly define all the rigid transformations. If only the script name is provided (not the full path), it is very important to be sure that the script's folder is within the Matlab path

How to properly set the Matlab path  

A script has been written to load all the required paths into Matlab.

The script is located in project_root and it's called add_to_path.m. The user needs to run that script only once. A prompt will be shown asking for admin elevation then a confirmation will be given by returning on the console the list of added folders to the path.



  • No labels