Modelling and simulation of a switched power converter - CiteSeerX

2 downloads 0 Views 190KB Size Report
the power of electric rotary machines. We describe ... 3. 1. 2. 4 rm lm l0 c0 u2 u1 load. Figure 1: The power converter circuit. ... phase-angle between the two. 3 ...
Modelling and simulation of a switched power converter Krister Edstrom

Jan-Erik Stromberg

([email protected]) Dept. of Electrical Engineering Linkoping University S-581 83 Linkoping, Sweden

([email protected]) Dept. of Sensors, Signals and Systems Royal Institute of Technology S-100 44 Stockholm, Sweden

Ulf Soderman

Jan Top

([email protected]) Agrotechnological Research Inst. ATO-DLO, P.O. Box 17 NL-6700 AA Wageningen, The Netherlands

([email protected]) Defence Research Est. (FOA) Department of Laser Systems P.O. Box 1165 S-581 11 Linkoping, Sweden

Abstract

els and sti solvers. The design of such solvers is constantly being improved and hence the approach may become more and more powerful. Another approach is to approximate the abrupt changes by instantaneous transitions and use solvers capable of handling discrete events. The resulting model is then referred to as a hybrid system in that it combines discrete transition conditions with continuous di erential equations. The latter approach is adopted and evaluated here. Over the years, many papers have covered the problem of modelling and simulation according to the hybrid approach. A majority of these papers deals with mathematical and computational issues such as the mathematical representation, the interpretation, the analysis and the practical execution of hybrid systems [6, 4, 5, 1, 14, 2]. In our work, which started in 1990, we have adopted a slightly di erent view. Instead of emphasising the hardcore computational matters, we have emphasised the conceptual side [12, 11, 15, 13, 8] of the modelling process. As expected, such an approach raises much debate since simulation is usually seen as a computational issue. However, our claim is that a proper conceptual approach signi cantly improves the model and the modelling process. In particular, a conceptually clear model facilitates the communication between engineers and is more likely to survive during the entire product life cycle. In this paper we go one step further, claiming that a conceptually clear model even improves the quality of the generated simulation code. We do so by showing how simulation code for the well known DASSL solver can be generated from switched bond graphs as presented earlier [12]. In order to make the approach independent of the speci c solvers used, we also introduce a neutral mode transition le (MTF) format. The MTF format is a concrete

In our earlier work dealing with switched systems we have focused on the conceptual and formal side of the modelling process. In this paper we go one step further and illustrate the practical generation of simulation code from a switched bond graph. The principles are illustrated by means of an industrial switched power converter used to control the power of electric rotary machines. We describe an implementation of the formal Mode Transition System (MTS) presented earlier. The format proposed is referred to as Mode Transition File (MTF) format. We present an algorithm to generate the mode transition le from a switched bond graph. Finally we illustrate how this le format can be converted to code for the well known DASSRT solver.

1 Introduction The objective of this paper is to describe the process of generating numerical simulation code from a conceptual mode-switching model of a physical system. We illustrate the approach by means of an industrial power converter used to control the power of electric rotary machines. Some of the components in the power converter, the diodes and the thyristors, are very fast compared to the other components in the system. In other words, the change from state "conducting" to state "blocked" is several magnitudes faster than the normal change rate of the state variables of the system. Since these systems undergo abrupt changes between continuous modes of operation, we refer to them as modeswitching dynamic systems. There are essentially two di erent approaches to the modelling and simulation of mode-switching systems. One is to employ purely continuous mod1

