MatLab in Model-Based Design for Power Electronics Systems

This chapter’s main goal is to show how MatLab can be very useful when applied in the model-based design of dynamic systems, especially in the domain of power electronics systems. Two cases will be described that are encountered in energy conversion: i) a slip energy recovery (SER) system and ii) a power electronic converter for a fuel cell (FC) based energy generation system. In both cases, the energy handled in the process needs to be controlled and optimized in order to increase the efficiency of the systems. The chapter explains how MatLab/Simulink, with its toolboxes, is well adapted to solve the issues of defining the design requirements, at developing different components’ models for the physical evolution processes and, through the combination of various sub-systems, how it enables engineers to verify that the overall performance satisfies the requirements. Considering the aspects mentioned above, the chapter will illustrate how a simple PC can be used to test any power system and through the analysis of simulation results, manufacturing companies can reduce the amount of experimental tests and thus save lots of money. For each case study some details of the requirements and implementation are discussed and validation results are presented in order to conclude on the advantages of modelling processes using the MatLab/Simulink. In fact, at designing electrical engineering systems that require accurate models of components and sub-systems, MatLab/Simulink is shown to be an accurate design tool and useful for implementation and rapid prototyping. In the first case, a brief explanation about the circuit‘s configuration of a SER system is presented and its control implementation in MatLab/Simulink are done. The SER system presents some problems associated with the operation of the power electronics converter, namely its effects on the electromagnetic torque. To analyze these effects, the model of the system implemented in MatLab/Simulink supports the harmonic study, with several special features. The oscillations of the electromagnetic torque are explained by considering the interaction between the stator and the rotor fundamental and harmonic currents. The simulation results show a strong disturbance in the electromagnetic torque in the steady state, caused by the power converter operation. To reduce this disturbance, and consequently to increase the mechanical life of the motor, an appropriate DC link coil is shown to be useful. The presentation of the second case illustrates how MatLab/Simulink can be used when undertaking an accurate design of electrical generation systems based on hydrogen. The behaviour of PEM fuel cells is dependent on so many parameters, so obtaining an accurate


Introduction
This chapter's main goal is to show how MatLab can be very useful when applied in the model-based design of dynamic systems, especially in the domain of power electronics systems. Two cases will be described that are encountered in energy conversion: i) a slip energy recovery (SER) system and ii) a power electronic converter for a fuel cell (FC) based energy generation system. In both cases, the energy handled in the process needs to be controlled and optimized in order to increase the efficiency of the systems. The chapter explains how MatLab/Simulink, with its toolboxes, is well adapted to solve the issues of defining the design requirements, at developing different components' models for the physical evolution processes and, through the combination of various sub-systems, how it enables engineers to verify that the overall performance satisfies the requirements. Considering the aspects mentioned above, the chapter will illustrate how a simple PC can be used to test any power system and through the analysis of simulation results, manufacturing companies can reduce the amount of experimental tests and thus save lots of money. For each case study some details of the requirements and implementation are discussed and validation results are presented in order to conclude on the advantages of modelling processes using the MatLab/Simulink. In fact, at designing electrical engineering systems that require accurate models of components and sub-systems, MatLab/Simulink is shown to be an accurate design tool and useful for implementation and rapid prototyping. In the first case, a brief explanation about the circuit's configuration of a SER system is presented and its control implementation in MatLab/Simulink are done. The SER system presents some problems associated with the operation of the power electronics converter, namely its effects on the electromagnetic torque. To analyze these effects, the model of the system implemented in MatLab/Simulink supports the harmonic study, with several special features. The oscillations of the electromagnetic torque are explained by considering the interaction between the stator and the rotor fundamental and harmonic currents. The simulation results show a strong disturbance in the electromagnetic torque in the steady state, caused by the power converter operation. To reduce this disturbance, and consequently to increase the mechanical life of the motor, an appropriate DC link coil is shown to be useful. The presentation of the second case illustrates how MatLab/Simulink can be used when undertaking an accurate design of electrical generation systems based on hydrogen. The behaviour of PEM fuel cells is dependent on so many parameters, so obtaining an accurate www.intechopen.com Engineering Education and Research Using MATLAB 72 model of a PEM fuel cell, including dynamical behaviour, becomes essential to design electrical power generation based on fuel cells. For that purpose, a mathematical model of a PEM fuel cell system developed in MatLab/Simulink is explained and the accuracy demonstrated. However, the difficulties emerge in the lack of manufacturer data about the exact values of the parameters needed for modelling it. The method adopted in order to determine the optimum set of parameters is the simulated annealing (SA) optimization algorithm, which proves to be well adapted to satisfy the goal of a fast convergence to establish the right values for the cell parameters. In fact, optimization is a key task in modelling almost all-modern technology. Optimization forms the basis for modelling and computational analysis, design of experiments and the associated statistical analysis of the data. The results carried out with a DC-DC power electronics converter appropriate to optimize the real point operation of a FC show that the MatLab model is appropriate to be applied in designing electrical generation systems. For each case study presented, the simulation results are compared with experimental data obtained from commercial systems.

