Skip to content

Latest commit

 

History

History

MATLAB

Matlab course examples

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

Examples

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

Projects dependencies

Project setup and run

  1. Launch MQTT broker. Please read carefully the documentation inside goodies folder.
  2. Open Matlab, go to MATLAB folder and launch SimpleAxis.m or Cartesian3DPrinter.m. Both scripts will setup and open their simulink models.
  3. Setup simulink simulation pace to be software realtime.simulation pace Enable pacing and set simulation time per wall clock to 1. simulation pace
  4. Run simulation. This will open also the Mechanics Explorer inside your Matlab window.

Note

  1. MQTT topics.
  2. 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:
    publish(M, '/sp', '0'); % SimpleAxis set point
    or
    publish(M, '/sp', '0'); % Cartesian3DPrint set point