Using Simulink Block

 

For synchronous simulation of control design tool and CoLink, following five steps are required as shown in Figure 2.

 

Figure 1  Five-step process

 

Step I

1.  Build or Open the CoLink model

     Any CoLink Model can be used in this interface.

 

2.  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

1.  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.

 

2.  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

 

1.  Run the MATLAB program.

2.  Change the working directory to the directory that has the M-file and the CoLink Model.

3.  In the MATLAB command window, type M-File name.

4.  In the MATLAB command window, type makerd.

5.  A new Simulink window with RecurDyn Plant block appears.

6.  Open a new Simulink model window.

7.  Drag and drop RecurDyn Plant block on the new Simulink model window.

8.  Design the control system with the pasted plant.

9.  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.

 

1.  Enter the executable file name and the installation directory of MATLAB program.

2.  Enter the name of M-File to run Simulink model to be used for the batch job of Simulink Model.

3.  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.