Slip energy recovery (SER) system
A slip energy recovery system is designed over a well-known control method of motor speed, which increases efficiency by returning the slip power back to the energy source system. However, this system presents some inconveniences, for example, low power factor, extra losses, harmonic current generation and electromagnetic torque oscillation. As a consequence, electromechanical vibrations are generated, which can cause motor failure and therefore, a need for motor rewinding and/or replacement. Operation of power electronic converters typically is cause of current and voltage harmonics, either on the mains side and or on the motor side, and these harmonics' components are transferred from one side to the other. Particularly, in a slip energy recovery system, harmonics are produced not only by the rectifier, but also by the inverter and motor through the DC link. This kind of analysis is not new, indeed, some authors have already studied similar problems. The following must be referred to: A. Mayer (1982) presented a complete study of a hiposynchronous converter cascade system, including the effects of the torque oscillation on the motor and the effects of harmonics in the mains. J. Brown and B. Jones (1986) developed and presented an analytical model for the analysis of performance of the Kramer drive system during transients. But in the present study, the system configuration is changed to overcome some of the remaining issues. The developed model is validated through the analysis and comparison of the results obtained in four types of different inverter thyristor bridges, with the same motor, diode bridge, and smoothing inductance. It is firstly concluded that it is better to adopt controlled flywheeling rather than the normal fully controlled technique for single-phase recovery bridge. Secondly, a 3-phase controlled flywheeling bridge gives the best machine performance, but at the expense of higher distortion in the supply currents than in the case with a fully controlled bridge. Results for stator current and voltage, rotor current and voltage, rectified current and electromagnetic torque are compared. R. Hanna (1989) presented some techniques for reduction of the harmonic content produced by adjustable speed drives. After a brief presentation of the main harmonic sources, the need to comply with harmonic standard IEEE 519 -1982 is discussed. The effects of harmonics on static devices and on electrical machines are examined and some techniques for their reduction are given. E. Akpinar and P. Pillay (1992) developed a model to predict the detailed operation of a slip energy recovery drive system in the transient and in the steady state system. They adopted a hybrid model which retains the actual rotor phase variables, but transforms the stator. They concluded that measurement and simulation results showed a good compromise. Y. Baghzouz (1992) introduced a method to evaluate the harmonics of currents and voltages of the SER system. The harmonic components were determined from closed form expressions that were functions of the numerical values of the distorted waveforms. The non-periodic nature of the stator currents and the existence of harmonics in the rotor currents and voltages for several speeds of operation were also presented. L. Refoufi and P. Pillay (1994) analyzed the impact of the system in terms of harmonic generation, with a chopper-controlled SER induction motor drive. They studied in detail the waveforms of the supply, stator and recovery currents, for different values of speed and analyzed the respective harmonic spectrum. The simulation and experimental results showed good agreement. W. Zakaria et al. (1996) developed a model of machine with a double-circuit in the rotor, one being delta connected and the other star connected, these two windings fed a 12-pulse diode bridge rectifier, in order to reduce the time harmonics in the machine. The simulation and experimental results showed a significant reduction of the current harmonics injected into the network and a significant reduction in the pulsating torque. A. Dell'Aquila et al. (1998) developed a method for the analysis of harmonic currents of the line side produced by variable speed induction motor drives. They developed a method to reproduce the distorted current waveforms injected by the drive system into the grid. G.  presented a circuit configuration that included a boost-chopper to connect the diode rectifier bridge to the dc-link voltage imposed by a voltage source inverter. To solve the drawbacks caused by the harmonics introduced by the rotor rectifier, they presented two different solutions. Despite its simplicity, this system presented good performance. A comparison between the phase-control and SPWM techniques showed that the SPWM is advantageous with regard to the phase-control technique. M. N. Eskander et al. (2001) presented a comparison between two inverter topologies for application in industrial drives. They presented the analysis of the steady-state characteristics of slip energy recovery drives, employing: a three-phase thyristor bridge inverter (topology 'A') and a three single-phase bridge inverter operating in the flywheeling mode (topology 'B') dealing with the waveforms of voltages and currents of the stator, rotor, DC link, inverter output and recovery transformer output. The results indicated that the power factor of the system employing inverter topology 'B' was higher than that of inverter topology 'A'. Therefore, the results encourage adopting the inverter topology 'B', in spite of the relatively more complex requirements of its control circuit. J. Faiz et al. (2001) studied the harmonics and performance of a slip energy recovery induction motor drive, based on the hybrid model dqabc. The sinusoidal pulse-with modulation (SPWM) control technique was used to improve the power factor of the drive and to weaken the injected low order harmonics into the supply. With the PWM technique, self-commutated switches (GTO or IGBT) replace the inverter thyristors and the inverter may operate with a zero reactive power. N. Hoshi et al. (1983) undertook a study of a slip power recovery system having sinusoidal rotor currents. The proposed system uses a PWM boost rectifier as a substitute for a diode rectifier and a boost chopper in a conventional compact type slip power recovery system. Therefore, with the incentives for energy-economy, a cement plant company decided to recuperate energy from the rotor of an induction motor that powered a big-blower. Instead of the conventional diode bridge, DC coil, thyristor inverter and adapter transformer, a set consisting of a thyristor bridge, no DC coil, thyristor inverter and an adapter transformer were selected. This presentation serves to present and discuss the particularities of the detailed model implemented in MatLab/Simulink. In the model, the motor, the transformer, and mechanical load parameters, are estimated by the experimental data provided by each manufacturer. Then, a three-phase transient model is modelled and simulated. Fig.1 shows the circuit configuration of the SER system, without the DC link coil, used in this study, with particular emphasis on the control system, represented by the S1 and S2 subtractors and NR and IR regulators. Besides the control system, the circuit is composed of: 1) a three-phase feedback transformer, represented by the Dd0 box; 2) the asynchronous motor M, fed through the stator by the three-phase mains RST; 3) the rotor windings, which are connected to the thyristor bridge SR1; 4) SR1 and SR2, which are the 6-pulse, 3-phase thyristor bridge rectifier and the 3-phase thyristor bridge inverter, respectively; 5) system components TG, IM and UM, which are used to measure the speed, current and voltage, necessary to the system control.