across c0 will therefore continue to increase until diode 1 conducts. The current through the load will continue to drop until thyristor 2 is turned on once again. When 2 is turned on, 1 and 3 will start blocking immediately, and the system has returned the initial mode. Hence the average power transferred from the source to the load is determined solely by the timing of the control signals u1 and u2 . The most common way of manipulating u1 and u2 is to apply a periThe switched power converter in gure 1 is used to control the power transferred from a voltage source odic signal with a xed frequency, and to adjust the to an inductive and resistive load; our simpli ed phase-angle between the two. model of the rotary machine. The converter can be divided into two subcircuits: a main-circuit including u, rm , lm , 1 and 2 and a turn-o circuit including 3 , c0 , l0 and 4 . The power transferred from the source to the load can be controlled by manipulating the periodic control signals u1 and u2. A switched bond graph is a means to derive a hybrid model of a mode-switching system [12, 10]. The + switched bond graph language is an extension of u the classical bond graph language with one single element, namely the ideal primitive switch denoted load Sw. A switched bond graph may be viewed as a compact representation of a set of classical bond rm graphs, each one representing a unique mode. In 1 addition, a switched bond graph implicitly reprelm sents the mode transitions and the conditions for u1 switching between modes. + To derive a mode-speci c bond graph for a particular continuous mode, the switches in the switched bond graph are replaced by zero e ort or zero ow 2 sources, according to the states of the switches. 3 When the switch elimination is completed, it is typically possible to simplify the graph according to classical bond graph simpli cation rules. u2 c0 An interesting property of the switched bond l0 + graph language is that causality will change properly upon mode-transitions. A consequence is that 4 each mode-model derived from a switched bond graph corresponds exactly to the bond graph which Figure 1: The power converter circuit. could be derived directly from the system considered in that particular mode. Another conseWhen the main circuit is transferring power, quence is that switched bond graphs allow us to i.e. 2 is conducting and 1 is blocking, the current use causal analysis to identify e.g. 'fatal' or 'nonin the main circuit tends towards a steady-state de- physical' modes [10]. A third consequence is that termined by the magnitude of u, rm and lm . To the computational model generated from a switched turn-o the current at a certain level, the main cir- bond graph may not always be minimal (e.g. a state cuit has to be broken by the turn-o circuit. space form with if-conditions in the right hand side Provided that c0 is already pre-charged to some only). However, in automated modelling, minimalvoltage uc0 > 0 V, we initiate a harmonic oscilla- ity of the simulation code is not a critical issue since tion in the turn-o circuit by turning on thyristor this can be dealt with separately as a part of the 4 . The voltage over c0 will then eventually drop compilation process. Conceptual clarity is, in our below zero and as a consequence 3 turns on. Pro- view, much more important in order to maintain vided that the magnitude of the current through l0 model quality in an industrial context. is larger than the magnitude of the load current, A switched bond graph model of the switched the current through thyristor 2 will instantly drop power converter is depicted in gure 2. Here the to 0, hence making it turn o . diodes and thyristors are modelled as ideal switches, Since the turn-o circuit constitutes a harmonic i.e., they can be in one out of two possible states, oscillator, the current through l0 will eventually namely zero e ort (E ) or zero ow (F ) state. From pass through zero again, hence turning thyristor 4 the gure it is quite clear how the mechanisms in the o . The remaining circuit now consists of a series ideal physical model (IPM) in gure 1 are mapped connection of u, rm , lm , 3 and c0 . The voltage onto ideal primitive bond graph elements. Any implementation of the more abstract mode transition system (MTS) presented earlier [10] as a computational model of switched bond graphs. The paper is completed by a few example runs.

2 The switched power converter

3 The switched bond graph model

2

classical bond graphs. In order to represent an MTS in a computer, we have to make the representation more concrete at the expense of making it less neutral. Still, we can maintain neutrality with respect to the speci c numerical solver used. By maintaining this clear distinction between the meaning of a bond graph on the one hand (the MTS) and its execution on the other (the solver-speci c code), we make it simpler to generate code for a wide variety of numerical solvers. The concrete implementation of the MTS is presented here in terms of a neutral le format, referred to as the Mode Transition File (MTF) format. In order to produce code for a speci c solver, we simply need to write a parser which takes the MTF as input and generates the solver speci c code according to its speci c syntax. Compare this two-pass approach to that used in any high-level language compiler. The structure of the MTF is particularly designed to allow for future optimisation of the code size. The general idea is to allow for reuse of codesegments within an MTF. One of the keys to this option is the use of labels. Since the MTF is a concrete mapping of the underlying MTS, the information contained in an MTF is essentially the same as that of an MTS. More precisely, an MTF is a text le which consists of six main blocks: 1. An identi er declaration block 2. A mode-model declaration block 3. A transition condition declaration block 4. A transition initialisation declaration block 5. A mode (switch state) de nition block 6. A mode-transition de nition block The identi er declaration block is further partitioned into the following three parts:  Parameters: de nition of all model variables which are time-invariant  Variables: de nition of all time-varying model variables, except for those which are inputs to the system  Inputs: de nition of those variables which constitute the external input to the system (e.g. control signals or disturbances) The mode-model declaration block starts with the keyword ModeDynamics and is further decomposed into sub-blocks labelled md: where is an integer number  1. Each mode-model label is followed by a sequence of causally ordered di erential and algebraic expressions, de ning the behaviour of that particular mode. The expressions are restricted to the identi ers declared in the

