20.6.8.3. Simulink
The Simulink block is for co-simulation between CoLink and Simulink. This block needs to use RecurDyn Solver with RecurDyn model.
20.6.8.3.1. Simulink Block
Dialog box
Interface Version: Simulink communication method
1.0: Preexistence user communication method
2.0 : New expansion communication method(default)
3.0 : This version is supported from Matlab 2015a version. The number of Plant Input and Plant Output can be defined until 10,000 with this version.
Parameter(s) |
Description |
Number of inputs |
Enter the number of data from CoLink to Simulink. |
Sampling Period |
Enter the number of data from Simulink to CoLink. |
M-File to createPlant Block |
Export the M-File name to use in Simulink. This option is activated in case that Interface Program is Simulink. |
Matlab Program |
Enter the executable file name and the installation directory of Matlab program. |
M-File to run Simulink Model |
Enter the M-File name to be used for the batch job of Simulink Model. |
Simulink Model |
Enter the name of Simulink model that is built for co-simulation with CoLink. This model must include RecurDyn Plant Block. |
20.6.8.3.2. Using Simulink Block
For synchronous simulation of control design tool and CoLink, following five steps are required as shown in Figure 20.133.
Step I
Build or Open the CoLink model
Any CoLink Model can be used in this interface.
Make sure the CoLink model is correct.
The CoLink model must be free of simulation errors. The modeling errors must be fixed in this step. If not, it is very difficult to modify the model in co-simulation.
Step II
Identify inputs and outputs.
Drag and Drop Simulink block in modeling window.
Define the number of inputs and outputs of block.
Connect input ports and output ports to other blocks with lines.
Enter the name of M-file to create RecurDyn plant block and click Export.
M-file name and sampling period. M-file sends necessary data to MATLAB\SIMULINK for synchronous simulation.
Step III
Build Simulink model with RecurDyn Plant block
Run the MATLAB program.
- Change the working directory to the directory that has the
M-file and the CoLink Model.
In the MATLAB command window, type M-File name.
In the MATLAB command window, type makerd.
A new Simulink window with RecurDyn Plant block appears.
Open a new Simulink model window.
Drag and drop RecurDyn\Plant block on the new Simulink model window.
Design the control system with the pasted plant.
Terminate MATLAB program.
Reserved variables
CoLink_model: CoLink plant file name
CoLik_inputs: Strings of CoLink input names
CoLink_outputs: Strings of CoLink outputs names
RecurDyn_controltimestep: sampling period for co-simulation
Step IV
Set parameters for batch job of Simulink.
Enter the executable file name and the installation directory of MATLAB program.
Enter the name of M-File to run Simulink model to be used for the batch job of Simulink Model.
Enter the name of Simulink model that is built for co-simulation with CoLink.
Step V
Co-Simulation
Simulate CoLink. CoLink automatically execute MATLAB program and simulate Simulink model. Then Simulink model used in co-simulation must be closed.