Model implemented in MatLab/Simulink
The model of the induction-motor is made in the PSB library. In this model, the rotor is referred to the stator. The adapter transformer is modelled with tree linear single-phase transformer models, also available in the PSB library. The converter is modelled with two thyristor bridges and no DC coil. It has the following main modules shown in Fig. 2: mains (M), asynchronous motor (AM), adapter transformer YgY0 (AT), starter rheostat (RS), rectifier bridge (SR1=RB), inverter bridge (SR2=IB), inverter adapter transformer (IAT), circulation-current-controller (CCC), mechanical load (blower -ML), rotor slip frequency calculator (RSFC), rotor voltages adaptive filter (RVAF), rectifier pulse generator (RPG), main voltage signal filter (MVSF), inverter pulse generator (IPG), rectifier controller (RC), inverter controller (IC) and inverter activation controller (IAC). Next, a general description of the system is presented.

General description
The rotor voltages are measured and with the slip frequency are the inputs of the adaptive filter (RVAF) that consists of a specially designed phase-locked 3-phase generator outputting three voltages with the successive 120º phase shift and phases locked with the corresponding unfiltered rotor voltages. The amplitudes of the generated voltages are limited in order to obtain a more stable system. These voltages, V_ab, V_bc and V_ca, are inputs to the rectifier pulse generator. In this pulse generator, V_ab, V_bc and V_ca, are processed in order to obtain the zero-crossing positive-going instants and a time-delay is computed according to the running values of the slip frequency and delay angle computed by the rectifier controller (RC). With these values of time, they are generated pulses, to be applied to the thyristors if they do not cause difficulties. The circulation-current-controller module (CCC) detects the occurrence of circulation current if it occurs and, in this case, blocks the ignition of the adequate thyristor in order to go out of the circulation current mode. The inverter controller (IC) and the rectifier controller (RC) have a rectified bridge current (Id) as input. The rectifier controller (RC) uses it for overcurrent protection, the inverter controller (IC) for imposing the current level of Id, in normal operation. Some details of the implementation of the various modules are presented below.

Pulse generation of the 3-phase inverter bridge
The pulse-generator of the 3-phase inverter bridge is based on the classical method applied for line-commutated converters, because the mains voltages are almost perfect with the particularity of the IGBTs pulses blocked during system startup.

Rectifier controller (RC)
The control of the rectifier bridge (RB), one of the main difficulties, is implemented considering that the system may operate in one of the following modes:

77
The control of the 3-phase rectifier is a more complex problem because the rotor voltages are not sinusoidal ones and have a low-frequency component proportional to the slip, which varies with the rotating speed. The difficulty increases because there is no DC link, therefore the voltage step due to the inverter appears directly in the rotor terminal voltages. Fig. 3 shows the details of the rectifier controller module (RC) that contains four submodules. Input Id is used for detecting overcurrent operation and input wm is used to detect if speed is inside the narrow band centred in the synchronous speed. The action to be taken is dependent on the output of the decision module (D).

1) Action module (A)
In normal asynchronous operation the output of D is 1, the action to take is to force αR to be 10º, using a rate limiter and the unblocking of the pulses after a delay of 0.8s, during rheostat system startup. In asynchronous mode with overcurrent, the output of the sum block is 3 and αR is forced to 90º using a rate limiter and the pulses are unblocked. This action tends to lower the DC current, if speed is inside the speed band and there is no overcurrent, the output of the sum block is 4, the action to take is to block the pulses and force αR to 0º using a rate limiter. Finally, if the speed is inside the speed band and there is overcurrent, the output of the sum block is 2, the action to take is to unblock the pulses and force αR to be 90º using a rate limiter.

2) Decision module (D)
Considering the operating modes 1, 2 and 3 described above, and using Boolean algebra, a table can be built, whose state variables set (A, B and C) may be in one of 3 28 = different states. Logic variable A at high level corresponds to the sub-synchronous normal mode. Logic variable B at high level corresponds to the overcurrent mode. Logic variable C at high level corresponds to the synchronous mode. The oversynchronous mode is not considered in this implementation. Table 1 presents the eight possible theoretical combinations; some of them do not occur in practice. Considering only the practical combinations, it may be verified that ABC =+ .

State Variable Values
Unblock pulses to the rectifier bridge

3) Overcurrent module (OC)
Fig . 4 shows the overcurrent module where the DC current, in SI units, is reduced to a perunit system using a base current of 983A. The result is passed through a low pass filter, with a time constant of 1.1ms, to reduce the oscillations. The output of this filter is compared with a per-unit maximum allowed overcurrent (2pu) and the difference is transformed into a logic level using a hysteretic comparator (Relay B), with ±0.01pu limits. When the output of the overcurrent module is equal to one, it indicates 'overcurrent'.

4) Synchronous speed module (SS)
In the detector of synchronous speed module presented in Fig. 3 above the speed wm, in radmec/s is reduced to a per-unit system, using a base speed of (3/100pi) radmec/s. The result is passed to a low-pass filter with time constant 1.1ms. The output of this filter is compared with a per-unit speed of 0.99pu and the difference is transformed into a long level using a hysteretic comparator (Relay C) with 0pu limits. When the output of the synchronous-speed module is equal to one, it indicates 'synchronous-speed'.

Circulation current controller (CCC)
As shown in Fig. 2, the implementation of the circulation current controller module, the subsystems of which are presented in Fig. 6a) and Fig. 6b), has inputs such as the rotor currents ia, ib and ic (A), the rectified current Id (A) and the pulses sent by the RPG module. The objective of this module is to send the pulses to the rectifier bridge-RB. In order to minimize the problem of the circulating-current, this module must implement some actions such as: 1st Action: Detection of the currents' state of conduction of each thyristor.
To know the values of the instantaneous current of each of the six thyristors rectifier, the rotor currents were measured and processed by hysteretic components. 2nd Action: Detection of critical states using AND blocks. Critical situations occur only with more than two thyristors conducting. Therefore, it suffices to take action with three thyristors conducting (123, 234, 345..., and 612). Table 2 presents these cases and the actions to be taken, that is: with thyristors 456 conducting, the non-safe condition occurs if thyristor 1 starts conducting. To stop this occurrence the blocking of pulses for thyristor 1 is activated. A similar procedure is taken for the other five possible cases. 3rd Action: Blocking of pulses (sent by the RPG) to the thyristor in each instance, to shortcircuit the rectifier bridge (RB).
The module of circulation current controller performs the all-necessary calculations, using AND operators to process the outputs of the DSM and RPG, for each thyristor. Deblocking signal for each thyristor  Topology  Ia  Ib  Ic   Thyristor to  be blocked  1  2  3  4  5  6  456 -

