DSP user
DSP user
I-258
tested with DSP in Simulink simulations. The measured results voltages with a gain. The switching pulses are generated in
and conclusions are given in sections 4 and 5, respectively. hysteresis current control block, which ensures the actual
currents are forced to track reference current waveforms in a
2. Modelling and Code Generation for PWM Rectifier specified hysteresis band. The output of the DC link voltage PI
controller is calculated as follows [17]:
The circuit model of the PWM rectifier is constructed in
MATLAB/Simulink, which contains power system and power I cm ( k ) = I cm ( k − 1 ) + K Δe [ e( k ) − e( k − 1 )] + K ee( k ) (1)
electronics tools to analyse the systems and specific blocks used
in code generation for C2000 DSPs. This model contains the where Icm is the ac line current magnitude, e is the error
measurement of voltage and current signals in the power circuit between the reference and the actual values of the dc link
via analog-to-digital conversion and digital processes that voltage, and KΔe and Ke are the proportional and integral gains
should be developed on DSP as shown in Fig.2. Here, the DSP for a given sampling rate. The indexes (k) and (k-1) indicates
section is performing calculations for the control circuitry and the sampled values at the present and the previous sampling
generating the gate pulses of IGBTs. This block is designed as a instants, respectively. The sampling rate for the digital PI
subsystem and contains the part from which the DSP code will controller is defined as the sampling rate of the ZOH blocks in
be generated. the model. The system parameters are given in Appendix.
Once the stable operation of the system is ensured in
simulations, the C-code of the DSP block is generated using
MATLAB C2000 code generation tools. The voltage and current
waveforms generated in simulation model are fed to DSP in
order to emulate the signals from the sensors of the physical
system. The DSP processes these waveforms and generates the
switching patterns at each simulation step. Here, the generated
code by Simulink contains the part after the measured signals
are read from analog-to-digital converter (ADC) registers and
before the gate signals are written into PWM registers only. So,
the initialization of these registers that should be done in the
complete DSP code developed for the designed system
operation is not included in the Simulink DSP subsystem. In that
way, the generated DSP code for current control loop and dc
link PI controller can be tested without using the real system in
order to avoid any failure and physical damage to IGBTs and
other power devices.
I-259
interval, the calculations are performed on the DSP and
switching signals are written into the memory locations. Then,
the Simulink is enabled to read these values to perform the next
step of simulation. Hence, the calculations for the complete
system operation are performed in Simulink and DSP
sequentially: This kind of operation is essential especially in PI
controlled scheme, because the controller needs the previous
values of the sampled variables as shown in (1).
After generating the DSP code by using Simulink, the DSP
Section in the Simulink model is replaced by a developed
Simulink-Code Composer Studio (CCS) interface block. This
interface block in the model is an s-function [18] that provides
access to the memory locations reserved for the signals on DSP.
This s-function is created for the system designed. Hence, before
running the simulations with DSP, the generated code is loaded
to DSP and the communication between the MATLAB and CCS
was established.
Simulations are performed at fixed integration step size,
which is set forth in the Simulation Parameters in Simulink. The
proper operation of DSP code is tested before connecting it to
the real system. The DSP execution time is measured to be 50
microseconds for closed-loop rectifier operation in the generated Fig. 2. The Simulink model of PWM rectifier
code. Hence, the sampling rates are set to the values slightly
larger than these measured values. The results obtained from
Simulink alone and Simulink connected to DSP are obtained to
be very similar to each other. In Fig.4, the results for closed-
loop operation with DC link voltage PI controller are given.
Since the results of both simulation and DSP in simulation are
identical, the results of PI controlled rectifier are given for DSP
in simulation only. The DC link voltage reference was set to
300V and actual DC link voltage settles to its steady-state value
in 0.15s as shown in Fig.4.
3. Code Development for Shunt APF and its Fig. 3. DSP code generation block in Simulink
Simulation with DSP
I-260
currents, and dc link voltage at each integration step of the
numerical solver. While testing the DSP code with Simulink
model, the sampling rate in the model is set to 100kHz, which is
the rate of ADC and hysteresis current control (HCC) switching.
So, the interrupt service routine for HCC is removed into main
program cycle, which is not the case in the real system
operation. Finally, the rate for updating reference current value
was measured to be approximately 10kHz in the developed
program, these values are updated in the simulations over 10
main program cycle. The Simulink model of the system is
shown in Fig.5. A switching ripple filter is also connected to the
input terminals of APF to trap the high frequency components
that would appear on the filter currents and parameters of this
circuit are given in Appendix.
The communication between the MATLAB and CCS is
established using the s-function mentioned in Section 2.2 with a
few modifications to define additional memory locations. The
proper operation of DSP code for shunt APF is assured before
connecting it to the gate drive circuit of IGBTs in the prototype Fig. 5. The model of simultaneous operation of shunt APF
system. The entire circuit and control parameters of shunt APF model in MATLAB/Simulink and TMS320F2812 DSP
are given in Appendix. Fig.6 shows the results of obtained from
simultaneous operation of DSP with Simulink.
4. Result of Implementation
Once the control algorithm is tested using the DSP and 5. Conclusions
Matlab-Simulink in a simultaneous operation, the DSP can be
connected to the power block having IGBTs, gate drives and The DSP program of a 3-phase unity power factor PWM
signal conditioning circuits. In the closed-loop control, the DSP rectifier is prepared by using MATLAB package program. This
can perform calculations and generate switching pulses in 50 is implemented using the facilities of MATLAB Simulink and
microseconds with standard floating-point operations, which is TMS320F2812 DSP tools. These embedded code generation
satisfactory for the control of the complete system. The results facilities provide a safe transition from the analysis stage to
of closed-loop operation of the real system at the start-up implementation one in power electronics applications. The
transient and steady-state are shown in Fig.7. Since the approaches given here can be implemented for rapid prototyping
simulations are performed under ideal conditions neglecting of the system in industrial applications. The proper operation of
noise effect on signal conditioning, the noise and switching the DSP is guaranteed through simulations before testing the
ripples due to the turn-on and turn-off characteristics of IGBTs code on physical system. The simultaneous operation of the
do not appear in the simulation results unlike the real system. DSP with the Simulink models was also established by the
The reference currents are updated in the main program cycle at developed model structure. This approach has been further
the rate of 20kHz, which is a satisfactory for rectifier operation. extended to shunt APF application in this work. MATLAB code
generation tools for the applications requiring a large amount of
4.2. Shunt APF mathematical computations such as IRPT in shunt APF maybe
inefficient; therefore, the structure of the DSP program can be
The experimental results obtained when shunt APF reorganized and developed by the user and tested in simulation
compensating the current harmonics of a diode rectifier load are model. Code generations tools of MATLAB can be considered
shown in Fig.8. During experiments, the dc link voltage is to be useful in providing rapid prototyping applications that
boosted to 650V and the APF reference currents for harmonic requires less mathematical computations. Even though the
compensation are generated approximately 4 cycles after the dc structure of the system needs more time consuming in
link voltage is settled to its reference value. The APF reference execution, the procedure described here can still provide an
currents are updated in the main program cycle at a rate of efficient and safe way in testing the DSP codes prepared for real
10kHz, which is a satisfactory frequency range for the system implementation.
compensation of load harmonics.
I-261
Acknowledgment
This work was carried out as a part of project, “Power
Quality National Projects”, sponsored by Turkish Scientific and
Research Council and Turkish Electrical Power Transmission
Co. (TEA) under contract 106G012.
Appendix
PARAMERTS OF PWM RECTIFIER:
Parameter Symbol Value
Supply voltage peak value Em 100V Fig. 7. The dc link voltage and line current of PWM rectifier a)
AC side filter inductance Lf 13 mH
steady-state b) startup transient
Resistance of filter inductance Rf 0.1 ohms
DC link capacitor C 1.1 mF
Load resistance R 100 ohms
DC link voltage initial value Vdc(0) 160 V
Hysteresis band width εh 0.2 A
PI controller gains Ke 0.001
KΔe 0.1
PARAMETERS OF SHUNT APF
Parameter Symbol Value
Supply voltage peak value Em 310V
AC side filter inductance Lf 1.8 mH
Resistance of filter inductance Rf 0.1 ohms
AC side supply inductance Ls 100 μH
DC link capacitor C 2.35 mF
Diode rectifier load resistance RL 30 ohms
DC link voltage initial value Vdc(0) 550 V
Hysteresis band width εh 0.2 A
PI controller gains Ke 0.001 Fig. 8. Experimental results of the shunt APF a) load currents b)
KΔe 0.1
supply currents c) APF dc link voltage.
Switching ripple filter components L 0.25mH,
R 3 ohms, [8] M.P. Kazmierkowski, ‘Control strategies for PWM
C 30 μF rectifier/inverter-fed induction motors’. Proc. IEEE Int. Symp. on
Industrial Electronics, Puebla, Mexico, December 2000, pp.15-23.
6. References [9] M. Cichowlas, M. Malinowski, M. Jasinski, and M.P.
Kazmierkowski, ‘DSP based direct power control for three-phase
[1] H. Akagi, ‘Trends in active power line conditioners’, IEEE Trans. PWM rectifier with active filtering function’. Proc. IEEE Int.
Power Electronics, 1994, vol.9, no.3, pp. 263-268. Symp. on Ind. Elect.., Brasil, June 2003, pp.831-835
[2] M.K. Mishra, K. Karthikeyan, and P.K. Linash, ‘A development [10] M. Aredes, J.A.M. Neto, J.C.C. Ferreira, L.F.C. Monteiro, R.M.
and implementation of DSP based DSTATCOM to compensate Fernandes, and M.J.V. Siqueira, ‘A simplified control strategy for
unbalanced nonlinear loads’. Proc. IEEE Power India Conf., New a unified power quality conditioner prototype’. Proc. IEEE Power
Delhi, India, April 2006, 8 pp. Electronics Specialist Conf., Brasil, June 2005, pp.2592-2597.
[3] Akagi, H.: ‘New trends in active filters for power conditioning’, [11] E. Ozdemir, M. Ucar, M. Kesler, and M. Kale, ‘The design and
IEEE Trans. Ind. Applications, 1996, vol.32, no.6, pp. 1312-1322. implementation of a shunt active power filter based on source
[4] B. Singh, K. Al-Haddad, and A. Chandra, ‘A review of active current measurement’. Proc. IEEE Int. Electric Machines & Drives
power filters for power quality improvement’, IEEE Trans. Conf., Antalya, Turkey, May 2007, pp.608-613.
Industrial Electronics, 1999, vol.46, no.5, pp. 960-971. [12] C. Yanbo, Z. Fudan, and K.W.E. Cheng, ‘Shunt active power
[5] A.Emadi, A. Nasiri, and S.B. Bekiarov, ‘Uninterruptible Power filter-SIMULINK simulation and DSP-based hardware
Supplies and Active Filters’ (CRC Press, 2005). realization’. Proc. Int. Conf. on Power Electronics Systems and
[6] E.B. Barcenas, V. Cardenas, and J.A. Roffiel, ‘Shunt Active Power Applications, Hong Kong, November 2006, pp. 120-125.
Filters and PWM Rectifiers in Three-Phase Three Wire Systems: A [13] R. S. Balog, Z. Sorchini, J. W. Kimball, P. L. Chapman, and P. T.
Survey’. Applied Power Electronics Conference and Exposition, Krein, ‘Modern Laboratory-based education for power electronics
Dallas, Texas, March 2006, pp.1307-1313. and electric machines’, IEEE Trans. Power Systems, 2005, vol.20,
[7] M.P. Kazmierkowski, and L. Malesani, ‘Current control no.2, pp. 538-547.
techniques for three-phase voltage-source PWM converters: a [14] M. Dawande, V. Donescu, Z. Yao, and V. Rajagopalan, ‘ Recent
survey’, IEEE Trans. Industrial Electronics, 1998, vol.45, no.5, advances in simulation of power electronics converter systems’,
pp. 691-703. Springer India, 1997, vol.22, no.6, pp. 689-704.
[15] C. Defour, S. Abourida, and J. Belanger, ‘Hardware-in-the-loop
simulation of power drives with RT-LAB’. Proc. Int. Conf Power
Electr. and Drives Systems, Canada, 2005, pp. 1646–1651.
[16] The Mathworks, Inc.: ‘Embedded Target for the TI
TMS320C2000TM DSP Platform for use with Simulink-User’s
Guide Version 1’ (The Mathworks, Inc., 2003).
[17] T. Surgevil, and E. Akpinar, ‘Modelling of a 5-kW wind energy
conversion system with induction generator and comparison with
experimental results’, Renewable Energy, 2005, 30, pp. 913-29.
[18] ‘Writing s-functions’ (The Mathwoks, Inc., 2003).
I-262