Home
Description - STMicroelectronics
Contents
1. 20 85 Figure 6 V f and slip regulation VIf ratio is maintained as a consequence the airgap flu is constant Torque C gg ee Loading torque t pical HVAC load e Working points Closed loop speed regulation a PI controller manages the slip in fact since the airgap flu is constant torque is direct controlled b slip e Stator Flu rotation speed ye Slip r Rotor speed Figure 7 V f and slip regulation control scheme AC Mains LM N i Speed sensor V f calc Ose limiter J O limiter 5 i i i i i i i i i i Oe 1 Or Oso Or 1 Legend V Voltage amplitude Reference stator speed e Slip speed reference value ay Target rotor speed amp Measured rotor speed Figure 7 shows that the output of the PID speed controller is a precise reference slip speed value Gs which added to the measured rotor speed a is the reference stator speed e Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control The PID speed controller can be tuned in real time by using the LCD user interface see Figure 24 and Section 3 3 2 Speed regulator parameters Furthermore under nominal flux conditions stator current increases linearly with slip speed therefore the slip speed saturation block limits the stator current within
2. When the motor is still enter a negative target rotor speed to run the motor in the opposite direction Doc ID 15783 Rev 1 33 85 Running the demonstration program UM0712 3 3 Using the ACIM user interface sub menus for motor control 3 3 1 ACIM user interface sub menus Press the joystick RIGHT or LEFT to navigate between sub menus Each sub menu of the user interface is composed of two fields which are in turn composed of one label one value and the corresponding unit for example ampere voltage temperature Figure 22 shows the structure of a typical sub menu however the corresponding unit is not displayed in this case The field can be editable or read only e Aneditable field can be selected and modified by the user when the cursor P is displayed beside the field e A read only field is used to display a value The user can neither select it nor modify it Figure 22 User interface sub menu Editable field Read only field Labels max 8 char Field active when blinking To select and modify an editable field the following steps are required 1 Press the joystick UP or DOWN to navigate between the editable fields of the sub menu The cursor blinks when the field is active 2 Press JOYSEL to select an active field The cursor changes to an up down arrow 1 Change the value by pressing the joystick UP or DOWN see Figure 23 4 To exit from edit mode press JOYSEL again or change sub m
3. Contents UMO0712 6 Module description 2 00 cece ee eee 80 6 1 High level modules 00000 eee 80 6 2 Low level modules 000 eee ee 81 Appendix A Additional information 0 0 00 eee eee 82 A 1 DAC configuration 066226 su nr donee RR n hr Ro RR RR ee aes 82 A 2 Motor control related CPU load 0 00 cee ee 82 A 3 References 0 0 cette eee 83 A 4 STM8 motor control builder GUI n a naana anana 83 REVISION history i4 2a ak aca aca ac OE 3 39388 Re Abano aan wh ees 04 8 e saw seam 84 4 85 Doc ID 15783 Rev 1 ky UM0712 List of tables List of tables Table 1 Table 2 Table 3 Table 4 Table 5 Table 6 Table 7 Table 8 Table 9 Table 10 Table 11 Table 12 Table 13 ROM and RAM requirements 00 cece eee eee 12 Joystick actions and conventions 0 e tees 31 Virtual reglsters u usse ee See Sees ee ie eee eee ahs 44 Vit al VOS Lm 45 ACIM drive structure for speed closed loop control 0 0c cee eee eee 46 ACIM drive structure for speed open loop control 0 00 cee 48 PWM amplitude resolution CPU frequency 24 MHZ 0000 0c eee eee 51 PWM amplitude resolution CPU frequency 16 MHzZ 0 2000 cee eee aes 52 ACIM virtual timers u 2 4 0 i44 0ec0bi Rec Geld eyed vada dea du xia V aa eee 58 Tacho input capture filter duration 0 0 llle BB 78 Example of ACIM motor control f
4. If the validation speed explained above is not measured within a period defined by the define statement STARTUP DURATION an error message startup failed is generated and the state machine moves from START state to FAULT state Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control 4 Figure 12 Closed loop startup strategy A actual rotor speed 0 STARTUP VAL SPEED measured rotor speed 0 r meas stator voltage frequency 0 STARTUP SLIP A stator voltage amplitude V STARTUP VO 1 Legend a Actual rotor speed VT Measured rotor speed ator voltage amplitude Doc ID 15783 Rev 1 27 85 Introduction to STM8S ACIM scalar control UMO0712 2 7 28 85 Three phase PWM sine wave and third harmonic generation To fulfill the basic AC induction motor voltage needs the reference PWM modulating signal can be a pure sine wave left graph of Figure 13 However this kind of modulation makes poor usage of the DC bus voltage If we consider Vbus as the bus voltage after mains rectification the maximum available voltage on a motor using a standard three phase power inverter is around 86 of Vbus Equation 13 Vohase neutral Vbus 2 with Vneutral Vpus 2 Voiiage phase 9X Vpk 49 2x Viu Adding a third harmonic modulation to the reference sine wave fundamental decreases the overall amplitude o
5. MC stm8s ACIM it This module contains all the interrupt service routines defined inside the interrupt vector that are NOT used by the firmware The interrupt service routine used by the firmware is defined inside each module that uses it MC stm8s clk This module manages the function responsible for setting the microcontroller clock MC stm8s DAC This module manages the digital to analog function implemented for debugging purposes It use TIM3 as described in Section A 1 MC stm8s display This module contains the low level functions that interact with the LCD display It has been developed on top of the mono 1cd module Exported functions include dev displaylnit used to configure the hardware for the LCD visualization dev displayClear used to clear the LCD screen dev displayFlush displays the data that have already been formatted by the MC display module dev displayPrintch used to refresh the cursor MC stm8s keys This module is used to initialize the hardware dev keyslnit MC stm8s port This module is used to initialize the GPIOs of the microcontroller required for configuration MC stm8s vtimer This module is used to implement management of the low level virtual timer so it is used only for initialization of the hardware dev vtimerlnit and contains the interrupt service routine of TIM4 vdev ios This module is used to manage the low level input output functionality see Table 3 Virtual registers Doc
6. 0 ete 27 Pure sine wave modulation and equivalent with third harmonic added 28 Third harmonic injection with increased fundamental amplitude 29 Third harmonic PWM modulation and corresponding currents 00 005 29 Bus voltage ripple compensation 0 000 eee eene 30 ACIM user interface menu structure and navigation 00 0c eee 32 ACIM drive welcome message ssssssssese rne 32 Jul PT kids ee ee ier ena see Paes Bowe ee aia 33 Main window showing target rotor speed and measured speed 33 Selecting the target rotor speed 1 6 teeta 33 User interface sub menu 6 0 tees 34 Field selected for editing 2 0 0 ccc eee ee 34 Constant flux control and slip regulation via PID 0 0000 cee eee 36 Constant slip control and flux regulation via PID llle 36 Drive strategy parameters 2 0 ec eee 36 Startup parameters 2 2 teens 36 Control strategy parameters 0 0 0 0 eet ee 37 Bus voltage and heatsink temperature parameters 000 eee eee eee 37 Error message shown in the event of an undervoltage fault 00 39 Main motor control state machine llle 41 STM8S motor control library architecture High level low level interface 42 STM8S motor control library organization llli sene 43 TIMI initialization erae sinen RR IRRIRRRRRAI HIA 51 TIM
7. N UM0712 J User manual STMB8S three phase AC induction motor control software library V1 0 July 2009 Introduction This user manual describes the alternate current induction motor ACIM scalar software library developed for STM8S microcontrollers These 8 bit ST microcontrollers STM8S come with a set of peripherals that make them suitable for performing both PM and AC induction motor scalar control The present document describes the STM8S software library developed to control induction motors in open loop or speed closed loop depending whether they are equipped with a tachogenerator speed sensor or not The control of the brushless direct current BLDC motor equipped with three Hall sensors or sensorless in six step mode is described in UM0708 The ACIM motor software library is made of several C modules and is fitted with STVD workspaces It is used to quickly evaluate both the MCU and the available tools When it is used with the STM8 128 MCKIT motor control starter kit and an AC induction motor a motor can be made to run in a very short time The ACIM library also eliminates the need for time consuming development of low level drive and speed regulation algorithms by providing ready to use functions that allow the user to concentrate on the application layer A prerequisite for using this library is basic knowledge of C programming AC motor drives and power inverter hardware In depth know how of STM8S functions is
8. UM0712 Getting started with the STM8S ACIM firmware 4 4 3 ACIM scalar control The high level shell of the ACIM scalar control drive is implemented in the current firmware library source file MC ACIM Drive c This module implements the control schemes explained in Section 2 4 Speed closed loop control and Section 2 5 Speed open loop control Figure 39 shows the functions implemented in the current firmware together with their connections It also shows the main connections with other modules The core function is ACIM Drive which is awakened automatically by the virtual timer V TIM ACIM DRIVE The periodicity is fixed by the CONTROL LOOP PERIOD define statement see Section 5 1 3 ACIM drive control define statements MC ACIM Drive Param h This function can be divided into three successive stages 1 Arequest for the rotor speed measurement to be updated The Tacho CalcSpeed HzMec function is called using the MC tacho c module 2 The three phase sine wave voltage and frequency to be calculated in the next control period This is done according to the current state of the application state machine if in idle start or run state a If in idle state No operations b Ifin start state ACIM StartUp ClosedLoop or ACIM StartUp OpenLoop functions are called c Ifin run state Closed loop mode ACIM MTPA Control or ACIM VF Control functions are called according to the actual drive strategy For example ACIM VF
9. e Interrupt management Nested interrupt controller with 32 interrupts Up to 37 external interrupts on 6 vectors e Timers 2x 16 bit general purpose timers with 2 3 capture compare channels input capture output compare or PWM Advanced 16 bit control timer 4 capture compare channels input capture output compare PWM edge or center aligned mode single pulse output mode 3 complementary outputs with adjustable dead time insertion Hardware fault protection break input Flexible synchronization 8 bit basic timer with 8 bit prescaler Auto wake up timer 2 watchdog timers Window watchdog and independent watchdog Doc ID 15783 Rev 1 7 85 Features UMO0712 8 85 Communications interfaces High speed 1 Mbit s active CAN 2 0B interface UART with clock output for synchronous operation LIN master mode LIN 2 1 compliant UART master slave mode automatic resynchronization SPI interface up to 10 Mbit s IC interface up to 400 Kbit s 10 bit analog to digital converter ADC with up to 16 multiplexed channels I Os Up to 68 I Os on a 80 pin package including 18 high sink outputs Highly robust I O design immune against current injection Development support Embedded single wire interface module SWIM and debug module DM for fast on chip programming Non intrusive debugging Doc ID 15783 Rev 1 ky UMO0712 Features 1 2 Access line STM8S features Core 16 MHz advanced STMB8 core
10. are mutually cancelled out a 120 phase shift on the fundamental corresponds to a 360 shift for the third harmonic This results in the following e Sinusoidal voltage and currents on the motor meaning no extra iron losses due to current harmonics e Phase to phase voltage which is 15 higher than with pure sine wave PWM modulation Figure 15 top curve shows the filtered PWM modulation on one of the three half bridges while Figure 15 bottom curve shows the corresponding currents in the three motor phases Figure 15 Third harmonic PWM modulation and corresponding currents To summarize third harmonic injection allows e A decrease in the diameter of the copper winding in the motor for a given power rating e Anincrease in the current in the motor for a given frequency therefore providing more output power e Anincrease in the maximum reachable speed for a given motor as long as the mechanics mainly ball bearings are suited for higher speed operations ky Doc ID 15783 Rev 1 29 85 Introduction to STM8S ACIM scalar control UMO0712 2 8 30 85 Bus voltage ripple cancellation The motor control software can be configured to continuously measure the DC bus voltage see Section 5 1 6 Power stage define statements MC PowerStage Param h Since the sampling frequency is equal to the inverter PWM switching frequency the DC bus ripple can be compensated with a very hi
11. C e STM8S20xxx datasheet Performance line 24 MHz STM8S 8 bit MCU up to 128 Kbytes Flash integrated EEPROM 10 bit ADC timers 2 UARTs SPI I C CAN STM8S903K3 datasheet 16 MHz STM8S 8 bit MCU up to 8 Kbytes Flash 1 Kbyte RAM 640 bytes EEPROM 10 bit ADC 2 timers UART SPI I C Programming manual PM0044 STM8 CPU programming manual User manual UM0144 ST assembler linker User manual UM0036 ST Visual Develop STVD User manual UM0482 STM8 128 EVAL evaluation board MB631 User manual UM0709 STM8 128 MCKIT motor control starter kit User manual UM0483 STMS2F103xx AC induction motor IFOC software library v2 0 Doc ID 15783 Rev 1 13 85 Introduction to STM8S ACIM scalar control UMO0712 2 2 1 Note 14 85 Introduction to STM8S ACIM scalar control Introduction to ACIM theory An ACIM has a polyphase stator identical to that of a synchronous machine The windings can be wye or star connected and they are embedded in slots around the inside circumference In a two pole three phase motor the stator windings are displaced 120 with respect to each other The windings are symmetrical in that each of them has the same number of turns and the same resistance Conversely the rotor structure characterizes two different kinds of machines A squirrel cage induction machine and a wound rotor machine In the squirrel cage induction machine the rotor consists of a series of conducting bars short circuited at each
12. Control implements the control scheme shown in Figure 7 V f and slip regulation control scheme while ACIM MTPA Control implements the scheme shown in Figure 10 MTPA mode control scheme The PID linear regulators are executed by the PID Regulator function MC pid regulators c module If in open loop mode The ACIM OpenLoop function is called If open loop mode with load compensation functionality is enabled the ACIM LoadCompensation function is also called These functions implement the control scheme shown in Figure 11 Speed open loop control with load compensation The ACIM LoadCompensation function executes the required look up table 3 Arequest to update the three phase sine wave with the calculated voltage and frequency The dev driveRun function is called using the MC stm8s ACIM drive c module Doc ID 15783 Rev 1 59 85 Getting started with the STM8S ACIM firmware UM0712 4 4 4 60 85 Figure 39 ACIM scalar control module MC_ACIM_Drive c module ACI M Drive Speed measurement IDLE STATE START STATE ACIM StartUp ClosedLoop ACIM StartUp OpenLoop ACIM MTPA Control ACIM OpenLoop ACIM LoadCompensation VDEV REG8 ACIM MODULATION INDEX VDEV REG16 ACIM FREQUENCY VDEV REG16 BOARD BUS VOLTAGE CLOSED LOOP OPEN LOOP Modulation index and frequency command VIRTUAL REGI STERS Tachogenerator signal reading The hi
13. DIVISOR Defines the scaling factor of the proportional gain of the speed controller 16 bit power of two value in the V f slip control area define VF KI DIVISOR Defines the scaling factor of the integral gain of the speed controller 16 bit power of two value in the V f slip control area define VF KD DIVISOR Defines the scaling factor of the differential gain of the speed controller 16 bit power of two value in the V f slip control area This define statement is used only if the PID controller is selected define VF OUT MAX This define statement sets the positive saturation value of the speed controller output in the V f slip control area The default value is MAX V F SLIP see Section 5 1 2 define VF OUT MIN This define statement sets the negative saturation value of the speed controller output in the V f and slip control area The default value is MAX V F SLIP see Section 5 1 2 Setting this define statement to zero keeps the controller from applying a negative braking torque define VF INTERM MIN This define statement sets the negative saturation value of the speed controller integral action in the V f slip control area The default value is VF KI DIVISOR VF OUT MIN define VF INTERM MAX This define statement sets the positive saturation value of the speed controller integral action in the V f and slip control area the default value is VF KI DIVISOR VF OUT MIN define MTPA PID TYPE This define st
14. INDEX 8 bit Contains the maximum modulation index applicable for the ACIM drive VDEV REG8 HEATSINK TEMPERATURE 8 bit Contains the measured heat sink temperature VDEV REG16 ACIM FREQUENCY 16 bit Contains the reference stator frequency to be applied to the motor Contains the number of time counts between the VDEV REG16 HALL TACHO COUNTS 16 bit first and last tacho signal edges as measured in the last time period VDEV REG16 BOARD BUS VOLTAGE 16 bit oa the measured bus voltage expressed in VDEV REG16 HW ERROR OCCURRED 16 bit Each bit represents an error condition that has already occurred VDEV REG16 HW ERROR ACTUAL 16 bit Each bit represents a current error condition 44 85 Doc ID 15783 Rev 1 q UM0712 Getting started with the STM8S ACIM firmware 4 2 2 Virtual I Os The virtual I Os are low level functions that are called by the high level modules For instance if a high level module wants to set a GPIO high level output as test pin it should call the virtual I O Device ios outS VDEV OUT8 LED 1 LED ON instead of driving directly the microcontroller register itself The virtual I Os implemented in the ACIM firmware are summarized in Table 4 Table 4 Virtual I Os Name out8 VDEV_OUT8_DISPLAY_FLUSH none Description Call used to invoke a refresh of the LCD screen out8 VDEV_OUT8_DISPLAY_PRINTCH none Call used to refresh the cursor displayed on the LCD for example blinkin
15. MAX This define statement sets the positive saturation value of the speed controller output in the MTPA control area The default value is 255 full DC bus voltage exploitation is allowed define MTPA OUT MIN This define statement sets the negative saturation value of the speed controller output in the MTPA control area The default value is 0 and only non negative values are allowed This is because the controller is unable to apply a negative braking torque when in the MTPA control area define MTPA INTERM MIN This define statement sets the negative saturation value of the speed controller integral action in the MTPA control area The default value is MTPA KI DIVISOR MTPA OUT MIN define MTPA INTERM MAX This define statement sets the positive saturation value of the speed controller integral action in the MTPA control area The default value is MTPA KI DIVISOR MTPA OUT MAX Doc ID 15783 Rev 1 67 85 Designing an application using the ACIM software library UM0712 68 85 Speed open loop mode and related define statements In conjunction with the configuration selected in MC_ACIM_conf h Section 5 1 1 the following define statements are available if SPEED OPEN LOOP or SPEED OPEN LOOP TACHO SENSING are uncommented define OPENLOOP CONTROLMODE SPEED OPENLOOP Uncomment above statement to enable a pure speed open loop V f control with a real time adjustable V f ratio and a foreseen slip frequency see Section
16. McGraw Hill New York Chapman SJ 1999 Electric Machinery Fundamentals 3rd edition McGraw Hill NewYork Krause PC Wasynczuk O and Sudhoff SD 2002 Analysis of Electric Machinery and Drive Systems Wiley IEEE Press STM8 motor control builder GUI The STM8 motor control builder GUI is not part of the motor control kit Please check http www st com mcu inchtml pages stm8 html for availability Doc ID 15783 Rev 1 83 85 Revision history UMO0712 Revision history 84 85 Table 13 Document revision history Date 01 Jul 2009 Revision 1 Initial release Changes Doc ID 15783 Rev 1 UMO0712 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document re
17. REFRESH RATE See description in MC ACIM Drive Param h hPWM fPrescaler Constant 16bit Contains the correct TIM1 prescaler to maintain the PWM resolution between 8 and 9 bits depending on selected PWM frequency hPWM Timer ARR Constant 16bit Doc ID 15783 Rev 1 Contains the correct TIM1 reload register to maintain the PWM resolution between 8 and 9 bits and unbiased output depending on selected PWM frequency y Getting started with the STM8S ACIM firmware q Table 5 ACIM drive structure for speed closed loop control continued Name Type Description bPWM Timer MMI Constant 8bit Contains the maximum PWM output resolution i e the maximum modulation index depending on selected PWM frequency bPWM DeadTime Constant 8bit Specifies the parameter to be written in the TIM1 dead time register TIM1 DTR according to define DEAD TIME NS hV Constant Constant 16bit Contains the conversion factor to transform volts to a PWM modulation index hHz to DPP Conv Constant 16bit Contains the conversion factor to transform electrical Hz 10 to DPP digits per PWM bMotor Pole Pairs Constant 8bit Expresses the number of motor pole pairs bRPM to Hz Conv Constant 8bit Contains the conversion factor to transform rpm to electrical Hz 10 hRPM to Hz Ampl Constant 16bit Contains the amplification factor to enhance the rpm to el
18. V1 0 includes a module whereby the motor speed can be read via a tachogenerator sensor To enable speed closed loop mode see Section 5 1 1 ACIM configuration file MC_ACIM_conf h Part of the drive is a negative feedback PID speed controller the actual rotor speed is measured and compared with a reference speed to produce the error signal This signal is processed by the controller to generate the command signal which keeps the speed error to a minimum This firmware library provides two closed loop control modes V F control and slip regulation see Section 2 4 1 and MTPA see Section 2 4 2 V f control and slip regulation This control mode is designed to optimize the dynamic response of the system if the motor is inside the first speed region constant torque To configure the firmware library accordingly see Speed closed loop mode and related define statements in Section 5 1 3 The operating principles and control scheme of V f and slip regulation are shown in Figure 6 and Figure 7 To prevent the inevitable delay due to the field circuit dynamic the magnetizing flux is maintained at its nominal value by keeping the ratio between the frequency and the applied stator phase voltage constant Under such conditions it is possible to demonstrate with good approximation that the electromagnetic torque is a function of the slip speed see Equation 2 Doc ID 15783 Rev 1 19 85 Introduction to STM8S ACIM scalar control UMO0712
19. a consequence airgap flux decreases Torque and T cur es ha e smaller and smaller cur e breakdo ntorque alues Torque nominal breakdo n Loading torque oltage torque Closed loop speed regulation the slip is managed by the PI D controller both the breakdo n torque and the rated current amplitude should be considered to set the maximum slip allo ed Slip Doc ID 15783 Rev 1 21 85 Introduction to STM8S ACIM scalar control UMO0712 2 4 2 22 85 Maximum torque per ampere MTPA control MTPA control mode is designed to optimize system energy efficiency see Section A 3 reference 1 as long as the motor is inside the first speed region constant torque To configure the firmware library accordingly see Speed closed loop mode and related define statements in Section 5 1 3 MTPA mode aims at maximizing the ratio between the electromagnetic torque produced and copper losses By transforming the ACIM equations on a dq0 reference frame synchronous with the rotor flux it is possible to demonstrate that the electromagnetic torque T4 and the rotor flux slip frequency o r can be expressed as in Equation 5 and Equation 6 see user manual UM0483 STM32F103xx AC induction motor IFOC software library v2 0 Equation 5 2 3 ly Te pp p las X las Equation 6 i as Si TX las Where Lm magnetizing inductance L rotor inductance t rotor electrical time
20. also necessary to edit the following low level parameter files present in the folder STM8 MC KITISTM8 MC FRAMEWORKparam MC stm8s clk param h see Section 5 1 7 MC stm8s ACIM param h see Section 5 1 8 MC stm8s port param h see Section 5 1 9 MC stm8s tacho param h see Section 5 1 10 Re build the project and download it on the STM8S microcontroller These modifications can be performed automatically using the STM8S MC Firmware Library builder Doc ID 15783 Rev 1 ky UMO0712 Designing an application using the ACIM software library 5 1 Customizing the ACIM software library parameter file 5 1 1 ACIM configuration file MC ACIM conf h The purpose of this file is to declare the compiler conditional compilation keys that are used throughout the entire library compilation process to select the actual speed position sensor If this header file is not edited appropriately no choice or undefined choice you receive an error message when building the project Note that you do not receive an error message if the configuration described in this header file does not match the hardware that is actually in use or in case of wrong wiring The speed position sensor choice depending on requirements includes speed closed loop speed open loop and tacho sensing define SPEED CLOSED LOOP Uncomment the above statement when a tachogenerator sensor is being used to detect rotor speed Based on this fee
21. bHeatsinkTemp Variable 8bit Contains the measured heat sink temperature expressed in degrees Celsius hUserADC Variable 16bit Contains the A D conversion result of the user selected channel hPWM Frequency Constant 16bit define PWM FREQUENCY See description in MC ACIM Drive Param h bPWM RefreshRate hPWM Prescaler Constant 8bit Constant 16bit define PWM REFRESH RATE See description in MC ACIM Drive Param h Contains the correct TIM1 prescaler to maintain the PWM resolution between 7 and 8 bits depending on selected PWM frequency hPWM Timer ARR Constant 16bit Contains the correct TIM1 reload register to maintain the PWM resolution between 7 and 8 bits and unbiased output depending on selected PWM frequency bPWM Timer MMI Constant 8bit Contains the maximum PWM output resolution i e the maximum modulation index depending on selected PWM frequency Doc ID 15783 Rev 1 ky Getting started with the STM8S ACIM firmware q Table 6 ACIM drive structure for speed open loop control continued Name Type Description Specifies the parameter to be written in the TIM1 bPWM DeadTime Constant 8bit dead time register TIM1 DTR according to define DEAD TIME NS hV Constant Constant 16bit Contains the conversion factor to transform volts to a PWM modulation index hHz to DPP Conv Constant 16bit Contains the conversion factor to transform elec
22. constant p number of pole pairs igs and igs the two components of the transformed three phase stator current system At steady state which is the validity domain of the scalar control the rotor flux slip frequency is equal to the slip frequency Equation 7 Equation 7 0 be Moreover given any instantaneous motor current amplitude l Equation 8 holds true Equation 8 Is tiga ligo Under these conditions electromagnetic torque is maximized for Equation 9 and Equation 10 Equation 9 las lds Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control Equation 10 _ 1 eopt T Therefore if the slip frequency is kept constant at the inverse of the rotor electrical time constant the MTPA target is attained In MTPA mode once the slip frequency is constant the control variable is the V f ratio which hence is the output of the PID speed controller MTPA mode and its control are shown in Figure 9 and Figure 10 The PID gains can be tuned in real time by using the LCD user interface see Figure 25 in Section 3 3 2 Speed regulator parameters Figure 9 MTPA mode strategy Closed loop speed regulation the stator voltage is managed by the PI D controler V f ratio and hence air gap flux is handled to regulate the electromagnetic torque Loading torque Torque typical HVAC load Slip is maintained at the optimum value obtained at the bench or calculated on
23. define statement is used to set the CPU frequency in mega Hertz Either 16 MHz or 24 MHz can be chosen Note If 24Mhz is chosen the firmware is configured to use the external oscillator with 1 wait state for the Flash latency Otherwise the internal oscillator with O wait state is used Microcontroller specific ACIM drive define statements MC stm8s ACIM param h The MC stm8s ACIM param h header file contains the following define statements related to the ACIM drive define BUS ADC CHANNEL define BUS ADC PORT define BUS ADC PIN The ADC channel to be used for the bus DC sampling and its related GPIO port and pin can be configured using the above define statements if the firmware runs on customized hardware Note The PIN description can be read from the appropriate STM8S datasheets The pins should not be used for other purpose inside the firmware and should never be configured as outputs define HEATSINK ADC CHANNEL define HEATSINK ADC PORT define HEATSINK ADC PIN The ADC channel to be used for the heatsink temperature sampling and its related GPIO port and pin can be configured using the above define statements if the firmware runs on customized hardware Note The PIN description can be read from the appropriate STM8S datasheets The pins should not be used for other purpose inside the firmware and should never be configured as outputs Doc ID 15783 Rev 1 ky UM0712 Designing an application using the ACIM
24. e define TACHO TIMER ARR Defines the reload register value for the timer that handles the tachogenerator signal This define statement is involved in the automatic prescaler adaptation to the motor speed according to Equation 18 approximated to the next greatest power of two define MAX ERROR NUMBER Defines the maximum number of times the timer which is reading the tacho signal period can reach the overflow without having captured a number of tacho pulses equal to TACHO PULSE AVERAGED MC tacho param h At this point a fault message is issued SPEED FEEDBACK Equation 18 Prescaler cpu frequency x TACHO PULSE AVERAGED x 60 TACHO TIMER ARR x motor speed RPM x TACHO PULSE PER REV The refresh rate of the low level section of the speed measurement process can also be calculated using Equation 19 below and considering the formula above with a given motor speed 78 85 Doc ID 15783 Rev 1 UM0712 Designing an application using the ACIM software library 5 2 Equation 19 Prescaler Refresh rate s cpu_frequency x TACHO_TIMER_ARR define MAX PRESCALER Defines the maximum prescaler value for the timer that handles the tachogenerator signal Effectively this defines the lowest speed that can be measured according to Equation 20 Equation 20 Min speed RPM cpu_frequency Hz x 60 x TACHO_PULSE_AVERAGED MAX_PRESCALER x TACHO_TIMER_ARR x TACHO_PULSE_PER_REV Setting up the system when using
25. end by conducting end rings In the wound rotor machine the rotor has a polyphase winding similar to that of the stator with the same number of phases and poles and its terminals abut insulated rings mounted on the shaft Carbon brushes make these terminals available to the user Squirrel cage induction machines are by far the most commonly used type of electric motor thanks to their extreme simplicity and ruggedness The great majority of induction machines are operated as motors Induction motors owe their name to their working principle that the rotor voltage which produces the rotor current and magnetic field is induced in the rotor windings The MMF magneto motive force and the magnetic flux produced by a balanced set of three phase steady state currents rotates about the air gap at a mechanical speed of s p where Qs is the stator current frequency and p is the number of pole pairs If the rotor mechanical speed 0 is different from the speed of this rotating air gap flux three phase currents are induced in the short circuited rotor windings The frequency r of these currents is equal to the difference of the stator current frequency and the rotor speed so that Equation 1 Gy Qg OQ Xxp Consequently the rotor currents produce a rotor magnetic flux which rotates about the air gap at a speed which seen from the rotor is equal to that of rotor currents but seen from the stator reference frame is equal to p Th
26. provided as feedback of the speed loop control Optimized dynamics drive Parameters tuning mode proportional integral derivative regulator PID gains V f ratio startup V f ratio startup slip Speed closed loop maximum torque per ampere MTPA control A Adjustable target rotor speed via the UI Rotor speed measured and provided as feedback of the speed loop control Optimized efficiency drive Parameter tuning mode PID gains V f ratio optimum slip startup V f ratio startup slip Additional features Three phase center aligned PWM sine waves and third harmonics synthesis adjustable switching frequency dead time output refresh rate DC bus voltage measurement and ripple compensation Automatic drive adaptation to AC mains voltage Dead time effect compensation DC bus brake resistor management Heatsink temperature measurement Fault handling for overcurrent shunt resistor network required DC bus overvoltage undervoltage heatsink overtemperature The Ul is provided through LCD and joystick Two channel virtual DAC functionality for real time tracing of software variables Firmware is compatible with STM8s motor control builder GUI Doc ID 15783 Rev 1 11 85 Features UM0712 Required ROM RAM Table 1 gives the ROM and RAM requirements These values include non motor control related code implemented for demonstration purposes such as ADC management or softwar
27. software library define USER1 ADC CHANNEL define USER1 ADC PORT define USER1 ADC PIN The ADC channel to be used for a user defined A D conversion and its related GPIO port and pin can be configured using the above define statements if the firmware runs on customized hardware Note The PIN description can be read from the appropriate STM8S datasheets The pins should not be used for other purpose inside the firmware and should never be configured as outputs define SINE3RDHARM This define statement is the sine wave reference look up table that is stored in the Flash memory It contains third harmonic by default which allows approximately 15 more voltage to be obtained on a motor from a given DC bus compared to pure sine see Section 2 7 Three phase PWM sine wave and third harmonic generation define BUSVOLT BUFFER SIZE Defines the buffer size utilized for averaging bus voltage measurement Maximum buffer size is 255 Note The DC bus voltage is sampled at a frequency defined by BUS SAMPLING FHEQ MC ACIM Drive Param L define HEATSINK SAMPLING FREQ Defines the heatsink temperature sampling frequency required Expressed in Hertz define USERADC SAMPLING FREQ Defines the user defined AD conversion sampling frequency required Expressed in Hertz define STARTUP ANGLE Defines the initial angle of the three phase voltage system This angle is expressed in unsigned 16 bit format where 0 65535 corresponds to 0 2 x r
28. strategy has been implemented using the analog to digital conversion of the bus voltage value to determine if a voltage level beyond the threshold is present in the bus voltage If this condition occurs and the brake management is enabled in the firmware the over voltage fault is not generated Instead the break control pin is driven to turn on the external brake resistor to dissipate the extra energy If the brake resistor is active it is expected that the bus voltage level will decrease Consequently the bus voltage value is monitored with the ADC conversion to detect the dissipative brake action condition to stop If the value falls below a certain threshold the dissipative brake is stopped To add a hysteresis between such switching on and off the turn off threshold is reduced compared to the turn on threshold See Section 5 1 6 Power stage define statements MC PowerStage Param h for details on how to enable or disable this feature See Section 5 2 Setting up the system when using a brake resistor for details on the hardware setup required to use this feature High level control This section explains how to implement a high level ACIM drive algorithm independently from the microcontroller peripheral definitions Virtual timers Virtual timers are high level hardware independent general purpose counters They are used to manage the execution of the code performed at specified time intervals for example the speed regulat
29. temperature sensor value expressed in C and the ADC converted value This curve is assumed to be linear see Figure 41 define BKIN POLARITY When the firmware runs on a customized hardware this define statement allows the polarity of the break input to be configured The polarity can be set to ACTIVE HIGH or ACTIVE LOW define PWM define PWM define PWM LOW SIDE POLARITY HIGH SIDE POLARITY LOW SIDE POLARITY define PWM HIGH SIDE POLARITY define PWM LOW SIDE POLARITY define PWM W HIGH SIDE POLARITY When the firmware runs on a customized hardware these define statements allow the polarity of the PWM output to be configured The polarity can be set to ACTIVE HIGH or ACTIVE LOW lt lt G G 4 Doc ID 15783 Rev 1 UM0712 Designing an application using the ACIM software library define PWM U HIGH SIDE IDLE STATE define PWM U LOW SIDE IDLE STATE define PWM V HIGH SIDE IDLE STATE V W define PWM LOW SIDE IDLE STATE define PWM HIGH SIDE IDLE STATE define PWM W LOW SIDE IDLE STATE When the firmware runs on a customized hardware these define statements allow the status of the PWM output during the idle state to be configured The status can be set to ACTIVE or INACTIVE define HEAT SINK TEMPERATURE MEASUREMENT This define statement is used to configure the firmware to perform heat sink temperature measurement If the hardware does not support this feature or if y
30. the base of known motor parameters uz Stator Flux rotation speed Rotor speed Slip a Doc ID 15783 Rev 1 23 85 Introduction to STM8S ACIM scalar control UM0712 24 85 Figure 10 MTPA mode control scheme speed sensor 1 Legend V Voltage amplitude amp Reference stator speed _ Slip speed reference value oy Target rotor speed amp Measured rotor speed The MTPA mode strategy has a clear drawback in the necessary delay needed to build up the magnetizing flux in response to a required torque variation The magnetizing flux can be increased through variation of the V f ratio up to the point when it assumes its nominal value it is not convenient to increase the magnetizing flux after this point because magnetic saturation of the stator iron occurs For these reasons MTPA mode switches automatically to constant V f and slip regulation mode described in Section 2 4 1 The PID gains of the speed controller used in the latter mode are taken into account and can be tuned in real time via the LCD user interface see Figure 24 in Section 3 3 2 Speed regulator parameters However while in constant V f and slip regulation mode if the required slip frequency is less than the optimum value e opt the PID speed controller switches back to MTPA mode the constant slip area Such switching from one mode to another is the task of the operation mode control
31. the periodicity of the open loop control in milliseconds Doc ID 15783 Rev 1 49 85 Getting started with the STM8S ACIM firmware UM0712 4 3 4 3 1 50 85 Low level control This section describes the implementation of the low level drive which is interfaced with the microcontroller peripheral memory Combined utilization of ADC and TIM1 for motor driving The STM8S ADC and advanced timer TIM1 peripherals are used in close combination in the current firmware library example Their utilization is explained jointly below The low level shell of the driving strategy is implemented in the firmware library source file MC stm8s ACIM drive C In the ACIM motor control firmware library the generated PWM pattern is center aligned This is the best arrangement for reducing magnetostriction noise and switching losses In addition TIM1 has edge aligned PWM capability The three phase sine wave with third harmonic injection is updated duty cycles are updated with a frequency related to the selected PWM frequency and the define statement PWM REFRESH RATE The sine wave reference look up table is stored in the Flash memory const u8 SINESRDHARM 256 MC stm8s ACIM Param h It has an 8 bit resolution 127 TIM1 has 16 bit resolution and a maximum frequency which is tied to the CPU frequency 24 MHz max for performance line STM8s 16 MHz max for access line STM8s The maximum duty cycle resolution achievab
32. up DOWN Joystick pressed down LEFT Joystick pressed to the left RIGHT Joystick pressed to the right JOYSEL Joystick pushed KEY Press the KEY push button The demonstration program user interface is based on a circular navigation menu with submenus item selection and back capability Figure 17 shows the menu structure To navigate the help menus and sub menus perform the following actions as required e RIGHT Navigates to the next menu or sub menu on the right e LEFT Navigates to the next menu or sub menu on the left Doc ID 15783 Rev 1 31 85 Running the demonstration program UM0712 Figure 17 ACIM user interface menu structure and navigation WELCOME MESSAGE A few seconds delay 3 2 3 2 1 3 2 2 32 85 LEFT LEFT RIGHT LEFT HELP LEFT RIGHT MERDA MENU 2 MM Start stop motor Y W x u x Startup Bus voltage and Heatsink LEFT sub menu sub menu RIGHT LEFT LEFT LEFT LEFT LEFT RIGHT RIGHT RIGHT RIGHT RIGHT ai15066 Getting started with the ACIM user interface Welcome message After the STM8 128 MCKIT motor control starter kit is powered on or reset a welcome message is displayed on the LCD screen to inform the user about the firmware code loaded on the board Refer to Figure 18 for the ACIM drive welcome message Figure 18 ACIM drive welcome message Help menus After a few seconds the LCD screen di
33. 1 and ADC utilization llslsseesee RII 54 ACIM drive low level module issssssesee RII 54 Tachogenerator reading method llslieeelees e 56 Tachogenerator sensing low level module 00 eee eee eee selle 56 ACIM scalar control module 0 0000 cette eee 60 Tachogenerator speed measurement module 002 00 eee eee 61 Transduction curve between the temperature sensor and the ADC converted 73 Brake resistor circuit llle 79 Doc ID 15783 Rev 1 ky UMO0712 Features 1 Features 1 1 Performance line STM8S features e Core Advanced STM8 core with Harvard architecture and 3 stage pipeline fcpu up to 24 MHz setting O wait state at fopy lt 16 MHz Extended instruction set Maximum 20 MIPS performance at fopy 24 MHz e Memories Program memory Up to 128 Kbytes Flash with 20 year data retention at 55 C after 10 kcycles Data memory Up to 2 Kbytes true data EEPROM with 300 kcycle endurance RAM Up to 6 Kbytes Clock reset and supply management 2 95 to 5 5 V operating voltage Flexible clock control 4 master clock sources Low power crystal resonator oscillator External clock input Internal user trimmable 16 MHz RC Internal low power 128 kHz RC Clock security system with clock monitor Power management Low power modes wait active halt halt Individual peripheral clock switch off Permanently active low consumption power on and power down reset
34. 2 5 define OPENLOOP CONTROLMODE SPEED OPENLOOP LOAD COMPENSATION Uncomment above statement to enable a speed open loop V f control with automatic load compensation see Section 2 5 1 Note A look up table that matches the foreseen load characteristic curve must exist Such a look up table is calculated automatically by the STM8S MC Firmware Library builder see Section A 4 define OPEN LOOP ACCELERATION SLOPE Defines the acceleration slope to be imposed during target speed variations both in start and run state Expressed in rpm s define OPENLOOP SLIP Defines in one tenth of a Hertz the default slip frequency f that is applied by the drive during run state if the selected operating mode is speed open loop with no load compensation Open loop load compensation mode define statements The define statements of this section SEGDIV ANGC OFST are automatically worked out by the STM8S MC Firmware Library builder Please refer to Section 2 5 1 Load compensation for a more detailed explanation of speed open loop load compensation mode Operation speed check define statements define MIN RUN SPEED This define statement is valid in speed closed loop mode speed open loop mode and tacho sensing mode It defines the minimum speed below which speed feedback is unrealistic in the application in run state Expressed in rpm This allows a low frequency to be discerned This value is set to 200 rpm by default and depends on
35. 783 Rev 1 61 85 Designing an application using the ACIM software library UM0712 5 Note 62 85 Designing an application using the ACIM software library It is relatively easy to set up an operational evaluation platform with a drive system that includes the STM8 128 MCKIT motor control starter kit featuring the STM8S microcontroller on which the software runs and a permanent magnet motor This section explains how to quickly configure your system and if necessary customize the library accordingly Follow the steps below to accomplish this task 1 6 Collect all the information needed regarding the hardware in use motor parameters power device features speed position sensor parameters current sensors transconductance Edit using an integrated development environment IDE the following high level parameter files present in the folder STM8 MC_KIT MC_FWLIB_SCALAR param MC ACIM conf h see Section 5 1 1 MC ACIM Motor Param h see Section 5 1 2 MC ACIM Drive Param h see Section 5 1 3 If the drive is being performed using a tachogenerator sensor setup the parameter header file MC tacho param h see Section 5 1 4 If working with different hardware that is compatible with the STM8 128 MCKIT motor control starter kit edit using an IDE the following parameter header files too MC ControlStage param h see Section 5 1 5 MC PowerStage Param h see Section 5 1 6 It is
36. ACIM motor control library functions while Table 12 give an estimate of the CPU load during ACIM motor control software execution Table 11 Example of ACIM motor control function execution time Function Source file Estimated execution Priority time us level ACIM Drive MC ACIM Drive c 250 1 ADCx_IRQHandler MC stm8s ACIM drive c 13 7 3 TIM1 UPD OVF TRG BRK IRQHandler MC stm8s ACIM drive c 4 4 3 TIMx UPD OVF TRG BRK IRQHandler MC stm8s tacho c 3 4 1 TIMx CAP COM IRQHandler MC stm8s tacho c 2 4 2 1 See Figure 38 Tachogenerator sensing low level module 82 85 Doc ID 15783 Rev 1 ky UM0712 Additional information A 3 A 4 Table 12 CPU load resulting from motor control Parameter Value CPU load in Speed loop control frequency 200 Hz 5 PWM and sine waves control frequency 8 KHz 14 5 Motor speed 3000 RPM Number of tachogenerator pole pairs 8 0 1 see Section 5 1 4 Tacho sensor define 3 TACHO_PULSE_AVERAGED statements MC_tacho_param h Total estimated CPU load 19 6 References 1 Cacciato M Consoli A Scarcella G Scelba G and Testa A 2006 Efficiency optimization techniques via constant optimal slip control of induction motor drives Proceedings of SPEEDAM Mohan N Undeland TM and Robbins WP 1995 Power electronics Converters Applications and Design Wiley second edition Fitzgerald AE Kingsley Jr C and Umans SD 1990 Electric Machinery 5th edition
37. ATIVE_BRAKE_ACTIVE_HIGH The braking action is triggered by a high logic level of the dissipative brake control signal DISSIPATIVE_BRAKE_ACTIVE_LOW The braking action is triggered by a low logic level of the dissipative brake control signal define BUS VOLTAGE MEASUREMENT This define statement is used to configure the firmware to perform DC bus voltage measurement If the hardware does not support bus voltage measurement or if you want to disable this feature leave this define statement uncommented The bus voltage will not be measured by the firmware and will be assumed constant and equal to the value specified in the next define statement define BUS VOLTAGE VALUE Defines the constant value of the bus voltage if the bus voltage measurement feature has been disabled This setting is not used if the bus voltage measurement function is enabled define BUS ADC CONV RATIO Defines the DC bus voltage partitioning ratio performed by the hardware to allow the bus voltage measurement This setting is not used if the bus voltage measurement function is disabled Doc ID 15783 Rev 1 71 85 Designing an application using the ACIM software library UM0712 72 85 define EXPECTED MCU_VOLTAGE Defines the reference value of ADC conversions ADC conversions are usually performed using a voltage reference that is identical to the microcontroller power supply voltage 5 V To increase the resolution it is possible to design a cus
38. CIM drive structure for speed open loop control is show in Table 6 Table 6 ACIM drive structure for speed open loop control Name Type Description Control Mode Enum variable Specifies the control mode selected SPEED OPENLOOP or SPEED OPENLOOP LOAD COMPENSATION hTarget rotor speed RPM Variable 16bit Contains the target mechanical rotor speed expressed in rpm hTarget rotor speed HzEI Variable 16bit Contains the target electrical rotor speed expressed in Hz 10 bDirection Variable 8bit Stores the spin direction selected at startup hMeasured rotor speed RPM Variable 16bit Contains the measured mechanical rotor speed expressed in rpm hActual rotor speed HzEI Variable 16bit Contains the estimated electrical rotor speed expressed in Hz 10 hAccelerationSlope Variable 16bit Defines the acceleration slope constant which is a function of selected acceleration define OPEN LOOP ACCELERATION SLOPE motor pole pairs and control loop period hSlip Variable 16bit Defines the slip frequency Hz 10 to be applied hVFConstant Variable 16bit Contains the V f ratio conversion constant hStartUpVFConstant Variable 16bit Contains the startup V f ratio conversion constant hStartUpSlip Variable 16bit Contains the slip frequency to be applied at startup Contains the measured bus voltage expressed in hBusVoltage Variable 16bit volts
39. I O functions see Section 4 2 Library architecture e MC Keys This module manages the button and joystick 4 directions plus a center button It is developed over the low level virtual I Os functions see Section 4 2 Library architecture Doc ID 15783 Rev 1 ky UM0712 Module description MC pid regulators This module is used to manage all the regulators needed by the application They can be proportional integral derivative PID or proportional integral regulators PIR The MC pid regulator module is used to instance a regulator structure and to execute it MC StateMachine This module is used to manage the main application state machine The only interface with it is the StateMachineExec function that is used to execute the state machine MC vtimer This module is used to manage the virtual timers as explained in Section 4 4 1 Virtual timers Main This is the main application firmware module In the actual implementation it is used to execute the state machine in an infinite loop 6 2 Low level modules The low level MC modules are stored in the folder STM8 MC FRAMEWORK and include the following MC stm8s ACIM drive This module contains all functions related to the low level electrical drive and engine control MC stm8s tacho c This module contains all functions related to the low level shell of the rotor speed measurement method via a tachogenerator sensor see Section 4 3 2 Tachogenerator signal reading
40. ID 15783 Rev 1 81 85 Additional information UMO0712 Appendix A Additional information A 1 DAC configuration In the current firmware library the DAC functionality is implemented using two output compare channels PD2 and PDO pins of TIM3 and modulating the duty cycle of the generated 62 5 kHz PWM signal To filter the generated signals without introducing significant delays on the waveforms use a first order low pass filter for example with a 1 KQ resistor and a 33 nF capacitor In the ACIM drive firmware both DAC outputs are used The first monitors the stator voltage amplitude and the second monitors the slip frequency controller outputs It is also possible to use the DAC outputs to monitor two user defined variables example user var and user var2 by modifying the statements below that are present in the MC ACIM Drive c file ifdef DAC FUNCTIONALITY dev DACUpdateValues DAC CH 1 u8 user var1 dev DACUpdateValues DAC CH 2 u8 user var2 dendif As the implemented DAC functionality has an 8 bit resolution a suitable scaling factor should be applied to user defined variables Note It is not possible to use the DAC functionality with the dissipative brake function See Section 5 1 5 Control stage define statements MC ControlStage param h for details on how to enable he DAC functionality A 2 Motor control related CPU load Table 11 gives the estimated execution time for a set of
41. IM1 CCR1 2 3 update Legend e gt IRQ handler duration A D conversion NN Interrupt request Figure 36 ACIM drive low level module Virtual registers module initialization dev drivelnit stm8 TIM1 ADCx Init Request for updated 3 phase sinewave VDEV REG8 ACIM MODULATION INDEX VDEV REG16 ACIM FREQUENCY VDEV REG16 BOARD BUS VOLTAGE MC stm8s ACIM Drive c module TIM1 UPD OVF TRG BRK IRQHandler ADCx_IRQHandler 54 85 Doc ID 15783 Rev 1 X UMO0712 Getting started with the STM8S ACIM firmware 4 3 2 Tachogenerator signal reading The low level shell of the measurement method is implemented in the ACIM firmware library source file MC stm8s tacho c Motor speed is read via a frequency measurement of the signal coming from the tachogenerator sensor TIM1 is used for this purpose One channel is configured in input capture mode with falling edge detection capability Note that STM8s timers have both rising and falling edge detection capability which can be used to enhance the resolution Figure 37 shows the measurement method which has been implemented in the current firmware Figure 38 shows the most important functions implemented in the current firmware together with their connections It also shows the main connections with other modules Two registers register 0 and register 1 are defined which are used alternatively
42. OP MTA Of SPEED CLOSEDLOOP VF Actual Control Mode Enum variable Specifies the actual control mode depending on the control mode selected and actual operating conditions SPEED CLOSEDLOOP MTA Of SPEED CLOSEDLOOP VF hTarget rotor speed RPM Variable 16bit Contains the target mechanical rotor speed expressed in rpm hTarget rotor speed HzEI Variable 16bit Contains the target electrical rotor speed expressed in Hz 10 bDirection Variable 8bit Stores the spin direction selected at startup hMeasured rotor speed RPM Variable 16bit Contains the measured mechanical rotor speed expressed in rpm Contains the optimum slip to be maintained in NMTPASIIp Variable IGBI the first control area of the MTPA drive hVFConstant Variable 16bit Contains the V f ratio conversion constant hStartUpVFConstant Variable 16bit Contains the startup V f ratio conversion constant hStartUpSlip Variable 16bit Contains the slip frequency to be applied at startup Contains the measured bus voltage expressed hBusVoltage Variable 16bit in volts bHeatsinkTemp Variable 8bit Contains the measured heat sink temperature expressed in degrees Celsius hUserADC Variable 16bit Contains the A D conversion result of the user hPWM_Frequency Constant 16bit selected channel define PWM_FREQUENCY See description inMC_ACIM Drive Param h bPWM RefreshRate Constant 8bit define PWM
43. OSEDLOOP VF Uncomment above statement to enable the most dynamic V f and slip control strategy Fill the parameters of the V f control area linear regulator only Section 2 4 1 V f control and slip regulation define CLOSEDLOOP TUNING Define statement valid only in speed closed loop mode Comment above statement to minimize the set of parameters that can be changed in real time by using the LCD user interface This define statement has a positive effect in reducing the application code size define VF PID TYPE Define statement valid only in speed closed loop mode It is used to configure the type of speed controller used when in the V f and slip control area There are two possible settings P or PID PI sets the proportional integral regulator while PID sets the proportional integral derivative regulator Doc ID 15783 Rev 1 65 85 Designing an application using the ACIM software library UM0712 66 85 define VF_KP Defines the proportional gain of the speed controller 16 bit value adjustable from 0 to 32767 in the V f and slip control area define VF_KI Defines the integral gain of the speed controller 16 bit value adjustable from 0 to 32767 in the V f and slip control area define VF_KD Defines the derivative gain of the speed controller 16 bit value adjustable from 0 to 32767 in the V f slip control area This define statement is used only if the PID controller is selected define VF KP
44. SE AVERA M UPD New prescaler x New prescaler y New prescaler y Q TACHO PULSES Index0 TACHO PULSES Index TACHO PULSES IndexO TIMx CAPTURE IRQ Figure 38 Tachogenerator sensing low level module UMO0712 VIRTUAL VDEV REG16 TACHO COUNTS REGISTERS vpEv REG8 TACHO PULSE NUMBER VDEV REG8 TACHO PRESCALER MC stm8s tacho c module module initialization dev tacholnit TIMx_UPD_OVF_BRK_IRQHandler TIMx_CAP_COM_IRQ_IRQHandler Doc ID 15783 Rev 1 X UM0712 Getting started with the STM8S ACIM firmware 4 3 3 4 4 4 4 1 Dissipative brake The ACIM motor is able to transform kinetic energy into electrical energy just like a dynamo This situation occurs when the control tries to decelerate the motor particularly when the stator frequency applied is lower than the rotor speed resulting in a negative slip speed being applied In this situation the inverter bulk capacitor is charged unless the power system used has regenerative capabilities The voltage across the bulk capacitors could increase to a destructive level depending on the amount of energy transferred A strategy for somehow dissipating the generated electrical energy is thus necessary Different methods could be implemented to do so but one of them in particular the utilization of a brake resistor is supported by the library presented in this user manual In the firmware this
45. STM8S ACIM firmware UM0712 4 4 1 Note 40 85 Getting started with the STM8S ACIM firmware Application state machine The motor control firmware library was developed around the state machine which is presented in Figure 31 The state machine is implemented in MC StateMacchine c module It is composed of the following states Reset idle start init start run stop wait fault and fault over Description of the states Reset The system is in reset state once after the main reset This state is used to perform the main initializations Idle When the system is in idle state the motor is stopped and is waiting for a startup to be executed Start init The start init state is executed at every restart of the motor It is used for specific initializations Start In this state the motor ramps up Run After the end of the startup phase the motor is in normal run state The user can interact with the system change parameters in real time or issue a stop request Stop The system is in stop state when the motor is stopped Wait The system is in wait state when the motor is stopped It remains in this state until a required condition for a new restart is present Fault The system goes into fault state when an error condition occurs It remains in this state while the fault condition is present Fault over When the fault condition disappears the system enters fault over state to indicate which
46. a brake resistor To make the STM8 128 MCKIT motor control starter kit board suitable for the management of a brake resistor some additional components must be soldered onto its wrapping area Figure 42 gives an example of the circuit to be used for hardware implementation of the brake Figure 42 Brake resistor circuit BRAKE GPIo Pour R4 1kQ BRAKE GPIO PIN 15 V 15 V Vbus R3 100 Q 20 W R1 1 kQ 1 BC557B R2 6 8 kQ BESS R6 220 kQ q Z1 STGFNC60HD Q2 BC547B R7 100 kQ 1 The size of the resistor in terms of both resistance and sustainable power should be carefully dimensioned 2 In the STM8 128 MCKIT motor control starter kit pin 23 of the MC connector J7 that carries the signal for brake implementation is positioned close to the wrapping area Doc ID 15783 Rev 1 79 85 Module description UM0712 6 6 1 80 85 Module description The current firmware is comprised of a set of modules that are subdivided logically into three groups e High level MC modules e Low level MC modules e Standard library The last two groups contain functions related to the microcontroller see Section 4 3 Low level control while the first group contains hardware independent functions as described in Section 4 4 High level control High level modules The high level MC modules are stored in the MC FWLIB SCALAR folder and include the following MC ACIM Drive This module contains a
47. acitors Bus undervoltage error A fault is detected when the bus voltage is below 18 V DC This threshold is specified in the MC PowerStage Param h header file by the MIN BUS VOLTAGE define statement Startup failed error This fault message is displayed only if the firmware is configured in speed sensor mode It signals that the startup output condition has not been fulfilled during motor acceleration see also Section 2 6 Startup strategy Speed feedback error An error on the speed position feedback has occurred Motor running error This fault can occur only if the firmware is in speed sensor mode It signals that the user is trying to start the motor when it is not still Figure 30 shows a typical error message displayed on the LCD screen Doc ID 15783 Rev 1 ky UM0712 Running the demonstration program Figure 30 Error message shown in the event of an undervoltage fault The message FAULT CONDITION is visible when the fault condition is still present The message FAULT OCCURRED is visible if the source of the fault has disappeared This indicates to the user that the fault has occurred If several fault conditions occur concurrently they are displayed in the LDC screen one after the other If the source of all faults disappears pressing the KEY button causes the main state machine to switch from the fault to the idle state Doc ID 15783 Rev 1 39 85 Getting started with the
48. adians Doc ID 15783 Rev 1 75 85 Designing an application using the ACIM software library UM0712 5 1 9 Port pin definition define statements MC stm8s port param h The MC stm8s port param h header file contains the define statements related to the definitions of the pins and ports used for the motor control related signals idefine DEBUGx PORT define DEBUGx PIN When the firmware runs on a customized hardware these define statements can be used to configure the ports and pins used for the debug signals The first define statement specifies the port Replace the x character in the GPIOx string by the correct letter For instance set GPIOH if port H is used The second define statement specifies the pin Replace the x character in the GPIO PIN x string with the correct number For instance set GPIO PIN 41 if pin 1 is used define KEY UP PORT define KEY UP BIT define KEY DOWN PORT define KEY DOWN BIT define KEY LEFT PORT define KEY LEFT BIT define KEY RIGHT PORT define KEY RIGHT BIT define KEY UP PORT define KEY UP BIT define USER BUTTON PORT define USER BUTTON BIT When the firmware runs on a customized hardware these define statements can be used to configure the ports and pins used for the user interface input signals joystick and button Define the port by setting the xxx PORT define statements to GPIOx where x specifies the port For instance set GPIOH if port H is used Define
49. al frequency f Furthermore under a constant V f ratio constant air gap flux the electromagnetic torque curve shifts to the right as the stator frequency is increased Figure 5 This concept gives rise to the drive strategy whereby varying the frequency and the voltage applied through a DC AC inverter the motor is able to supply the nominal torque at nominal conditions of stator and rotor currents over its complete speed range The speed range is typically divided into two regions In the first region up to the nominal speed the motor can produce its nominal torque The second region beyond the nominal speed is characterized by constant power flow where the torque decreases with inverse proportionality to the speed Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control 2 4 2 4 1 Depending on the application and the availability of a speed sensor two main operating modes can be selected Speed closed loop control see Section 2 4 and speed open loop control see Section 2 5 Both operating methods are described as scalar controls in voltage mode stator current amplitude is controlled at steady state through modulation of the applied voltage Speed closed loop control Applications which demand good speed accuracy and or fast responses to either load torque variation or speed reference variation require a closed loop controller and a speed sensing device The current ACIM firmware library
50. atement is valid only in speed closed loop mode when MTPA control strategy is enabled It is used to configure the type of speed controller used when in the MTPA control area There are two possible settings PI or PID PI sets the proportional integral regulator while PID sets the proportional integral derivative regulator Doc ID 15783 Rev 1 ky UM0712 Designing an application using the ACIM software library define MTPA KP Defines the proportional gain of the speed controller 16 bit value adjustable from O to 32767 in the MTPA control area define MTPA KI Defines the integral gain of the speed controller 16 bit value adjustable from 0 to 32767 in the MTPA control area define MTPA_KD Defines the derivative gain of the speed controller 16 bit value adjustable from 0 to 32767 in the MTPA control area This define statement is used only if the PID controller is selected define MTPA KP DIVISOR Defines the scaling factor of the proportional gain of the speed controller 16 bit power of two value in the MTPA control area define MTPA KI DIVISOR Defines the scaling factor of the integral gain of the speed controller 16 bit power of two value in the MTPA control area define MTPA KD DIVISOR Defines the scaling factor of the differential gain of the speed controller 16 bit power of two value in the MTPA control area This define statement is used only if the PID controller is selected define MTPA OUT
51. automatically few second after the reset define ENABLE OPTION BYTE PROGRAMMING Comment this define statement to disable in application option byte re programming Doc ID 15783 Rev 1 ky UM0712 Designing an application using the ACIM software library Note Disabling this option allows to decrease the firmware size In this case the option bytes can be programmed off line by using the STVP tool 5 1 6 Power stage define statements MC PowerStage Param h The MC PowerStage param h header file includes define statements related to the power stage These settings must be modified if the firmware is used with a customized hardware different from the one of the kit or to enable disable unused library features The power stage define statements comprise define RS M This define statement is not used in the STM8S ACIM control software library V1 0 define AOP This define statement is not used in the STM8S ACIM control software library V1 0 define DISSIPATIVE BRAKE Uncomment this define statement to enable the dissipative brake function see Section 4 3 3 The next define statement must be edited when this feature is enabled define DISSIPATIVE BRAKE POL This define statement is used to set the polarity of the dissipative brake signal It should be set according to the dissipative brake hardware implementation This setting is not used if the dissipative brake function is disabled There are two available options DISSIP
52. ce 3 3 a pie cioRre aed Ra ear eo Ede rio ace d 31 3 2 Getting started with the ACIM user interface 0000 32 3 2 1 Welcome message ssssssee ee 32 3 2 2 Help MENUS serere Exe RR Se RR TR RUE TR a ede a RE GU RU 32 3 2 8 Main menu Changing the target and measured rotor speed 33 3 3 Using the ACIM user interface sub menus for motor control 34 3 3 1 ACIM user interface sub menus llle 34 3 3 2 Speed regulator parameters 0 0 0 cee eee eee 35 3 3 3 Drive strategy parameters 0 eee tee 36 3 3 4 Startup parameters 0 0 0 cece 36 2 85 Doc ID 15783 Rev 1 ky UMO0712 Contents 3 3 5 Control strategy parameters 0 0 0 ee 37 3 3 6 Displaying the DC bus voltage and heatsink temperature parameters 37 3 3 7 Fault messages n cssc see ha Kay eee cadena okey eae e sna eed oe 38 4 Getting started with the STM8S ACIM firmware 40 4 1 Application state machine 0 0 ee ee 40 4 1 1 Description of the states lslellls esee 40 4 1 2 Description of the state machine operation 000 41 4 2 Library architecture isses ker Ro Rx babes em x Orr m ER Rd 42 4 2 1 Virtual registers 2 0 e 44 4 2 2 Virt al VOS ss cuente poke x REPE GE EHE RR Dees ee 45 4 2 8 Drive SUUCIUIC ux fb ciw ee cede ket aue uc dub EE Yu pr IE da 46 4 3 Low level control S s eda d r act boe ded Arp Ro exce d hd rof wee 50 4 3 1 Combi
53. current l The magnetizing current is required to create the air gap flux which is produced by the combined effect of stator and rotor currents The magnetizing current lm can be further divided into a component which is responsible for core losses and a pure magnetizing current The load current I is responsible for the rotor current It is a function of the applied load and the working point condition The combined effect of load and rotor resistance appears as the equivalent resistance r s The equivalent circuit can be redrawn to separate representation of the rotor resistance from the effect of applied load and working conditions see Figure 3 Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control Figure 3 Induction motor equivalent circuit 2 r iX iX EE tue A m ANV v m ir ET gis 2 3 Electromagnetic torque characteristic curve The electromagnetic torque speed characteristic curve is shown in Figure 4 where V and amp are held constant at their nominal values Figure 4 Electromagnetic torque speed characteristic Pull out torque T T ated b 2 0 1 5 1 0 0 5 Speed is represented on a rated scale and also represented simultaneously as a function of the slip Torque T is displayed as a fraction of its rated value Doc ID 15783 Rev 1 17 85 Introduction to STM8S ACIM scalar control UMO0712 18 85 The
54. curve has three peculiar regions e The low slip region at the right hand side of the curve characterized by a linear relation of T and I with slip and negligible inductive reactance The normal operating range of an induction motor is inside this region where the energy conversion efficiency is also optimal e Inthe moderate slip region the inductive reactance is no longer negligible thus the rotor current is less than proportional with slip The displacement angle the angle between the rotor and air gap flux departs from its optimum value of 90 The torque increases up to a maximum value called pull out torque and then decreases This region can be used just for short term overloaded operations e Thethird region characterized by high slip is an unstable and inefficient working area Figure 5 V f regulation Vif ratio is maintained as a consequence the airgap flux is constant and the electromagnetic torque curve Te translates to the right when the stator frequency increases but its shape remains unchanged Loading torque typical HVAC load Torque Working points p d We Stator Flux rotation speed fo b Slip see equation 2 wr Rotor speed Starting with the induction motor equivalent circuit Figure 3 it can be seen that at steady state and within the low and medium slip regions air gap flux is directly controlled by the ratio of stator phase voltage Vs and stator electric
55. dback speed closed loop control is carried out as explained in Section 2 4 Fill out MC tacho param h and MC stm8s tacho param h see Section 5 1 4 and Section 5 1 10 which concern the define statements related to speed sensing Fill out MC ACIM Drive Param h and MC ACIM Motor param h see Section 5 1 3 and Section 5 1 2 respectively which concern the define statements related to drive method selection define SPEED OPEN LOOP Uncomment the above statement when a speed sensor is not being used to control or detect rotor speed Speed open loop control is carried out as explained in Section 2 5 Fill out MC ACIM Drive Param handMC_ACIM Motor param h see Section 5 1 3 and Section 5 1 2 respectively which concern the parameters related to drive method selection define SPEED OPEN LOOP TACHO SENSING Uncomment the above statement when a speed sensor is not being used to control rotor speed Speed open loop control is carried out as explained in Section 2 5 The tachogenerator signal is processed to check operating conditions or for debug purposes Fill out MC tacho param h and MC stm8s tacho param h see Section 5 1 4 and Section 5 1 10 which concern the define statements related to speed sensing Fill out MC ACIM Drive Param h and MC ACIM Motor param h see Section 5 1 3 and Section 5 1 2 respectively which concern the define statements related to drive method selection Doc ID 15783 Rev 1 63 85 Designing an app
56. during each period to store the captured values of the timer Each register has three locations which are called Oa Ob indexO register 0 or 1a 1b index1 register 1 The first location Oa or 1a respectively is used to store the earliest capture which has occurred after a TIMx update where x stands for the timer number selected to read the period of the tacho signal The second location Ob or 1b respectively is rewritten each time a new capture arrives The third location indexO or index1 respectively counts the number of captures that have occurred in that timer period Four basic operations of tachogenerator signal reading e Onacapture event the corresponding interrupt handler is entered The captured value of TIMx is written in a register location see above The index variable is incremented e Onatimer update event the corresponding interrupt handler is entered Pointing to registers is alternated context switching For example if register 1 was used to store captures in the previous period register O is used in the next period while register 1 is being analyzed see below e The timer prescaler TIMx PSCR is managed and configured to detect a number of captures equal to the user defined define statement TACHO PULSE AVERAGED see Section 5 1 4 Tacho sensor define statements MC tacho param h during the next timer period e Captures that occurred in the last timer period register 1 following the example above are p
57. e declared for the timer input capture selected for tacho signal processing see Section 5 1 9 Note The PIN description can be read from the appropriate STM8S datasheets The pins should not be used for other purpose inside the firmware and should never be configured as outputs GPIO alternate function remapping of TIM2 TIM3 channels should also be considered define IC FILTER DURATION Defines the length of the digital filter to be applied at the input stage of the selected timer channel The digital filter contains an event counter in which N events are needed to validate a transition of the output Valid filter values are summarized in Table 10 Doc ID 15783 Rev 1 77 85 Designing an application using the ACIM software library UMO0712 Table 10 Tacho input capture filter duration define Sampling Events psec filter psec filter IC FILTER DURATION frequency N F CPU 16 Mhz F CPU 24 Mhz 0x00 No filter No filter 0 0625 0 0417 Ox01 F CPU 2 0 1250 0 0833 0x02 F CPU 4 0 2500 0 1667 0x03 F_CPU 8 0 5000 0 3333 0x04 F_CPU 2 6 0 7500 0 5000 0x05 F_CPU 2 8 1 0000 0 6667 0x06 F_CPU 4 6 1 5000 1 0000 0x07 F_CPU 4 8 2 0000 1 3333 0x08 F_CPU 8 6 3 0000 2 0000 0x09 F_CPU 8 8 4 0000 2 6667 Ox0a F_CPU 16 5 5 0000 3 3333 OxOb F CPU 16 6 6 0000 4 0000 OxOc F CPU 16 8 8 0000 5 3333 OxOd F_CPU 32 5 10 0000 6 6667 Ox0e F_CPU 32 6 12 0000 8 0000 OxOf F CPU 32 8 16 0000 10 67
58. e electromagnetic torque is then produced due to the interaction of the two synchronous magnetic fields The difference between the air gap flux electrical speed s and the electrical rotor speed is the so called s ip speed of the rotor defined in Equation 2 Equation 2 Qe Qel The air gap flux electrical speed is also described as the synchronous speed Usually the slip is also expressed as a fraction of the synchronous speed Equation 3 Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control Equation 3 S Qe amp However there is an upper limit to the motor s speed If the rotor is running at synchronous speed Equation 4 there is no induced voltage For this reason induction motors are also called asynchronous motors and the torque is defined as an asynchronous torque because it is produced at any rotor speed except for the synchronous speed Equation 4 Q Qu P Consequently s 0 On the other hand if the rotor is stationary s 1 rotor induced voltage has the same stator frequency In this case the motor behaves as a transformer with short circuited secondary winding All other working conditions fall somewhere between these two limits The winding arrangement of a 2 pole induction motor is shown in Figure 1 Figure 1 Simplified arrangement of windings cross section Oa bs Os Doc ID 15783 Rev 1 15 85 Introduction to STM8S ACIM sca
59. e time bases They serve as a rough guide since the code size produced can be smaller or larger depending on the chosen memory model Library source code is released free of charge if used in the final application based on ST products Table 1 ROM and RAM requirements Configuration ROM Kbytes RAM Kbytes Speed open loop 6 13 0 18 Speed open loop load 6 32 0 18 compensation Speed open loop load l 7 35 0 21 compensation tacho sensing Speed closed loop V f slip control MTPA control ie OF 1 4 Development tools The present software library has been fully validated using the STM8 128 MCKIT motor control starter kit This kit also includes a Raisonance R Link hardware debugger which makes it an ideal solution to start a project and evaluate or use the ACIM software library For rapid implementation and evaluation of the ACIM library it is recommended to acquire the STM8 128 MCKIT motor control starter kit 1 4 1 Toolchains 12 85 This library has been compiled using COSMIC C toolchains running under ST Visual development release 4 1 2 STVD Free IDE and demonstration versions of third party toolchains can be found at http www st com mcu then select downloads A complete software package consists of e An IDE interface STVD free download available on internet e A third party C compiler Cosmic a free 16 K size limited evaluation version can be obtained upon request This version is sufficient to compile all stand alone firmwa
60. ectrical Hz 10 conversions hDigit to BusV Conv Constant 16bit Contains the conversion factor for DC bus voltage measurements define TEMP SENS ALPHA See ENTE alpha Constant ab description in MC PowerStage Param h bNTC beta Constant abit define TEMP SENS BETA See description in MC PowerStage Param h bStartup Vo Constant Bbit define STARTUP VO See description in MC ACIM Motor Param h hMax Speed Constant 16bit define MAX SPEED RPM See description in MC ACIM Motor Param h hMin run speed Constant 16bit define MIN RUN SPEED See description in MC ACIM Drive Param h hStall speed Constant 16bit define STALL SPEED See description in MC ACIM Drive Param h hStartup val speed hStartup duration Constant 16bit Constant 16bit define STARTUP VAL SPEED See description in MC ACIM Drive Param h define STARTUP DURATION See description in MC ACIM Drive Param h hStartUpFinalSpeed HzEI Constant 16bit define STARTUP FINAL SPEED See description in MC ACIM Drive Param h bControlLoop Period ms Constant 8bit Expresses the PID regulator action interval expressed in milliseconds pPID VF Struct Constant pointer Pointer to the speed PID structure pPID_MTPA_Struct Constant pointer Pointer to the speed PID structure Doc ID 15783 Rev 1 47 85 Getting started with the STM8S ACIM firmware UMO0712 48 85 The A
61. ed closed loop V f mode see Section 2 4 1 V f control and slip regulation This parameter is linked in association with the magnetizing current to the maximum stator current allowed see Section 2 3 Electromagnetic torque characteristic curve It must be chosen to avoid running next to the pull out torque condition define MTPA SLIP Defines in one tenth of a Hertz the optimum slip frequency fs that is applied by the drive when in speed closed loop MTPA mode fixed slip region see Section 2 4 2 Maximum torque per ampere MTPA control define STARTUP VO Defines in one tenth of a volt the voltage boost required at startup to compensate for stator voltage drop see Section 2 6 Startup strategy ACIM drive control define statements MC ACIM Drive Param h The MC ACIM Drive Param h header file includes define statements related to General drive define statements Speed closed loop mode and related define statements Speed open loop mode and related define statements Open loop load compensation mode define statements Operation speed checks define statements Startup phase related define statements Doc ID 15783 Rev 1 ky UMO0712 Designing an application using the ACIM software library General drive define statements define CONTROL LOOP PERIOD Defines the speed regulation frequency expressed in milliseconds define TARGET ROTOR SPEED Defines the default mechanical rotor speed set point when in r
62. enth of a Hertz the slip frequency fs that is applied by the drive during the startup procedure When the motor and the inverter being used are working in conditions where they can withstand a current overload this define statement in association with define STARTUP V F RATIO can help produce the extra starting torque many applications require see Section 2 6 Startup strategy Doc ID 15783 Rev 1 69 85 Designing an application using the ACIM software library UM0712 5 1 4 5 1 5 Note 70 85 Tacho sensor define statements MC tacho param h The MC tacho param h header file includes define statements related to the tachogenerator sensor These settings are used only in sensored configurations speed closed loop or speed open loop and tacho sensing modes In conjunction with these define statements the user should fill the MC stm8s tacho param h header file The tacho sensor define statements comprise define TACHO PULSE PER REV Defines the number of pulses per revolution given by the tachogenerator define TACHO PULSE AVERAGED Defines the target number of tacho periods to be captured during each speed measurement cycle This define statement determines the fractional number of rotor revolutions TACHO_PULSE_AVERAGED TACHO_PULSE_PER_REV over which the average motor speed is calculated Control stage define statements MC ControlStage param h The MC_ControlStage param h header file contains the pa
63. enu e Figure 23 Field selected for editing Editable field Read only field Seleted field Each sub menu is related to a specific issue of ACIM motor control The following sections provide a detailed description of the sub menus Users with less experience in ACIM motor control are advised to jump to Section 4 Getting started with the STM8S ACIM firmware 34 85 Doc ID 15783 Rev 1 ky UM0712 Running the demonstration program 3 3 2 Note Speed regulator parameters Overview Two different speed closed loop mode drive are implemented and selectable see Section 2 4 Speed closed loop control e V f control and slip regulation e MTPA control Before starting the motor either mode can be activated via the user interface see Section 3 3 5 Control strategy parameters If MTPA is enabled optimized drive efficiency both the PI regulators should be tuned see Figure 24 and Figure 25 and both the optimum slip and V f ratio should be settled see Section 3 3 3 Drive strategy parameters If MTPA is disabled optimized drive dynamics only one PI regulator should be tuned see Figure 24 and only V f ratio should be settled see Section 3 3 3 For both situations startup parameters should be specified see Section 3 3 4 Startup parameters Both the proportional and integral gains can be adjusted via the LCD user interface The differential gain cannot be adjusted in this way It is configu
64. error occurred The system also waits for user action The states marked with an asterisk are executed continuously until an event occurs user action or fault condition Doc ID 15783 Rev 1 ky UMO0712 Getting started with the STM8S ACIM firmware 4 1 2 Description of the state machine operation Each state corresponds to the execution of the related state machine function The change of state is performed according to the value returned by that state machine function The returned value of a state machine function can be one of the following e State remain No change in state is required by the state machine function e Next state The natural flow of the state machine is being followed for example idle gt init start gt start gt run The natural flow is symbolized by green lines in Figure 31 e Optional jump A path deviation caused by user action has occurred for example start gt stop Optional jumps are symbolized by blue lines in Figure 31 e Error condition A fault condition has occurred for example startup failure hardware fault The error conditions are symbolized by red lines Each state machine function make calls to the related drive functions to the user interface interaction functions and to the error check functions It executes the action on the basis of the outputs of these functions Figure 31 Main motor control state machine User interface STOP End of Fault User interface cond
65. f the startup procedure expressed in milliseconds This is the longest time the controller waits for the exit condition STARTUP VAL SPEED define statement to be verified In speed open loop mode and tacho sensing it defines the duration of the startup procedure expressed in milliseconds At the end of this duration the controller checks if the exit condition STARTUP VAL SPEED define statement is verified In speed open loop mode it defines the duration of the startup procedure expressed in milliseconds At the end of this duration unless other errors have occurred the controller switches from start to run state define STARTUP V F RATIO This define statement can be expressed as a decimal number It is used to set the V f ratio the drive applies to the motor during the startup phase STARTUP V F RATIO can be calculated as a ratio of motor phase voltage expressed in volts O V to peak and electrical frequency expressed in Hertz If the selected operating mode is speed closed loop this define statement defines maximum applicable V f ratio However if in speed open loop it defines the fixed V f ratio to be applied When the motor and the inverter being used are working in conditions where they can withstand a current overload this define statement in association with define STARTUP SLIP can help produce the extra starting torque many applications require see Section 2 6 Startup strategy define STARTUP SLIP Defines in one t
66. f the resulting PWM modulation PWM duty cycle reaches neither 0 nor 100 right graph of Figure 13 This is due to the fact that the minimum of the third harmonic corresponds to the maximum of the fundamental and vice versa Figure 13 Pure sine wave modulation and equivalent with third harmonic added Sinewave modulation Sinewave modulation with 3rd harmonic injection equivalent to pure sinewave modulation PWM Modulation Third harmonic Uncompensated Fundamental PWM duty cycle full modulation PWM duty cycle full modulation Consequently this allows the fundamental and the resulting third harmonic signal amplitude to be increased up to the point were the modulating signal reaches the DC bus limits 100 PWM modulation See Figure 14 By applying an appropriate coefficient to the third harmonic component the fundamental amplitude can be further increased by 15 Doc ID 15783 Rev 1 ky UMO0712 Introduction to STM8S ACIM scalar control Figure 14 Third harmonic injection with increased fundamental amplitude Sinewave modulation with 3rd harmonic injection PWM Modulation Third harmonic Fundarrental 15 PWM duty cycle full modulation Finally when considering phase to phase voltage on the motor third harmonic components
67. fers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE ST PRODUCTS ARE NOT RECOMMENDED AUTHORIZED OR WARRANTED FOR USE IN MILITARY AIR CRAFT SPACE LIFE SAVING OR LIFE SUSTAINING APPLICATIONS NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY DEATH OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ST PRODUCTS WHICH ARE NOT SPECIFIED AS AUTOMOTIVE GRADE MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any
68. g out8 VDEV_OUT8_LED_1 command Call used to drive the virtual LED 1 which is mapped to a real HO pin of the MB631 evaluation board The command can take one of the values below and is used to drive the HO pin in question LED_ON Sets a high state to the output turning on the related LED LED_OFF Sets a low state to the output turning off the related LED LED_TOGGLE Performs a toggle on the output switching it on or off out8 VDEV_OUT8_LED_2 command out8 VDEV_OUT8_LED_3 command Same as above but related to virtual LED 2 H1 pin of the MB631 evaluation board Same as above but related to virtual LED 3 H2 pin of the MB631 evaluation board out8 VDEV_OUT8_LED_4 command Same as above but related to virtual LED 4 H3 pin of the MB631 evaluation board inp8 VDEV_INP8_USER_INPUT none 4 Call used to get the input from the user interface joystick and key button in the implementation of the MB631 evaluation board Doc ID 15783 Rev 1 45 85 Getting started with the STM8S ACIM firmware UMO0712 4 2 3 46 85 Drive structure The drive structure contains the variables and parameters related to the motor and the drive The ACIM drive structure for speed closed loop control is shown in Table 5 Table 5 ACIM drive structure for speed closed loop control Name Type Description Control Mode Enum variable Specifies the control mode selected SPEED CLOSEDLO
69. gh level shell of the tachogenerator signal reading is implemented in the current firmware library source file MC tacho c see Figure 40 This module s operations rely on measurements performed by the low level shell see Section 4 3 2 Tachogenerator signal reading which are subsequently stored in virtual registers The operations take account of define statements which are related to the specific tachogenerator sensor in use They also take into account the timer clock frequency For example motor speed is calculated using Equation 16 Equation 16 STM8 FREQ x VDEV TACHO PULSE NUMBER VDEV TACHO COUNTS x VDEV PRESC ALER x TACHO PULSE PER REV Motorspeed X Doc ID 15783 Rev 1 UMO0712 Getting started with the STM8S ACIM firmware Figure 40 Tachogenerator speed measurement module MC tacho c module Tacho module initialization Tacho Init MC tacho param h TACHO PULSE PER REV MC stm8s clk param h STM8 FREQ MHZ Request for updated rotor speed calculation Tacho CalcSpeed HzMec Rotor speed Hz mechanical speed Request for last rotor measured speed Tacho GetSpeed RPM Rotor speed RPM mechanical speed Request for last rotor measured speed Tacho GetSpeed HzMec Rotor speed Hz mechanical speed VIRTUAL REGI STERS VDEV REG16 TACHO COUNTS VDEV REG8 TACHO PULSE NUMBER VDEV REG8 TACHO PRESCALER q Doc ID 15
70. gh resolution thus generating clean phase voltages Figure 16 shows a power demanding operating condition to highlight such functionality C3 measures the DC bus F4 is the duty cycle applied to a phase and C4 is the phase current The duty cycle applied is considerably distorted due to the very high oscillation of the DC voltage Figure 16 Bus voltage ripple compensation Measure P1 duty C1 P2 freq C2 P3 freq C3 P4 freq C1 PS freq C4 PB rms C4 value 135 94535 Hz 15 9906177 Hz 15 9723 kHz 22 694280 Hz 3 090 A status R E v v imebase 604 msl Trigger 50 0 ms div Stop 1 064 2 50MS 5 0MS s Edge Positive Doc ID 15783 Rev 1 ky UM0712 Running the demonstration program 3 3 1 Running the demonstration program The ACIM motor control software library includes a demonstration program which allows a SELNI AC induction motor to be driven by the user in sensored mode In this way a set of parameters can be changed via a user interface ACIM user interface The ACIM user interface has been developed to display drive variables and to customize the application by changing parameters and disabling enabling options in real time The interface is composed of e A 2x15 character LCD screen e A joystick see Table 2 for the list of joystick actions and conventions e A push button KEY button Table 2 Joystick actions and conventions Keyword User action UP Joystick pressed
71. ine wave and third harmonic generation block see Section 2 7 Three phase PWM sine wave and third harmonic generation Doc ID 15783 Rev 1 25 85 Introduction to STM8S ACIM scalar control UMO0712 2 6 26 85 Figure 11 Speed open loop control with load compensation AC Mains Voltage measurement i 1 Legend V Voltage amplitude Reference stator speed _ Slip speed reference value ay Target rotor speed Startup strategy The closed loop startup strategy implemented is displayed in Figure 12 A constant slip frequency equal to that specified in define statement STARTUP_SLIP see Section 5 1 3 ACIM drive control define statements MC ACIM Drive Param h is applied to the motor The resulting stator frequency applied is given in Equation 12 Equation 12 Q Met measured The stator voltage Vs increases linearly as a function of time as long as the relation below holds true V a lt STARTUP V F RATIO The voltage boost required at low motor frequencies to compensate for stator voltage drop is specified through the define statement STARTUP VO see Section 5 1 2 ACIM motor define statements MC ACIM Motor Param h As soon as the rotor measured speed is greater than STARTUP VAL SPEED see Startup phase related define statements in Section 5 1 3 the drive switches from start to run state and the control schemes explained in Section 2 4 Speed closed loop control are executed
72. ion via PID Figure 25 Constant slip control and flux regulation via PID Drive strategy parameters The sub menu shown in Figure 26 can be configured only when the firmware is in speed closed loop mode This menu allows the parameters related to drive strategy to be adjusted while the motor is running seeSection 2 4 1 V f control and slip regulation and Section 2 4 2 Maximum torque per ampere MTPA control Figure 26 Drive strategy parameters MTPA slip is displayed as one tenth of a Hertz while the V f ratio value is multiplied by 1000 Startup parameters The sub menu shown in Figure 27 can be configured in both speed open loop and speed closed loop modes This menu allows the parameters related to the startup phase to be adjusted while the motor is running Figure 27 Startup parameters Doc ID 15783 Rev 1 ky UM0712 Running the demonstration program 3 3 5 3 3 6 When the firmware is configured in speed closed loop mode the StUpVfR parameter represents the maximum V f ratio applied during startup When the firmware is configured in speed open loop mode StUpVfR is a constant ratio The StUpSlip parameter is the slip frequency maintained during startup see Section 2 6 Startup strategy for further details about the startup procedure Control strategy parameters The sub menu shown in Figure 28 can be configured only when the firmware is i
73. ion algorithm that must be performed at fixed time intervals Implementation of these virtual timers is based on a physical layer that uses the resources of the STM8S microcontroller The virtual timers are implemented using the TIM4 peripheral TIM4 is configured to generate an interrupt each millisecond and is used as a time base to update each virtual timer The virtual timers can be used in two modes e Polling mode The end of counting has to be checked using a specific function call Execution of the code is subject to the value returned by this function e Automatic mode At the end of counting the specified function is automatically executed Doc ID 15783 Rev 1 57 85 Getting started with the STM8S ACIM firmware UM0712 The virtual timers are implemented in one shot This means the counting must be restarted each time whatever the mode A set of virtual timers are implemented inside each drive firmware Each virtual timer is dedicated to specific operations It is identified by a name VTIMx where x is the number of the virtual timer Virtual timer names can be customized through a define statement For example timer number 0 can be named VTIM KEY by using the define statement define VTIM KEY VTIMO 4 4 2 Using the ACIM virtual timers The list of virtual timers used by the ACIM drive is given in Table 9 Table 9 ACIM virtual timers Name Type Description This virtual timer is used fo
74. ition START Fault CDLED S c QD Fault condition Comm condition condition End of START User interface End of d Next state a Error condition Optional Jump End of WAIT ky Doc ID 15783 Rev 1 41 85 Getting started with the STM8S ACIM firmware UM0712 4 2 42 85 Library architecture The STM8S ACIM motor control library has been logically divided into three different parts Figure 32 e MC_FWLIB_SCALAR containing the high level motor control modules e STM8_FWLIB containing the STM8 standard libraries e STM8 MC FRAMEWORK containing the low level motor control routines Figure 32 STM8S motor control library architecture High level low level interface werwus sonam FWLIB_SCALAR High level Device independent Virtual I Os HF Virtual registers Device dependant Low level STM8_MC_FRAMEWORK STM8_FWLIB Each part of the library is in turn divided into is divided in three sublevels as shown in Figure 33 e Inc folder containing the prototype definitions h files e Src folder containing the implementation files c files e Param folder containing the configuration files h file The configuration files contain everything necessary to customize the motor control drives The param folder is not present in the STM8_FWLIB Doc ID 15783 Rev 1 ky UMO0712 Getting started with the STM8S ACIM firmware Figure 33 STM8S motor con
75. its nominal value The resulting voltage amplitude and reference stator speed are applied to the motor by means of pulse width modulation of the three phase inverter This is implemented by the three phase sine wave and third harmonic generation block see Section 2 7 Three phase PWM sine wave and third harmonic generation Since the V f ratio is kept constant the higher the stator frequency required to reach the target speed the higher the applied stator phase voltage At a certain point under nominal load torque a maximum inverter modulation index nominal motor speed is required Following this the power flow reaches its maximum Higher speeds can be attained but at a cost of gradually reducing the magnetizing flux and hence the load applied Such operating mode called flux weakening is executed in the second speed region constant power In this second speed region see Figure 8 keeping the stator phase voltage at its maximum value progressively increases the stator frequency results in reduced V f ratios Consequently the air gap flux falls and the electromagnetic torque curves have progressively smaller breakdown torque values Simultaneously taking into account that the magnetizing current Im falls in proportion to the V f ratio the slip speed saturation value can be increased while respecting the motor nominal current and torque curve breakdown values Figure 8 Flux weakening region Vif ratio is decreased as
76. lar control UMO0712 2 2 16 85 ACIM steady state electrical circuit The equivalent electrical circuit of an induction motor is very similar to that of a transformer Since rotor voltages and currents are induced in the same way the only difference between the two is that in an induction motor the secondary winding is short circuited and the load or working condition is represented as a function of slip speed Figure 2 shows the equivalent T circuit of one phase of an induction motor phase a Voltages and currents of the remaining two phases are simply shifted in time by 120 The motor is considered to be wye connected Figure 2 Induction motor equivalent circuit 1 1 Legend V is the line to neutral stator applied voltage the stator phase current Im the magnetizing current the referred or equivalent rotor current rg is the stator resistance ris the referred rotor resistance Xl is the stator leakage reactance XI is the referred rotor leakage reactance Xm is the magnetizing reactance Re is the core loss equivalent resistance The rotor resistance and leakage inductance and their referred values are not directly measurable on squirrel cage motors Specific measurements such as no load and locked rotor tests provide methods to indirectly obtain these parameters In the equivalent T circuit the stator current is divided into two components The magnetizing current Im and the load
77. le using the current firmware library ranges from 8 bits to 9 bits This range allows the generation of a complete array of PWM frequencies according to user needs while simultaneously maintaining fixed and speed optimized PWM output calculation Example When the CPU frequency is 24 MHz the total number of timer counts required to generate a 12 kHz PWM frequency is 2000 In this case the timer reload register ARR is 2000 due to the center aligned pattern Therefore the offset value to have a zero output is 500 This gives an output resolution of approximately 10 bits 500 but using 24 bit calculations On the other hand by keeping the output resolution between 8 and 9 bits the calculations required for PWM update can be sped up Figure 34 shows that by decreasing the TIM1 speed to 12 MHz with a prescaler value TIM1_PSCR 1 the reload register is 500 and the output resolution is about 9 bits This allows 16 bit intermediate calculations Doc ID 15783 Rev 1 ky UM0712 Getting started with the STM8S ACIM firmware Figure 34 TIM1 initialization TIM1_ARR 500 OFFSET 250 1 Legend PWM frequency 12 kHz PWM period 83 3 us CPU frequency 24 MHz TIM1 frequency 12 MHz TIM1_PSCR 1 Total TIM1 counts required 1000 According to the specified PWM frequency as specified in Section 5 1 3 ACIM drive control define statements MC_ACIM_Drive_Param h the timer prescaler is automatically ch
78. ler see Figure 10 The LCD user interface shows in real time the current operating mode see Section 3 3 5 Control strategy parameters The resulting voltage amplitude and reference stator speed are applied to the motor by means of pulse width modulation of the three phase inverter This is implemented by the three phase sine wave and third harmonic generation block see Section 2 7 Three phase PWM sine wave and third harmonic generation Doc ID 15783 Rev 1 ky UM0712 Introduction to STM8S ACIM scalar control 2 5 Speed open loop control In some applications utilization of a speed sensor is not convenient and the load torque has a slight variation with speed In such conditions speed open loop control can be activated see Section 5 1 1 ACIM configuration file MC ACIM conf h To configure the firmware library accordingly see Speed open loop mode and related define statements in Section 5 1 3 The drive consists of applying a constant V f ratio so as to supply the required magnetizing current and a constant slip frequency Motor speed variation is attained by varying the stator frequency as a function of target speed and slip frequency according to Equation 1 1 Equation 11 Ob Marget e The V f ratio and slip frequency applied can be modified in real time by using the LCD user interface see Section 3 3 3 Drive strategy parameters This firmware library provides two open loop control modes e Pure open
79. ler specific ACIM drive define statements MC stm8s ACIM param h it evaluates whether or not to convert the heatsink temperature and or the user defined signal in the next PWM period Conversions are started as soon as their sequence is established Doc ID 15783 Rev 1 ky UM0712 Getting started with the STM8S ACIM firmware An ADC end of conversion interrupt ADC2 IRQHandler function is awakened after each single conversion has finished The purpose of the handler in this case is to store the result of the conversion and to start a single conversion if instructed by the ADC manager routine Following this and with reference to the BUS SAMPLING FREQUENCY define statement Section 5 1 3 ACIM drive control define statements MC ACIM Drive Param h the measured DC bus voltage is averaged Buffer length is defined by the BUSVOLT BUFFER SIZE define statement see Section 5 1 8 Microcontroller specific ACIM drive define statements MC stm8s ACIM param h It is placed in the VDEV REG16 BOARD BUS VOLTAGE virtual register Meanwhile the measured heatsink temperature is checked against its upper threshold and stored in the VDEV REG8 HEATSINK TEMPERATURE virtual register Conversely TIM1 CCRA is used to trigger the A D conversion of the DC bus voltage Since the center of the PWM pattern is mainly clear from power device switching this area is chosen for bus voltage reading by selecting TIM1_CCR4 TIM1 ARR 1 As soon as the trigge
80. lication using the ACIM software library UM0712 5 1 2 64 85 ACIM motor define statements MC ACIM Motor Param h The MC ACIM Motor Param h header file includes define statements related to the motor They are define MOTOR POLE PAIRS Defines the number of motor pole pairs define MAX SPEED RPM Defines the maximum rotor speed expressed in rpm define V F RATIO This statement is used to set the nominal V f ratio the drive applies to the motor It can be expressed as a decimal number which is calculated as a ratio of motor nominal phase voltage expressed in volts O V to peak and nominal electrical frequency expressed in Hertz This define statement is directly linked to the motor air gap flux and hence to the motor magnetizing current see Section 2 3 Electromagnetic torque characteristic curve define MAX V F SLIP Defines in one tenth of a Hertz the maximum slip frequency fg that can be applied by the drive when accelerating in speed closed loop V f mode see Section 2 4 1 V f control and slip regulation This define statement is linked in association with the magnetizing current to the maximum stator current allowed see Section 2 3 Electromagnetic torque characteristic curve It must be chosen to avoid running next to the pull out torque condition define MIN V F SLIP Defines in one tenth of a Hertz the maximum negative slip frequency fs that can be applied by the drive when decelerating in spe
81. ll functions related to the electrical drive and engine control see Section 4 4 3 ACIM scalar control MC tacho c This module contains all functions related to rotor speed measurement via a tachogenerator sensor see Section 4 4 4 Tachogenerator signal reading MC ACIM Motor This module is the holder of the drive structure It contains all functions used to interact get or set parameters with the ACIM drive structure or to get a reference of that structure for other modules MC ACIM User Interface This module is the holder of the user interface specific for the ACIM drive It contains a function used to provide the reference of that structure for other modules Interaction with the structure is managed by MC User Interface c MC User Interface This module is used to manage the user interface see Section 3 1 ACIM user interface which interacts with MC keys and MC display modules The user interface is specifically defined according to the drive of the MC ACIM User Interface module e MC dev This module is an interface between the high level and low level modules For example it is used to initialize the low level modules by calling each specific initialization function dev clklnit dev portlnit MC display This module is used to manage user display information In the firmware the display is implemented using an LCD screen of 15 rows x 2 lines Note This module is developed over the low level virtual
82. loop mode described above Open loop and load compensation mode see Section 5 1 3 ACIM drive control define statements MC_ACIM_Drive_Param h This mode aims to compensate the speed error due to a known load variation with speed For tuning debug purposes or application requirements the tachogenerator sensing module can be activated if a speed sensor is available Therefore the actual motor speed is displayed in the LCD user interface define SPEED OPEN LOOP TACHO SENSING see Section 5 1 1 2 5 1 Load compensation For applications where the load torque has a known characteristic curve and the speed accuracy is not critical speed open loop control plus load compensation can be chosen as a suitable drive To configure the firmware library accordingly see Speed open loop mode and related define statements in Section 5 1 3 Speed open loop control with load compensation control scheme is shown in Figure 1 1 The correct slip speed frequency for each target rotor speed is selected via a look up table which has been built offline by the STM8s motor control builder GUI see Section A 4 The look up table is based on the specific load torque characteristic curve provided by the user The resulting reference stator speed and the voltage amplitude V calculated according to the settled V f ratio are applied to the motor by means of pulse width modulation of the three phase inverter This is implemented by the three phase s
83. manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supersedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2009 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com ky Doc ID 15783 Rev 1 85 85
84. n speed closed loop mode This menu allows the user to select a control strategy between MTPA optimized efficiency and V f and slip regulation optimized dynamics Such a choice can be made only when the state machine is in idle state before sending a start command In Figure 28 MTPA mode is editable and allows the control strategy to be selected Switch it on to enable the MTPA control Switch it off to enable V f and slip regulation The second line MTPA shows the mode which is currently in use Figure 28 Control strategy parameters Displaying the DC bus voltage and heatsink temperature parameters The sub menu in Figure 29 shows the measured DC bus voltage and the heatsink temperature No parameters are selectable Figure 29 Bus voltage and heatsink temperature parameters The BUS DC value is the rectified input voltage expressed in volts The Heatsink value is the temperature measured by the negative temperature coefficient NTC resistor when it is placed on the power stage close to the heatsink of the power switches Heatsink is expressed in degrees Celsius Doc ID 15783 Rev 1 37 85 Running the demonstration program UMO0712 3 3 7 38 85 Fault messages This section provides a description of all the fault messages that can be displayed on the LCD screen when using the ACIM firmware together with the STM8 128 MCKIT motor control starter kit There are seven diffe
85. ne requency resoiution SWM REFRESH RATE x 65536 Clearly the higher the PWM REFRESH RATE define statement which can be adjusted as explained in Section 5 1 3 ACIM drive control define statements MC ACIM Drive Param h the better the resolution but the lower the maximum achievable stator frequency Example To synthesize a three phase sine wave with at least 12 points having selected a PWM frequency of 16 kHz and a PWM refresh rate of 3 the maximum stator frequency is about 444 Hz Figure 35 shows the scheme adopted in the current firmware library for ADC and TIM1 peripheral management The output compare registers TIM1_CCR1 2 3 containing the new PMW duty cycles are updated automatically at counter underflow and in consideration ofthe PWM REFRESH RATE define statement If TIM1 is configured in center aligned mode it is capable of a double update counter overflow and underflow events This feature of TIM1 can be used to improve the frequency resolution However it has not been used in this version of the ACIM firmware library Figure 36 shows the most important functions implemented in the current firmware together with their connections It also shows the main connections with other modules The TIM1 update interrupt function TIMi UPD OVF TRG BRK IRQHandler is used to run the ADC manager routine Depending on the HEATSINK SAMPLING FREQUENCY and USER ADC SAMPLING FREQUENCY define statements see Section 5 1 8 Microcontrol
86. ned utilization of ADC and TIM1 for motor driving 50 4 3 2 Tachogenerator signal reading 00 cee eee eee 55 4 3 3 Dissipative brake 1 2 1 irere tiri iiis rentia t 57 4 4 High level control us bun eed Cow aaaea 57 4 4 1 Virtual timers 26 eee ae 57 4 4 2 Using the ACIM virtual timers llle 58 4 4 3 ACIM scalar control 0 0 0 0c res 59 4 4 4 Tachogenerator signal reading llle 60 5 Designing an application using the ACIM software library 62 5 1 Customizing the ACIM software library parameter file 63 5 1 1 ACIM configuration file MC ACIM confth lllslsllssss 63 5 1 2 ACIM motor define statements MC ACIM Motor Param h 64 5 1 3 ACIM drive control define statements MC ACIM Drive Param h 64 5 1 4 Tacho sensor define statements MC_tacho_param h 70 5 1 5 Control stage define statements MC ControlStage param h 70 5 1 6 Power stage define statements MC PowerStage Param h 71 5 1 7 Microcontroller clock definition MC stm8s clk param h 74 5 1 8 Microcontroller specific ACIM drive define statements MC stm8s ACIM param h sssssse eee 74 5 1 9 Port pin definition define statements MC stm8s port param h 76 5 1 10 Tacho param microcontroller interfaces MC stm8s tacho param h 77 5 2 Setting up the system when using a brake resistor 79 ky Doc ID 15783 Rev 1 3 85
87. only required for customizing existing modules and for adding new ones for a complete application development Doc ID 15783 Rev 1 1 85 www st com Contents UMO0712 Contents 1 ua n5 mcm 7 1 1 Performance line STM8S features 000 c eee eee eee 7 1 2 Access line STM8S features 0 eee 9 1 3 ACIM software library V1 0 features 2 2 0 0 0 0 c eee eee 11 1 4 Development tools cbe Peco x Gaeuee hoe RE EGER RAS be ENS e bead 12 1 4 1 Toolclialns vee d ea ice Cer aa a tot eder e dade d 12 1 4 2 Programming tools ssi E IRPEbRIG ext ERR XR RA RERO ou 13 1 5 Reference documents 0000 ccc cece 13 2 Introduction to STM8S ACIM scalar control 14 2 1 Introduction to ACIM theory sssssele e 14 2 2 ACIM steady state electrical circuit llle 16 2 3 Electromagnetic torque characteristic curve aas asuaan nauan 17 2 4 Speedclosed loop control nuana anaana 19 2 4 1 V f control and slip regulation 00 02 19 2 4 2 Maximum torque per ampere MTPA control 4 22 25 Speed open loop control 00 eee 25 2 5 1 Load compensation ea dre weree eei ett 25 2 6 Startup strategy sese eR E RERAERRREGEERPEXEEREWREAG YE 26 2 7 Three phase PWM sine wave and third harmonic generation 28 2 8 Bus voltage ripple cancellation llle 30 3 Running the demonstration program ses 31 3 1 ACIM s r interfa
88. osen in accordance with Table 7 and Table 8 For instance if the CPU frequency is 16 MHz and the desired PWM frequency is 6 kHz the prescaler adopted is automatically 2 The amplitude resolution can be calculated using Equation 14 Equation 14 CPUfrequency 3222counts PWM amplitude resolution 4 x PWMfrequency x TIM1 PSCR 1 Table 7 PWM amplitude resolution CPU frequency 24 MHz PWM frequency Hz 9 bit resolution Hz Min resolution counts TIM PSCR used 23437 46875 23437 128 46875 Hz 0 11718 23436 11718 128 23436 Hz 1 7812 11717 7812 170 11717 Hz 2 5859 7811 5859 192 7811 Hz 3 4687 5858 4687 204 5858 Hz 4 3906 4686 3906 213 4686 Hz 5 3348 3905 3348 219 3905 Hz 6 Doc ID 15783 Rev 1 51 85 Getting started with the STM8S ACIM firmware UM0712 52 85 Table 8 PWM amplitude resolution CPU frequency 16 MHz PWM frequency Hz 9 bit resolution Hz Min resolution counts TIM_PSCR used 15625 31250 15625 128 31250 Hz 0 7812 15624 7812 128 15624 Hz 1 5208 7811 5208 170 7811 Hz 2 3906 5207 3906 192 5207 Hz 3 3125 3905 3125 204 3905 Hz 4 2604 3124 2604 213 3124 Hz 5 2232 2603 2232 219 2603 Hz 6 The output frequency resolution can be calculated using Equation 15 Equation 15 i PWMfrequenc PWM f lution n wirequency re
89. ou want to disable it leave this define statement uncommented The heat sink temperature will not be measured by the firmware and will be assumed constant and equal to the value specified in the next define statement define HEAT SINK TEMPERATURE VALUE Defines the constant value of the heat sink temperature if the heat sink temperature measurement feature has been disabled This setting is not used if the heat sink temperature measurement function is enabled define PWM LOWSIDE OUTPUT ENABLE Comment this define statement to disable the complementary output control of TIM1 In this case the required deadtime should be managed by the power device drivers Figure 41 Transduction curve between the temperature sensor and the ADC converted ADC converted value A gt Temperature C This curve represents Equation 17 where ais defined using TEMP SENS ALPHA D is defined using TEMP SENS BETA and TO is defined using TEMP TO Doc ID 15783 Rev 1 73 85 Designing an application using the ACIM software library UM0712 74 85 Equation 17 Transduction equation ADC ax t B ax To Microcontroller clock definition MC stm8s clk param h The MC_stm8s_clk_param h header file contains the following define statement strictly related to the microcontroller and its peripherals For this reason the name of the microcontroller is present in the name of the file define STM8 FREQ MHZ This
90. put for synchronous operation Smartcard IrDA and LIN mode LIN 2 1 compliant UART master slave mode automatic resynchronization SPlinterface up to 8 Mbit s C interface up to 400 Kbit s Doc ID 15783 Rev 1 9 85 Features UMO0712 10 85 Analog to digital converter ADC 10 bit x1 LSB ADC with up to 10 multiplexed channels scan mode and analog watchdog I Os Up to 38 I Os on a 48 pin package including 9 high sink outputs A Highly robust I O design immune against current injection Development support Embedded single wire interface module SWIM for fast on chip programming Non intrusive debugging Doc ID 15783 Rev 1 ky UMO0712 Features 1 3 ACIM software library V1 0 features ACIM voltage mode scalar controls Speed open loop Adjustable target rotor speed V f ratio and slip speed via the user interface UI Speed open loop and load compensation A Adjustable target rotor speed via the UI Varied V f ratio and slip speed according to the characteristic torque curve of the load Speed open loop and load compensation tachogenerator sensing A Adjustable target rotor speed via the UI Slip speed varying according to the characteristic torque curve of the load Rotor speed checked to validate startup and max min run speed Speed closed loop V f and slip control A Adjustable target rotor speed via the UI Rotor speed measured and
91. r two purposes It counts the duration of the welcome message It counts the time interval for the key repetition function When the joystick is set in one position or the button is VTIM KEY Polling pressed a fixed delay time KEY HOLD TIME 300 ms is respected before repeating this function KEY REPEAT TIME 100 ms This can be used to increase or decrease a field value by keeping the joystick pressed UP or DOWN This virtual timer is used to count the cursor blinking frequency VTIM_DISPLAY_BLINK Polling DISPLAY_BLINKING_TIME300ms This virtual timer is used to count the LCD refresh frequency VTIM DISPLAY REFRESH Polling DISPLAY REFRESH TIME300ms This virtual timer is used to count the delay time between the VTIM USER INTERFACE REFRESH Polling visualization of the error messages when several faults occur simultaneously This delay is set as 1 s by the firmware This virtual timer is used to call the ACIM drive function see V_TIM_ACIMDRIVE Automate Section 4 4 3 ACIM scalar control V_TIM_ACIMSTARTUP Automatic This virtual timer is used to time out the startup procedure This virtual timer defines the refresh rate of the information V_TIM_ACIMUPDATEINFO Polling sent to the LCD and DAC This virtual timer is used to define the duration of the high side V_TIM_ACIMSTARTUPINIT Polling driver bootstrap capacitor charging phase executed before each motor startup 58 85 Doc ID 15783 Rev 1 4
92. rameters related to the control stage These settings must be modified if the firmware is used with a customized hardware different from the one of the kit or to disable some library features in order to reduce code size and CPU occupation define DISPLAY Uncomment this define statement to select the control board LCD as display define DAC FUNCTIONALITY The DAC functionality is a debug option which can be used to analyze the behaviors of up to two variables inside the code The variables to be analyzed should not vary more than 20 kHz See Section A 1 for details on how to customize it The DAC functionality cannot be set together with the dissipative brake option define TIM1 CHxN REMAP Uncomment this define statement to remap the TIM1 CH1N TIM1 CH2N TIM1_CH3_N and TIM1 ETR pins This remapping is necessary if the STM8S features less than 80 pins ddefine BKIN Comment this define statement to disable the emergency input feature of the advanced control timer define JOYSTICK Comment this define statement to disable the joystick input define SET TARGET SPEED BY POTENTIOMETER Uncomment this define statement to use the potentiometer RV1 available on the MB631 This potentiometer allows to set the target rotor speed In this case the rotor speed cannot be modified using the joystick define AUTO START UP Uncomment this define statement to disable the KEY button management The motor is start to run
93. re configurations The choice of the C toolchain is up to the user However only COSMIC are fully supported and the dedicated workspace compatible with STVD can be directly opened in the root of the library installation folder STM8 STVD COSMIC stw STM8 STVD COSMIC BLDC stp STM8 STVD COSMIC ACIM stp Doc ID 15783 Rev 1 ky UMO0712 Features 1 4 2 1 5 In addition the STM8S motor control builder GUI see Section A 4 allows these libraries to be customized through variables corresponding to the motor you are using This makes the first utilization of the library significantly easier see Section 5 Designing an application using the ACIM software library Programming tools To program an MCU with the generated S19 file you should also install the ST Visual Programmer software STVP and use a SWIM programming interface Raisonance RLink The STVP tool provides an easy way to erase program and verify the code programmed in the MCU Go to htt www st com for information on STVP and RLink Reference documents e User manual UMO708 STMBS three phase AC induction motor software library V1 0 e Reference manual RM0016 STM8S microcontroller family e STM8S103xxx datasheet Access line 16 MHz STM8S 8 bit MCU up to 8 Kbytes Flash data EEPROM 10 bit ADC 3 timers UART SPI IC e STM8S105xx datasheet Access line 16 MHz STM8S 8 bit MCU up to 32 Kbytes Flash integrated EEPROM 10 bit ADC timers UART SPI I
94. red conversion has finished the related ADC EOC handler is entered Its assigned tasks in this case are e Compensate the DC bus ripple through variation of the modulation index required by the drive received through the function dev driveRun and the virtual register VDEV REG8 ACIM MODULATION INDEX e Update the three phase sine wave generated on the basis of the electrical frequency required by the drive received through the function dev driveRun and the virtual register VDEV REG16 ACIM FREQUENCY e Update the corresponding TIM1 output compare registers TIM1 CCR1 2 3 e Checkifthe converted DC bus voltage is higher than the overvoltage threshold defined in MC PowerStage Param h see Section 5 1 6 Power stage define statements MC PowerStage Param h Note The brake resistor is switched on hysteresis control or a fault overvoltage is generated depending on whether DISSIPATIVE BRAKE is commented Doc ID 15783 Rev 1 53 85 Getting started with the STM8S ACIM firmware UM0712 Figure 35 TIM1 and ADC utilization TIM1 CCRA eee TIM1 ARR TIM1 UPD IRQ ADC manager Heatsink A D conversion is started ADC EOC IRQ User Defined A D conversion is started BU EOC IRQ TIM1 CH4 TIM1 UPD IRQ ADC manager User Defined A D conversion is started ON Apc EOC IRQ Bus DC A D conversion is ADC EOC IRQ triggered Bus Voltage compensation 3ph sine wave generation T
95. red through VF KD and or MTPA KD define statements in MC ACIM Drive Param h see Section 5 1 3 Configuring the speed regulator When the firmware is configured in speed closed loop mode the user can adjust the speed regulator parameters while the motor is running The speed regulator implemented can be a proportional integral PI regulator or a proportional integral derivative PID regulator The regulator acts on the control variable minimizing the error between the target speed and the measured speed PID regulator parameter adjustment is performed by means of two sub menus which are displayed in succession The first sub menu is used to configure constant flux control and slip regulation see Figure 24 below via the PID regulator in the control scheme of Figure 7 V f and slip regulation control scheme The second sub menu is used to configure constant slip control and flux regulation see Figure 25 below via the PID regulator in the control scheme of Figure 10 MTPA mode control scheme The PID gains applied are the ratio between the values defined through the LCD screen and the divisors settled in the MC ACIM Drive Param h file Section 5 1 3 Example define VF KP DIVISOR 128 unit none define VF KI DIVISOR 512 unit none define VF KD DIVISOR 16 unit none Doc ID 15783 Rev 1 35 85 Running the demonstration program UMO0712 3 3 3 3 3 4 36 85 Figure 24 Constant flux control and slip regulat
96. rent fault sources when using the ACIM firmware in conjunction with the STM8 128 MCKIT motor control starter kit Over current error If a low level is detected on the PWM peripheral dedicated pin BKIN while the STM8 128 MCKIT motor control starter kit is being used either the hardware over temperature protection or the hardware overcurrent protection has been triggered Over temperature error This fault message is displayed when an over temperature has been detected on the dedicated analog channel The intervention threshold NTC THRESHOLD C and the related hysteresis NTC HYSTERESIS CO are specified in the MC PowerStage Param h header file see Section 5 1 6 Bus over voltage error This fault message is displayed only if the DISSIPATIVE BRAKE definition is commented default setting in the MC PowerStage Param h configuration header file see Section 5 1 6 It means that an over voltage has been detected on the dedicated analog channel The intervention threshold MAX BUS VOLTAGE is specified in the MC PowerStage Param h header file If the DISSIPATIVE BRAKE definition is not commented in the MC PowerStage Param h configuration header file it is assumed that a resistor with a high power dissipation capability was connected in parallel to the bus capacitors through a switch In this case the over voltage does not generate a fault event because the resistor is supposealy able to dissipate the excess voltage across the bus cap
97. rocessed to calculate the tacho signal period Three sets of information are entered into the virtual registers see Table 3 Virtual registers the number of timer counts between the first and last captures are stored in register VDEV REG16 TACHO COUNTS the number of captures occurred is stored in register VDEV REG8 TACHO PULSES while the timer prescaler used for that particular measurement is stored in VDEV REG8 TACHO PRESCALER On the basis of these data the high level section of the tachogenerator signal measurement module calculates the motor speed It takes into account the tachogenerator pole number and timer clock frequency see Section 4 4 4 Tachogenerator signal reading Doc ID 15783 Rev 1 55 85 Getting started with the STM8S ACIM firmware 56 85 Figure 37 Tachogenerator reading method V aka YY ghee WOW Register 0 i i 0a C1 2 1a C1 3 i 0b C3 2 1b C43 IndexO i IndexO i TIMx_PSCR x i TIMx_PSCR y ntext switching ontext switching captures stored in registerN c ptures stored in register 0 captures stored in register 1 processing register 0 TACHO COUNTS TACHO_PRESCALER processing register 1 TACHO_COUNTS C3 1 C1 TACHO_PRESCALER x processing register 0 TACHO_COUNTS C3 2 C1 2 TACHO PRESCALER x TACHO_PULSE_AVERAGED 4 TACHO PULSE AVERAG D 4 TACHO PUL
98. sensor and signal conditioning stage characteristics Typically the tacho signal is too weak at very low speeds to trigger input capture on the MCU define MAX SPEED FEEDBACK This define statement is valid in speed closed loop or in speed open loop with tacho sensing mode It defines the maximum speed above which speed feedback is unrealistic in the application in run state It is expressed in rpm define STALL SPEED This define statement is valid in speed closed loop mode speed open loop mode and tacho sensing mode It defines the maximum motor speed allowable to begin the startup procedure see Section 2 6 Expressed in rpm Doc ID 15783 Rev 1 ky UM0712 Designing an application using the ACIM software library Startup phase related define statements define STARTUP_VAL SPEED In speed closed loop mode or in speed open loop mode with tacho sensing mode this define statement configures the minimum measured rotor speed at which the startup phase is validated so that the control can switch to run state see Section 2 6 Startup strategy In speed open loop mode without tacho sensing mode it defines the target speed of the startup phase acceleration This parameter defines the maximum duration of the startup acceleration in conjunction with the OPEN LOOP ACCELERATION SLOPE parameter It is expressed in rpm define STARTUP DURATION In speed closed loop mode this define statement configures the maximum duration o
99. splays the first help message see Figure 19 The user can navigate to the next help menu by pressing the joystick RIGHT To go back to the previous help menu press the joystick LEFT The KEY button can be pressed any time to start and stop the ACIM motor When the KEY button is pressed the user interface is automatically switched to the run motor menu This action can be performed regardless of which sub menu is selected Doc ID 15783 Rev 1 ky UM0712 Running the demonstration program 3 2 3 Figure 19 Help menu HELP MENU 1 HELP MENU 2 HELP MENU 3 Main menu Changing the target and measured rotor speed To enter the main menu press the joystick RIGHT once more from help menu 3 see Figure 17 The main menu function is the same as the other sub menus except that the system is automatically switched to the main menu when the motor is started or stopped Once in the main menu the target rotor speed and the measured speed can be displayed see Figure 20 Figure 20 Main window showing target rotor speed and measured speed 1 To set the target rotor speed press JOYSEL when the Targ rpm function is active gt displayed and blinking 2 After pressing JOYSEL the arrow changes in to a double arrow 1 to indicate that the value can be changed see Figure 21 3 Press the joystick UP and DOWN to increase and decrease the value Figure 21 Selecting the target rotor speed
100. the pin by setting the xxx BIT define statements to GPIO PIN x where x with specifies the pin For instance set GPIO PIN 1 if pin 1 is used define DISSIPATIVE BRAKE PORT define DISSIPATIVE BRAKE BIT When the firmware runs on a customized hardware these define statements can be used to configure the port and pin used for the dissipative brake signal see Section 4 3 3 In the first define statement set the port by replacing the x character in the GPIOx string with the correct letter For instance set GPIOH if port H is used In the second define statement specify the pin by replacing the x character in the GPIO_PIN_x string with the correct number For instance set GPIO_PIN_1 if pin 1 is used 76 85 Doc ID 15783 Rev 1 ky UM0712 Designing an application using the ACIM software library 5 1 10 Tacho param microcontroller interfaces MC stm8s tacho param h The MC stm8s tacho param h header file contains the following define statements related to low level operations of the tachogenerator signal processing define TACHO TIMERx CHANNELy The default choice is TACHO TIMER2 CHANNEL2 the tacho signal is routed to Tim2 input capture 2 in the STM8 128 MCKIT motor control starter kit If the firmware runs on customized hardware the correct statement which reflects the actual timer input capture selection should be uncommented define TACHO IC PORT define TACHO IC PIN The corresponding GPIO port and pin must b
101. tomized hardware that uses a lower ADC reference value In this case EXPECTED MCU_VOLTAGE contains the required value used for the computation of the converted values The precision of the measurement can also be improved by setting EXPECTED MCU VOLTAGE to the appropriate value For example if the microcontroller measured power supply voltage is 5 1 V it is possible to set EXPECTED MCU_VOLTAGE to 5 1 to maximize the precision in the computation of the converted values define MAX BUS VOLTAGE define MIN BUS VOLTAGE These two values expressed in volts set the bus DC voltage range If the bus voltage exceeds OVERVOLTAGE THRESHOLD Vor is below UNDERVOLTAGE THRESHOLD V the corresponding error event is generated and is kept as long as the bus voltage remains outside the allowed range In addition if DISSIPATIVE BRAKE is defined an overvoltage event is handled by activating the brake resistor and the corresponding error message is not issued define NTC THRESHOLD C define NTC HYSTERIS C These two values expressed in C are used to set the power device operating temperature range measured at heatsink If the measured temperature exceeds NTC THRESHOLD C the corresponding error event is generated and is kept as long as the measured temperature remains above NTC THRESHOLD C NTC HYSTERESIS C define TEMP SENS ALPHA define TEMP SENS BETA define TEMP TO These three values are used to characterize the transduction curve between
102. trical Hz 10 to DPP digits per PWM bMotor Pole Pairs Constant 8bit Expresses the number of motor pole pairs bRPM to Hz Conv Constant 8bit Contains the conversion factor to transform rpm to electrical Hz 10 hRPM to Hz Ampl Constant 16bit Contains the amplification factor to enhance the rpm to electrical Hz 10 conversions hDigit to BusV Conv Constant 16bit Contains the conversion factor for DC bus voltage measurements define TEMP SENS ALPHA See description bNTC alpha Constant 8bit in MC PowerStage Param h bNTC beta Constant abit define TEMP SENS BETA See description in MC PowerStage Param h bStartup Vo Constant 8bit define STARTUP_VO See description in MC ACIM Motor Param h hMax Speed Constant 16bit define MAX SPEED RPM See description in MC ACIM Motor Param h hMin run speed hStall speed Constant 16bit Constant 16bit define MIN RUN SPEED See description in MC ACIM Drive Param h define STALL SPEED See description in MC ACIM Drive Param h hStartup val speed Constant 16bit define STARTUP VAL SPEED See description in MC_ACIM Drive Param h hStartup duration hStartUpFinalSpeed HzEI Constant 16bit Constant 16bit define STARTUP DURATION See description in MC ACIM Drive Param h define STARTUP FINAL SPEED See description in MC ACIM Drive Param h bControlLoop Period ms Constant 8bit Expresses
103. trol library organization d STM8 STVD COSMIC stw E 1 MC FWLIB SCALAR g Inc 1 Param BO Be Src H STM8 FWLIB oo Ee u Inc PO Be Src ET STM8 MC FRAMEWORK e Inc lins CJ Param ee G Src The high level modules contain the device independent algorithms while the low level modules contain the hardware dependent code This means that only the low level modules interact directly with the peripherals and the interrupt service routines of the microcontroller The high level modules interact with the low level modules mainly through three interfaces see Figure 32 e The virtual registers e The virtual I Os e The drive structure ky Doc ID 15783 Rev 1 43 85 Getting started with the STM8S ACIM firmware UMO0712 4 2 1 Virtual registers The virtual registers are composed of two sets of 8 bit and 16 bit registers Refer to Table 3 for a description of the virtual registers implemented in the ACIM firmware Table 3 Virtual registers Name Size Description VDEV REG8 TACHO PRESCALER 8 bit Contains the prescaler value used in the speed measurement performed with the Tacho sensor Contains the number of pulses to be taken into VDEV REG8 TACHO PULSE NUMBER 8 bit account for the speed measurement using the Tacho sensor VDEV REG8 ACIM MODULATION INDEX 8 bit Contains the modulation index to be applied for the ACIM drive VDEV REG8 ACIM MAX MODULATION
104. un state Expressed in rpm define PWM FREQUENCY Defines the PWM switching frequency applied to the power stage Expressed in Hertz define PWM REFRESH RATE Defines the repetition rate as a number of full PWM periods at which point new duty cycle command values are calculated and refreshed in output The higher the refresh rate the lower the CPU load and the better the output resolution achievable However maximum achievable frequency and DC bus ripple compensation are negatively affected see Section 4 3 1 Combined utilization of ADC and TIM1 for motor driving define DEAD TIME NS Defines the dead time duration expressed in nanoseconds to avoid a shoot through condition define DEAD TIME COMPENSATION Uncomment this define statement to enable the dead time compensation feature define BUS SAMPLING FREQ Defines the DC bus voltage sampling frequency required Expressed in Hertz Speed closed loop mode and related define statements In conjunction with the configuration selected in MC ACIM conf h Section 5 1 1 the following define statements are available if SPEED CLOSED LOOP is uncommented define CLOSEDLOOP CONTROLMODE SPEED CLOSEDLOOP MTA Uncomment above statement to enable the most efficient MTPA control strategy Fill the parameters of both the linear regulators for MTPA and V f control areas see Section 2 4 2 Maximum torque per ampere MTPA control e define CLOSEDLOOP CONTROLMODE SPEED CL
105. unction execution time 0 00 eee eee 82 CPU load resulting from motor control 0 0060s 83 Document revision history illeeeeeeeee re 84 Doc ID 15783 Rev 1 5 85 List of figures UM0712 List of figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 Figure 19 Figure 20 Figure 21 Figure 22 Figure 23 Figure 24 Figure 25 Figure 26 Figure 27 Figure 28 Figure 29 Figure 30 Figure 31 Figure 32 Figure 33 Figure 34 Figure 35 Figure 36 Figure 37 Figure 38 Figure 39 Figure 40 Figure 41 Figure 42 6 85 Simplified arrangement of windings cross section lilii llsllsesssn 15 Induction motor equivalent circuit 1 aaua uaaa 16 Induction motor equivalent circuit 2 llieeelele ee 17 Electromagnetic torque speed characteristic 0 000 eee 17 VA regulation 2 nuce Dueb dh bebo ue Dee SNR dS RE ae deo famed 18 V f and slip regulation lsleiseleese m m 20 V f and slip regulation control scheme llssssllesees eee 20 Flux weakening region lsseseeeeeeee rr 21 MTPA mode strategy oe cresti 00 0 cece ee hr 23 MTPA mode control scheme 0 00 ee re 24 Speed open loop control with load compensation 0 000 eee eee 26 Closed loop startup strategy 0 0
106. with Harvard architecture and 3 stage pipeline Extended instruction set Memories Program memory Up to 32 Kbytes Flash with 20 year data retention at 55 C after 10 kcycles Data memory Up to 1 Kbytes true data EEPROM with 300 kcycle endurance RAM Up to 2 Kbytes Clock reset and supply management 3 0 to 5 5 V operating voltage Flexible clock control 4 master clock sources Low power crystal resonator oscillator External clock input Internal user trimmable 16 MHz RC Internal low power 128 kHz RC Clock security system with clock monitor Power management Low power modes wait active halt halt Individual peripheral clock switch off Permanently active low consumption power on and power down reset Interrupt management Nested interrupt controller with 32 interrupts Up to 37 external interrupts on 6 vectors Timers 2x 16 bit general purpose timers with 2 3 capture compare channels input capture output compare or PWM Advanced 16 bit control timer 4 capture compare channels input capture output compare PWM edge or center aligned mode single pulse output mode 3 complementary outputs with adjustable dead time insertion Hardware fault protection break input Flexible synchronization 8 bit basic timer with 8 bit prescaler Auto wake up timer 2 watchdog timers Window watchdog and independent watchdog Communications interfaces UART with clock out
Download Pdf Manuals
Related Search
Related Contents
User`s Manual HP MSL5026 User's Manual T-Rex 450 Sport V2 Super Combo Traulsen ALT126WUT-FHS Freezer User Manual Alazard, Claude - HE-Arc Phonix SOXZ3BCB mobile phone case Manuel d`installation et d`entretien Electrodistributeurs à télécharger le document VARIO 200 Scotch Brite 2060 - Tampon Microfibre Usage Court Copyright © All rights reserved.
Failed to retrieve file