Inverter controller (IC)
As shown in Fig. 2, the inverter controller module inputs are the mechanical-speed (wm) and the DC link current (Id). This module contains two sub-modules in cascade such as the speed regulator (SR) and the DC current regulator (CR) as presented in the Fig. 7 below. The module SR sends the reference value of the current to the CR module, which in turn determines the value of the inverter angle, αI.

1) Speed regulator (SR)
The speed regulator sub-module is presented in Fig. 8 and the speed wm as the input (in radmec/s). This is processed by two paths: (a) In path1, wm is reduced to a per-unit value, using as base speed the synchronous mechanical speed, then the per-unit value wmpu is passed through a low-pass filter, with a time constant of 1.1ms and compared with the perunit reference speed in order to obtain the filtered error speed. This error is applied to a limiter with limits ±0.1pu. The output of this limiter is the signal D, the per-unit filtered and limiter speed error, which is active during most of the time. (b) Through the path2 the instantaneous speed is compared with the reference of 90radmec/s. The control signal E is used to select the input value of the PI controller. Then the main purpose of this module is to send a reference current (in pu units) to the DC current regulator module.

2) DC current regulator (CR)
The DC current regulator module is presented in Fig. 9 below. It has the DC current Id(A) and reference current iref(pu) as inputs. The DC current is reduced to a per-unit value, using a base-current of 982.43A. The per-unit value is passed through a low-pass filter with a 1.1ms time constant. The output of this filter is compared with irefpu and applied to a limited PI controller if time is higher than 0.8s. Between 0 and 0.8s, the controller input of the PI is zero, keeping the αI value constant. This action minimizes the initial transients due to the inverter.

Starter rheostat (RS)
During startup of the system, the two bridges are blocked and the rotor starting current passes through a liquid rheostat. This liquid rheostat is a time-dependent resistance as can be seen in Fig. 10. To model the variable resistance, the rotor currents were measured and the measurements were used to command a voltage-controlled-source, which in turn gives the values of the resistors R1, R2 and R3, as presented in Fig. 11. It was considered that the 0.1229 resistance decays linearly from 0.1229 to zero during the time interval of t0 to t1, being equal to 1MΩ during the time interval between zero and t0, and again equal to 1MΩ when either some starter time has elapsed or if the speed exceeds 30π radmec/s.

Simulation results
The simulation results are obtained considering the following parameters and conditions: integration method; ode23tb [stiff/TR-BDF2], step variable with a maximum value of 2e-4; absolute and relative tolerances of 10e-3; reference speed of 30π radmec/s and interval of time simulation of 0-10 seconds. The variations of the angles of the inverter and rectifier bridges are respectively: 90º 150º

Electromagnetic and mechanical torques
The electromagnetic torque is measured directly from the block model of the three-phase asynchronous machine selected in the library of MatLab/Simulink software. The S.I. unit parameter is selected. All the stator and rotor quantities are referred to in the rotor reference frame (qd frame). Considering an electrical system with these conditions, the electromagnetic torque is given by Eq.

Harmonic analysis
The harmonic analysis of the system is based on a programme developed for the effect, with several features, namely: the capability to analyse a large range of frequencies (until 2500Hz or more) and high resolution of the plots. The results for the stator current, the rotor current and the electromagnetic torque are presented below in Fig. 13 a) and b), Fig. 14 a) and b), and Fig. 15 a) and b), respectively. These figures show the signal amplitude versus frequency modulus. In order to obtain the maximum information concerning the spectrum of the variable, a logarithmic y-axis scale is adopted. The Discrete Fourier Transform (DFT) was used in this study and its module coefficients a0, ak and bk were calculated. A total of 10000 samples were used in the calculations.

Rotor current, ir
In steady state behaviour, a non-quality factor can be defined such as NQFir=(ir maxir min )/(ir max +ir min ) which corresponds to the distortion of the waveform of the rotor current. Without inductance in the DC link coil, this corresponds to a 0.4628 value and if an inductance of 10mH is used in the DC link coil, the value decays to 0.062. The spectrum of the harmonic components of the rotor currents due to the six-pulse rectifier (SR1) and to the DC side average value, appear at frequencies given by the Eq. 3, in which k=0, 1, 2, 3.  Fig. 13. b) Rotor current referred to the stator in steady state and the frequency spectrum with an inductance L of 10mH -the rotor slip in the case is 0.3906 Considering the Eq. 3, for k=0 and the slip s=0.3906, the fundamental rotor frequency is equal to 19.53Hz. Then the 5th, 7th, 11th and 13th harmonic orders appears in the rotor current and are equal to -97.66Hz, +136.7Hz, -214.8Hz and +253.89Hz, respectively. As it can be observed by the rotor current spectrums of Fig. 13 a) and Fig. 13 b) and by the Table 3, the rotor current frequencies reflect the DC current frequencies with two side-bands of the fundamental rotor frequency, which is 19.53Hz. The harmonic components, due to the sixpulse inverter that appear on the DC current at frequencies multiples of 300Hz, appear also in the rotor currents with two side-bands of m300Hz±19.53Hz, which for m=1 corresponds to the frequencies of 285.47Hz and 319.53Hz, respectively. The DC current distortion introduced by the six-pulse inverter is reflected on the rotor currents, resulting in the appearance of additional harmonics, given by Eq. 4, with k=0, 1, 2, 3,… and m=0, 1, 2, 3,…  Table 3. Frequencies and amplitudes of the rotor current referred to the stator for phase a and for slip=0.3906

