ECTE344 LAB REPORT For Experiments 1-4
Luca Russo, 5223283
[email protected]
Table of Contents Experiment 1 ..............................................................................................................................................................1
Aim ..........................................................................................................................................................................2 Method ................................................................................................................................................................... 2 Results .....................................................................................................................................................................2 Section 1 .............................................................................................................................................................. 2 Section 2 ............................................................................................................................................................. 3 Section 3 ............................................................................................................................................................. 3 Problems .................................................................................................................................................................3 Reflection ................................................................................................................................................................3 Learning Outcomes & Objectives ...........................................................................................................................3 Experiment 2 ..............................................................................................................................................................4
Aim ..........................................................................................................................................................................4 Method ................................................................................................................................................................... 4 Results .....................................................................................................................................................................4 Section 1 .............................................................................................................................................................. 4 Section 2 .............................................................................................................................................................. 4 Section 3 ............................................................................................................................................................. 5 Section 4 ............................................................................................................................................................. 5 Problems .................................................................................................................................................................5 Reflection ................................................................................................................................................................5 Learning Outcomes & Objectives ...........................................................................................................................5 Experiment 3 ..............................................................................................................................................................6
Aim ..........................................................................................................................................................................6 Method ................................................................................................................................................................... 6 Results .....................................................................................................................................................................6 Pre-lab ................................................................................................................................................................. 6 Section 1 .............................................................................................................................................................. 6 Section 2 ............................................................................................................................................................. 7 Section 3 ............................................................................................................................................................. 7 Problems .................................................................................................................................................................7 Reflection ................................................................................................................................................................7 Learning Outcomes & Objectives ...........................................................................................................................7 Appendix ...............................................................................................................................................................8-14
1
Experiment 1 Aim The experiment acts as an introduction to Simulink, a MATLAB tool useful when designing embedded systems. Three major aspects of system design and testing are covered in the experiment; model building, error debugging and interfacing with the Hilink hardware module.
Method Prior to attempting the experiment, students are asked to familiarise themselves with the learning objectives outlined in a 2005 paper by Feisel and Rosa [1], the Hilink user manual and basic Simulink UI. The first section encompasses modelling a simple RL circuit (Fig.1.) within t he Simulink environment. To do so, students are familiarised with the procedure required to create a template file. Template files must be used as the starting blank models when working with Hilink. Several Simulink icons are then described; one of them being the Simulink Library Browser which is then explained in further detail. From here, fundamental features such as block placement, block parameter configuration, subsystem creation, the diagnostic window, error prone blocks and scope functionality are demonstrated. Section two begins by identifying common errors that can occur when designing systems on Simulink. Certain blocks output vectors have multiple elements, and t hus have an associated width which m ay not be compatible with other blocks. Also, if systems do not have properly defined initial conditions, they will fail to run. We are introduced to these errors in or investigation of the vehicle suspension system block, which has both array dimension errors and is missing initial conditions. These problems can be pre-empted by utilising inbuilt Simulink display options and detected using the diagnostic window. The possible quick fix involving a demux and terminator is outlined. A pre-built model is then debugged using call-backs within the model properties. A Hilink board, along with a power cord and null mo dem cable, are needed for the third section of the experiment. First the Hilink board is physically linked to the pc via null modem cable and plugged into power. The library browser is then used to locate the Hilink test block which can be found in the ECTE344 Hilink library. Running a model containing this block executes a hardware test for the Hilink to ensure proper functionality. Once the hardware has been tested, modelling can begin.
Results Section 1:
An investigation into the operation of the ‘sum’ and ‘derivative’ block is undertaken, with important fields such as ‘List of signs’ outlined. The RL circuit model, as seen in figure 2, is run for the first time with the scope window
present. Two waveforms are fed into the scope, the result is shown in figure 3, one is the unchanged sinewave and the other is the system output. The RL circuit subsystem mentioned earlier was duplicated and implemented in sequence to model a second o rder system. Relevant parameters were adjusted to suit system described in task. Outputs are monitored and recorded via two-input scope.
= 0.9 5 , = 0.41 It is clear that the smaller waveform is a derivative of the larger one. Notice how the magnitude of the system output is dependent on the rate of change in gradient of the input waveform. The input wave is then changed from a sine wave to a step input, and changes in system behaviour are noted and the step response of the system is plotted, see figure 4.
2
Section 2:
The debugged vehicle suspension system is implemented and tested from within a system. Task 1.2.3 involved inserting a unique input as an alternative to a sine wave block, as seen in figure 5. The input can be modified by changing the parameters of one of the many blocks which make up the input. Using this model, it was determined that maximum system displacement occurs when input frequency is equal to two. For further understanding, the inputs of the system are once again modified to determine another characteristic of the system. The force required to displace the spring is evaluated by adjusting a slider gain block that is adding gain to the system. We find that for the spring to to uch its upper support anchor, 3.95N of force must be applied. Section 3:
The circuit depicted in Figure. 5. Is assembled in Simulink using the library browser to search for relevant blocks, and call-backs are added to change the sampling frequency of the model to 2048Hz. Mo difications were then made to the model to allow for three outputs; angular velocity, radians per second and degrees per second. All the aforementioned variables are important in the analysis of the motors behaviour. The first experiment opens the door of possibilities when it comes to the use of Simulink in the analysis and design of systems, and the quick implementation of models onto hardware is another indicator of how powerful a tool Simulink can be.
Problems Scope resolution in section 1 is not fine enough. – To address this issue, internal parameters of the simulation must be adjusted. Leaving the max step size as auto can lead to unclear plots in many cases. Change max step size parameter from auto to 1/100/ Values of R and L are not initialised or g iven values during run time. – Once again, the blocks ‘model properties’ window must be opened for inspection. Call-backs are perfectly suited as a method to initialise system variables, and thus, the resistors are given values via call back commands. Vector dimension error and missing initial cond. in V Subsystem – This problem is briefly outlined in methods section. Use a demux + terminator to terminate certain cells of the array then use call back for initial conditions. Now the matrix dimensions of the two blocks agree.
Reflection Hilink board number 53 was selected for use in this section. From now on the best attempt should be made to acquire the same board due to variations in Hilink board characteristics. The experiment succeeded as an introduction to interfacing with the Hilink board and using Simulink as a powerful tool in the analysis of a realworld system. Additionally, valuable debugging tools are outlined and utilised throughout the experiment.
Learning Outcomes & Objectives There is no clear-cut, most important learning outcome in this experiment. Each section deals with a necessary aspect of using Simulink when modelling systems. Given the circumstances, the learning o utcomes of section two stand out in importance. Using Simulink tools for debugging errors is an invaluable skill to have when it comes to system design as in many ways, debugging can be the most intimidating or time-consuming part of the design process if inadequately prepared. The following skills were expanded upon the completion of the experiment: Models, data analysis, design, learning from failure, instrumentations
3
Experiment 2 Aim The aim of this experiment is to develop a deeper understanding of the real-life system modelling process, and vital control system criteria through the examination of a physical DC motor unit. In addition, the operation of low-pass filters as well as their usefulness in solving issues related to dead zone and saturation is covered.
Method A briefing is given on the distinction between a linear and non-linear system, why these distinctions are relevant to the experiment and the application of transfer functions as a solution to problems faced by non-linear systems. An important data analysis block, Least Squares Polynomial Fit (LSPF), is demonstrated by passing through test data and demultiplexing the signal to two separate displays, m and b. The LSPF block attains a line of best fit given input data. The step response of a transfer function is a nalysed using inbuilt scope measurement tools. These tools will be crucial in gathering results in any experiment. The rest of the preparation activities involves becoming acquainted with Simulink slider blocks, and how to connect a slider to the desired block. The experiment is then divided into four sections, each dealing with a unique aspect of the modelling process. Section one acts as practice in subsystem creation as well as covering the groundwork required for sections to come. The subsystem can be seen in fig 6. This section also points out important characteristics of the E0 block, specifically that mode can be switched from position to velocity in the block parameters window. The concept of using a gain block as a way to convert between units it emphasised. The next section entails combing knowledge gained about slider blocks and subsystems with multiple outputs with hardware implementation. A modelled system, as shown in figure 7, is implemented in conjunction with the Hilink board to investigate relating to linearity, steady state response, motor dead zone and saturation. Directly following the application of Simulink as a real-world analysis tool, section three seeks to increase ones’ appreciation of Simulink as a design tool. The subsystem, called HilinkMultiOutSI, is recycled from the previous section. Using values calculated from previous exercises, a transfer function is attained and compared to the measured response of the real-world motor. Finally, a lowpass filter is incorporated in the model in the form o f a transfer function. The effects of the lowpass on the system are explored. Sliders are taken advantage of for ease of modifying the sine wave block frequency parameter while the simulation is running. The goal of this section is to investigate a system characteristic known as gain crossover frequency.
Results Section 1:
A laboratory instructor deemed the subsystem was constructed correctly. Section 2:
9
9
The circuit simulation is run with voltage values ranging from to , with a finer resolution for interval of to . The resulting values for angular velocity are then added to table 1 and plotted, see figure 8. After examining the generated plot, it can be deduced that the motors behaviour is linear for larger values of input voltage. The static gain, is calculated manually;
2
2
= 343340 18 =37.9 From Figure.8, it is clear that a dead zone occurs near the zeros of the input voltage variable. This is an issue; however, it may be overcome by exploiting a non-linear system where linearity halts. 4
Section 3:
Both the time constant, , and pole position, section. The steps to do so are as follows:
, of the system must be determined prior to continuing this
= 6 ∴ steady state value of angular velocity , = 223 / The rise time is defined as the time it takes for the system to rise to 63.21% of its steady state value In this case (as measured on scope), that value is 10.7.
The pole position is the inverse of the time constant
Final value of input step block
→ = = .× − = 93.5 /
Now with the pole position and static gain calculated, a transfer function can be formed.
= = 37.9 1 + 1 + 93.5 The simulation is then run another time, this time with the calculated transfer function. Rise time and steady state value are deduced from the scope. Steady state value and . Discrepancies in the rise time are to be discussed in the reflection section. Table. 2. compares various response properties for the transfer function and motor.
= 224 /
= 9.53
Section 4:
The model depicted in figure 9 is run with a range o f values for the filter time constant parameter. The results are can be seen in Table.3. Clearly, as the filter time constant increases in value, the gain crossover frequency decreases. This means that the system will become unstable at lower frequencies. The time filter constant is then set to value shown in table. 3. and a new transfer function is formed by measuring the time constant of the new system response. From the scope:
= 224 → 63.21% ℎ = 141.6 & = 11.78 → = 84.96 / 37.9 = 1+/84.96 The new transfer function is then added to the model, as seen in figure 10 and its response properties are noted in Table. 4. By inspecting the overshoot property, it can be said that the filtered DC motor would perform better in a position control system. A smaller overshoot translates to more accurate positions. However, if the design of a shaft velocity control system is to be considered, the unfiltered system will perform much better. Velocity control depends on a much more responsive system. Therefore, a system with increased rise, delay and settling time is not suited.
Problems No major problems were faced in this experiment.
Reflection The transfer function had very similar response characteristics to the real-world motor response. The importance of experimentation and data g athering is accentuated throughout the procedures in t his experiment. Hence, the most valuable learning objective f rom this lab is the ability to derive system properties through the analysis of real-world system. The transfer function is of vital importance in control theory and so, being able to obtain one from a system is of utmost importance.
Learning Outcomes & Objectives The following skills were expanded upon the completion of the experiment: Instrumentation, models, experiment, data analysis, design and safety. 5
Experiment 3 Aim The experiment focuses on furthering insight on the usefulness and application of bode plots to system design and analysis. The behaviour of a DC motor is explored and reconstructed experimentally, and the overall functionality of the frequency response estimation tool is highlighted. The importance of more complex subsystems is also demonstrated.
Method A new system is modelled in preparation for the following tasks. This model includes a dead zone block to represent the non-linearity faced in the DC motor at lower voltage values. The system is fed an input chirp signal with amplitude equal to 10 for testing purposes. The experiment begins with the construction of a virtual function generator subsystem which will be useful when attempting to experimentally estimate a valid transfer function of an unknown black-box (that is, unknown) system. The virtual function generator subsystem consists of the following blocks: two sine waves, two products, three gains, a clock, the debugged vehicle suspension system, summation, demultiplexer and scope. In addition, various block parameters must be modified, and sliders/knobs must be implemented correctly. The full composition of the function generator sub system can be seen in figure 15. The model is again altered to include the HilinkMultiOutSI subsystem from experiment 2. A knob is associated to the initial phase of the system. Input waveform frequency is adjusted during the simulation, with the intent of lining up input waveform with the output, thus determining multiple pole location. It is important to carefully scrutinise the amplitude of the input sine wave as too low a value would lie in the dead zone while too large a value would lead to saturation, and therefore less reliable results. Once again, the step response is compared to previous experiment transfer functions to evaluate the legitimacy of the method used. Lastly, the model assembled in the previous section is run several times, incrementally doubling the frequency of the input sine wave each time. This is repeated until a frequency is reached which is ten times that of the highest pole calculated. The transfer function of the system is then expressed in both second order form and simplified form.
Results Pre-lab:
Research into the dead zone block revealed many key aspects of its operation. The function of the dead zone block is to define a region in which the output must be zero. Integer, fixed-point and floati ng-point data types are supports. By default, the limits of the block are defined between Moving forward, values for gain ratio and phase are simulated by running the model shown in figure 11.
[.5 5].
ℎ = 132
= 12 , The input waveform is changed to
() =10×sin(10 ). The input and output waveforms can be seen
as a sketch, in figure 12 . A new model is created with a second order transfer function and its bode plot, shown in figure 13, is plotted. Section 1:
The clock is used to display the running time of the current simulation. It is a convenient block to do so as it uses the double data type which suits the needs of time keeping. By adjusting the slider corresponding to frequency, the change in phase can be monitored easily. Once shifted input and unshifted output waveforms align, the lagging when frequency response directly corresponding to the new phase introduced. The system will be lagging when frequency is frequency is , and prduce unity gain when frequency is .
1.54 135
2.31
45
1
6
Section 2:
The frequency at which the first pole occurs is found to occur at
87.7
= 11.8 and the second occurs at =
Section 3:
The results of the system frequency response are shown in table 5 then plotted on a MATLAB semi-log bode plot, seen figure 16. The semi-log plot comes in handy when one of the two variables is not increasing linearly. This lab has a heavy dependence on comparison of system properties in order to draw conclusions. The final second order system is defined as
=
37 ) (1 + 55 )(1+ 93.5
This step response has characteristics that closer resemble that of the DC motor. To get the transfer function of position when the input is radians, we simply multiply the above transfer function with . Resulting in the function;
2
() =
37 ×2 1 + 55 1+ 600
Problems Saturation can easily occur if Simulink system parameters are not checked. In the same way, dead zone can deduct from the relevance of the results obtained in this section. To overcome such issues, it is of extreme importance that the amplitude of the sinusoidal input wave be carefully thought out, in a manner that avoids both extremes.
Reflection The experiment gives a good foundation in experimentation and analysis. The bode plot tool is an invaluable tool in the analysis of input response of systems and, as such, is the centre of attention for this experiment.
Learning Outcomes & Objectives Understanding the significance of experimentation in conjunction with applying bode plot analysis is the main reason to undertake this experiment. The tasks included in this experiment expose various facets of the bode plot as well as the effect of lowpass filtering o n system response. The following skills were expanded upon the completion of the experiment: Instrumentation, models, experiment, data analysis, design, and safety.
References All information and theoretical background is taken from ECTE344 control website and lecture slide. 7
Appendix Experiment 1
Figure 1. RL circuit diagram
Figure 2. Simulink model of RL circuit
Figure 3. RL Circuit Voltage Waveform - sinusoidal
Figure 4. Figure 3. RL Circuit Voltage Waveform - step
Figure 5. Vehicle Suspension Subsystem w/ custom inputs
8
Experiment 2
Within the subsystem lies
Figure 6. Position and velocity monitoring subsystem
Figure 7. System linearity check model
Input Voltage (V)
Figure 8. Real-world motor response
9 8 7 6 5 4 3 2 1.5 1 0.5 0 0.5 1 1.5 2 3 4 5 6 7 8 9
Angular Velocity (rad/s)
340 305 268 226 186 147 106 66 45 25 0 0 0 24 43 64 103 141 181 223 260 302 343
Table 1. Relation between motor input voltage and angular velocity
9
Property Overshoot Rise time (10 – 90%) Delay time (0 – 50%) Settling time (within 5% of SS)
Transfer Function
0.5% 16.42 6.52 52.5
DC motor
0.9% 19.7 8.21 70
Table 2. Response properties of simulated and real-world system
Figure 9. System w/ added lowpass filter
Filter Time Constant
Gain Crossover Frequency
0 0.01 0.02 0.03 0.04 0.05
1800 540 400 320 270 230
Table 3. System response with varying time constant
Figure 10. System w/ new filtered transfer function
Property Overshoot Rise time (10 – 90%) Delay time (0 – 50%) Settling time (within 5% of SS)
Transfer Function filtered
0.5% 17.5 7.97 58.2
DC motor filtered
0.35% 28 17.05 82.08
Table 4. Response properties of estimated filter transfer function and the filtered DC motor
10
Experiment 3
Figure 11. DC motor simulation
Figure 12. Sketch of system input (black) and output (red) waveforms
Figure 13. Bode plot of second order transfer function
11
Figure 14. System w/ Function Generator and dashboard modifiers
Ch1
Ch2
12 Figure 15. Contents of function generator block
Frequency (rad/s)
1 2 4 8 16 32 64 128 256 512 1024 2048
Frequency (Hz)
0.159 0.318 0.637 1.274 2.55 5.09 10.19 20.37 40.73 81.49 162.97 651.9
Phase shift (
0 9 13 15 17 21 40 61 105 135 180 265
.)
Gain (magnitude) 37 37.9 38.8 38.6 36.9 35 28 19.6 10 5.03 0.5 0.2
Gain (dB) 31.5 31.5 31.7 31.6 31.2 30.6 28.9 25.8 20 14 -0.6 -14
Table 5. System properties with increasing frequency
Bode magnitude plot
Bode phase plot
Figure 16. Bode magnitude and phase plots from values in table. 5
13