Se: u

u1

1

0

Sw: µ1

Sw: µ2

0

1

I: l m

Sw: µ3

1

R: r0

C: c0

0

Sw: µ4

1

u2

I: l 0

Figure 2: A switched bond graph model of the power converter. method from the literature, to convert a domain speci c IPM to a bond graph, can be almost immediately applied to switched bond graphs. The conditions for switching between the two diode modes are f < 0 (E?! F ) and e > 0 (F?! E ), or reversed if the direction of the diode is opposite to the positive current direction. For a thyristor the rst condition is the same as for a diode, but the second condition involves an additional relation over the gate voltage u and the gate turn-on threshold k: e > 0 ^ u > k. As for the other elements in the bond graph, they are all assumed to be characterised by linear relations with the following parameter values: rm = 1 ; lm = 10 mH; l0 = 0:2 mH; c0 = 1 mF; u = 100 V . See [10] for further details regarding the characterisation of the switched bond graph.

4 The mode transition le In earlier work [10, 8, 9] we have presented a formal but abstract representation of the computational model underlying a switched bond graph. The representation is referred to as Mode Transition Systems (MTS). The purpose of the abstract notation used, is to allow a precise understanding of the behaviour represented by a switched bond graph. At the same time, the notation is neutral in the sense that we do not have to refer to the semantics of a speci c programming language in order to interpret the representation. In that sense an MTS plays very much the same role for a switched bond graph, as a differential algebraic equation (DAE) system does for 3

identi er block and to a speci c pre-de ned set of unary and binary operators. Expressions are delimited by line-wraps, mode-models are delimited by new mode-model labels and the entire modemodel block is terminated by the keyword EndOf ModeDynamics. The transition condition block starts with the keyword TransitionConditions and is further decomposed into individual transition conditions. Transition conditions start with condition labels trc: in the same way as mode-models do. Each condition label is followed by exactly one Boolean expression over relations over the identi ers in the identi er declaration block. The transition condition block is terminated by the keyword EndOf TransitionConditions. The transition condition block is followed by a corresponding initialisation block introduced by the keyword TransitionInitialisations. Transition initialisations start with initialisation labels tri: in analogy with transition conditions. Each such label is then followed by a sequence of expressions over the identi ers in the identi er declaration block. Expressions are delimited by line-wraps, initialisations by new labels and the entire block is terminated by the keyword EndOf TransitionInitialisations. The two transition related blocks are followed by the mode de nition block introduced by the keyword Modes. The block is further decomposed into separate modes by mode-labels mode:. Each mode-label is followed by a pair consisting of a mode-model label and a switch-state string. A switch-state string is a string composed of the state-labels of the individual switches. Therefore this string typically consists of a sequence of F:s and E:s corresponding to the e ort and the ow states of the switches. Modes are delimited by new mode-labels and the entire block is terminated by the keyword EndOf Modes. Note that two di erent modes, i.e. switch state con gurations, may very well correspond to one and the same continuous mode-model. This is the reason for making a distinction between mode-models on the one hand, and modes on the other, since it facilitates optimisation of the size of the MTF by reuse of mode-models. The MTF is nally concluded by a transition declaration block introduced by the keyword Transitions. The transition block is the block which de nes the structure of the overall transition system. It consists of a sequence of transition declarations, which are delimited by means of square brackets ([]). Each individual transition consists of a pair of mode-labels, delimited by [], a transition condition label and a transition initialisation label. These three elements are delimited by commas. One of these elements, namely the transition initialisation, is optional, and may therefore be substituted by the special keyword nil (no initialisation). The mode transition block is terminated by the keyword EndOf Transitions. The entire MTF is -

nally terminated by EndOf

ModeTransitionFile.

4.1 Generating the MTF