Stator current, is
It was observed that in a steady state the peak-to-peak value of the stator current is not greatly affected by the value of the inductance placed on the DC link coil. A DC component of the rotor current establishes a rotating magnetic field in the air gap and induces voltages in the stator winding at frequency given by Eq. 5, where s is the slip and fms is the fundamental frequency. For s=0.3906 and fms=50Hz, this corresponds to a 30.47Hz with positive sequence.
Similarly, a rotor current frequency fr manifests itself in the stator current frequencies of (fr+fm) with fr>0, for positive sequence rotor currents, and fr<0, for negative sequence rotor currents. Adding the effect of motor speed to the rotor current frequencies, the reflected stator frequencies are given by Eq. 5, with k=0,1,2,3,....
Adding the effect of rotor side-band frequencies due to the inverter harmonics, the frequencies of the induced harmonics present in the stator, considering these two effects are given by Eq. 6, with k,m=0, 1, 2, 3. This equation will be reduced to the Eq. 5 if m = 0.

Electromagnetic torque, tem
Figs. 15 a) and 15 b) show the spectrum of the harmonics of the electromagnetic torque, considering two situations without and with an inductance of 10 mH. The harmonics presented in the spectrum of the electromagnetic torque can be explained considering the interaction of the magnetomotive forces (mmf) between the stator and the rotor currents, in its fundamental and harmonic components. The Eq. 7 below is used for the calculation of the electromagnetic torque.
Each component spectrum of the electromagnetic torque is due to the interaction between a sinusoidal component of the stator current and a sinusoidal component of the rotor current as is described by the Eq. 8 following: By rearranging the Eq. 8 above, this can be presented in the new form of Eq. 9, where k and k1 are constants, ws is the angular speed of the stator currents, wr is the angular speed of the rotor currents, wm is the mechanical speed in radelec/s, fs and fr are the stator and the rotor current frequencies and fm=(1-s).fs is the mechanical frequency in electrical Hertz. The values of ws and wr can be either positive or negative depending on the positive or negative characteristics of the sequence.

Experimental results
Although the main objective of this study did not focus on the power quality of the energy provided by the network, in order to evaluate the effects caused in this, by the system under analysis i.e. by the SER system, some experimental measurements were taken in the voltage busbars of 60kV and 6KV and also the voltage busbar that feeds directly the SER system. It was verified, however, that in any of the situations analyzed, only the fundamental frequency component of 50Hz is present. The current measured on the busbar of the SER system shows a waveform whose spectrum has the fundamental component of 50Hz and its multiples. Figs. 16 and 17 show the experimental results concerning the current waveforms for the rotor and the stator. The information relating to the harmonic spectrum of these variables is presented using linear scales in both x and y-axis. Due to the low plot resolution (just 256 points) used by the experimental equipment, the results do not show the detailed information that is obtained in simulation (with 10000 points). The experimental results were obtained for slip = 0.3906 and are in accordance with the simulation ones for the same conditions of the SER system operation.

Experimental rotor current, ir
Figs. 16 a) and 16 b) show the rotor current and correspondent spectrum for the slip=0.3906, the correspondent fundamental rotor frequency is 19.53Hz. The harmonic components introduced by the six-pulse rectifier converter, due to the DC side average value, are reflected on the rotor currents at frequencies given by the Eq. 3. The frequency of 19.53Hz (100%) is obtained when k is equal to zero in Eq. 3. The harmonics of 5th, 7th and 11th orders are also present in the spectrum and predicted by the equation. They correspond to the frequencies of 97.66Hz (26.8%), 136.71Hz and 214.83Hz, respectively.
As it is observed, the harmonic components, due to the six-pulse inverter that appear in the DC current at frequencies multiples of 300Hz, also appear in the spectrum of the rotor currents with two side-bands of 300Hz ± 19.53Hz. These correspond to the 280.47Hz and 319.53Hz peak frequencies in the spectrum of Fig. 16 b), respectively.

Experimental stator current, is
Figs. 17 a) and 17 b) show the stator current and correspondent spectrum for the slip=0.3906. By the Eq. 5 and Eq. 6 presented above, the analysis of the spectrum of Fig. 17 shows that: 1) the 50Hz fundamental frequency can be obtained when k is equal to zero in equation 5, 2) the 5th and 7th harmonics of the rotor current appear in the stator at frequencies of |-97.66 +30.47|=+67.19Hz and |+136.71 +30.47| = 167.18Hz, which correspond to using k equal to one and m equal to zero in equation 6, 3) the 11th harmonic of the rotor current appears in the stator at frequencies of |-214.83 +30.47|=184.36Hz.
The effects of the inverter harmonics on the stator current were obtained by Eq. 6 with k = 0. The highest peaks of the stator frequency are the 250Hz and the 350Hz corresponding to the rotating fields established by the rotor frequencies of 280.47Hz and 319.53Hz. X Scale: 50ms/div, Y Scale: 100mV/div, X Resol: 25# /div, Y Resol: 25# /div, X size: 256.

