This folder contains two examples developed during the Digital Manufacturing course Department of Industrial Engineering, University of Trento.
The aim of the examples is to briefly show a digital twin example where the c-cnc represents the physical machine while the Matlab® and Simulink® simulation represent its digital version.
The cartesian printer model is a modified version of an this example provided by Matlab®.
SimpleAxis
: Simscape® model of a simpifyed machine axis. The axis movement occours through a DC motor which is controlled in position by means of a PID. The axis set point can be set via MQTT.Cartesian3DPrinter
: Simscape® model of a cartesian 3D printer where axes movements are based on the SimpleAxis example.
- Simulink and Matlab® r2021b.
- Simscape® multibody.
- Simscape® electrical.
- MQTT in Matlab toolbox
- Launch MQTT broker. Please read carefully the documentation inside goodies folder.
- Open Matlab, go to MATLAB folder and launch
SimpleAxis.m
orCartesian3DPrinter.m
. Both scripts will setup and open their simulink models. - Setup simulink simulation pace to be software realtime. Enable pacing and set simulation time per wall clock to 1.
- Run simulation. This will open also the Mechanics Explorer inside your Matlab window.
- MQTT topics.
- In order to test if your simulation is runnning correctly you can try to set axis/axes set point/points by using one of these Matlab commands:
or
publish(M, '/sp', '0'); % SimpleAxis set point
publish(M, '/sp', '0'); % Cartesian3DPrint set point