Lab 3 - Handout
Lab 3 - Handout
The objective of this lab is to become more familiar with the hardware and software used in
the Electric Generator labs by running a set of experiments using Simulink and dSPACE
ControlDesk. The first experiment is to measure the real and reactive powers of a single
phase RL load and to calculate its resistance and reactance. The second experiment is to
design an open-loop voltage controller to control the speed of a DC generator, operated as
a motor. The captured data will then be used to estimate the electric parameters of the DC
generator. Note that the two machines (i.e., the squirrel-cage induction generator and the
DC generator) are not coupled at any point in this experiment.
2. Experiment
Be sure to read the dSPACE DS1104 Control Work Station and Simulink Tutorial (Lab 1)
for basic hardware and software setup used in this lab.
Equipment needed:
• dSPACE I/O box
• PEDB with ribbon cable and +12V supply
• Squirrel-cage Induction Generator (SCIG)
• DC Generator (DCG), frame mounted
• Rack of Cables
To A1 on PEDB
∅
∅
To B1 on PEDB
∅
Open
= ) ) 1)
= ) ) 2)
= ∗ 3)
)= )∗ ) 4)
= )) 5)
= − 6)
i (t)
& ') "# = $%
6/(
+ ∶ ;0:3/6 13.= I .J ℎ1 5. .6 7 8
<
In steady-state, equation 7 becomes:
= + *+ 8)
This equation will be used to calculate the armature resistance and the back-EMF constant
of the DC motor for slowly varying voltages.
2.2.1 Simulink Model
Make necessary adjustment to the Simulink model of the open-loop voltage controller
presented in section-V of the dSPACE DS1104 Control Work Station and Simulink
Tutorial. Keep in mind to change the delay length to 167 in the averaging block pertaining
to the motor current. Make sure to include Stop/Start, Reset and Zero Encoder commands
as well as the ability to read the data from the encoder and the current of the motor. Do not
forget to set the model configuration parameters as described in section 2.1.1.
Next, create a new experiment. This time, you will be taught to create the simState radio
button block. In the layout,
>>Instrument Selector > Standard Instruments > select Multistate Display and draw it
on the layout. Also, select On/Off Button from the same menu.
You will see that a block with two radio buttons will be created. This number can be changed
by accessing the instrument properties (this, however, isn’t necessary, since you need two
radio buttons as you saw in the previous part of this lab).
>> Right click on the On/Off Button. Go to Instrument Properties and the browse the
Buttons option just under the Push Button.
In the resulting Buttons window, you can change the names and values of the buttons.
>> Select Button 1 > under the properties, enter ‘STOP’ for the Text and change the Value
to 0.
>> Select Button 2 > under the properties, enter ‘RUN’ for the Text and change the Value
to 2.
Now, drag and drop the simState variable in the radio button block in the layout, as done
before. Design the rest of the ControlDesk layout in dSPACE to take the measurements.
2.2.2 Connection
For the hardware setup and connections, also refer to the dSPACE DS1104 Control Work
Station and Simulink Tutorial. Before running the measurement, make sure that the encoder
is measuring the position and velocity of the DC motor properly by rotating the DC motor
shaft one revolution, 360 degree, and confirming the motor shaft position on the dSPACE
ControlDesk. Because the encoder reads a negative value for a positive voltage applied,
make sure that the Simulink model inverts the encoder data as done in the lab tutorial. Also,
check the analog-to-digital channel, and make sure that it is measuring the correct values.
For this purpose, you can follow the analog-to-digital converter and digital-to-analog
converter sections in the tutorial.
2.2.3 Measurement
Once the layout is set up, arrange for automatic data export in .mat format. Apply a trigger
rule using the Start_Stop variable for a positive edge of 0.5. There should be no need for a
trigger delay. Ensure that your duration trigger is set to a value approximately, if not, greater
than the time you suppose you will need to record the following set of data. Put the program
on RUN mode. Click on Start Triggered Recording button on the recorder. Check the
Start_Stop check button and apply steps of increasing voltage, for example 5, 10, 15, 20,
and 25V in succession at approximately regular intervals. Click on the Stop Recording
button, reduce the voltage and stop the motor. Measure the current, velocity, and position
of the DC motor as they change (engage plotters) and tabulate current and velocity for each
increment of voltage. Note that the angular velocity unit in the mathematical DC motor
model (Eq.7) is in rad/sec. In MATLAB, filter the noise observed in the data if necessary,
using a Butterworth filter as follows:
[b,a] =butter(3,0.1);
omega_filtered = filtfilt(b,a,omega)
This code creates a third-order filter with a cutoff frequency of 500 Hz (0.1/(2*Ts) where
0.1 is the 2nd argument in the function butter and Ts (sampling period) is 0.0001 as set in
MATLAB. Compare the filtered data with the original; you should notice the reduction of
noise.
With the data obtained above, and the steady-state equation (Eq. 8), it is possible to obtain
a plot of the Voltage/Current vs Velocity/Current, which should satisfy the following
equation:
+
= +* 9)
By fitting a line to the plot, derive the back-EMF constant and the armature resistance of
the DC motor. Hint: you may use Matlab function POLYFIT to fit the data.
3. Report Requirements: