Aalto University, School of Electrical Engineering Automation and Electrical Engineering (AEE) Master's Programme ELEC-E8004 Project work course Year 2021 Final Report Project 2-01 Low-voltage three-phase electric drive for laboratory exercises Date: 3.6.2021 Suran Roman Hartikainen Hannu Kulkarni Shweta Kyllönen Jaakob Page 1 of 54 Information page Students Roman Suran Hannu Hartikainen Shweta Kulkarni Jaakob Kyllönen Project manager Roman Suran Official Instructor Lauri Tiitinen Starting date 12.1.2021 Completion date 3.6.2021 Approval The Instructor has accepted the final version of this document Date: 3.6.2021 Page 2 of 54 Abstract The project Low-voltage three-phase electric drive for laboratory exercises gives an insight about the knowledge right from the design of an electrical machine to the control of the machine using drives. The combination of both software and hardware aspects of the project and their implementation proves to be very useful for us master’s students. The main inspiration behind this project is to build a kit that includes all the necessary components required by a student be it a bachelor’s student or a PhD student. The elements are namely a system with MATLAB and Simulink installed in it, a micro-controller board with motor control, an inverter, a motor and a load. The Simulink models in standard form will be incorporated in the kit such that they can be readily used or modified for different kinds of motor control methods and various applications of the motor. A project plan was made by the team with the guidance from the instructor and timeline for each task was decided. The measurables and deliverables of the project were determined and accordingly the work started. The starting period had to be remote online meetings because of lockdown restrictions and the status of each task was updated to streamline the work. Individual responsibilities were assigned to each team member and progress was being monitored once or twice a week. Based on various characteristics of the elements in the project, one control method was selected, and respective Simulink model was built for the same. After optimizing the model as per the measurements obtained, the model was finalized with successfully running the motor as per desired parameters. The motor was controlled using a Simulink interface called host model which was responsible for the serial communication between the software and hardware. The obtained measurements of the various parameters were a check point to see if the control method was working properly or not. Modifications were made using the standard Simulink model to implement various motor control methods. Apart from main deliverables and measurables, all the safety parameters were also taken care of while designing and operating the motor. We were able to analyze the anticipated the risks and prepare a mitigation plan for the same. From this project we were enlightened with different aspects of any project such as its technical and business aspects. Aspects such as choosing what components to be used for the project to transforming it into a sellable product were clear to us. Our basic concepts of electrical machines and electric drives were sharpened because of having hands-on experience. Apart from technical skills, our behavioral skills were developed too. Getting to work together as a team in the University created a cheerful and productive environment. Preparing instruction manual, business aspect document and business idea pitching, introductory video and project report and presentation helped us to impart a professional touch to our project. We would like to thank the teachers for giving an opportunity to be able to work on realization of a project which addresses the real time problems and our instructor for timely guidance and support. Page 3 of 54 Table of Contents 1. 2. 3. 4. Introduction .................................................................................................................................. 5 Objective ...................................................................................................................................... 6 Project plan .................................................................................................................................. 7 Simulink model and TI microcontroller ...................................................................................... 8 4.1. Main Simulink model ............................................................................................................ 8 4.1.1. Advantages of TI hardware in the context of MATLAB ............................................... 8 4.1.2. Overview of the main Simulink model .......................................................................... 8 4.1.3. Serial communication .................................................................................................. 10 4.1.4. Hardware Interrupt ....................................................................................................... 11 4.1.5. ADC measurements (current, voltage, how the adc block works)............................... 12 4.1.6. Encoder ........................................................................................................................ 18 4.1.7. PWM signals generation .............................................................................................. 21 4.1.8. Protection ..................................................................................................................... 24 4.1.9. Initialization file ........................................................................................................... 25 4.2. Host model .......................................................................................................................... 25 5. Volts-per-Hertz open loop control ............................................................................................. 26 5.1. Brief introduction to Volts-per-Hertz control ..................................................................... 26 5.2. Volts-per-Hertz open loop control system .......................................................................... 26 5.3. Simulation results ................................................................................................................ 27 5.3.1. No load simulation ....................................................................................................... 28 5.3.2. Load simulation............................................................................................................ 30 5.4. Measured results .................................................................................................................. 31 5.5. V/f conclusions .................................................................................................................... 33 6. Amps-per-Hertz control in the open loop .................................................................................. 34 6.1. Brief introduction to Amps-per-Hertz control..................................................................... 34 6.2. Amps-per-Hertz open loop control system ......................................................................... 34 6.3. Simulation results ................................................................................................................ 35 6.3.1. No load simulation ....................................................................................................... 35 6.3.2. Load simulation............................................................................................................ 36 6.4. Measured results .................................................................................................................. 39 6.5. Amps-per-Hertz open loop control conclusions .................................................................. 40 7. Vector control ............................................................................................................................ 41 7.1. Brief introduction to vector control ..................................................................................... 41 7.2. Vector control system .......................................................................................................... 41 7.3. Simulation results ................................................................................................................ 42 7.3.1. No load simulation ....................................................................................................... 42 7.3.2. Load simulation............................................................................................................ 44 7.4. Measured results .................................................................................................................. 46 7.5. Vector control conclusions .................................................................................................. 47 8. Final conclusions of selected control methods .......................................................................... 48 9. Reflection of the Project ............................................................................................................ 49 9.1. Achieving objectives ........................................................................................................... 49 9.2. Timetable ............................................................................................................................. 49 9.3. Risk analysis ........................................................................................................................ 50 9.4. Project Meetings .................................................................................................................. 50 9.5. Quality ................................................................................................................................. 51 10. Discussion and Conclusions.................................................................................................... 52 List of Appendixes ............................................................................................................................. 53 References .......................................................................................................................................... 54 Page 4 of 54 1. Introduction Control of electric drives and power converters is well-known field in Electrical Engineering, which becomes more and more popular with the rise of the energy consumption. There is also a significant industry development in automation and robotics which has an impact on the rise of electric drives. Customers have specific demands whether it is industry or household, thus different types of converters are needed. The environmental issues such as global warming force us to reduce carbon emissions as much as possible. The efficiency of the whole system plays an important role from economic and ecologic point of view. Hence, electric cars and smart grid system are topics we should deal with. The motivation in this field is enormous and we have already achieved a significant progress in decade. Our project is focused on low-voltage three-phase electric drive, which will be used as a laboratory exercise for future students. Three-phase electric drive will be used to control motor by methods such as scalar and vector control. Three-phase synchronous servo motor operates at very low voltage level and therefore fulfils safety precautions and can be used by laymen without professional competence in electrical engineering. However, to avoid hardware damage, the instruction manual is highly recommended to read. The online module including the hardware and Simulink models will impart the flexibility to the users to choose what kind of motor control they would like to implement. The hardware can be easily bought online and the software with documentation are provided at wiki aalto website. A business aspect for the project including the hardware, Simulink models with instruction manual have been developed and designed to sell the module as a product. The main inspiration behind the business idea is related to how students can learn online with hands-on experience during the lockdown due to pandemic. The aim of the project is therefore to create satisfactory motor control together with the instruction document suited to the knowledge of the students. Thus, it is a simple yet very knowledgeable project which will clear the basic concepts of the students by getting hands-on experience with step-by-step instructions and help from the experts in the field. Similar topology of the final project can be also used widely for different automation industry purposes. Page 5 of 54 2. Objective The objective of the project is to develop a laboratory exercise kit for students. The module will include three-phase electric drive which will be used to control motor by methods such as scalar and vector control. The main task of the project is to create a Simulink model for the open-loop V/f control and to verify the interface between the model and Texas Instruments microcontroller. The microcontroller outputs are then connected with the three-phase inverter. We should get desired inverter output voltage waveforms by which the servo motor is fed. The Simulation model is also considered as an essential part of the main Project. The Simulink model is used to verify the control system and to debug its controlling parts, which are then later used in the main model. The PMSM motor and Inverter model were therefore built for this simulation. The simulation results of each control system are compared with the measured ones. The project can be enhanced with more advanced control methods. Basic applications of the kit could be a mini windmill, crane system etc. With some additional improvements, the project can be implemented into various special industrial automation purposes. The instruction document and satisfactory motor control realization for laboratory exercises are considered as main deliverables of the project. That means the instruction document should be clear for bachelor’s and master’s degree students with basics in the field of Electrical Engineering. The students therefore can easily build the project according to the instruction document. The open-loop V/f motor control can be replaced by advanced control techniques, so the hardware and software can be also used by doctoral students for research purposes. It is expected that the motor will rotate in both directions and the speed is controlled via laptop by typing the required speed to the program. We should be able to switch the states of the motor such as Run, Stop and Reverse. The program should also contain some safety features such as overcurrent and overvoltage protection. The dead time management will also be taken care of. However, the layout can vary in design and it can be also upgraded. More sophisticated control with exact number of rotations can be used and hence some crane system to load the motor can be implemented. Page 6 of 54 3. Project plan Main purpose of a project plan is helping to carry out the project properly and successfully by splitting whole project to clear, smaller tasks and responsibilities, and reserve time for them. Large scale projects cannot be handled in one’s mind, and well documented plan makes returning to plan possible anytime and anywhere needed. Plan also defines a time window when the project should be finished and gives some midterm deadlines for smaller tasks as guidelines of the project progress. Project plan is also a good place for mapping needed resources. To make project successful and finish it in planned time window, it is crucial to understand what the needed resources is such as facilities, measurement equipment, software, and number of workhours. Potential issues and problems should be considered with planned action related to situation to make sure that project will be carried out despite setbacks which will surely come up. When project plan has made properly, is well documented and shared to everyone whom the project concerns, we can be sure that every member is familiar with project and it is accepted by client or instructor. Of course, in this case the purpose on project plan is also teaching what is it and how to do it. A skill to make high quality project plans is very important for many people working in engineering field. In the project plan was descripted high-level phases of project. After excluding documentation parts of the project (project planning, business aspect tasks, seminar tasks and final documentation and instructions), following milestones were considered in project: • Parts procurement • Interface between microcontroller and Matlab/Simulink • Simple open loop control model • Physical hardware built • Integration of HW and SW • Final control system • Final product with some prototype version The primary goal for control system was to implement simple open-loop V/f control model, and the secondary goal was to make more advanced model. At the end of project there were three different models implemented: in addition to a simple V/f model, current control loop was added to V/f model, and vector control model was implemented to the final product. Apart from this, simulation from operation of each model was implemented to compare simulated results with actual measured results. For purpose of demonstrating the project in the final gala, some kind of crane system was considered. Due to need to focus more on efforts required for the other tasks we decided to use less time to implement demonstration system and idea of crane system was replaced by simple propeller attached to motor shaft. Demonstration with propeller is not as fine as we wanted but the results of project can be seen from that and it saved our time. The split of different milestones was relatively successful because the distribution of the work to different milestones was close to the expected Project Plan. High-level phases were more joined together and had to be made more simultaneously. Still the milestones described well the parts of work. Moreover, to build the simulation models was extra task which we can only benefit from. In this chapter, the purpose of a project plan, the main points of that and some comments risen from the plan were briefly explained. More detailed information can be seen from the Project plan in the appendix section. Page 7 of 54 4. Simulink model and TI microcontroller In this project, three different control models are implemented. Most of the part in those models is similar, only difference between those is in control algorithms. Those algorithms are discussed in chapters 5, 6, and 7. In this chapter, the focus is to explain integration of hardware and software. The whole control system contains two main parts, main Simulink model and Host model. The main Simulink model is the part of the software which will be downloaded to the microcontroller and includes control system itself with features such as ADC measurements and protection. The Host model is a user interface in computer and the control tools of motor are present. In the Host model, actual data from the motor and the inverter is also shown. Communication between these models happens via serial communication. The main Simulink model is described in chapter 4.1. and Host model in chapter 4.2. 4.1. Main Simulink model The main Simulink model is the part of motor control software which is downloaded to the microcontroller. It gets ADC measurements from the microcontroller and motor control signals from Host model as inputs and sends control information to inverter as output. In addition, the main Simulink model sends information such as motor speed and inverter’s output currents to the Host model for users’ information. This subchapter explains the different parts of main Simulink model and those actions. 4.1.1. Advantages of TI hardware in the context of MATLAB Although our decision to choose components from Texas Instruments was based on a strong suggestion got from our instructor, there are many advantages of using those together with Matlab and Simulink. When all used components were bought from TI, we got high quality and well documented components which are compatible together and have ready-made software which allows operation in Matlab/Simulink environment. Matlab/Simulink is widely used in universities and thus is often well-known tool where it is easy to start learning. It offers advanced simulation environment where special low-layer programming skills of embedded systems are not needed caused to easiness of visual block programming logic. Matlab has add-ons which makes it possible to program models to TI microcontroller straight in Matlab/Simulink. Embedded Coder Support Package for Texas Instruments C2000 Processors [1] includes set of different blocks for controlling functions and pins in the microcontroller. This add-on also includes documentations and large number of examples how to use the block set. MATLAB Coder [2] and Simulink Coder [3] generates C and C++ code from simulated models and Embedded Coder [4] makes C and C++ code optimized for embedded systems. 4.1.2. Overview of the main Simulink model The whole motor control model is based on ADC measurements and communication between microcontroller and Matlab/Simulink. The ADC measurements and serial communication have been implemented by using Hardware Interrupt and provide conditions for Control Model to operate. The Page 8 of 54 main model includes Hardware Interrupt, ADC Measurements, Serial communication, and the Control model is shown in Figure 1. In addition, the Control model is briefly explained below. Figure 1 - Main control model Control system itself is quite simple and easy to read but when all other features, such as serial communication, measurements and protections are included to model, the whole system is large, and it would be difficult to read without clear structuring. To make the model much more readable, parts of a block diagrams were collected to subsystems and whole model was split to different, logical and functional sections (blue areas in the Fig. 2.) each of which has an initial, important function in the model. From upper left in figure, following logical sections are considered: Measurements, Control system, Communication from Matlab/Simulink, Communication to Matlab/Simulink, Protection and PWM counter compare. Figure 2 - Control model Communication from Matlab/Simulink, as its name implies, gets motor control information from Host model (see Ch. 4.2) in Matlab/Simulink model. The information in this section is shared to other section where it is needed. There is also a datatype conversion in this section. Control system includes the motor control system itself. Section has inputs from user (motor control signals) and from measurements and sends forward the duty ratio for PWM purpose. A ramp function which limits motor acceleration speed is implemented in this section. PWM counter compare gets duty ratio from Control system section and generates PWM signals for inverter’s use. This section also gets information if the inverter should be disabled due to settings or Page 9 of 54 protections. By sending this information to the inverter, inverter’s gates will remain as open circuit, and inverter will be disabled. Measurements section has measured data such as output currents from the inverter and motor rotational speed. This data will be sent to the other sections where needed. Protection ensures a safe use of model. It gets control signals and measurements as input and based of those, sends inverter disable signal forward to stop operation and hence, protecting hardware against damage. In addition, control of microcontroller’s red and blue LEDs, which indicates fault state, is implemented in this section. Communication to Matlab/Simulink responds about data sending to use of the Host model via serial communication. The data is used to show important information about operation, such as motor speed and inverter’s output currents. Functions of different sections discussed are described briefly in this subchapter. More detailed information can be seen later in this document. 4.1.3. Serial communication In order to transmit and receive data between the host system and target device, a common communication protocol must be shared to interlink those systems. The importance of sharing, processing and displaying the data is essential part of interest in embedded systems. Two main communication protocols exist: Parallel and Serial communication. Parallel communication sends multiple bits at the same time. The buses are usually needed to transmit data in huge, crashing bits waves. If we consider 8-bit data bus, 9 wires are needed. Serial communication requires only two wires and stream of data is transferred at speed of one single bit at a time. Therefore, the parallel communication is faster, but it requires more pins. In a microcontroller, certain number of pins is available, so we often decide to sacrifice speed to have more pins. [5] In our application, we are using serial communication to transmit data to the host system and to receive data from the host system. In both cases the serial communication interface (SCI) is used. SCI enables communication with another microprocessor or external network. SCI is asynchronous, so the data does not need an external clock signal. The alternative name for SCI is UART (Universal Asynchronous Receiver/Transmitter), which is better known name. [6] Serial communication Motor Control Blockset blocks are used to enable serial communication between the host model and microcontroller among which belong the Host Serial Receive, Host Serial Transmit and Host Serial Setup. These blocks allow the user to monitor, control, and customize the motor operation in real time. The phase currents and speed can be viewed, speed demand can be adjusted including reversing the speed and the start_stop, run_enable or reset switches can be used to start and stop the motor or reset the fault. The target model (main model) does not have to be deployed multiple times. The measured data is sent through Fast Serial Data Monitoring subsystem, which was taken from the Motor Control Blockset example model. Fast serial data monitoring algorithm is used to perform control and diagnostic operations through the host model. This algorithm supports observation of data from the target device (microcontroller) at the same rate as the PWM switching frequency of 10kHz. The results are therefore more credible in debugging, diagnostics the transients or analysis of the motor behavior. [7] Fast serial transfers are done through Universal Serial Bus connection, which supports SCI. As we already mentioned, the main model is deployed into microcontroller and the board sends signals like currents and speed over the serial interface. The board also receives control signals from the host system. It follows that the use the host model in the host device (computer) is essential in the motor Page 10 of 54 control application. The whole scheme of the motor drive and their controlling and communication parts is shown below. Figure 3 – Three-phase motor drive with control part and communication part 4.1.4. Hardware Interrupt A hardware interrupt is an electronic alerting signal sent to the microcontroller from an external peripheral. For example, when we press a key on the keyboard. The micro controller will read the pressed key or command and perform the task as per the interrupt service routine. Here in this case, we are using two hardware interrupts – one for serial communication and another for ADC measurement. The hardware interrupt block which itself is Interrupt service routine used in Simulink model has function call as an output. This block allows asynchronous processing of interrupts triggered by external events. This makes it more applicable for use in real-time applications for quick response. The interrupts are triggered by calling the function. The size of the function call line equals the number of interrupts the block is set to handle. Each interrupt is represented by four parameters namely CPU interrupt numbers, Peripheral Interrupts Expansion (PIE) interrupt numbers Task priorities, Preemption flags. So, one interrupt is described by a CPU interrupt number, a PIE interrupt number, a task priority, and a preemption flag which altogether can be considered as vector form. The interrupts are given priority in the interrupt service routine. The CPU and PIE interrupt numbers together uniquely specify a single interrupt for a single peripheral or peripheral module. Serial communication interrupt establishes communication between the host model, main model and the microcontroller. It makes user to give commands to the start or stop the motor at a desired speed. The signals which are transmitted over the serial communication are reference speed, start_stop, run_enable and reset. Serial communication has a single interrupt that belongs to both receive and transmit. Reset also acts as in interrupt which disables the other interrupts in case of any fault. Page 11 of 54 ADC measurement interrupt enable to receive information regarding the actual speed, current and voltage which the motor operates with. This is to ensure that the motor is operating correctly as per the given input over the serial communication. These measurements are also useful for performance analysis of the motor. Figure 4 - PIE and CPU Interrupt Numbers for F2837xD 4.1.5. Figure 5 - Block parameters for hardware interrupt ADC measurements (current, voltage, how the adc block works) Brief Theory The TI microcontroller uses a successive approximation register (SAR) analog-to-digital converter (ADC) [8]. This method of ADC is accurate and has nearly no latency, so it is suitable for motor control. The ADC measurements are crucial for the correct operation of the inverter. The basic principle is shown in the figure below. Figure 6- The basic principle of SAR ADC The signal comes to the operational amplifier, and before the signal goes to ADC it is filtered with a low-pass resistance capacitor filter. The ADC has two main phases, the acquisition and conversion phases. In the acquisition phase, the switch one S1 conducts and charges the sampling and holding capacitor. After the capacitor is charged, the conversion starts. The conversion starts from the most significant bit, and it corresponds to half of the measuring scale. If the input signal is higher than compared signal first bit equals one. If it is less, the bit equals zero. Then the second bit is tested, and 1/4 of the measuring scale is added to the existing half. If the input Page 12 of 54 is higher than compared signal, the bit equals one. If not, the bit equals zero. This is repeated as many times as the ADC bit depth is. In TI microcontrollers case it is 12 times. Every step, the added voltage to the comparison signal is halved. When the conversion is done, the capacitor will be discharged to the ground. And a new sample is charged to the sampling and holding capacitor. [9] Voltage measurement The voltage measurement is the first example of the ADC measurement. The block scheme of the voltage measurement is shown in the Figure 7. Let us first examine the ADC block. Information about DC voltage bus is scaled to 3.3V with the use of the voltage divider. Analog voltage is then sampled to discrete voltage information, what can be then processed by microcontroller. This is the main importance of the ADC block. Figure 7 - Voltage measurement Hardware interrupt block triggers an ISR (Interrupt Service Routine) and schedules the execution of the selected subsystem. The sampling is synchronized with PWM, so the (EV) Event Manager triggers the ADC. PWM waveform is generated by the same EV unit and hence it is a trigger source for starting of ADC conversion. When the conversion is done, the ADC sends a flag of the end of the conversion to the microcontroller and the hardware interrupt for the ADC is finished. In the next trigger event, when the counter equals to the period, the trigger will start the conversion again. Data acquisition window was set to be with the broadest width (value 15) to make sure that the data is measured precisely. The voltage signal in the sampling capacitor in ADC is not immediately equal to the sending signal, because of the charging of the capacitor. The data acquisition window value in the settings determines how longs is the sampling switch closed. Block parameter settings are shown in the figure below: Page 13 of 54 Figure 8 – ADC Block parameters settings The ADC resolution is 12-bit (0…4095) uint16 datatype. The number has to be therefore converted into SI value. Some offset and correction have to be made to obtain correct measured results. This is satisfied by Voltage correction and data conversion block. The maximal sensed real voltage 80V is scaled to 3.3V (unit16 - 4095). This value was found in the datasheet, which part of the schematic regarding the voltage sensing is shown below. Inside the correction block, the ADC value is scaled to real value. Figure 9 – DC bus voltage scaling [10] At first, the ADC measured results did not correspond to the voltmeter results. The correction of ADC measured voltages was needed to be made. In given range, according to Table 1, we measured voltages with voltmeter and corresponding voltages with the ADC measurement. Page 14 of 54 Table 1 - Voltmeter voltage, ADC voltage before and after the correction N.o. Real voltage ADC voltage real voltage (with correction) 1 2 3 4 5 6 7 18 20 22 24 26 28 30 19.50 21.67 23.83 25.99 28.16 30.30 32.50 18 20 22 24 26 28 30 Both waveforms have linear dependency. To find correction function, we have to first find equations for both lines and then subtract real measurement line equation with ADC measurement line equation. We can then linearly extrapolate the resulting function for all voltage ranges. This correction was later tested and the ADC results correspond well to the measured one. We do not exclude that for different microcontrollers and inverters this correction will not be suitable, so it is therefore needed to test the correctness of the measurements and rewrite the correction function block based on the similar principle as we did. Figure 10 - Voltmeter voltage and ADC voltage before correction Current measurement The current ADC measurement is to be done in the similar way as a voltage measurement. The current value information in the ADC input can also vary between 0…3.3V. The current scaling and offset are different, so we need to understand how the scaling and offset were done. Let us first take a look at the inverter schematics for current sensing. Voltage scaling is now out of our interest, but you can notice that the same voltage divider was chosen as in the measuring the DC bus voltage. Page 15 of 54 Figure 11 - Phase current sensing [10] The IC INA240A1PW is implemented. By further investigating the IC in datasheet [11], we can find the proper current scaling constant and another useful information. The gain of the operational amplifier is 20 V/V. Another useful information, which was found in the datasheet is the type of the op-amp is in inverted connection. The displayed currents without any correction are inverted. This is the reason why we use gain -1 in the scaling block. Figure 12 - Typical application of the INA240A1PW (inverted opamp) [11] Let us continue with the scaling issue. The current sensing resistor of 5mΩ is used and can be found in the inverter schematics. The maximum voltage over the current sensing resistor can be 3.3V. The maximum range of the measured current can be 3.3𝑉 𝐼𝑚 = 𝑔𝑎𝑖𝑛 ∙ 𝑅 = 𝑐 3.3𝑉 20𝑉/𝑉 ∙5mΩ = 33 𝐴. Because we are also measuring negative currents, the offset needs to be done. The measured range of the current is (-16.5…+16.5 A). Please note, that the inverter has some current limits, so you will not Page 16 of 54 possibly measure in the whole range. We also know about some difficulties with measuring the current lower than -11.2 A, so the viewed results are not trustworthy anymore. That will be discussed in another chapter about measured results. Figure 13 - Scaling and offset Additional offset of 200 (out of 4095) was obtained by experimental measurements, so the sinusoidal currents oscillate around zero. The same notice holds for this experimental measurement as in the previous case. The scaling values can vary depending on the production deviations and condition of the hardware. Figure 14 - ADC current measurement and additional scaling The ADC blocks parameters settings are shown below. Similarly, as voltage measurement, the current measurements are synchronized with the PWM. The importance of synchronizing the currents is more visible in this case. We synchronize the currents with PWM in such a way to get average value of the currents. We are using the same start of conversion trigger number and input conversion channel for all three phases to sample the currents simultaneously. Page 17 of 54 Figure 15 - Current measurement block settings 4.1.6. Encoder The motor has hall measurement and quadrature encoder [12]. In the models, the quadrature encoder is used. In this chapter, quadrature encoders basic working principle and implementation are explained. The basic function is that there are three different sensors, and these detect slits in a disk. The figure below shows the disk and the waveform that it produces. From the pulses, it is possible to calculate the motor speed by derivation of the position. Figure 16 - Encoder disk and waveforms The reason for quadrature encoder pulse A (QEPA) and quadrature encoder pulse B (QEPB) is to tell the pulses and direction. Quadrature encoder pulse index (QEPI) tells when the rotor is rotated the whole rotation or where is the zero position. 2𝜋 ppr = 4∗number of slits (1) If the disk has ten slits, there is a possibility for ten, 20, or even 40 pulses per revolution, because it is possible to calculate the pulse in both rising and falling edge and from both QEPA and QAPB Page 18 of 54 signals. The maximum accuracy of the encoder can be calculated with eq 1 ppr (pulses per revolution), and the direction is known from table 2. Table 2 - Direction of quadrature encoder Clockwise Counter-clockwise time a b a b t1 0 0 0 0 t2 1 0 0 1 t3 1 1 1 1 t4 0 1 1 0 t5 0 0 0 0 When the microcontroller starts for the first time, it does not know which position the rotor is in, So it starts to count from the initial value, usually zero. Now when the QEPI goes high, the controller knows where is the zero position. But this does not mean that mechanical zero position and electrical zero are at the same angle. This is the reason why the offset has to be measured, so the controller knows the electrical angle. If the offset is not well defined, the controller might modulate wrongly, and it might cause harm to the motor. [8] For example, during this Project, the motor did not produce any torque even though the current was at the maximum limit. This happened because the controller modulated only in the id axis because the electrical angle was 90 degrees compared to the real angle. In the instruction, there will be an explanation of how to measure the correct offset. Simulink implementation In the Simulink, there is MathWorks pre-made block for the quadrature encoder. The enhanced quadrature encoder pulse. From pulses to radian conversion was done with motor control blockset’s conversion block quadrature decoder, also form the same blockset speed measurement, and mechanical to electrical position blocks were used. Settings for these blocks are shown in figures 18 – 21 Figure 17 - Position and speed measurement subsystem The implementation of speed and position measurement is quite straightforward. There is a counter for mechanical counts, and that value is converted to a mechanical angle. The mechanical angle can Page 19 of 54 be converted to an electrical angle and mechanical speed. There is low pass filter for the speed to avoid some high noise on measured speed. Figure 18 – The enhanced quadrature encoder pulse block Figure 19 - Quadrature decoder block Page 20 of 54 Figure 20 – Speed measurement block Figure 21 – Mechanical to electrical position block 4.1.7. PWM signals generation Brief theory Pulse width modulation is the most common method used in the inverters to control electric drives and power converters. By changing the pulse width of the output signal, we can change the output voltage and therefore the power as well. The core of the PWM is to chop the signal with the power switches with proper switching frequency to obtain the required output voltage and frequency of the modulated signal. That can be accomplished by comparing the carrier signal with the modulation signal. The most common carrier signal is center-aligned triangular carrier. The modulation signal can vary depending on the type of the modulation. In DC/DC conversion the reference (modulation) is constant. The average value of the voltage can be changed by setting different voltage reference. In the DC/AC conversion, the principle is similar, but the voltage reference is persistently changing. The topology of the inverter is also considered to achieve alternating output signal. The frequency of the carrier influences the output current ripple, but also switching frequency of the switch. Based on that, proper frequency has to be selected. A lot of factors are considered such as switch limits, costs, signal quality and efficiency. In low voltage low power applications, the most common switches for the inverters are MOSFETs with switching frequency 10-20 kHz. In our application, the switching frequency 10 kHz was selected. The simplest PWM modulation signal used in the inverters is pure sinusoidal signal, which solves the problem of high THD of the square-wave inverter, but switching losses are higher. The pure SPWM is not used in industrial application, because only 87% of the maximum available voltage can be used. To achieve amplitude modulation ratio equal to one and use all available voltage, we should add suitable zero-sequence component. As we already know, the zero-sequence voltage does not affect the phase currents and voltage space vector when the load is star connected and the neutral wire is not used and in delta connection . It disappears in space vector transformation. Symmetrical suboscillation method is commonly used in modern electric drives and replaces third harmonic injection. The zero-sequence voltage is calculated as Page 21 of 54 𝑢0 = 𝑚𝑖𝑛(𝑢𝑎,𝑟𝑒𝑓 ,𝑢𝑏,𝑟𝑒𝑓 ,𝑢𝑐,𝑟𝑒𝑓 )+𝑚𝑎𝑥(𝑢𝑎,𝑟𝑒𝑓 ,𝑢𝑏,𝑟𝑒𝑓 ,𝑢𝑐,𝑟𝑒𝑓 ) 2 and the new modified voltage references will be ′ ′ ′ 𝑢𝑎,𝑟𝑒𝑓 = 𝑢𝑎,𝑟𝑒𝑓 − 𝑢0 𝑢𝑏,𝑟𝑒𝑓 = 𝑢𝑏,𝑟𝑒𝑓 − 𝑢0 𝑢𝑐,𝑟𝑒𝑓 = 𝑢𝑐,𝑟𝑒𝑓 − 𝑢0 . (2) (3) We utilize all the voltage without overmodulation. The importance of the Symmetrical suboscillation method is visible in the line-to-line voltages which requires to have higher amplitude than 87% of the DC voltage bus. In the Figure 22, the carrier comparison is shown for the reference speed 1500 rpm in the scalar control model with symmetrical suboscillation method. For simplicity and better readability of the waveform, the switching frequency 2,5 kHz and two out of three phases were chosen. If the reference signal is higher than the carrier, the inverter output voltage with respect to the negative DC bus will be equal to the supply voltage, in other case zero. By subtracting 𝑢𝐴𝑁 and 𝑢𝐵𝑁 we will obtain lineto-line voltage (third waveform). In reality, the triangular carrier is discrete and not analogous in the embedded systems applications. Figure 22 - Symmetrical Suboscillation Method in PWM with switching frequency 2,5 kHz Page 22 of 54 Simulink implementation In Simulink, there is a premade block for PWM outputs. The enhanced pulse width modulator (ePWM). In the ePWM block, it is possible to set the input reference ether with percentage or counter compare, and the value ranges from 0 to PWM_timer_period. Carrier style is up-count (1), downcount (1), or up-down-count (2). Usually, the up-down count is chosen. 𝐶𝑙𝑜𝑐𝑘_𝑠𝑝𝑒𝑒𝑑 𝑃𝑊𝑀_𝑡𝑖𝑚𝑒𝑟_𝑝𝑒𝑟𝑖𝑜𝑑 = 𝑆𝑦𝑠𝑡𝑒𝑚_𝑐𝑙𝑜𝑐𝑘_𝑑𝑖𝑣𝑖𝑑𝑒𝑟∗𝑠𝑤𝑖𝑡ℎ𝑐ℎ𝑖𝑛𝑔_𝑓𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦∗𝐶𝑎𝑟𝑟𝑖𝑒𝑟_𝑠𝑡𝑦𝑙𝑒 (4) The timer period can be either in seconds or in clock cycles. This is the switching frequency and it is only for up-count or down-count. If up-down is used, the timer period has to be divided with two. But the user should use clock cycles. Figure 23 – General and counter compare settings Deadtime is important for protecting the switches. If both the upper and lower switch conducts simultaneously, it will short the dc-bus and break the switch. The ePWM block has a deadband unit that will delay the switching action based on seconds or clock cycles. Page 23 of 54 Figure 24 – Deadband settings When setting the logic for carrier and reference, it is enough to set it only for ePWMA because of the ePWMB works as inversely. So, if the upper switch conducts, the lower does not and vice versa. But the logic for the operation is that when the carrier is counting up and goes bast the reference, it will open the switch, and when the carrier is counting down and passes the reference, the switch closes. Figure 25 – ePWMA settings 4.1.8. Protection To avoid hardware damage, protections against over- and undervoltage and overcurrent were implemented to Simulink model. The protection block gets following information as parameter: DCvoltage and -current measurements, minimum and maximum voltage and maximum current limits and reset, start, run-enable and the previous fault state signals. The block output is fault signal which is high (1) if fault exists and low (0) otherwise. The fault signal becomes high in case the actual measured voltage is outside of voltage limits or measured current is over the limit. In addition, if fault has occurred after the last reset, the fault signal remains high until fault signal has reset properly. The fault signal can be reset only if start and run-enable are off in host model and thus, start and runenable signals are low. This is how it can be ensured that when fault signal changes to low, the motor will not start to rotate due to settings in the host model. Page 24 of 54 In the inverter board, there is one pin reserved to enable signal which allows the microcontroller to enable and disable the PWM modulation. In case there is some fault occurred or run-enable signal has switched off, disable signal will be sent to the inverter and red LED on the microcontroller starts to blink. Three different red LED blinking functions have been implemented to make diagnostics and fault finding easier: • One blink and delay: Undervoltage • Two blinks and delay: Overvoltage • Three blinks and delay: Overcurrent • Continuous blinking: Run-enable switch is off at host model. If there are no faults occurred and run-enable signal has switched on, enable signal will be sent to the inverter and blue LED on the microcontroller turns on. 4.1.9. Initialization file In order to operate properly, the control model needs some initial information about system, such as technical and mechanical characteristics of the used motor, and clock parameters. For that purpose, the initialization file is considered. Initialization file sets initial values to certain parameter and the most important of those is descripted below. Motor parameters play an important role in control model. Mechanical data of motor such as inertia, and electrical data such as stator resistance and synchronous inductance as well as rated values and number of pole pairs are crucial information to get predictable and truthful control of motor. Motor parameters are individual characteristics which can be different for each motor. Similarly, information of encoder and offset in position is individual parameters. Other information based on microcontroller and model itself is defined in the initialization file. These information are CPU’s clock frequency, switching frequency of inverter gates, PWM timer period, sampling period, and bandwidths of current- and speed controllers. Rate limiter values limits the acceleration and deceleration speeds of motor. Parameters related to motor, power supply and encoder should be checked from actual components before start. Some parameters related to microcontroller and model itself can be carefully changed for different projects and learning. These parameters can be for instance, different clocking frequencies, rate limiter values of speed- and current controllers’ bandwidths. Because the information in the initialization file is needed to adjust the control model, the initialization file must be run before downloading software to the microcontroller. In this project, the initialization file is universal for all control and simulation models meaning that every models and simulations can be run with same initialization, but all the parameters are not used in every model. 4.2. Host model Host model is used to establish a communication channel between Simulink on development computer (host) and the target hardware that runs the executable file created by the code generation and build process. The host model transmits signals for e.g., start_stop and run_enable to the main motor control model and receive signals for e.g., speed, voltage and current measurements. [15] More information about how to use the host model to control the motor can be found in the instruction manual (Appendix C). Page 25 of 54 5. Volts-per-Hertz open loop control 5.1. Brief introduction to Volts-per-Hertz control [13] Volts per Hertz (V/Hz) scalar control is based on the main working principle that the ratio between voltage and frequency is kept constant throughout the motor speed range. In this method, the frequency of the stator magnetic flux is set according to the desired synchronous rotor speed while the magnitude of the stator voltage is adjusted to keep the ratio between them constant. This method is named as scalar control because there is no utilization of control over current or voltage. The nominal values of voltage and frequency parameters of the PMSM are used to calculate the V/f ratio. If a constant V/f ratio is maintained between the amplitude and frequency of 3-phase voltage waveforms, the steady state stator flux of the PMSM can be kept relatively constant. However,practically, a typical V/f profile is not constant over complete range of motor speed. V/F scalar control is most commonly used control strategy used for induction motor drives. In case of PMSM, the V/f scalar control is a good alternative in applications where good dynamic performance is not required and there is no need for position sensor. (e.g.: HVAC, fans, pumps or blowers). In case of PMSM, both open and closed-loop control of the speed can be implemented based on the V/f scalar control. For cases where system dynamic response is not a concern, the frequency is determined based on the desired speed and the assumption that the rotor will follow the synchronous speed. This type of control performs the control of PMSM speed without any feedback of motor parameters or rotor position. The motor is driven by the conventional 3 phase voltage-source inverter via BOOSTXL-3PHGANINV. The TI MCU TI Delfino F28379D LaunchPad is being used to generate the sinusoidal PWM signals with bipolar switching. Steady state stator voltage 𝑢𝑠 = 𝑅𝑠 𝑖𝑠 + 𝑗𝜔𝑠 𝛹𝑠 (5) Approximate magnitude 𝑢𝑠 = |𝜔𝑠 |𝛹𝑠 𝑤ℎ𝑒𝑟𝑒 𝑢𝑠 = |𝑢𝑠 | And 𝛹𝑠 = |𝛹𝑠 | (6) 𝑢𝑠 ,𝑟𝑒𝑓 = 𝜔𝑠 ,𝑟𝑒𝑓 𝛹𝑠 ,𝑟𝑒𝑓 where supply frequency 𝜔𝑠 ,𝑟𝑒𝑓 corresponds to desired rotor speed. (7) 5.2. Volts-per-Hertz open loop control system Above all created control systems, the scalar control can be considered as the simplest one and it can be used to control non-dynamic changes low-cost applications such as pumps and fans. For our purposes, we modeled scalar control system to compare it with the other motor control algorithms. The control system used in our model „V_f_control.slx“ is shown in the Figure 26. The main part of the scalar control system is V/f block. The other parts such as reference signal/s, ramp function and duty ratios generation are repeating in the latter control systems. Hence, the V/f control can be assumed as a keystone before developing the other more advanced control systems. Scalar control principle is based on the keeping the flux constant in the open loop control, when the input is a speed reference, and the outputs are adequate duty ratios without any feedback loop. The Page 26 of 54 current and speed measurement are not needed to control the motor and thus it makes the product simpler and cheaper. The control system input is a speed reference in rotations per minute, which is set by a user in the host model. The start signal also comes from the host model. If the start switch is ON, the speed reference is applied, in other case (switch is OFF) the speed reference is zero, so the motor speed will decrease to zero according to the ramp function. If the main switch signal run_enable is zero, the motor will immediately stop. Then the reference speed is converted to the rotor angular speed and the change of speed is limited by rate limiter function block to start the motor smoothly without any overvoltage spikes in the transient state. The rotor angular speed is converted to the electric angular rotor speed (multiplication by the pole pairs). Inside the V/f control block is written a code how to generate voltage reference for the PWM. The reference voltage is in the alpha-beta coordinate systems (stator coordinates). To compensate stator resistance voltage in lower speed region (up to 30 Hz) a boost voltage is used. We linearly approximated this region by line with the initial value of 0.5 V. In the constant flux region, the voltage is increasing as the speed is increasing with the constant rate equal to the magnetic flux constant calculated in the init.m. We do not operate in the field-weakening region and therefore it is not implemented in the code. For better understanding, the absolute value of the voltage space vector is shown in the simulation part. (Figure 27) The main purpose of the PWM block is to generate duty ratios varying between zero and one, which signals are then used in carrier comparison sinusoidal PWM. Inside the block can be found Clarke inverse transformation (voltage space vector transformed into phase voltages). Symmetrical suboscillation method is used to obtain modulation ratio equal to one (by adding zero sequence voltage vector). More information can be found in the Control of Electric Drives and Power Converters course material. The duty ratios are then adjusted in the mentioned range for triangular comparison. Figure 26 – Scalar control open loop system 5.3. Simulation results The rotor speed reference is set to 1500 rpm. The speed is limited with the rate of 100 rad/s. The scalar control system was tested in no-load condition and with the load which describes the repeating Page 27 of 54 sequence block. The real measurements were done without any load and therefore the simulation was done to test stability of the system. To simplify the simulation, some assumptions have been made. The ideal DC voltage source was used in the simulation and no blanking time (so called dead time) with ideal switches was applied. Constant magnetic field of the permanent magnets and constant synchronous inductance of the motor and resistance were also assumed. Figure 27 - Simulated absolute value of the space vector of voltage in V/f open loop control (nref = 1500 rpm) This project is not dealing with the field weakening region and therefore we will not investigate the motor behavior in this region. In the Figure 27, the absolute value of voltage space vector is shown. The boost voltage of 0.5 V is used when the speed is zero. The stator voltage with higher slope in lower frequencies (up to 30 Hz) is there to compensate the losses in the winding resistance. The slope in the higher frequencies is then given by the flux constant (Ψ𝑠 ). 5.3.1. No load simulation In the Figure 28, we can see the simulated motor shaft speed compared with its reference in no-load condition (zero load torque). The speed follows its reference when accelerating. When the speed is constant, the speed deviates around its reference (the average speed is 1493 rpm). Let us observe the phase currents. We can notice the phase currents start to increase above rated current up to 16 A. That is more than two times higher than the rated peak current 7.1 A. In reality, we should not deliver such high currents, because it is inevitable either for inverter or for the motor. In reality, we will not get zero load torque, since we have to assume the friction losses in the bearings and other additional losses. Since the rated torque is only 0.27 Nm, the relative value of non-zero noload torque will be significant and that will cause the amplitudes will be lower than in the simulation. Page 28 of 54 Figure 28 - Simulated motor speed and its reference in open loop V/f control – no load Figure 29 - Simulated stator phase current in open loop V/f control – no load Page 29 of 54 5.3.2. Load simulation Small torque of ten percent of the rated torque is applied in constant speed region. That resulting phase currents lower its value to 15 A. When the load torque is not present (t = 5 s), the phase currents amplitude will rise to 16 A. Figure 30 – Simulated stator phase currents in scalar open loop control – load sequence Figure 31 – Simulated stator phase currents in scalar open loop control – load step (t = 1 s) Page 30 of 54 Another example of motor load is shown in the Figure 31. The load step with value of half of the rated torque is applied during the acceleration. We can observe speed dip and current drop when the load is applied. Then the motor speed resembles the speed during no load, but with lower currents amplitudes. The scalar control is suitable for cheap and easy control of electric drives, but it has poor dynamics. When we are loading the motor with higher load (𝑖. 𝑒. 𝑇𝑟𝑎𝑡𝑒𝑑 /2 𝑜𝑟 𝑚𝑜𝑟𝑒) at zero speed or during the acceleration, the speed starts to reverse and oscillate, and the currents are distorted. The oscillation can be infinite or take a short time depending on the load and the step time. Figure 32 – Simulated motor speed and its reference in scalar open loop control – load step (t = 1s) 5.4. Measured results The measurements use the same parameters as in simulations, so it is possible to compare those two results. The measurements are done without load because it was nearly impossible to generate a constant load that can be adjusted. Page 31 of 54 Figure 33 – Measured motor speed and its reference Measured speed follows well the reference speed. After the motor reaches the steady-state, the speed starts to oscillate slightly, but the first order low pass filter dampens this oscillation. And when observing the motor, the speed does not seem to vary at all. Because of the voltage compensation, the rotor starts to rotate even at a lower speed. Figure 34 – Measured stator phase currents Measured currents agree well with the simulated results. Phase currents can reach nearly 15A peak value. Measured currents are from the inverter itself, and in higher currents, suffer from inaccuracy because operational amplifiers are operating close to the maximum rated value. This phenomenon can be seen in Figure 34. Page 32 of 54 Figure 35 – Measurement error in high speeds As can be seen in the figure above, the negative half of the wave is cut. This phenomenon appears when the current exceeds 11A amplitude. 5.5. V/f conclusions The basic V/f control is easy to implement, and it can rotate the motor. But this control suffers because it is open-loop control, and the only thing that can be controlled is the speed. This causes the motor currents to reach high values at a higher speed because the current is not controlled. This control system is good for simple applications and for the first control system to learn for its simplicity. But this is not suitable for controlling a permanent magnet synchronous motor. because id and iq currents cannot be controlled, and it causes the motor to heat up. Page 33 of 54 6. Amps-per-Hertz control in the open loop 6.1. Brief introduction to Amps-per-Hertz control I/f control in open loop, is an intermediate step between v/f control and vector control. The magnitude of the current command should be set by the characteristics of the load. The amplitude of the current reference should be chosen in such a way that maximum torque per ampere (MTPA) can be achieved. In some methods, a constant current value is considered for analysis or a cut off line is calculated based on the speed dependent curve. Current vector amplitude can be found dynamically by closing the loop. I/f is often used in the start-up routines of pm machines, and then later the algorithm switches to field-oriented vector control. This switch however, causes a spike because the current references of the two control methods do not match. To achieve smooth transition, the current in the I/f control should be brought to MTPA-point (once the speed has settled). If the I/f controller always works in MTPA point and is able to reject load disturbances then it can work as a standalone method and not just to start up the vector controller. 6.2. Amps-per-Hertz open loop control system Amps-per-Hertz open loop control algorithm is an intermediate step between V/f open loop control and vector control. In addition to the V/f open loop control, the phase currents mesurement is done. The current is controlled and we can select current reference alongside with the speed reference. This system has a current PI controller. Let us briefly exlain how the system works. To better understand the algorithm, we recommend to check the model and investigate the functions. The speed reference and its limitation is the same as in the previous example. The electrical angular speed is then used in the Current Controller and PWM block to calculate duty ratios and in the Integrator block to calculate current vector angle. The angle is calculated in discrete time and also it is limited in the range of (−𝛑, +𝛑). Figure 36 - Amps-per-Hertz open loop control system Page 34 of 54 The current control is done in the Current Controller block, where PI controller is used to achieve desired current equal to current reference. Since the 𝒊𝒒 current component produces the torque, we used in the current reference 𝒊𝒅 = 𝟎 𝑨. The current 𝒊𝒒 can be changed depending on the load, but for simplicity we used constant current value. Since we are using control frame, whose angle is generated from the speed reference not from the true rotor angle, the 𝒊𝒒 reference does not purely generate the torque. By measuring the speed and position of the rotor in the next chapter about vector control, we can set the rotor frame whose q component will generate the torque. Similarly as in the previous model, the symmetrical suboscillation PWM was used. The run_enable signal is used to update the integral state of the current controller when it is ON and to clear the integral state (set the integral to zero) when the switch is OFF. 6.3. Simulation results Similar starting conditions regarding reference speed and rate limitations are implemented in the upgraded control system. The measured currents are now used in Amps-per-Hertz open loop control. In addition to the reference speed, the currents 𝑖𝑑 and 𝑖𝑞 are used as references. Those currents represent space current vector in rotor coordinates. 6.3.1. No load simulation Stator phase currents in Amps-per-Hertz control in no load are represented by current space vector, which is composed of the 𝑖𝑞 and 𝑖𝑑 component. The 𝑖𝑞 component was set to 𝑖𝑞 = 4 𝐴 . Therefore, the amplitude of phase currents is also 4 A. The current controller bandwidth α𝑐 = 2 ∙ π ∙ 200 was tested at instant, when the motor starts accelerating or when motor reaches its speed reference. When motor starts accelerating, the 𝑖𝑞 component will reach the refence fast enough. The 𝑖𝑑 component is non-zero (𝑖𝑞,𝑚𝑎𝑥 ≈ 15 𝑚𝐴) and during acceleration after the transient state it will be 𝑖𝑑 ≈ 8 𝑚𝐴 . Similarly, the 𝑖𝑞 differs compared to its reference during acceleration by 8 mA ( 𝑖𝑞 = 4.008 𝐴 ). When the speed is constant, the components are equal to the references. Page 35 of 54 Figure 37 - Simulated current space vector components (no load) The motor speed waveform perfectly follows the reference speed during the acceleration. In the end of the acceleration period (similarly as in the beginning), there is a tiny oscillation which is damped well. Figure 38 - Simulated motor speed and its reference in in Amps-perHertz open loop control (no load) 6.3.2. Load simulation The load simulation during acceleration turned out to be instable and the motor speed collapsed. Therefore, the simulation is done during the constant speed. In the Figure 39, we can observe the load step response (𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /4). The main consequence is the speed oscillation with relatively high initial deviation (circa 200 rpm). This oscillation can be reduced by higher 𝑖𝑞 component value. Page 36 of 54 Figure 39 - Simulated motor speed and its reference in in Amps-per-Hertz open loop control (𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /4) The reaction of current vector components on the load is shown in the following figure. The oscillation of both components is significant with similar amplitudes and attenuation. Figure 40 - Simulated current space vector components (torque response) The stator phase currents waveform is shown below. We can observe how the phase currents are changing when the load is applied and how long it takes to reach the initial amplitude. Page 37 of 54 Figure 41 - Simulated stator phase currents in in Amps-per-Hertz open loop control – load step (t = 2.1 s) The last figure from this type of simulation shows the 𝑖𝑑 current oscillation disturbance. The load was reduced up to 10% of rated torque to view the oscillation in steady-state condition. Figure 42 - Simulated current space vector components (𝑇𝑙𝑜𝑎𝑑 = 0.1 ∙ 𝑇𝑟𝑎𝑡𝑒𝑑 ) Page 38 of 54 6.4. Measured results The measurement uses the same parameter as the simulation, and the motor does not have a load. Figure 43 – Measured current space vector components When the motor starts to accelerate and the current reference is applied, the id current oscillates the maximum value for id ≈ 0.3 A. But when the current reaches the desired value id goes to zero. Figure 44 – Measured stator phase currents The figure above shows that the current controller keeps the amplitude at a constant 4 A value, even when the rotor accelerates. Page 39 of 54 Figure 45 – Measured motor speed and its reference In the measurement, there was some weird oscillation around 600 rpm. This also occurred in steadystate. Open loop I/f control is not fully stable in the entire operating region and exhibits areas of poor dampening. 6.5. Amps-per-Hertz open loop control conclusions In conclusion, the amps-per-hertz control works better than the V/f control. The motor does not heat up if the current is chosen correctly. This happens because, in V/f control, we cannot control id and iq current components or even the current, but in amps-per-hertz, a current controller controls these components individually. One downside of this control method is that it always modulates that specific current instead of load-dependent current. Page 40 of 54 7. Vector control 7.1. Brief introduction to vector control [14] Vector control is also known as field-oriented control or simply field orientation control. In this type of control, a dq frame is constructed which rotates synchronously with the motor flux. The current control is most commonly performed in this type of frame. Generally, the load or source is modeled as a series connection of a resistance, an inductance, and a voltage source as shown in figure below. The model can be written as 𝑉 𝑠 = 𝑉𝑠𝑠 , 𝑖 𝑠 = 𝑖𝑠𝑠 , 𝑅 = 𝑅𝑠 , 𝐿 = 𝐿𝑠 And back emf 𝑑𝛹𝑅𝑠 𝑠 𝐸 = = 𝑗𝜔𝑟 𝛹𝑅 𝑒 𝑗𝜃 𝑑𝑡 Vector control can be defined as the control of phase and amplitude of a motor stator voltage vector or current vector at the same time. The motor torque depends on the stator current space vector 𝑖𝑠 = 𝑖𝑑 + 𝑗𝑖𝑞 . Thus, control of id and iq can control the motor torque where current 𝑖𝑑 as excitation current, on the control of 𝑖𝑑 , considering id = 0 as the control strategy. The current components 𝑖𝑞 and 𝑖𝑑 can also control the active and reactive powers P and Q respectively. Unity power factor can be obtained with an assumption as id = 0. For PMSM, 𝐿𝑑 = 𝐿𝑞 , equation is implemented into the electromagnetic torque equation. Torque equation is only related to the parameters electromagnetic torque and the q axis current 𝑖𝑞 . Therefore when 𝑖𝑑 = 0, maximum torque control can be achieved with the control of the 𝑖𝑞 , in PMSM vector control. 𝑖𝑑 and 𝑖𝑞 equations 𝑑𝑖 𝐿 𝑑𝑡𝑑 = 𝑣𝑑 − 𝑅𝑖𝑑 + 𝑤𝐿𝑖𝑞 − 𝐸𝑑 𝑑𝑖𝑞 𝐿 𝑑𝑡 = 𝑣𝑞 − 𝑅𝑖𝑞 + 𝑤𝐿𝑖𝑑 − 𝐸𝑞 7.2. (8) (9) Vector control system The vector control system is considered as the most advanced system above all mentioned control systems in this project. It can handle the dynamic load changes better than scalar control system. This Page 41 of 54 is reached by implementing current control loop and speed control loop; therefore, we need to measure current and speed of the motor. The output of the rate limiter is angular motor speed reference and together with measured angular speed it leads to the speed controller to generate torque reference. The torque reference is then used in the Current Reference block to generate propriate current reference in rotor flux coordinates. We do not expect going into field-weakening region and therefore only the 𝑖𝑞 current is computed. The permanent magnet flux constant can be found in the datasheet [12]. The current controller is basically the same and therefore the same principles hold as in the Ampsper-Hertz control. The only difference is that now the rotor position is not estimated but measured. From the measured rotor position we also obtain the measured speed. Figure 46 - Vector control system 7.3. Simulation results 7.3.1. No load simulation In the previous in Amps-per-Hertz open loop control, the current PI controller was implemented. The vector control has a speed control loop in addition to the current control loop, which improves the dynamics of the electric drive. By the term of better dynamics is meant higher stability when the load step is applied, lower oscillations, higher damping and faster response of the speed and consuming only as much current as it is needed. Small additional load torque was selected (𝑇𝑀 /30) to simulate impact of friction losses and other additional losses. This torque was adjusted based on the measurement results in no load condition. As we can see from the Figure 47, the current amplitude is 0.25 A and it keeps constant curing the acceleration. After the acceleration, the current decreases to 0.23 A. In reality, the additional losses and friction losses are not constant in whole speed region, so the measured waveform will be slightly different (see the next chapter). Page 42 of 54 Figure 47 - Simulated stator phase currents in vector control – no load The 𝑖𝑑 current oscillation disturbance is not visible from the figure below. However, the real measurement senses the disturbance. Non-zero 𝑖𝑞 current is needed to compensate the friction and additional losses. Figure 48 - Simulated stator current components comparison – no load Page 43 of 54 7.3.2. Load simulation The load simulation with load of 𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /2 was done during the constant speed, but also during acceleration. In both cases, the vector control succeeded, and the control did not collapse. However, the speed controller might have difficulties when higher loads close to the rated load occur during the acceleration. Overall, the vector control is assumed to be the best control technique compared with the previous motor control systems. Let us show an example when the load of 𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /2 is applied in 𝑡 = 2.1 𝑠. We can observe a deep speed dip at the instant when the load is connected. However, the attenuation back to the reference is momentary. Figure 49 - Simulated motor speed and its reference in vector control (𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /2) The stator phase currents are shown in the Figure 50. The load step causes the amplitudes of the currents to increase. During the acceleration, small load torque 𝑇𝑀 /30 causes non-zero phase currents. Page 44 of 54 Figure 50 - Simulated stator phase currents in vector control (𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /2) Current vector components in rotor coordinates are shown in the figure below. We can observe id current spike as result of changing load, despite the reference zero. The iq component which produces torque has lower spike than the reference. Figure 51 - Simulated stator current components comparison (𝑇𝑙𝑜𝑎𝑑 = 𝑇𝑟𝑎𝑡𝑒𝑑 /2) Page 45 of 54 7.4. Measured results The measurement uses the same parameter as the simulation, and the motor does not have a load. Figure 52 – Speed measurement When the speed controller is added, the oscillation in 600 rpm disappears, and in steady-state, the speed remains constant. Figure 53 – Measured stator current components From the figure above, it is possible to see that this specific acceleration rate does not require that much current from the inverter. If the motor is loaded, the current will rise as well, but this cannot be measured because the project group did not have access to the load motor. Page 46 of 54 Figure 54 – Measured stator phase currents The current waveform does not match simulated results. But the current demand should be quite low because the acceleration rate is low, which means the torque that is needed to accelerate the motor is small. 7.5. Vector control conclusions Vector control solves the problem that amps-per-hertz control had. In vector control, it is possible to control the current according to the load. When the current is lower, the motor will produce less heat, and the system efficiency is better than in amps-per-hertz control. Page 47 of 54 8. Final conclusions of selected control methods The conclusion on these control methods is that vector control is probably the best because it can control the current according to the load. But the vector control is also the most advanced control method, and it needs more knowledge than the V/f control, for example. The V/f control is easy to understand in concept, and it is an excellent starting point for new students to learn how to control electric motors. This control system is suitable for simple small asynchronous motors such as small pumps or fans that do not need accurate control. This control is not ideal for permanent magnet synchronous motors, especially when the motor is not loaded, because the currents can get high, and worst case, this might cause the motor to overheat. Amps-per-hertz control is a good middle point between V/f and vector control. It has a lot of benefits compared to V/f control. For example, the currents can be controlled. When currents are controlled, the motor will not overheat, assuming that the current reference is selected correctly. Each part has good things to learn. When building V/f control, the student should also implement basic measurements and protection functions because these things are necessary for the next part, amps-per-hertz control, where the student can test the current controller. When the current controller is implemented, there might be some errors, and that’s why the protection for over-current is critical. When the current controller works, it is easy to implement the vector control. Overall, these steps are necessary for understanding how to implement control systems in an actual application. Page 48 of 54 9. Reflection of the Project 9.1. Achieving objectives Main objectives of the project can be distributed into two different goals. The first goal was to implement a satisfactory motor control realization for laboratory exercises. The second was to write an instruction document for peer students. Both goals should be achieved for calling project successful. In the Project plan (Appendix A) was mentioned that at least a simple open-loop V/f control model should be considered with features such as proper control actions (e.g., run, stop, inhibit), protection against over- and undervoltage and overcurrent, and dead-time management. The instruction document should be clear for bachelor’s and master’s degree students with basics in field of Electrical Engineering. The open-loop V/f control model should also be possible to replace with advanced control techniques so that exercise can be used by doctoral students for research purposes. The other, optional goal mentioned in the Project plan was to implement more advanced control models, such as vector control. The first main goal can be considered as successful. A working open-loop V/f control with suitable user interface was successfully implemented. Moreover, the open-loop I/f control and the vector control models were developed during this project. The main control model is split to logical areas so that upgrading the control algorithms is easy to do. In addition, a simulation models for each control model were created to compare simulated results to measured results. The second goal related to the instruction document can be also considered as successful. The document has clear, step-by-step guide how to download needed software, get started and use the models. Therefore, it can be though that objectives were achieved, and project was successfully completed. 9.2. Timetable Timeline of the project was planned by using a few different tools. Firstly, the project was split into high-level phases based on milestones and deadlines of project. Secondly, work was distributed to work packages and tasks with estimation of time needed to finish these. Based on those, estimated timeline of the project was created by using Gantt-chart form. In larger scale, the estimation of timeline was quite realistic compared to reality. Despite changes in the project plan, such as replacing the crane system by propeller and creating simulation models, high-level phases, milestones, and deadlines were met at time. However, a split to high-level phases was not completely accurate because some phases of the project were merged together and thus take less time. On the other hand the other tasks took more time to complete. Although the estimated timeline was quite realistic, estimation of time needed to complete different work packages and tasks was not so successful. Verification and debugging of the models took more time than planned. However, that was not major issue because there was time resourced to different problem situation which made timeline slightly more flexible. Furthermore, time resourced to crane system was used to advanced research work package and simulation models. In consideration of the fact, that the group members learned to be familiar with project planning in this scale, the planned timetable was fairly successful. Page 49 of 54 9.3. Risk analysis In the project plan, some possible anticipated risks are listed which can affect negatively to project work. During this project some out of those listed risks have been realized. • Resource unavailability: Lab equipment. Due to pandemic situation and some misusing and inappropriate behavior in the Aalto spaces by some students, free entry to laboratory equipment at Sähköpaja was restricted without instructor or authorized person. This problem has been managed by arranging laboratory meetings at time when some instructor was there. In addition, one of the group members has all materials and measurement devices to do needed laboratory work at home, which helped a lot with this problem. • Hardware damage. The inverter broke down during the work. Effects caused of this was only minor because damage does not happen at critical phase of the work, and delivery of new ordered inverter was quite fast. In addition, there was the other spare inverter available if damage would have happened at critical time. • Delay in timeline: Implementation of final models and making those clear took more time than estimated. Due to that, the crane system considered to be used to demonstrate our project was replaced by simple propeller. Hence, workhours reserved to build the demonstration system were used to do more important tasks. Additionally, simulation models for each control system were built instead of the crane system implementation. In the situations when some problems occurred, the team reacted those by using the actions described in risk management section in project plan. The defined actions worked very well in realized risk situations. 9.4. Project Meetings Initially project meetings have been arranged as planned, twice a week, one of which with only group members and other with the instructor. However, the amount of meeting depended on needs, and there were weeks with less meetings and, especially at the end of the course, several meetings were arranged on weekly basis. Due to pandemic situation, the most of meetings were arranged via MS Teams, which is also used for all information and resource sharing. There were still needed some meetings in Sähköpaja laboratory in campus for building and verifying the product. The need of meetings in person reduced as one of the group members had his own components and measurement equipment, and he was able to do product and some measurements and debugging at home. Meeting agendas were defined for every meeting with the instructor. Although the meetings with only group members was planned to be more freely, for most of meetings have been defined some main agenda by project manager. The main points of the meetings with the instructor have been written and archived to MS Teams where they were available later. During the course there was many things what we learned related to project meetings. The utility of creating agenda and writing memos of meetings is obvious. At start of meeting, it is easier to focus to essential things when the agenda is defined beforehand. When information and memos of meetings is archived, there is no need to remember those and those who have been unable to participate to meeting can get the information afterwards. We also noticed how complicated is to try to find time to meeting in the situation that every group member has individual and different schedule. In this case, there was only four of us and the instructor. If integration of schedules felt difficult now, it is probably almost impossible with much larger groups. Page 50 of 54 There were some benefits from remote meetings such as when schedule is busy, there is no need to transfer between different locations. On the other hand, we noticed that contact meetings are much more natural and comfortable, and even productive than remote meetings. 9.5. Quality In the project plan have been mentioned that each group members have a responsibility to complete his work to the best of his ability with team collaboration so that quality of the work fulfils the instructor’s expectations. Everyone also has responsibility to inform others about the quality issues if occurred so that can be taken into discussion in next meetings. The quality expectations have been ensured by weekly meetings with the instructor. Therefore the quality and organization of the project can be considered as successful. There were a only few quality issues which had a negative effect on the work. Firstly, during an implementation of Simulink model, we had done some quick fixes to models whose only purpose was to get some other part to work. Some of those quick fixes had made the models more complex and difficult to read. The result was that we had to use more time to reduce all redundant parts and simplify the models. The other minor issue was a version control. During the development of models, all of us made changes to same models and update them ,but sometimes it happened that changes were made simultaneously and the versions were not synchronized. It was usually about quick fixes which could be merged together. The best way to avoid this problem would have been to use some version control software like Git, which prevent to make changes to file if the latest version is that file not updated. Page 51 of 54 10. Discussion and Conclusions This project was an excellent opportunity to learn skills from many fields. We learned theory related to electric motors and control of these, but also how to use that knowledge to create working control models in Matlab/Simulink environment. Hence, this project gave us much experience in hardware as well as software. Due to business aspect exercises, we got little touch from financial side of research work. This project taught us how to combine skills and individual strengths from different fields and use these to solve all problems encountered and achieve the best possible results. The practical skills and project based working experience is important for future working life. Roman- After completing the project, I gained a deeper understanding of the motor control. The interface between Texas Instrument hardaware and MATLAB Simulink is perfect. I recommend to beginners to start with the TI microcontroller, because of the easiness of block logic. No special lowlayer programming skills of embedded systems are needed. The basics of MATLAB and Simulink are advatage to know beforehand. I also learned as a project manager how to understand people’s opinions, how to deal with a huge variety of daily problems and how to organize meetings. It is still far away from professional management, but it was a good practice and improvement. Shweta- After the completion of the project, I got a multi-dimensional learning experience. It includes aspects regarding technical skills, business skills, behavioral skills etc. The main motivation for choosing this project was to get an opportunity to work on both software and hardware part of a project. I learned about how a motor works and different control methods. Getting to work on simulink models for motor control and host model was very helpful for strengthening my theoretical concepts. Struggling with meeting in the university campus during the pandemic situation was challenging. The desire to learn and weekly meetings with the team and instructor really kept me going. Hannu- From the project, I learned how motor control works and how to implement it into the real system. I picked this project work because I have worked with frequency converters quite long time already, but I did not have any expertise on how the control system is implemented. Whole my career with frequency converters, I have worked only with hardware and prebuild systems. I think that this project gave excellent insight into how the hardware and software work together. The most significant challenge for this project was COVID because of the remote teaching. Jaakob- This project helped me to learn and get deeper understanding about motor control. Creating control system by using Matlab/Simulink environment together with Texas Instruments high-quality components was inspirational and instructive experience. This project also taught me the realities related to project-based working and I am sure that this was very beneficial in my future. However, due to current pandemic situation, this project explained an importance of personal meetings and face-to-face conversations. I think the pandemic situation was the major challenge for the project. Page 52 of 54 List of Appendixes Appendix A: Project Plan Appendix B: Business Aspects Appendix C: Instruction Manual Page 53 of 54 References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] MathWorks, ”Embedded Coder Support Package for Texas Instruments C2000 Processors,” [Online].Available: https://www.mathworks.com/matlabcentral/fileexchange/43096embedded-coder-support-package-for-texas-instruments-c2000-processors. [Searched 21. 5. 2021]. MathWorks, ”MATLAB Coder,” [Online]. Available: https://www.mathworks.com/products/matlab-coder.html. [Searched 21. 5. 2021]. MathWorks, ”Simulink Coder,” [Online]. Available: https://www.mathworks.com/products/simulink-coder.html. [Searched 21. 5. 2021]. MathWorks, ”Embedded Coder,” [Online]. Available: https://www.mathworks.com/products/embedded-coder.html. [Searched 21. 5. 2021]. J. Blom, ”Serial Communication,” Sparkfun, [Online]. Available: https://learn.sparkfun.com/tutorials/serial-communication/all. [Searched 15. 5. 2021]. TechTarget Contributor, ”What Is Serial Communications Interface (SCI)?,” 24. 3. 2011. [Online]. Available: https://whatis.techtarget.com/definition/serial-communicationsinterface-SCI. [Searched 21. 5. 2021]. MathWorks, ”Motor Control Blockset - Getting Started Guide,” 9. 2020. [Online]. Available: https://www.mathworks.com/help/pdf_doc/mcb/mcb_gs.pdf. [Searched 21. 5. 2021]. Texas Instruments, ”TMS320F2837xD Dual-Core Delfino Technical Reference Manual,” 1. 2019. [Online]. Available: https://www.ti.com/lit/ug/spruhm8h/spruhm8h.pdf. [Searched 21. 5. 2021]. Texas Instruments, ”8.1 Introduction to SAR ADC Front-End Component Selection,” [Online]. Available: https://training.ti.com/ti-precision-labs-adcs-introduction-sar-adc-frontend-component-selection?context=1139747-1140267-1128375-1139106-1128643. [Searched 21. 5. 2021]. Staebler ja Zhou, ”BOOSTXL-3PhGaNInv (No. SENS007),” Texas Instruments, 24. 1. 2018. [Online]. Available: https://www.ti.com/lit/df/sluray0a/sluray0a.pdf?ts=1621154330263&ref_url=https%253A% 252F%252Fwww.google.sk%252F. [Searched 21. 5. 2021]. Texas Instruments, ”INA240 High- and Low-Side, Bidirectional, Zero-Drift, Current-Sense Amplifier With Enhanced PWM Rejection,” 2. 2018. [Online]. Available: https://www.ti.com/lit/ds/symlink/ina240.pdf?ts=1621574727469&ref_url=https%253A%25 2F%252Fwww.ti.com%252Fproduct%252FINA240. [Searched 21. 5. 2021]. Tecnic, ”Industrial-Grade NEMA 23 Motors,” [Online]. Available: https://www.teknic.com/files/product_info/N23_Industrial_Grade_Motors.pdf. [Searched 21. 5. 2021]. NXP Community, ”Module 5: V/F Scalar Control,” 15. 1. 2018. [Online]. Available: https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Module-5-V-F-ScalarControl/m-p/726087. [Searched 21. 5. 2021]. L. Harnefors, M. Hinkkanen, O. Wallmark ja A. G. Yepes, Control of Voltage-Source Convertersand Variable-Speed Drives, Stockholm: Kungliga Tekniska Högskolan, 2015. MathWorks, ” communication-between-host-and-target,” [Online]. Available: https://in.mathworks.com/help/mcb/gs/communication-between-host-and-target.html Page 54 of 54