Caspoc - Simulink Co-Simulation
Compared to the classical coupling the Co Simulation between Caspoc and Simulink is much easier to use and all functionality of Caspoc is included in the co-simulation. Also all scopes in Caspoc can be used as wel as the aniumation features. The interactive components in Caspoc are also enabled during the co-simulation.
The co-simulation is based upon data exchange between Caspoc and Simulink at every time step. The simulation in Simulink is controlled from Caspoc. In this way, the control can be implemented in Simulink and co-simulated with a simulation in Caspoc.
Co-Simulation processThere are some basic steps to perform to couple the simulations. The co-simulation is easy to set up and both simulators show simulation results in their own scopes. The co-simulation is controlled from Caspoc where a co-simulation is initiated and started. The process for the co-simulation is given the process number 2, as can be defined in the co-simulation properties dialog box. In general there is no input from the user required in this properties dialog box.
Communication blocksThe data exchange during the simulation is done in the block diagrams in Caspoc and Simulink.
The following blocks are used for the communication:
Caspoc:Simulink:
There are multiple inputs and outputs possible in the co-simulation. Therefore you can define which block in Caspoc is connected to an input/ouput in Simulink. This is done by numbering the blocks in Caspoc
The blocks also have to be parameterized:
Caspoc:Properties for the ToLF block:
Properties for the FromLF block:
Simulink:
The simulation in simulink also has to be parameterized in order to work with Caspoc. Select the properties as indicated in the properties dialog box for the simulation parameters and give the correct values for the simulation times and step size.
To start the co-simulation, you first have to initialize the co-simulation in Caspoc. This will set up the communication.
You can stop the co-simulation in Caspoc by selecting "Options/Co-Simulation/Stop". If Caspoc is not responding after you select it from the menu bar or via Alt-TAB, you can cancel the co-simulation by clicking the [Esc] button on your keyboard.