In an ongoing research e ort, we are currently implementing experimental code generators for the proposed MTF format. When providing the switched bond graph in gure 2, the code generator, currently under construction, generates the MTF example presented below. The code-partition presented shows the information relevant for mode FEFE . Also, the identi ers appearing in the code, have the following meaning with respect to the variables in gure 2: rm = R1, lm = I1, l0 = I2, c0 = C1, u = Se1, u1 = u1, u2 = u2, uc0 = x1, ilm = x2, il0 = x3 Given these identi ers, the following code is produced by the code generator: ModeTransitionFile Parameters R1 = 1.0 C1 = 0.001 I1 = 0.01 I2 = 2.0e-4 Se1 = 100.0 EndOf Parameters Variables x1, x3, x2 EndOf Variables Inputs u1, u2 EndOf Inputs ModeDynamics . . . md6: der(x1) = - 1/(I2)*x3 der(x2) = Se1 - R1/(I1)*x2 der(x3) = 1/(C1)*x1 . . . EndOf ModeDynamics TransitionConditions . . . trc5: 1/(I2)*x3 < 0 . . . trc9: Se1 > 0 trc10: 1/(I1)*x2 < 0 trc11: 1/(C1)*x1 > 0 . . . EndOf TransitionConditions Modes . . . mode6: md6, FEFE . . . EndOf Modes Transitions . . .

4

VDA

[ [ [ [

[mode6, mode14], trc9, nil] [mode6, mode2], trc10, nil] [mode6, mode8], trc11, nil] [mode6, mode5], trc5, nil] . . . EndOf Transitions EndOf ModeTransitionFile

250

200

150

100

50

The complete algorithm generating the MTF is a two-pass algorithm. In the rst pass the modes are extracted, and in the second, the transitions are derived. The algorithm for nding the modes is straightforward: for all combinations of switch states, replace the switches by proper sources, and then derive the mode-equations using established algorithms [7, 16]. In order to extract the transitions, we rst have to make an important decision: Do we allow for one single or any number of switches to toggle at one single mode-transition? As usual, the choice depends on the purpose of the model and the questions to be answered by the simulation. The choice is also a matter of computational complexity. So far we have employed so called interleaved composition, [9], of the transitions, which means that we assume only one single switch can toggle at one single mode-transition. The consequence of making this assumption is that we have to deal with so called transient modes. The analysis required to resolve this problem was described in [10]. Due to space restrictions we will not further discuss the practical implementation of the transient mode-analysis. Another consequence of the decision made, is that the resulting MTF will become smaller than if more than one switch were allowed to toggle (parallel composition). Leaving out the details having to do with transient modes, the resulting transition composition algorithm can be summarised as follows: For all modes and all switches, change the switch state corresponding to the mode by toggling one switch. Add to the set of transitions the transition between the original mode, the new mode and the condition for toggling the switch to the new mode. Finally add the initialisation rule (if any) to that transition.

0

-50

-100

0

0.02

0.04

0.06

0.08

0.1

0.12

0.14

Current through load Voltage over C0 Current through I0

Figure 3: Result from a simulation of the bond graph of the power converter.

given in terms of a Backus-Naur Form (BNF) or equivalent. Using the experimental DASSRT code generator constructed so far, we obtain the simulation result depicted in gure 3. In this particular experiment the initial values were uc0 (0) = 100 V, ilm (0) = 90 A and il0 (0) = 0 A. We see that the average load current ilm is approximately 100 A and that the turn-o circuit is active only a small part of the time. To study the details of the cyclic mode-changes, we focus on a small part of the simulation data. In gure 4 the rst peak of the load-current is plotted. Here the changes between the di erent modes are clearly visualised, with the load-current rescaled and rebiased. The plot begins in mode (a), i.e. switch state FEFF in which the current through the load is slowly increasing. Then thyristor 4 is turned on externally. In mode (b) (FEFE ) the voltage uc0 over the turn-o capacitor starts to decrease. When uc0 passes below 0, a new mode (c) (FFEE ) is entered since diode 3 starts to conduct and thyristor 2 turns o . Mode (d) (FFEF ) is entered when the current through the turn-o thyristor 4 crosses the zero again. Finally mode (e) (FFEF ) is entered when voltage uc0 reaches the same value as u and diode 3 blocks. The cycle restarts when thyristor Once the MTF has been generated, it can almost 2 is once again turned on externally. immediately be converted to code speci c for a certain numerical solver. Consider for instance the well known solver DASSRT, a version of DASSL [3] with a built-in root nder. Converting the MTF to the Fortran code required by DASSRT is now a mat- We have shown that simulation code for hybrid syster of simple string manipulations. This converter, tems can be extracted from a switched bond graph. and many other converters that may be needed in The result is a Mode Transition File (MTF), the the future, can be automatically generated by any operational version of a Mode Transition System compiler-compiler, once the syntax of the solver is (MTS). The latter formally represents the compu-