Conclusions
With this case study it was shown in a simple but clear form that the MatLab tools could meet all the requirements of implementing a particular and rather complex power electronics system such as the SER. The implementation of the SER system in MatLab has allowed a better understanding of the same and, in addition, has provided the answers necessary to act in conformity with the results. The implementation of the control and the characterization of the various elements of the system were presented in detail according to the strategy imposed by the commercial system. It should be noted that when this study was undertaken, the SER system was operating in a cement plant. The control strategy implemented allows the elimination of the circulation current of the system and for the harmonic analysis, a MatLab programme is developed for the effect, with several features, namely: the capability to analyze a large range of frequencies and high resolution. Some results for the stator current, the rotor current and the electromagnetic torque were presented. These results show the existence of strong components of high frequency on the stator and rotor currents. The oscillations presented in the electromagnetic torque were explained by considering the interaction between the stator and the rotor fundamental and harmonic currents. Considering the effect of the inductance of the DC link coil, it affects directly the ripple of the waveform of the rotor current, which is reflected in the values of amplitude of the frequency spectrum. energy generation systems. The control of the operation point of the PEM fuel cell requires appropriate use of static power electronic converters, capable of providing accurate support to the control methods. Hence, the main objective of applying converters with fuel cells is to obtain maximum efficiency using the easiest and correct control strategies, taking into account requirements like cost, efficiency, ripple current and stable operation under transient load conditions. There are two main possible converter topologies which can be utilized in order to meet the objective: a DC-DC converter together with a DC-AC and a DC-AC interfacing directly with the FC to the grid. A specific application must be considered in order to select the best topology. Usually the DC-DC converter is put between the fuel cell and the inverter which performs two functions: 1) acts as the DC isolation for the inverter; and 2) produces sufficient voltage for the inverter input so that the required magnitude of the AC voltage can be produced. The inverter can be single-phase or three-phase depending on the utility connection. Some typical structures of the electrical fuel cell system are presented in Figs. 18, 19 and 20 below. Basically, the DC-DC converter can be a current-fed or a voltage-fed type. A current-fed DC-DC converter requires less input filtering to minimize the high frequency current ripple drawn by the fuel cell because the inductor is placed at the input. Then, after an analysis and comparison of various topologies, a full-bridge resonant inverter, followed by an HF transformer and rectifier, composes the power scheme selected to our application. Additionally, two low-pass filters are inserted, one on the primary side is used to protect the fuel cell ripple-current and another on the secondary side is used to improve the quality of the energy supplied by the power system. The next sessions give some characteristics of the series-resonant topology, which are necessary for its design.

Model of the converter in MatLab/Simulink
A modular power scheme of the DC-DC converter and its implementation in MatLab/Simulink is presented in Fig. 21. The operation of this converter can be described as follows: the voltage supplied by the fuel cell stack, which is typically low (29V -42V), must be converted to a high and constant level, in our case, for 400VDC in order to be used to generate power to the grid through an inverter. The HF transformer is a step-up voltage transformer, which also serves as galvanic isolation between the high and low voltage levels of the circuits. The resonant converter with its LC series resonant circuit gives the sinusoidal waveforms of voltage and current in the primary side of the transformer. Selecting appropriate values for the L and C elements, the resonant frequency of the circuit is established. Then, the DC voltage of the fuel cell is firstly inverted in the primary side of the HF transformer, being rectified on the secondary side. The LC filter in the primary side allows protecting the PEM fuel cell from the ripple current and voltage produced by the converter, and also allows the storage of energy in the DC bus. The LC filter in the secondary allows reducing the ripple current and ripple voltage to the load, respectively.

Control structure
The control structure implemented in MatLab/Simulink corresponds to the modular scheme represented in Fig. 22, which is presented and described considering two parts. Fig. 22. Modular scheme of the control structure selected

Voltage controller
The voltage control sub-system is implemented in MatLab/Simulink as represented in Fig.  23 Fig. 23. Voltage control sub-system of the converter

