Getting Started



Training Lab

Experiment 1

Experiment 2

Experiment 3

Experiment 4

Experiment 5

Optional Experiment

Doc Control

Experiment 1: Introduction to the control laboratory.

     Before starting the experiment write down the number of your experiment rig in your lab logbook.   You should keep using the same rig for all the 5 experiments because each motor has its own transfer function.


     The text is more regularly updated according to feedback in comparison with the videos.  If there is a difference between the text and a video you should follow the text.



Task 1 Learn how to use the Simulink software.


Follow the guide "Creating a simple model". This guide can be found by opening MATLAB and typing simulink into the command window. Click "help" from the Simulink toolbar and navigate to Simulink Help --> Getting Started --> Creating a simple model.  Build and simulate the simple model given in the section.

At some points in the coming experiments you will need to take measurements from signals in the Simulink scope. This can be done in two ways:
  1. Zooming in on a point of interest in the Simulink scope
  2. Exporting the signals to the MATLAB workspace and plotting the results.
Test both of these methods on the model created in this part. If you do not know how to do this follow the instructions below:

1) Run the simulation. Open the Simulink scope by double click on it. Pick a point of interest on the signal, click and hold on an area around this point by dragging the mouse across the point of interest. This will zoom in the scope over the area you highlighted. You may need to do this a few times to increase the accuracy of your measurements.

2) Open the Simulink scope before running the simulation. Click on the scope parameters button, navigate to the History tab and check the "Save data to workspace" box and make sure the variable name is "ScopeData". Also make sure that the "limit data points to last" option is sufficiently high. Approx. 10000. Run the simulation and navigate to the MATLAB command window and type plot(ScopeData.time,ScopeData.signals.values). Open the MATLAB figure. To measure specific values you may want to use the Data Cursor by clicking the data cursor button . Once the data cursor icon is selected a point on the signal can be selected and the data points will be displayed.

Assess the advantages and disadvantages of both of these methods with regards to both signal visualization and taking measurements at specific points.

Task 2

Make sure the circuit is set up as shown below.  If it is not call your demonstrator for an inspection. 

Note: P0_A could also be red+black and P0_B could also be purple under our new colour code.

Open MATLAB. Navigate the directory to C:\Program Files(x86)\Hilink. Copy and paste all of the files in this folder to another folder, preferably on your USB drive. Then change the MATLAB working directory to your new directory where all the files were pasted. This directory will need to be used as the working directory for all experiments in ECTE344 so take note of where it is located. Save all files produced in all experiments to this directory (not in subfolders).

In the MATLAB command window set S = inf and T = 1/2048.

Note: This will need to be done at the start of every experiment so take note on how to do it.

(If the program keeps crashing do the following:

Open windows task manager by pressing ctrl+alt+del. Select the processes tab, find the MATLAB process, right click on it and choose set affinity. Select only one core that the process will run on.  You should try CPU7 first.)

Download the Simulink files needed for this laboratory here

Open the model from the downloaded content named "Experiment1part1".

With the model opened press ctrl+b to build the model.
Note: Every time there is a change in the model (excluding block parameters such as frequency or amplitude) you will need to build the model again.

Click on the Connect to Target button
on the Simulink tool bar and run the simulation.

Record your observations.

Repeat the process for the file "Experiment1part2"

Task 3 - Developing motor speed and position blocks

Open the model "Experiment1part1" from the downloaded files.

Identify the blocks in the Simulink model that could be combined into one Simulink block that represents the motor where the input is the input voltage and the output is the position of the shaft as shown in the figure below:

This is a PID controlled system which will be studied later in the session.

To create this custom block highlight the blocks you think need to be included  in the motor position block by holding "Shift" and clicking each block that needs to be included. Once all relevant blocks are highlighted press "ctrl+g" to create a subsystem. After creating your subsystem delete everything from your model except the subsystem. Change the label from "Subsystem" to "MPdegree" signifying that it is motor position (degrees) and save your model as "MPdegrees.mdl".

Note: The shaft is always subject to a sinusoidal dithering signal for position control. This is to reduce the non-linear effects of static friction. Hence the high frequency sinusoid being fed into H0 must be included in the motor position subsystem.

The output of this block is the shaft position in degrees. Observe the model and think how you would convert the output to radians. Convert the output of the subsystem to radians. Save this model as "MPradians". These subsystems will be used in later experiments.

Follow the same procedure to find a motor speed block. This can be done using the model "Experiment1part2" downloaded at the start of the experiment. Find the block for speed output in radians/sec. Save this subsystems and "MSradians".

Note: The model "Experiment1part2" is already in rad/sec so no need to convert. Also since the speed block is typically already constaly moving there is no need for a dithering signal.

Task 4 - DC motor speed: Simulink modelling

Visit the Control Tutorials at and study the DC Motor Speed: Simulink Modelling section by clicking on MOTOR SPEED at the top and MODELLING at the bottom-left under SIMULINK.  Following the instructions to create the DC motor block using Simulink.  Delete the input and output terminals by right click on it and select delete.  Connect a step block from the Source section of the Simulink Library Browser to the voltage input of the DC motor.  Connect a scope from the Sink section of the Library to the speed output of the DC motor block.  Simulate the speed of the motor to a step voltage.  This is the step response of the DC motor.

Left click MODELLING at the top-left under SYSTEM and study the motor transfer function.   Study the effects of the moment of inertia on the step response of the DC motor speed using Matlab command step.  Increase the value of the moment of inertia from 3.2284E-6 to 3.2284E-5 step by step with a step size of 3.2284E-6.  Represent your results using a graph and comment on how the moment of inertia affects the step speed response of the DC motor.

Task 5 - DC motor position: system modelling

Visit the Control Tutorials at and study the DC Motor Position: System Modelling section by clicking on MOTOR POSITION at the top and MODELLING on the left.  Simulate the step response of the motor transfer function.