5 Simulation code generation

6 Conclusions

5

V/A

(a)

(b)

(c)

(d)

(e)

(a)

250

[5]

200

150

[6]

100

50

0

[7]

−50

−100 0.018

0.019

0.02

0.021

0.022

0.023

0.024

0.025 t

[8]

Current through load Voltage over C0 Current through I0

[9]

Figure 4: A closeup of the simulation result, showing the di erent mode transitions. The load current is rescaled and rebiased.

tational model underlying a switched bond graph. The format of the MTF is independent of the speci c solver used, and serves as a neutral exchange le. Moreover, by separating the modes and mode transitions from their internal speci cations, we al- [10] low for optimisation of the code size. We have implemented the proposed approach and tested it for a number of practical cases. Some simulation results have been presented using a nontrivial example from the electrical domain. In the ongoing research of hybrid systems we plan [11] to develop a formal (BNF) syntax of the MTF. This will allow others to generate translators for speci c solvers. Moreover, we aim to work more on the issue of transient modes and mode consistency checking. We assert that the introduction of the conceptual switching element in bond graphs alleviates these [12] inherently complex and important problems.

References

[13]

[1] M. Andersson. Object-Oriented Modeling and Simulation of Hybrid Systems. PhD thesis, Lund Institute of Technology, 1995. [2] M.S. Branicky. Studies in Hybrid Systems: Modeling, Analysis, and Control. PhD thesis, MIT, 1995. [3] K.E. Brenan, S.L. Campbell, and L.R. Petzold. Numerical Solution of Initial-Value Problems in Di erential-Algebraic Equations. NorthHolland, 2 edition, 1989. [4] Z. Chaochen, A.P. Ravn, and M.R. Hansen. An extended duration calculus for hybrid real-time systems. In Hybrid Systems, Lecture Notes

[14] [15] [16]

6

in Computer Science, No. 736, pages 36{59, Berlin, 1993. H. Elmqvist, F.E. Cellier, and Martin Otter. Object-oriented modeling of hybrid systems. pages xxxi{xli. SCS, 1993. R.L. Grossman, A. Nerode, A.P. Ravn, and H. Rischel, editors. Proc. of Workshop on Theory of Hybrid Systems, LNCS 736, Lyngby, October 1992. Springer Verlag. D.C. Karnopp, D.L. Margolis, and R.C. Rosenberg. System Dynamics, A Uni ed Approach. Wiley Interscience, 1990. U. Soderman. Conceptual modelling of mode switching physical systems. PhD thesis, Linkoping University, Linkoping, 1995. Dissertation no. 375. U. Soderman and J.-E. Stromberg. Switched bond graphs: multiport switches, mathematical characterization and systematic composition of computational models. Technical Report R-95-07, Department of Computer and Information Science, Linkoping University, Sweden, 1995. http://www.ida.liu.se/publications/cgibin/tr-fetch.pl?R-95-07+bib. U. Soderman and J.-E. Stromberg. Towards systematic composition of computational models. In Proc. Second Int. Conf. on Bond Graph Modeling (ICBGM'95), volume 27 of SCS Simulation Series, pages 73{79, 1995. U. Soderman, J.L. Top, and J.E. Stromberg. The conceptual side of mode switching. In Proc. of the IEEE Int. Conf. on Systems, Man and Cybernetics (SMC'93), volume 1, pages 245{250, Le Touquet, 1993. J.-E. Stromberg, J. Top, and U. Soderman. Variable causality in bond graphs caused by discrete e ects. In Proc. First Int. Conf. on Bond Graph Modeling (ICBGM'93), volume 25 of SCS Simulation Series, pages 115{119, 1993. J.E. Stromberg. A mode switching modelling philosophy. PhD thesis, Linkoping University, Linkoping, 1994. Dissertation no. 353. J.H. Taylor and D. Kebede. Modeling and simulation of hybrid systems in matlab. In IFAC'96 proceedings, pages 275{280. IFAC, 1996. J.L. Top. Conceptual modelling of physical systems. PhD thesis, University of Twente, Enschede, 1993. J. van Dijk. On the Role of Bond Graph Causality in modelling mechatronic systems. PhD thesis, University of Twente, 1994.