Explanation of the voltage control sub-system
The voltage control sub-system of the converter allows limiting the maximum and minimum values for the output voltage i.e. the control output signal, Vcontrol, is always equal to zero (0), if Vout> = 750V(Selector #1), on the other side is always equal to one (1), if Vout = 0V (Selector #2). Otherwise, the control module works according to the main goal for which it was designed, that is, through a PI controller and regardless of the type and amount of load applied to the power system, it keeps the converter output voltage at 400V (Selector #3). This works as follows: the value of the output voltage (Vout) of the converter is obtained and compared with the reference value; an error signal is produced and processed by the P -proportional I -integral controller producing a reference signal of voltage control (Vcontrol). The proportional term responds immediately to the error voltage yet typically cannot achieve the required set-point accuracy without an unacceptably large gain. On the other hand, the integral term yields an error zero in steady state for a constant set-point and enables the rejection of disturbances.

Frequency controller
The frequency control sub-system implemented in MatLab/Simulink is represented in Fig.  24.

Explanation of the frequency control sub-system
The frequency control sub-system allows the generation of the four gate signals to the resonant inverter bridge, which changes accordingly to the signal reference. Once the input signal is known, interpreted as a voltage (VCOref), established by the PI controllers, the continues-time VCO generates a sinusoidal signal whose frequency shifts from the Quiescent frequency parameter (fc) with a sensitivity to the input parameter (kc) and amplitude Ac. The inverter topology is a full-bridge; then four output signals need to be generated by this sub-system, one for each transistor respectively (Mi, i =1,2,3,4). They are synchronized by φ, which is the initial phase parameter and assumes zero or π value in the case. Parameterization of the voltage control oscillator blocks are shown in Fig. 25 according to the Eq. 10.

PEM Controller
While the voltage-controller is responsible for controlling the output voltage of the converter, the PEM-controller is responsible for controlling the operation of the PEM, keeping it in its optimal operation point. This controller works as follows; once characterized an operation point of the PEM, for certain load conditions and constant output voltage (maintained by the voltage-controller), assuming for example that is point P in Fig.  26, the PEM-loop has the task of improving the performance of the system, defining a new point P ' or P'' that best optimizes the PEM performance, i.e. which maximizes the energy produced with minimum consumption of hydrogen. The algorithm of control that satisfies these conditions of operation is represented by the flowchart of Fig. 27 and its descriptive explanation are further given through the summary presented in the table below:

Flowchart explanation
While the voltage-loop is responsible of control-ling the output voltage of the converter, the PEM-loop is responsible of controlling the operation of the PEM, keeping it in its optimal operation point. This controller is implemented in MatLab/Simulink and works as follows; once characterized an operation point of the PEM, assuming for example that is point P in Fig.  26, the PEM-loop has the task of improving the performance of the system, defining a new point P' or P'' that best optimizes the PEM performance, i.e. introducing small perturbations in the system thus leading the cell to operate under conditions of maximum efficiency of the PEM, in other words, providing maximum power with minimal consumption of hydrogen. However, a minimum consumption of hydrogen means the operation of the PEM with minimum current, i.e. IFC minimum and VFC maximum, just in the sense of P' of the output characteristic of the PEM, as exemplified in the graph above. A lowering of the current cell implies a lowering of the operating frequency of the resonant converter, so the search condition from the point of optimum operation of PEM requires the lowering of the resonant frequency of the converter. Once you find the optimum for the present conditions of load, the resonant converter is operating at a frequency that is also the minimum frequency that ensures the load conditions imposed on the system. The process is repeated whenever there is a variation of the conditions imposed by the load. The actions to be performed by the PEM controller considering a particular condition of operation of the converter are summarized in Table 6.

PEM controller in MatLab/Simulink
As shown in Fig. 28 below, the implementation in MatLab/Simulink of the PEM controller previously explained is a cascade of various sub-systems, such as in a first step a sub-system generates a DELTA value. Once known, the value of DELTA, a new sub-system, generates a voltage reference value (Vcontrol), according to the current value of IFC. The term of IFC expressed by Eq. 13 takes into account the load conditions; the fact is that the power transferred from the PEM to the load has no losses and the output voltage must be kept always constant and equal to 400VDC. The DELTA value is reduced by a factor of 0.25 as shown in Fig. 28. Finally, there is a sub-system to control the output voltage VFC acting under the control algorithm previously explained.

DELTA sub-system in MatLab/Simulink
The sub-system DELTA and the corresponding parameterization of function relay are implemented in MatLab/Simulink as shown in Fig. 29 and Fig. 30.

Explanation of the DELTA system
For each module that produces a specific DELTA, the following methodology is used: a. VCO is compared with the lower limit value of the relay, b. VCO is compared with the upper limit value of the relay (the top line that enters in the comparator limit value).
www.intechopen.com The upper limit of each module of the sub-system DELTA is determined by the function 'relay' whose output is determined according to the following conditions. i. The lower value VCO to reach the ceiling value of the relay, ii. The higher value since the relay changes state (with VCO greater than the upper value of the relay), iii. The output relay again put on the lower value of output relay when VCO back down and reach the lower limit value. From this moment, the relay output (value upper/lower) is defined by this cycle -then turns to step i) and the cycle repeats. This methodology is applied for the overall DELTA steps, as an example, if the natural limit is 0.825, the relay has the limits > 0.825 and ≤ 1. When VCO goes up to 0.825, the output of relay is 0.825, and in this case there is a condition of equality. Above 0.825, VCO is greater and the relay function goes to the 2nd block. In the next internals of time, the current continues to rise and when it reaches the 1 value or other value may be higher it happens a singular situation, i.e. in either case in which VCO is 'exactly' equal to 1 is on the 1st block, leaving in the next block, because the voltage in the 1st block is greater. With these conditions, an increase of VCO happens.

Voltage control sub-system in MatLab/Simulink
The sub-system Vcontrol and the corresponding parameterization of function relay are implemented in MatLab/Simulink as shown in Fig. 30 and Fig. 31.

Explanation of the Vcontrol sub-system
For each module that produces a specific Vcontrol, the following methodology is used: a. IFC is compared with the lower value of the relay, b. IFC is compared with the upper limit value of the relay (the top line that enters in the comparator limit value). The upper limit of each module of the sub-system Vcontrol is determined by the function 'relay' whose output is determined according to the following conditions. i. The lower value IFC to reach the ceiling value of the relay, ii. The higher value since the relay changes state (with IFC greater than the upper value of the relay), iii. The output relay again put on the lower value of output relay when IFC back down and reach the lower limit value. From this moment, the relay output (value upper/lower) is defined by this cycle -then turns to step i) and the cycle repeats. This methodology is applied for the overall Vcontrol (92 steps), as an example, if the natural limit is 15A. The relay has the limits >15A and ≤ 16A. When IFC goes up to 15A, the output of relay is 15 and in this case there is a condition of equality. Above 15A, IFC is greater and the relay function goes to the 2nd block. In the next internals of time, the current continues to rise and when it reaches the 16A (or other value ... may be higher) a singular situation happens, i.e. in either case in which IFC is 'exactly' equal to 16A on the 1st block, leaving in the next block, because the voltage in the 1st block is greater. With these conditions, an increase of IFC happens.

Analysis of the static behaviour of the PEM
The analysis of the static behaviour of the PEM fuel cell is done for some variables that better characterizes its performance, namely, its polarisation plot Vfc =f(Ifc) and power delivery as function of the load supplied to the NEXA system. The voltage varies between 45V and 22V approximately, while current varies from 5 to 45A. The efficiency of this stack is around 22% -33%.

