Wide DHMPC TTCG
TrueTime Code Generation
The class Automatic Code Generation (ACG) creates a ready-to-use setup networked control system simulation by generating a Simulink model based on TrueTime blocks and corresponding configuration m-files. The Network model is specified by the number of actuators and sensors, while controller and plant should be customized by the user fulfilling the respective subsystem.
Class description
[TrueTime] is a very powerful tool which can handle simulation of a variety of tasks, with a particular focus on real-time implementation of controller and sensors/actuators codes. As a result of this plenty of possibilities offered, the user needs to set-up a lot of features, some of which might be out of scope for some needings.
This class permits to generate automatically all the configuration m-files needed to run a standard networked-control simulation. The user is asked to simply set the number of sensors and actuators that are desired to be in the network and a name for the Simulink model to be generated.
Then the code generation creates a Simulink model that contain two submodels, Plant and Controller, that can be customized by the user according to personal needing.
The m-files generated are also intended to be a starting point for those users that want to deal with real-time code aspects. Those users are invited to modify the generated m-files to customization.
The supported TrueTime versions is 1.5 as it is (at the writing time) the latest stable version. Since a Beta version is in advanced development state, we will update the present class to support TrueTime2.0 after the first stable version is released.
Private Properties
Directly unaccessible for the user.
- Ns : number of sensors;
- Na : number of actuators;
- name: name of the generated Simulink model;
Class Methods
Class Contructor
obj=ACG(Ns,Na,name)
- Ns : number of sensors in the network (Optional: default value=1);
- Na : number of actuators in the network (Optional: default value=1);
- name : name of the simulink model file (Optional: default value='acg_default')
Code Generation
obj.GenerateCode();
Generated the files required for performing a standard network-aware simulation using TrueTime.
Remove generated code
obj.RemoveoldCode();
Remove all generated code so as to clean the folder and permit new generation;