Analysis of the dynamic behaviour of the PEM
The analysis of the dynamic behaviour of the PEM fuel cell is done for several variables, which better characterizes its behaviour. The results presented correspond to the NEXA system. Fig. 33 illustrates the influence of the temperature on its polarization curve. As can be seen, in normal operation the losses experienced by the fuel cell are converted into heat, the stack temperature will increase or decrease respectively to the power delivered, therefore, as the temperature affects the performance of the PEM fuel cell, this needs to be analyzed in detail. So, three levels of temperature operation were considered for this study (40ºC, 50°C and 60ºC). Fig. 33 clearly shows that an increase in temperature decreases the value of output voltage and consequently the efficiency of the fuel cell. The dynamic behaviour of the PEM fuel cell is also affected by capacitor value, as can be observed in Fig. 34. If there is a decrease in the fuel cell current, the voltage rises, showing similar delay effect for different values of the capacitor. However, because each point on the polarisation curve is obtained in steady state, the delay due to the capacitor does not affect the polarization curve of the PEM fuel cell. The analysis represented is centred in the stepup current at an instant time of 27s. (1) C= 2.48F (2) C= 1.50F (3) C= 3.50F (2) (1)  Fig. 35 shows how in open loop mode, the operation of the power converter is affected through small variations in the reference signal VCO. It appears as an output voltage variation of the converter. This is because if the value of VCO is changed, the frequency of operation of the resonant DC-DC converter is c h a n g e d . I n a b s e n c e o f c o n t r o l o f t h e converter (in open loop), the higher the frequency of operation (that is to say, the VCO) the faster the response of the system and the output voltage value is at its highest, as can be seen by the three plots of the figure.

Analysis of the converter behaviour in closed loop
Figs. 36, 37 and 38 below correspond to time responses of the main variables of the converter system in closed loop. The plot response of PEM fuel cell for a change in the load at time 0.04s is represented in Fig. 36. As can be seen, in closed loop, the response of PEM to a step load requested (IFC) results in a reduction in the output voltage (VFC). The PEM response is affected by the PI controller implemented which aims to put the PEM operating in accordance with the request load and maintaining a constant voltage of 400V at the converter output, as can be seen in the plot of Fig. 38, which corresponds to a change in the load at instant time 0.04s. In Fig. 37 the LC series resonant tank waveforms are sinusoidal. The L and C components are placed on the primary side of the transformer and established for a resonant frequency of 50kHz. Obviously, other output powers demand lower converter frequency, operating around resonant pulses at the middle of the semi-period of the converter frequency.

Experimental results
Figs. 39 and 40 show some experimental results obtained in the digital oscilloscope Tektronix TDS2024. A Tektronix A622 is used for DC current measurement, while for the AC current measurement a CWT miniature Rogowski coil range from Powertek is used. The fuel cell voltage in Fig. 39 is 20.6V and the current of the fuel cell is in this case 11.3A. Considering two points of the experimental PEM polarization represented in Fig. 26, (10A, 20.88V) and (12A, 20.68V9 it can be seen that the measured values in the output of the PEM, during the operation of the resonant converter, are in accordance with the respective curve for a given request load. Fig. 40 shows the series resonant converter waveforms, namely the resonant voltage VCr and resonant current ILr, which are both sinusoidal as expected. The operation frequency of the converter is in this case 33.38Khz.

Conclusions
Similarly to the first case study presented, it was demonstrated in this second case that the MatLab tools could meet all the requirements of designing a power electronic converter for fuel cell (FC) based energy generation systems. The modeling of the converter and the PEM in MatLab/Simulink allows a better understanding of the behaviour of the system and provides results that are an excellent tool in the project of the dynamics of the controller. The case presentation is divided in two parts: in the first part the authors discuss the methodology for an accurate model for the fuel cell stack including its static and dynamical behaviour which is an essential aspect in the design of electrical power generation based on fuel cells. The design tool adopted is MatLab/Simulink, which proves to be a very common and easy tool for the design of electrical control systems. However, due to the lack of manufacturer data-sheets about the exact values of the parameters needed for modelling, it is necessary to adopt a methodology in order to determine the optimum set of these parameters. The method adopted by the authors is the simulated annealing (SA) optimization algorithm, which proves to be well adapted to satisfy the goal of a fast convergence to establish the right values for the cell parameters. The good agreement between the simulation and the experimental results shows that the proposed model provides an accurate representation of the static and dynamic behaviour for the PEM fuel cell. In the second part of the paper the authors give an overview of the possible topologies to be adopted for the DC/DC converter which are appropriate to take control and optimization of operation point of the fuel cell. In that sense, the soft switching proves to be particularly attractive and, in particular, the series resonant topology converters because they allow for reducing the switching losses and consequently increasing the efficiency. The simulation results are compared with real data obtained from a commercial system. Finally, the combination of a good power converter with a well-defined controller, together with the well-optimized fuel stack model, makes the electrical generation systems by FC very attractive indeed.

Conclusions
This chapter discusses the authors' approach to designing electrical generation systems based on MatLab/Simulink. It is shown, through explanation of development in MatLab using two examples, that MatLab is an appropriate tool for computational analysis of electrical systems in order to design physically controlled systems. In the first case in the chapter, it analyzed the implementation and control of a SER system, a conventional system based on power electronics and electrical drives. For the second case, the design process of a completely different system is chosen, also demanding experimental validation of results. The designing begins with the implementation of an appropriate model for PEM fuel cell behaviour based on analytical formulation of chemical processes behind fuel cell operation and the design of an equivalent and analogue electrical circuit describing the fuel cell operation. This case requires attention on the selection and implementation of an appropriated static power converter capable of either controlling and adapting the unregulated DC power generated by the fuel cell to a regulated electrical power source, or optimizing the efficiency of the fuel cell through appropriate input impedance. The power converter is a necessary sub-system for these kinds of systems, as it allows them to operate as controlled voltage sources for any operating point of the fuel cell. The quality of the approach is demonstrated through implementation of the fuel cell and converter models, and other conventional sub-systems in a MatLab/Simulink model of the generation system. The authors' approach allows for optimizing the design of electrical generation systems, both in economical terms and in performance quality, by making available accurate models that describe the electrical and chemical operations involved by simple methods when using the available toolboxes of the MatLab/Simulink. The results illustrate in both cases that the MatLab/Simulink, being a cheap design environment tool software, can be generically adopted as an appropriate and accurate design tool.