Open Collections

UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

A dynamic circuit-based model for ferromagnetic materials Wicks, Kenneth 2008

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
24-ubc_2008_spring_wicks_kenneth.pdf [ 8.51MB ]
Metadata
JSON: 24-1.0064768.json
JSON-LD: 24-1.0064768-ld.json
RDF/XML (Pretty): 24-1.0064768-rdf.xml
RDF/JSON: 24-1.0064768-rdf.json
Turtle: 24-1.0064768-turtle.txt
N-Triples: 24-1.0064768-rdf-ntriples.txt
Original Record: 24-1.0064768-source.json
Full Text
24-1.0064768-fulltext.txt
Citation
24-1.0064768.ris

Full Text

A Dynamic Circuit-Based Model for Ferromagnetic Materials by Kenneth Wicks B.A.Sc., The University of British Columbia, 1997 M.A.Sc., The University of British Columbia, 2001 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF Doctor of Philosophy in The Faculty of Graduate Studies (Electrical and Computer Engineering)  The University Of British Columbia (Vancouver) March 2008 c Kenneth Wicks 2008  Abstract In recent years there has been increased interest in the development of sensorless switched reluctance machine drives. The proper operation of a switched reluctance machine (SRM) requires knowledge of the position of the rotor of the machine. The inclusion of a physical position sensor compromises the inherent robustness of this type of machine. Thus, there has been a need to develop techniques to estimate the position of the rotor in SRM drives. Switched reluctance machines are able to operate over a large range in speed. A fully loaded SRM is typically designed to saturate the ferromagnetic material that comprises the stator and rotor of the machine whereas a lightly loaded machine does not. Therefore, the model of the machine should be able to handle both a large range in frequency and input excitation levels of the magnetic material in the machine. The development of a new dynamic circuit-based ferromagnetic model is described in this thesis. The investigation of the behaviour of 24 gauge M19 silicon steel led to the conclusion that, for this material, a circuit model that has static parameters is unable to accurately reproduce the behaviour of the actual material over a large range of input frequencies and excitation levels without resorting to retuning the parameters of the model. This thesis provides two new mechanisms that dynamically adjust the resistance values of the flux tubes of the model. Comparisons using a normalized vertical least-squares metric between the newly proposed dynamic model and a model that has static resistance values clearly show the improvement that is gained by using these mechanisms. A practical implementation of the new model is also given. Timing using a general purpose CPU shows that this implementation of the model will most likely be able to be used as part of a multi-phase lumped parameter model for a SRM in realtime.  ii  Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  ii  Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  iii  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  vi  Abstract  List of Tables  List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  ix  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  x  1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Switched Reluctance Drives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Machine Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.2 Control of Switched Reluctance Machines . . . . . . . . . . . . . . . . . . . . 1.1.3 The Multi-Phase Lumped Parameter SRM Model . . . . . . . . . . . . . . . 1.1.4 Modification of the Multi-Phase Lumped Parameter SRM Model . . . . . . . 1.2 Intended Contribution of this Work . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Utilized Material and its Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.1 Ferromagnetism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.2 Hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.3 Eddy currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4.4 Relating the Magnetization of a Material to Other Field Quantities . . . . . 1.5 State of the Art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.1 Finite Element Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5.2 Solution of the Diffusion Equation . . . . . . . . . . . . . . . . . . . . . . . . 1.5.3 Incorporation of Empirically Determined Equations for Eddy Current Losses 1.5.4 Circuit-Based Ferromagnetic Models . . . . . . . . . . . . . . . . . . . . . . 1.5.5 The Jiles-Atherton Model of Hysteresis . . . . . . . . . . . . . . . . . . . . . 1.6 Outline of this Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  1 1 2 3 5 7 8 9 10 11 12 15 16 17 17 18 20 20 21 25  2 Hysteresis Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 The Classical Preisach Model . . . . . . . . . . . . . . . . . . . 2.1.1 The Hysteresis Operator γˆαβ . . . . . . . . . . . . . . . . 2.1.2 The Preisach-Krasnoselskii Model . . . . . . . . . . . . . 2.1.3 Explicit Formulation of the Preisach-Krasnoselskii Model  27 27 28 28 30  iii  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  . . . . .  Table of Contents . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  34 35 36 36 38 46  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Excess Currents . . . . . . . . . .  . . . . . . . . . .  . . . . . . . . . .  . . . . . . . . . .  . . . . . . . . . .  47 47 50 54 55 56 58 63 68 69  4 New Mechanisms for Circuit-Based Ferromagnetic Models . . . . . . . . . . 4.1 Mechanisms that Failed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Direct Use of the Derivatives of the Circuit Mmfs . . . . . . . . . . . . . 4.1.2 The Use of the Flux and Mmf Derivatives Together . . . . . . . . . . . . 4.2 Proposed New Circuit Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 A Partially Successful Attempt . . . . . . . . . . . . . . . . . . . . . . . . 4.2.2 Variation of Rk Based on Λk (F˙k+1 ) . . . . . . . . . . . . . . . . . . . . 4.2.3 Accounting for Eddy Currents due to Domain Wall Motion . . . . . . . . 4.2.4 Procedure for Identifying the Parameters of the Model . . . . . . . . . . 4.3 Accuracy of the Proposed Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Analytical Determination of the Accuracy . . . . . . . . . . . . . . . . . 4.3.2 Graphical Comparison Between a Dynamic and a Static Ten Tube Models 4.4 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  . . . . . . . . . . .  . . . . . . . . . . . . . .  70 70 70 71 74 75 78 80 85 87 88 95 100  5 Implementation Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 An Implementation of the Modified Basic Circuit . . . . . . . . . . . . 5.1.1 Discretization of the Basic and Modified Basic Circuits . . . . . 5.1.2 Practical Implementation of the Modified Preisach Model . . . . 5.1.3 Elimination of Stack Overflow Errors . . . . . . . . . . . . . . . 5.1.4 Update of the Modified Preisach Model Based on the Value of B 5.1.5 Modification of the Basic Circuit . . . . . . . . . . . . . . . . . . 5.1.6 Putting it All Together . . . . . . . . . . . . . . . . . . . . . . . 5.2 Solution Convergence, Stability, and Computation Time . . . . . . . . 5.2.1 Solution Convergence . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Solution Stability . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 Solution Complexity . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Chapter Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  . . . . . . . . . . . . .  101 101 102 104 108 110 111 116 122 122 125 127 128  2.2  2.3  2.1.4 The Everett Function . . . . . . . . . . . . 2.1.5 Limitations of the Classical Preisach Model The Modified Preisach Model . . . . . . . . . . . . 2.2.1 The Model Formulation . . . . . . . . . . . 2.2.2 Model Implementation . . . . . . . . . . . Chapter Summary . . . . . . . . . . . . . . . . . .  . . . . . .  3 Existing Circuit-Based Ferromagnetic Models . . . 3.1 Circuit Based Modeling: A Preamble . . . . . . . . 3.1.1 Basic Circuit . . . . . . . . . . . . . . . . . . 3.1.2 Tube Structure . . . . . . . . . . . . . . . . 3.2 Performance Trends in the Existing Circuits . . . . 3.2.1 Basic Circuit Performance with Fixed Rk . . 3.2.2 Static Modification to Rk . . . . . . . . . . . 3.2.3 Variation of Rk Based on the Variation of J 3.2.4 Variation of Rk Based on a Correction Factor 3.3 Chapter Summary . . . . . . . . . . . . . . . . . . .  iv  . . . . . .  . . . . . .  . . . . . . . . . . . . . . . . for . .  . . . . . .  . . . . . .  . . . . . . . . . . . . . . . . the . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . .  . . . . . . . . . . . . .  . . . . . .  . . . . . . . . . . . . .  . . . . . . . . . . . . .  . . . . . . . . . . . . .  . . . . . . . . . . . . .  . . . . . . . . . . . . .  Table of Contents 6 Conclusions and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 6.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 6.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134  Appendices . . . . . .  . . . . . .  . . . . . .  140 140 141 144 144 145  B Analysis Data and Supporting Curves . . . . . . . . . . . . . . . . . . . . . . . . B.1 Error Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.2 A Graphical Comparison Between Four Tube Dynamic and Static Models . . . . B.3 Variation of Tube Resistances and Magnetic Intensity Profile Inside the Material  . . . .  . . . .  147 147 148 152  . . . . . . . . .  . . . . . . . . .  154 154 154 162 162 163 164 164 169  A Acquisition of the Experimental Data A.1 Test Material and Its Associated Coils A.2 The Drive Circuit . . . . . . . . . . . A.3 The Data Acquisition Equipment . . A.4 Test Setup . . . . . . . . . . . . . . . A.5 Limitations of this Testing Approach  C ANSI C Code of the Realized Model C.1 stdafx.h . . . . . . . . . . . . . . . . C.2 main.C . . . . . . . . . . . . . . . . C.3 cpu time.h . . . . . . . . . . . . . . C.4 cpu time.C . . . . . . . . . . . . . . C.5 hysteresis.h . . . . . . . . . . . . . . C.6 lookup gain.h . . . . . . . . . . . . . C.7 lookup gain.C . . . . . . . . . . . . C.8 output m Bpv.C . . . . . . . . . . .  . . . . . . . .  . . . . . .  . . . . . . . . .  v  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . .  . . . . . . . . .  . . . . . . . . .  List of Tables 1.1  Specifications of the test material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10  2.1 2.2  Data structure for µ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Data structure for Mj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45  4.1  Operating conditions for comparing the models . . . . . . . . . . . . . . . . . . . . . 89  5.1 5.2  Parameters of the IIR filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Data structure for µ and Bpv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114  B.1 Error data for the comparison of various models  vi  . . . . . . . . . . . . . . . . . . . . 147  List of Figures 1.1 1.2 1.3 1.4 1.5 1.6 1.7  Sensorless SRM drive . . . . . . . . . . . . . . . . . . . . Lumped parameter model for a 6/4 SRM . . . . . . . . Geometry of the test material . . . . . . . . . . . . . . . Orbital and electron spin magnetic moments in an atom Ferromagnetic and antiferromagnetic structures . . . . . An illustration of hysteresis . . . . . . . . . . . . . . . . Sequence of magnetization changes due to an external H  . . . . . . .  . . . . . . .  3 6 9 11 12 13 15  2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8  The elementary hysteresis operator γˆαβ . . . . . . . . . . . . . . . . . . . . . . . . The β − α plane showing the geometric interpretation of Equation 2.1 . . . . . . . A typical first order reversal curve . . . . . . . . . . . . . . . . . . . . . . . . . . . The β − α plane and the path of the material for sequence of reversals of H . . . . Definition of the triangular area T (α, β) . . . . . . . . . . . . . . . . . . . . . . . . Experimental first order reversal curves for test material . . . . . . . . . . . . . . Piecewise linearized first order reversal curves for test material . . . . . . . . . . . The relationship between the variables that are used to interpolate other first order reversal curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The relationship between the variables that are defined in Equations 2.19 – 2.24 .  . . . . . . .  28 29 31 32 34 39 40  2.9 3.1 3.2 3.3 3.4 3.5 3.6 3.7  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . . . . . . .  . 41 . 43  3.9 3.10 3.11 3.12 3.13  Basic circuit that exhibits eddy current effects . . . . . . . . . . . . . . . . . . . . . Three tube model with its magnetic equivalent circuit parameters defined . . . . . . Electrical equivalent circuit of the basic eddy current model . . . . . . . . . . . . . Classical and domain eddy current models . . . . . . . . . . . . . . . . . . . . . . . . Tube Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels 250 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variation of tube DC resistances with n . . . . . . . . . . . . . . . . . . . . . . . . . Modification to Rk for n = 4 and 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition of unit vectors for Equations 3.23 - 3.25 . . . . . . . . . . . . . . . . . . . 60 Hz curves for γ = 2/3 at three excitation levels . . . . . . . . . . . . . . . . . . . 500 Hz curves for γ = 2/3 at three excitation levels . . . . . . . . . . . . . . . . . .  4.1 4.2  Gain function g(F˙ ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Performance of a 10 tube model with the 1 + g(F˙k+1 )φ˙ k correction factors . . . . . 74  3.8  vii  50 51 52 53 55 56 57 58 61 62 64 66 67  List of Figures 4.3 4.4 4.5 4.6 4.7 4.8 4.9 4.10 4.11 4.12 4.13 4.14  Performance of a 4 tube model with the modification Rµk (µk ) . . . . . . . . . . . . Variation of Λ with |F˙ | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Definition of gz for a ten tube model . . . . . . . . . . . . . . . . . . . . . . . . . . . Variation of Γ with |F˙ | . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comparison between a dynamic and two static four tube models with 50 µs timesteps Comparison between dynamic four tube models for two timesteps . . . . . . . . . . Comparison between dynamic four and ten tube models with 25 µs timesteps . . . . Effect of discretizing an inductor with the backward Euler integration rule . . . . . . Response of ten tube models for 60 Hz input excitations . . . . . . . . . . . . . . . Response of ten tube models for 250 Hz input excitations . . . . . . . . . . . . . . . Response of ten tube models for 500 Hz input excitations . . . . . . . . . . . . . . . Response of ten tube models for 1 kHz input excitations . . . . . . . . . . . . . . .  5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 5.15  Circuit representation of the circuit elements . . . . . . . Determination of Lpv . . . . . . . . . . . . . . . . . . . Three possible new branches of the solution near (H0 , B0 ) Flowchart for the hysteresis algorithm . . . . . . . . . . . Modified trajectory of the material . . . . . . . . . . . . . Flowchart for the hysteresis algorithm based on B . . . . Minimal realization of the IIR filter . . . . . . . . . . . . . A typical cell in the definition of gz . . . . . . . . . . . . Three sided cells near the initial magnetization curve . . . Discretized three tube model . . . . . . . . . . . . . . . . Norton equivalent discretized three tube model . . . . . . Main flowchart for the implemented model . . . . . . . . . Iteration 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . Iteration 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . Iteration 3 . . . . . . . . . . . . . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  . . . . . . . . . . . . . . .  102 103 105 106 109 110 112 113 115 117 119 121 123 123 124  A.1 A.2 A.3 A.4  Test material, driving, and sense coils . . . . . . . Drive circuit for the magnetic core . . . . . . . . . Schematic of the drive circuit for the magnetic core Testing apparatus . . . . . . . . . . . . . . . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  . . . .  141 142 143 145  B.1 B.2 B.3 B.4 B.5 B.6  Response Response Response Response Magnetic Variation  of four tube models for 60 Hz input excitations . . . . . . . . . . . . . . . of four tube models for 250 Hz input excitations . . . . . . . . . . . . . . of four tube models for 500 Hz input excitations . . . . . . . . . . . . . . of four tube models for 1 kHz input excitations . . . . . . . . . . . . . . . intensity profile inside the material in time for a 10 tube model . . . . . . of the outermost tube resistances of a 10 tube model for the profile above  148 149 150 151 152 153  viii  . . . .  . . . .  . . . .  . . . .  78 79 83 84 90 91 92 93 96 97 98 99  Acronyms AC Alternating Current DC Direct Current BE Backward Euler (integration rule) PI Proportional Integral (controller) A/D Analog to Digital emf Electromotive Force. Otherwise known as voltage mmf Magnetomotive Force 1D 1-Dimensional 2D 2-Dimensional 3D 3-Dimensional DSP Digital Signal Processing FEA Finite Element Analysis LTI Linear Time Invariant SISO Single Input Single Output MIMO Multiple Input Multiple Output MISO Multiple Input Single Output UBC The University of British Columbia FIR Finite Impulse Response (filter) IIR Infinite Impulse Response (filter) SRM Switched Reluctance Machine CPU Central Processing Unit ID Inner Diameter OD Outer Diameter  ix  Acknowledgements I would like to first thank my supervisors Dr. William Dunford and Dr. Luis Linares for their insight and guidance through the trails of this work. Without their help I would never have progressed to this point. I would also like to thank all of the members of the power group that I have had the pleasure to meet during my studies over the years . In particular, I would like to thank Magnus Lind, Michael Winch, Tom De Rybel, and Marcelo Tomim for all of your help and encouragement. You have brightened many otherwise dark days. I would not be here today without the support and love of my parents and family. It would take me many lifetimes to repay their boundless support. Finally, I am forever indebted to my dear wife, Cathay Zhang-Yi-Ying Wicks, for putting up with me over the last few years. Her patience and understanding has made this journey so much easier for me.  x  Chapter 1  Introduction The use of ferromagnetic materials is widespread since they allow the generation of large magnetic fields for relatively small values of current. Their use can be seen in many devices including power frequency transformers and electric machinery. Thus, the development of models that are suitable for characterizing the behaviour of ferromagnetic materials has been a focus of research for many decades in several fields. The ability to be able to predict the behaviour of ferromagnetic materials with models provides great advantages to the user of the materials. These models allow designers to do many things ranging from validating their designs to being part of an optimization algorithm for the geometry of the material. The literature contains many different approaches to modeling ferromagnetic materials. Every class of models have their own strengths and weaknesses. The choice of which class of model is appropriate for a given application depends on three major things: speed, accuracy, and ease of use. The work that is presented in this thesis provides an extension to a specific class of models that have been available for many years. The intended application of the new model is in the sensorless control of switched reluctance drives  1.1  Switched Reluctance Drives  With the development of reliable power semiconductor devices and powerful microcontrollers, switched reluctance machine (SRM) drives have become feasible. Switched reluctance machines have several advantages over the more traditional types of electric machines. One of the chief advantages of SRMs is their ability to be operated at very high speeds – in some cases in excess of 100,000 rpm. Another important feature of SRMs is their ability to be used in hostile environments such as space. These machines are able to operate in these conditions because their construction is very simple and, therefore, very robust. However, one very limiting issue in the operation of SRMs is the requirement of the knowledge of the position of the rotor. If a physical sensor is utilized to measure the position then the robustness of the machine is severely compromised. Thus, a substantial amount of work in the area of sensorless control of SRMs has appeared recently in the literature [1–26]. Most of the literature on sensorless control of SRM drives has been focused on low to medium speed applications. The few papers that have dealt with very high speed SRM control are rare [1–3]. With the exception of a couple of papers by Panda et al. [4, 5], no current position estimation 1  Chapter 1. Introduction techniques have explicitly included the dynamic behaviour of magnetic materials in their models. There has been a fair amount of offline modeling work on the estimation of the behaviour of SRMs that includes some dynamic effects of magnetic materials [27–31]. However, based on the experience that has been gained from undertaking this work, the author of this work believes that all of the currently available models for SRMs have a major shortcoming. This shortcoming is that these papers present magnetic models that have static parameters. Based on the findings of this work, it is concluded that a static model with a single set of parameters cannot accurately reproduce the behaviour of ferromagnetic materials over a large range of frequencies and input excitation levels. This is particularly relevant to very high speed SRMs because they in fact do operate over a large range of speeds and levels of excitation of the magnetic material. Due to the nature of the operation of SRMs, a large range in speed equates to a large range in frequency. The major goal of this work was to provide a model that can be potentially used in realtime to accurately predict the position of the rotor of a SRM over a large range in operating speeds and load levels. Due to time constraints only part of this goal was achieved. However, the work that was completed constitutes the major part of the work that is needed to be done to achieve the stated goal.  1.1.1  Machine Structure  A switched reluctance machine is typified by its double salient structure. This means that the machine has teeth (otherwise known as poles) on both its stator and rotor. For the vast majority of applications, the ability to be able to control the torque at any position and in either direction of rotation is necessary. Thus, configurations of SRMs that have this characteristic prevail over others that do not. Examples of SRMs that have this property include machines with six stator poles and four rotor poles, eight stator poles and six rotor poles, and twelve stator poles and eight rotor poles. A shorthand for specifying the structure of the machine has been developed. For the case of a SRM with six stator poles and four rotor poles the machine is called a 6/4 SRM. As with other machines, pairs of poles are electrically connected to become the phases of the machine. Furthermore, multiple pairs of poles can be electrically connected. Machines with this type of configuration tend to have shorter magnetic paths compared to machines that have single pairs of poles. Unfortunately, connecting more that one pair of poles to become a phase effectively increases the excitation frequency that is seen by the magnetic material. Depending on the characteristics of the magnetic material of the machine, this can potentially eliminate any benefits that are gained by having shorter magnetic paths in the material. A 6/4 SRM is an example of a three phase machine with a single pair of poles per phase while a 12/8 SRM is an example of a three phase machine with two pairs of poles per phase. Thus, for the same speed of rotation and the same size of machine, the excitation frequency of a 6/4 SRM is half that of the 12/8 SRM but its magnetic paths are double the length. 2  Chapter 1. Introduction Another defining characteristic of SRMs is their phase currents are unidirectional. This is in contrast to AC machines which require bidirectional currents. The orientation of the phase currents are set up to minimize the magnetic path length of the material during the commutation between the phases of the machine. The necessity for only unidirectional currents is the direct result of the physical mechanism behind the generation of the torque in this type of machine. SRMs operate on the principle that a force is produced on a structure in a magnetic field in order to decrease the reluctance of the magnetic path of the field. The reluctance of a magnetic circuit is analogous to the resistance in electric circuit theory. In the case of a SRM, the structure in the field is the rotor and the field is generated by concentrated windings on the poles of the stator of the machine. Thus, when a pair of stator poles is excited with a current in either direction, a force is generated on the rotor poles that are the nearest to the excited stator poles in order to align the rotor poles with the stator poles. If the phase currents of the machine are suitably generated and the number of stator and rotor poles of the machine are as described above then the machine can exhibit continuous torque in either direction. A silhouette of a 6/4 SRM is given later when an equivalent circuit model of the machine is presented.  1.1.2  Control of Switched Reluctance Machines  In order to understand how SRMs are controlled, consider a typical block diagram of a sensorless SRM drive that is given in Figure 1.1.  * ωm  PI speed controller  Te*  ! Kt torque controller  imax imin  i*  Vdc  hysteresis controller  d power electronics circuit vp  hysteresis band generator θo θo θc θc rise/fall angle generator ωm d dt  A B C  phase selector/ controller  A/D  A/D  SRM  ip  θ position estimator  Figure 1.1: Sensorless SRM drive While the specifics of the control algorithms of SRMs are beyond the scope of this work, a 3  Chapter 1. Introduction general description is given to emphasize the need for the estimation of the rotor position. As mentioned above, the phase currents of the machine generate a magnetic field in the machine that tends to align the poles of the rotor with the currently excited stator poles. If the rotor poles that are closest to the excited stator poles are moving towards the stator poles then the torque on the rotor is positive. Conversely, if the rotor poles are moving away from the stator poles then the torque on the rotor is negative. As a result, the phase current should be reduced to zero as close to the alignment position of the poles as possible to minimize the generation of negative torque. The number of degrees of rotation that is required to do this depends on both the current speed of the rotor of the machine, ωm , and the value of the current. The rise/fall angle generator block in Figure 1.1 is a predetermined 2-dimensional lookup table that outputs the required fall (or turn-off) angle, θc , of the machine based on the speed of the machine and the desired value of the phase current, i∗ . Similarly, the rise (or turn-on) angle, θo , is determined by the desired value of current for the next phase of the machine and the current speed of the rotor. The current is controlled with a hysteresis type of controller. A band around the desired value of current is specified based on the amount of allowable ripple in the current and the update rate of the control algorithm. If the measured value of the phase current, ip , is larger than the upper value of the band, imax , then a negative voltage is applied to the phase to decrease the value of the phase current. Conversely, if the phase current is lower than the lower value of the band, imin , then a positive voltage is applied to the phase to increase the value of the phase current. For all other cases the value of the phase voltage is maintained at its current value. The phase that the voltage is applied to is determined by the current value of the position of the rotor, θ. This is determined by the phase selector/controller block in Figure 1.1. In fact, the hysteresis controller block in Figure 1.1, actually contains a hysteresis controller for each phase of the machine. The phase selector/controller block either enables or inhibits the actions of each hysteresis controller based on the state of the machine. For example, the value of the desired current is overridden in order to properly switch the current off in the current phase i.e. the current is set to zero when the block determines that it is time to switch off the current in the conducting phase. Likewise, when it is time to ramp up the current in the next phase of the machine then the appropriate hysteresis controller is enabled. For high speed operation of the machine, the control of the machine becomes wholly based on the generated rise and fall angles since the phase currents can no longer be arbitrarily controlled. In this mode of operation, the output of the hysteresis controller block is completely determined by the phase selector/controller block. In all modes of operation of the machine the duty cycle, d, of each phase is either set to one to increase the current in that phase or to zero to decrease the current in that phase. The duty cycle signals are given to a power electronics circuit that is fed with a voltage that is fixed at some value. Note that the structure of the power electronics circuit effectively blocks negative values of current except for a typically small undershoot that occurs when a phase current goes to zero. 4  Chapter 1. Introduction Since the controller for the machine is typically implemented in a microcontroller such as a digital signal processor, the analog phase currents and voltages need to be converted into digital. This is performed with analog-to-digital (A/D) converters. Typically, microcontrollers have onboard A/D conversion. The value of the desired current is generated by the torque controller block that is shown in Figure 1.1. The input of this block is the desired electrical torque, Te∗ that is generated by the speed controller that is also shown in Figure 1.1. The torque constant Kt is not necessarily constant as it is in other machines. The error in the speed of the machine is the input to the speed controller. The speed controller is typically a saturable proportional-integral (PI) type of controller. The last block in the sensorless controller of a SRM is the position estimator. As is mentioned above, it is the improvement in the accuracy of this block that is the motivation for this work. The approach to achieve this goal is given next. For further details on the structure, design, and control of SRMs please refer to a comprehensive book on this subject by Miller [32]. There is also another book that is available that gives a collection of topics on SRM control that is edited by Miller [33].  1.1.3  The Multi-Phase Lumped Parameter SRM Model  From the above discussion, it is clear that the current position of the rotor is required to properly control the switching of the phases of the machine. To this end, an estimation of the position of the rotor is required. One important phenomenon that occurs in the high speed operation of SRMs is the simultaneous conduction of current in more than one phase of the machine at a time. This can occur for significant periods of time at high speeds. Since the characteristics of ferromagnetic materials are very nonlinear, a simple superposition of the results of separate phases can produce large errors in the estimation of the position. To account for the mutual effects of the phases and to allow for the multi-phase excitation of the machine, a lumped parameter model by Lyons et al. provides an excellent way of consistently finding the position of the rotor [6, 7]. Figure 1.2 illustrates this model for a 6/4 machine. Note that the airgaps that are shown in the machine silhouette are greatly exaggerated to show the relationship between the physical machine and the parameters of the model. Also, only the winding for phase A is shown. The parameters of the model as given in Figure 1.2 are as follows: FA  is the input magnetomotive force of phase A;  FB  is the input magnetomotive force of phase B;  FC  is the input magnetomotive force of phase C;  RSP  is a saturable element that represents the reluctance of the base of the stator poles;  RRP is a saturable element that represents the reluctance of the base of the rotor poles;  5  Chapter 1. Introduction  FA RSC  RSPT  RRP  RRC RRPT  RG  RSPT  RSP  RSC RPC  FB  RPC  RSPT RPP  RG RRC RRP RRPT RSPT  RRP RPP  RRPT  RRC  RG RSP  RSP RG  RRC  RRC RRP  RRPT  FB  RRP  RRPT RRP RRC RG  RPP  RPP  RRPT  RSPT  RSP  RPC  RSPT  RG  RPP  RSC  RSC  RSP  RPC FC  RPC  RSC  RSP FC  RPP RPC RSC  FA  Figure 1.2: Lumped parameter model for a 6/4 SRM  RSP T is a saturable and position dependent element that represents the reluctance of the tips of the stator poles; RRP T is a saturable and position dependent element that represents the reluctance of the tips of the rotor poles; RG  is a non-saturable and position dependent element that represents the reluctance in the airgaps of the machine;  RSC is a saturable element that represents the reluctance of the backplane (or core) of the 6  Chapter 1. Introduction stator; RRC is a saturable element that represents the reluctance of the core of the rotor; RP P is a non-saturable element that represents the reluctance of the air path between adjacent stator poles of the machine; RP C is a non-saturable element that represents the reluctance of the 3-dimensional end effects of the machine and the leakage paths in air between the stator poles and backplane.  The magnetomotive forces (mmf) FA , FB , and FC are equal to the number of turns on each individual stator pole multiplied by the appropriate phase current e.g. FA = N iA where N is the number of turns. In order to determine the position of the rotor, the simultaneous sampled values of the phase currents and fluxes are necessary. Flux is analogous to current in electric circuits theory, however, there is an inherent danger in using this analogy. This danger is explained later in Chapter 3 when the flux is defined. The phase currents are already available since the hysteresis controller requires their values. The fluxes can be estimated from the phase voltages, phase currents, and the winding resistances. In the existing model, the values of the mmf drops across the position independent reluctances as a function of the flux through the element are stored in a look-up table. The reluctances of the stator and rotor pole tips and the airgap are combined to form a single position and flux dependent reluctance, RGT . This gap-tip reluctance function can be inverted at a known flux levels to obtain a set of curves that relate the position as a function of reluctance and flux level. Thus, once the values of the reluctance across the airgaps are calculated from the rest of the model, the value of the position can be determined with a 2-dimensional lookup table that stores the values of the position as a function of the gap-tip reluctance and flux level. Due to the typical relationship between the rotor position and the current for different levels of flux, it is well documented that there are optimum ranges of position to calculate the position for each phase [6]. Outside of these regions, the error in the position estimate can be potentially very large. One drawback of the model that was proposed by Lyons et al. is it does not account for the dynamic effects of the material. Since this model is inherently very accurate, it was decided to modify the model to include these missing effects. These modifications are discussed next.  1.1.4  Modification of the Multi-Phase Lumped Parameter SRM Model  The base model that was proposed by Lyons et al. is modified by replacing the time-invariant saturable inductances with time variant reluctances that exhibit hysteresis and eddy current effects. This involves both the determination of a suitable model for the new reluctances and the 7  Chapter 1. Introduction modification to the existing implementation of the SRM model for the inclusion of the new circuit elements. The work that is presented in this thesis is entirely focused on the first task. However, some comments on the second task are presented to give a sense of what still needs to be done. The position in the new framework can be calculated in a similar fashion to the original model. First, the mmf drops are computed for the position independent reluctances. The sum of these mmf drops for each phase then gives the mmf drop across the position dependent RGT reluctances. The mmf drop for the phase with the least expected error in the position is then compared to the mmf drop that is calculated by using the elements for RGT . It is likely that the position data will be stored in small increments instead of being continuous. The estimate of the position is obtained by minimizing the difference between the two mmf drops across the position dependent reluctances. Note that this determination of the position gives the rotor angle relative to the aligned position of the chosen phase but not which side of the aligned position. The other phases are used to determine what side of the stator pole this angle refers to in order to find the absolute position of the rotor. The big disadvantage of this approach is it numerically quite complex. The determination of the rotor angle needs to be performed many times between commutations of the phases in order to preserve the proper dynamic behaviour of the new reluctance elements as opposed to only a few times for the original model. Furthermore, the time to calculate a single rotor position is also significantly longer compared to the original model. Finally, a mechanism also needs to be devised to update the history terms of the model when the accuracy in the absolute position is poor.  1.2  Intended Contribution of this Work  The intended contribution of this thesis is: to produce a model that can be potentially used in realtime to predict the behaviour of a given ferromagnetic material of a given geometry over a large range of excitation frequencies and over a large range of saturation levels without resorting to retuning the parameters of the model. The key to the stated objective is the requirement that the parameters of the model are only determined at the time of the model’s formulation and thereafter remain fixed. As was briefly mentioned above, the pre-existing schemes are unable, in general, to achieve this without a loss in accuracy. As will be seen, this loss in accuracy can be quite severe. It is hoped that this new type of model can then be used for the online prediction of the position of the rotor of a switched reluctance machine. Note that the application of this type of model is not just limited to the prediction of the rotor position of a SRM. It can also be used as part of an offline model to design and validate the performance of many different kinds of devices including but not limited to fast acting solenoids and SRMs. 8  Chapter 1. Introduction  1.3  Utilized Material and its Geometry  The magnetic material that was studied in this work is used by a commercial SRM. Since the efficiency of the machine is not a factor for this particular machine, the SRM is designed as cheaply as possible. As a result, the magnetic material is relatively thick for this type of machine. Based on the information from the manufacturer of the machine, the material is industrial grade M19 silicon steel. The magnetic material is doped with a small percentage of silicon to decrease the resistivity of the material. This comes at a cost to the magnetic properties of the material but this cost is relatively small. The specified thickness of the material is 0.635 mm. In the gauge system of specifying thicknesses, this corresponds to 24 gauge. The material was cut into a torus with a rectangular cross-section. This geometry is shown in Figure 1.3. The coil that drives the material is wound such that the excitation H field is in the direction that is shown in the figure. The other details for the winding arrangement of the driving coil and the sense coil are given in Appendix A. However, it is worth noting here that the coils are arranged in order to minimize any leakage paths of the flux. Leakage flux tends to vary the value of the magnetic field density along the magnetic path. Thus, large errors can occur in the measurements of the characteristics of the material if significant leakage paths exist. The specifications of the material along with the dimensions of its geometry are tabulated in Table 1.1.  H ½ID  ½OD  w  Figure 1.3: Geometry of the test material The material was cut using an abrasive high pressure water cutter. Since this process does not generate heat it is assumed that magnetic properties of the material were not overly affected 9  Chapter 1. Introduction by this process. The act of manipulating the material can cause minute stresses and deformities in the crystal lattice of the material. As is discussed below, the work that is required to move the domain walls of the material will increase if there are more irregularities or stresses in the lattice. Typically, laminations that are punched out of raw materials need to be heat treated by a process called annealing to bring the magnetic properties back to those that are specified by the manufacturer. It is hoped that the process of abrasive water cutting essentially leaves the magnetic properties of the material intact. The material was cut from the stator of the aforementioned machine. Initially, the material in the stator of the machine was tested but the irregular shape of the stator makes it very difficult to isolate the properties of the material from other effects such as air leakage paths between stator poles. However, the general shape and magnitude of the response of the material in the uncut stator and the test geometry are quite similar. This gives confidence that the process of abrasive water cutting is relatively unobtrusive. Table 1.1: Specifications of the test material Parameter  1.4  Value  Unit  Type  M19 silicon steel  Grain-oriented ?  No  Nominal resistivity  2 × 10−5  Ω-m  1/2ID  57.5  mm  1/2OD  62.3  mm  w  0.635  mm  Basic Concepts  Before the discussion can proceed any further some basic concepts of ferromagnetic materials need to be discussed. Most of the discussion that is presented here is taken from Magnetoelectric Devices: Transducers, Transformers, and Machines by Slemon [34]. The properties of ferromagnetic materials can be split into two broad categories: time rate dependent and time rate independent. This is not to say that the time rate independent properties do not vary with time but that their variation is not a function of the rate of change of time. The properties that are of interest to this work are hysteresis and eddy current effects. Hysteresis 10  Chapter 1. Introduction effects are time rate independent whereas eddy current effects are time rate dependent. Before these properties can be discussed, however, a basic definition of ferromagnetism is required.  1.4.1  Ferromagnetism  Magnetic effects in all materials are the result of the orbital motions of electrons about the nuclei of atoms and the spin motion of each electron as is depicted in Figure 1.4. A net magnetic moment exists in atoms that have an incomplete inner shell of electrons. In these atoms the spins of electrons in one direction are not completely cancelled by electrons with the opposite spin direction. Thus, a net magnetic moment is produced. For illustration purposes an atom with a net magnetic moment can be considered as equivalent to a small constant current loop. Only changing the orientation of the spin axis of the electrons can alter the direction of this equivalent current loop.  pm  pm  Figure 1.4: Orbital and electron spin magnetic moments in an atom The alignment of an equivalent current loop in proximity to other current loops dictates whether or not a material is ferromagnetic. Consider the two potential cases that are given in Figure 1.5 below. The case of antiferromagnetism that is shown in Figure 1.5(b) occurs when the atoms are in too close proximity to each other. Materials with this arrangement have no benefit because the magnetization M that is produced can not link an external current carrying coil. On the other hand, the magnetization that is produced in the ferromagnetic case that is depicted in Figure 1.5(a) is useful since it does have the ability to link an external coil. However, materials made of pure elements that are naturally ferromagnetic at useable temperatures are not the only materials that can display ferromagnetism. If an antiferromagnetic element is combined with a nonmagnetic element then the spacing between the atoms can become larger. In these cases the resulting material 11  Chapter 1. Introduction  pm M  M  i  M  pm i  M (a) ferromagnetic  (b) antiferromagnetic  Figure 1.5: Ferromagnetic and antiferromagnetic structures can display ferromagnetic properties. In summary, materials that display ferromagnetism are, at a minimum, partially composed of atoms that are able to produce a net magnetic moment. The magnetic moments in the crystal lattice of the material also need to be orientated as is shown in Figure 1.5(a) for ferromagnetism to occur.  1.4.2  Hysteresis  Hysteresis is defined by the Oxford American Dictionary as: the phenomenon in which the value of a physical property lags behind changes in the effect causing it, as for instance when a magnetic induction lags behind the magnetizing force. This lag is best illustrated by considering a typical hysteresis loop in a ferromagnetic material that is shown in Figure 1.6. The quantity H is the magnetic (field) intensity whereas the quantity B is the magnetic field (density). The B field is also sometimes called the magnetic flux density. The units for H are typically given in A/m while the units for B are typically given in T. The trajectory from the origin to the positive extremum in the trajectory is called the initial magnetization curve. It is called this since the material starts from a demagnetized state and increases (or decreases) until the direction of H is reversed. Notice that for a negative-going trajectory the value of B is non-zero when H becomes zero. In fact, the B becomes zero for a negative value of H. Clearly, the B field (the response) lags behind the H field (the cause). The cause of hysteresis in ferromagnetic materials is due to physical structure of the material. Ferromagnetic materials are comprised of magnetic domains. In a given domain all of the magnetic 12  Chapter 1. Introduction  B  H  Figure 1.6: An illustration of hysteresis  moments are aligned in the same direction. Without an external H field, the alignment of the moments within the domains are in directions that minimize the total energy of the crystal structure of the material. The number of minimum energy alignments of the magnetic moments within the crystal structure of the material is highly dependent on the structure of the crystal itself. The application of a sufficiently large external H field allows the magnetic moments to be rotated in the direction of the field. The resulting additional energy that is stored in the crystal lattice of the material is called the magnetic anisotropy energy. If at a later time the H field is removed, the magnetic moments move to the closest minimal energy alignment. The new alignment of the magnetic moments are not necessarily the same as the configuration before the external field was applied. The rotation of the magnetic moments within the domains of the material is associated with domain rotation. Adjacent domains are separated by a thin wall. The magnetic moments within the wall are smoothly rotated from the alignment on one side of the wall to the opposing alignment on the other side. Since the magnetic moments within the wall are not aligned in any of the minimal energy configurations of the crystal, energy is stored within the wall. If a sufficiently large external H field is applied to the crystal lattice of the material, the domain wall will move in order to enlarge the domain that is aligned closest to the direction of the external field. The value of H that is required to achieve this is called the coercive force. In the event that a new domain wall is required to be created, such as when the material is moving from a state of saturation, the wall is initially located such that its total volume is minimized. The energy that is used in moving the wall across the material is irrecoverable. It is used to push the wall across regions in the material with impurities, irregularities, or strains in the crystal lattice. Eventually the energy is dissipated as heat in the 13  Chapter 1. Introduction material. The loss that is the result of this process is called the hysteresis loss. The two preceding affects that occur as the result of the application of an external H field are dominant for different parts of the hysteresis loop. This is because the strength of the field that is required for domain rotation is considerably higher than that for domain wall motion. Furthermore, materials that already have their grains oriented in the direction of the field essentially do not require domain rotation. The losses in these grain-oriented materials are, therefore, less than materials that have no preferred direction of magnetization. The material that was utilized in the work that is presented in this thesis is of the latter type. The actual mechanism that causes the magnetic moments to rotate is a torque that is created in presence of the external H field. This torque, is given by: Tm = pm × µ0 H  (1.1)  where pm is the value of the magnetic moment of the atom with units A-m2 and µ0 is a constant called the permeability of free space. Its value is 4π × 10−7 Wb /(A-m).  Since the value of the magnetic moments is essentially fixed, the magnitude of H dictates the  variation of the torque that acts on the moments. Thus, the amount of the magnetization can be directed controlled by the variation of H. To illustrate the difference between domain wall movement and domain rotation consider the sequence of changes in the magnetization of a section of a ferromagnetic material that is depicted in Figure 1.7. These changes are the result of the monotonic increase in the magnitude of H. Note that the domain wall that is shown as a dashed line in Figure 1.7 is for illustration purposes only. In actuality, the wall is typically hundreds of atoms thick. The first three steps in the sequence show the movement of the domain wall whereas the last step shows the result of domain rotation. Initially, the net magnetization of the section of material that is shown in Figure 1.7(a) opposes the external H field. As the value of H increases, the domain wall that separates the magnetic moments with opposite directions moves downwards as is shown next in Figure 1.7(b). This results in a component of the net magnetization that is now in the same direction as H. Further increasing H rids this section of the material of any domain walls as is depicted in Figure 1.7(c). As Figure 1.7(d) shows, the magnetic moments are then finally aligned with the external H field. Once the magnetic moments are fully aligned with the H field further increasing H does not increase the magnetization. At this point the material is deemed to be fully saturated. The value of B at this point is typically called the saturation flux density. The concepts of hysteresis and the domain structure of ferromagnetic materials are used throughout this work. These basic concepts are expanded upon as is necessary. In particular, Chapter 2 shows the development of a class of practical hysteresis models and Chapter 4 shows a modification to existing models that is based on magnetic domains.  14  Chapter 1. Introduction  DO  MA  WA LL  CR YS TA L  BO  UN  DA  RY  IN  H  H  (a)  (b)  H  H (c)  (d)  Figure 1.7: Sequence of magnetization changes due to an external H  1.4.3  Eddy currents  The existence of eddy currents is a direct consequence of Faraday’s Law. Faraday’s Law states that for any surface that is bounded by the closed line, the time rate of change of the flux perpendicular to the surface gives rise to a voltage along the line i.e. E =−  dφ dt  (1.2)  where E is the voltage in volts (V) and φ is the flux. If the area of the surface is given by A and the magnetic field B is constant on the surface then φ = BA. The negative sign in Equation 1.2 indicates that the voltage is set up to oppose the  15  Chapter 1. Introduction change in flux. A current will then flow along the line as a result of the voltage. This current is called an eddy or Foucault current. The specific amount of current depends on the value of the voltage and the conductivity of the material that the current is passing though. This current loop gives rise to a B field that opposes the change in the original B field. The generation of eddy currents results in the phenomenon called the skin effect. The name is aptly chosen since, for current carrying conductors, the current tends to flow on the outside of the material. The depth at which the current falls to 1 e of its original value is given by: δ=  2 ωµ0 σ  (1.3)  where σ is the conductivity of the material and ω is the frequency (in rad/s) of the current. δ is typically called the depth of penetration. Note that the conductivity of a material is the reciprocal of its resistivity. The SI unit for conductivity is S/m. For magnetic systems the concept of the skin effect also applies. However, the skin effect refers to the attenuation of the H field as it penetrates the core of the magnetic material. Since ferromagnetic materials are nonlinear, the depth of penetration varies as H varies. Once definition that was developed for sinusoidally excited saturated cores by MacLean and Agarwal [35, 36] is: δ=  2H0 ωσB0  (1.4)  where H0 is the peak of the magnetic intensity at the surface of the core. B0 was proposed by Agarwal to be 75% of the saturation flux density. If x is the distance from the surface of the core then the relationship between H and B at x is approximated by Bx = B0 sign(Hx ). Note that the value of δ in Equation 1.4 gives the absolute penetration depth not the depth at which H falls to 1 e of its original value. Some authors use Equation 1.3 for magnetic materials by replacing µ0 by µ. This is only very approximate at best since µ is a function of time and the wave solution that generates Equation 1.3 assumes that the intrinsic parameters of the medium are time invariant. One of the main uses of the depth of penetration is to estimate the number of layers that are required for circuit based ferromagnetic models.  1.4.4  Relating the Magnetization of a Material to Other Field Quantities  The magnetization M of a material is related to the H field and B field in the material by: M=  1 B−H µ0  16  (1.5)  Chapter 1. Introduction Typically M is replaced with H in Equation 1.5 by assuming that M and H are related by: M = χm H  (1.6)  where χm is the magnetic susceptibility of the material. It is dimensionless if H and M are expressed in the same units. Substituting M from Equation 1.6 into Equation 1.5 yields the more commonly found B = µH. The constant of proportionality µ is called the permeability of the material. Classically, Equation 1.6 is only valid for linear media since χm is assumed to be a constant. However, for nonlinear hysteretic media, the end result B = µH is useful if µ is defined by the slope of the curve relating H and B.  1.5  State of the Art  There are numerous papers in the literature that address the various aspects of ferromagnetic materials. This section provides a glimpse into the papers and methodologies that are the most suitable for a start point of this work. Other techniques that are clearly not suitable for solving the aforementioned problem are also mentioned for completeness. The requirements that are stated above place restrictions on the modeling techniques that are currently available. For instance, the use of finite element element analysis is not considered since the computational times for this class of models is excessively long. The unbounded nature of the iterative nonlinear solution techniques that are mostly used today are also unsuitable for realtime applications.  1.5.1  Finite Element Analysis  In finite element analysis (FEA) the physical device is represented by a 2-dimensional (2D) or 3-dimensional (3D) mesh of objects. The fields inside the objects are allowed to vary based on a polynomial of a fixed order. The algorithm then solves the fields inside the objects based on the values of the field on its surfaces. The solution is deemed to be correct when the boundary conditions on all adjoining surfaces of all of the objects are matched to within a specified error. With a large number of elements, this procedure takes a very long time — in the order of hours to stimulate a transient case for a simple rotating 3D device with a fine mesh. The excessively long simulation times of this approach makes it impractical for many situations. Clearly, for the intended use of the model examined in this work, this approach is too unwieldy. However, for the determination of reluctances in air or for static solutions of the fields inside materials, finite element analysis is a very useful tool. One approach that has gained popularity is the solution of circuit based models that are coupled 17  Chapter 1. Introduction with FEA models. In some of these cases, the airgap reluctances are represented with a FEA model and the material with a lumped parameter circuit model. This approach significantly improves the speed of the overall solution while retaining a good portion of the accuracy of the original FEA model.  1.5.2  Solution of the Diffusion Equation  Many approaches derive analytical equations for the solution of the H field inside ferromagnetic materials staring from the 1-dimensional (1D) diffusion equation. The specific case of the diffusion equation for the laminations of a transformer is well known [37]. Assuming that the external H field is in the +z direction, the 1D diffusion equation in rectangular (x,y,z) coordinates can be written as:  ∂2 ∂ Hz (x, t) = σ Bz (x, t) 2 ∂x ∂t Bz (x, t) = f Hz (x, t)  (1.7)  (1.8)  As is discussed in Section 1.4.3, the fields inside the material are attenuated by the presence of eddy currents. The electric field that drives these currents is related to H by: ∂ Hz (x, t) = −σEy (x, t) ∂t  (1.9)  where Ey (x, t) is the electric field. Typically, the units of the electric field are given in V/m. Equations 1.7–1.9 are solved subject to boundary conditions that are specified based on the assumptions that were made in the formulation of the model. For instance, the main assumption of this formulation is the height of the lamination is significantly larger than its width. Thus, the effects near the ends of the lamination are ignored. The 1-dimensional diffusion equation can also be solved using cylindrical coordinates. An example of this is presented in Chapter 4. The diffusion equation accounts for eddy currents that flow in the classical sense. It does not, however, model the currents that are generated in order to dampen the movement of the domain walls. This is a major limitation of the model. The errors that are produced by models that do not include eddy currents due to domain wall movement can be very significant if the core is not allowed to saturate to any extent. This is further explored in Chapters 3 and 4. One of the key difficulties in finding the solution to Equations 1.7–1.9 is the relationship between Hz (x, t) and Bz (x, t) is nonlinear and hysteretic. The choice of hysteresis models can dictate what is a feasible approach to finding the solution. Two very popular classes of hysteresis models are the Preisach and Jiles-Atherton approaches. The Preisach approach is dealt with extensively in Chapter 2 whereas the Jiles-Atherton approach is presented below. 18  Chapter 1. Introduction The solution for the 1D diffusion equation needs to be solved numerically since its parameters are very nonlinear. There are many ways to numerically represent the diffusion equation. Naidu proposed using a spline function to represent the distribution of H in subintervals of a single lamination [37]. His formulation uses a Preisach model to model hysteresis. The resulting model requires solving a set of seven non-linear equations. Stoll’s book The Analysis of Eddy Currents is the start point of many papers that utilize his approximations for magnetic diffusion problems [38]. One approximation that is frequently used is to model cylindrical geometries by “rolling” the angle out flat. The solution of the problem is then formulated for an infinite plane that has a width equal to the original radius of the cylinder. The time derivative in the resulting diffusion equation is then replaced by the Laplace variable s = j ω. This approximation has also been applied to geometries with a square cross-section if the square cross-section is approximated with a circular cross-section [39]. The resulting solution of the 1D diffusion equation for these cases is given by: cosh x µωs Hz (x, s) = H(rm , s)  (1.10) cosh rm  µωs  where rm is the radius of the cylinder or half the length of the side of the square cross-section. It is this approach that is utilized by Dallago et al. to model a high frequency transformer with a ferrite core [39]. Although, the model in this paper is developed for ferrimagnetic (ferrite) materials, the basic results of the paper provide useful information. Using Equation 1.10, they present a circuit-based model with core reluctances given by: R(s) = R0  s coth ω0  s ∼ = R0 1 + 3 ω0  s ω0  (1.11) if ω  ω0  2 . where R0 is the DC reluctance of the section of the core to be modeled and ω0 = 1 µσrm  The DC reluctance of the core can be modeled with any hysteresis model. The authors use the Jiles-Atherton approach. One particularly interesting result of using this approach is the frequency dependent portion of the reluctance R0 3 ω0 does not depend on µ so long as ω  ω0 . While this is  the case for a large range of ferrimagnetic materials, it certainly is not for the case of ferromagnetic materials. Furthermore, the solution of the diffusion equation given by Equation 1.10 assumes that the parameters σ and µ are time invariant. This is certainly not true to any extent for inputs that saturate the core — µ changes significantly in a cycle that saturates the core. Thus, this approach is only useful for modeling ferromagnetic materials in certain very restrictive cases. 19  Chapter 1. Introduction The problems that are associated with using a solution of the form of Equation 1.10 does not invalidate the use of the diffusion equation. Rather, they reinforce the fact that Equations 1.7–1.9 must be solved using nonlinear solution techniques for the majority of cases with ferromagnetic materials.  1.5.3  Incorporation of Empirically Determined Equations for Eddy Current Losses  The use of empirically determined equations for determining the contribution of eddy currents to the instantaneous value of H in the core of a ferromagnetic material is widespread [40–43]. In particular, these equations are often used in the determination of the iron losses of the material. The contribution of the eddy currents to H that are produced in the classical sense is given by: Hcls = k1  ¯ dB dt  (1.12)  ¯ is the average value where k1 is a constant that is determined by fitting experimental data and B of the B field in the material. The contribution of the eddy currents that flow as the result of domain wall movement is found to be: Hexc = k2  ¯ dB dt  1 2  (1.13)  where k2 is a constant that is determined by fitting experimental data. Thus, the instantaneous value of H inside the material can be determined by: H(t) = Hext − Hcls − Hexe  (1.14)  where Hext is the externally applied H field. As with the other modeling approaches, the relationship between H and B is determined with the use of a hysteresis model. Papers that describe models that use the Preisach or Jiles-Atherton hysteresis formulations can both be found in the literature for this class of solution techniques. Note that the average value of B in the material is used in Equations 1.12 and 1.13 instead of the value of B at a particular depth. Additionally, these relationships are developed using sinusoidal excitations. Both of these conditions impose rather restrictive limitations on the validity of using this approach. This is discussed in further detail in Chapter 3.  1.5.4  Circuit-Based Ferromagnetic Models  Since these circuits are the focus of this work, a whole chapter is devoted to exploring the performance of the preexisting circuits. However, for completeness some general commentary is included 20  Chapter 1. Introduction here. Circuit-based modeling techniques have been used for many decades. In fact, a single layer version of the basic circuit that is presented in Chapter 3 is incorporated in the ubiquitous Tcircuit transformer model if the magnetizing branch is modeled as a nonlinear inductor in parallel with a resistor. Some of the earlier work such as Charap’s paper modeled both hysteresis and eddy current effects in ferromagnetic materials in a single circuit i.e. the effects due to hysteresis are not modeled separately from eddy current effects [44]. This is in stark contrast to the recent trends in magnetic material modeling. A major advantage of circuit-based models is they can be incorporated into larger models that describe complex devices seamlessly. Thus, the equations that describe the whole device can be solved together. This advantage along with others are explained in the remaining chapters to come.  1.5.5  The Jiles-Atherton Model of Hysteresis  As is briefly mentioned above, there are two major classes of techniques that are used for modeling hysteresis: the Preisach and Jiles-Atherton methodologies. Both of these approaches are phenomenological in nature. The main features of the Jiles-Atherton approach are presented here while the next chapter covers in depth the theory behind the Preisach approach. The main results of the Jiles-Atherton model appear below. The detailed derivation of these results can be found in the original paper by Jiles and Atheron [45]. The Jiles-Atherton approach attempts to model the behaviour of the domain walls in ferromagnetic materials. Specifically, the translation and bowing (bending) of domain walls is modeled. The basic shape of the hysteresis loop is provided by an anhysteretic magnetization Man (H) curve. This curve does not exhibit hysteresis. It models the behaviour of the material that would occur if the motion of the domain walls was fully reversible. Thus, in the words of Jiles and Thoelke, “ · · · the anhysteretic magnetization represents a global minimum towards which the  magnetization strives but is prevented from reaching because of impedances to domain wall motion” [46]. Typically, a modified Langevin function is used to model Man . This function is given by: Man (H) = Ms coth  He γ  −  γ He  (1.15)  where Ms is the value of the magnetization at the saturation flux density, γ is a parameter that characterizes the shape of Man with units equal to He , and He is the effective magnetic intensity that is seen by every magnetic domain of the material due to the coupling between neighbouring domains. The effective magnetic intensity is defined as: He = H + αM 21  (1.16)  Chapter 1. Introduction where α is the coupling factor between domains. The domain walls bow (bend) in the vicinity of the origin of the initial magnetization curve. Wall bowing is considered to be the primary mechanism for domain wall motion in this region. The bowing of the domain walls is a reversible process. However, the bulging of the wall is impeded by localized imperfections in the crystal lattice of the material [47]. The locations of these imperfections are called “pinning” sites in the literature. In the Jiles-Atherton formulation, the translation of the domain walls is assumed to be impeded by uniformly distributed pinning sites. As is described above in Section 1.4.2, the energy that is required to move the walls past imperfections in the crystal lattice is eventually dissipated as heat. Thus, the translation of the domain walls is a irreversible process. The energy that is lost due to moving the wall pass these pinning sites is expressed as a function of the irreversible change in the magnetization Mirr : Epin (Mirr ) =  Mirr  n π 2m  0 Mirr  = µ0 k  dMirr (1.17)  dMirr  0  where n is the average density of pinning sites in the material,  π  is the average pinning energy of  the sites for 180o domain walls, m is the magnetic moment of a typical domain, and k is a parameter that lumps material dependent variations together with units equal to Mirr . The constant k is sometimes known as the domain anisotropy parameter. Note that 180o domain walls rotate the magnetic moment from one side of the wall to the other by 180o . Usually these walls continue through many crystals in the material. Conversely, 90o walls are typically contained only within individual crystals [44]. Thus, the Jiles-Antherton formulation only models the movement of the 180o walls. The irreversible magnetization can be obtained from Equation 1.17. The results of this derivation can be found in the oft cited paper by Jiles and Atherton [45] as: Mirr = Man − kδ  dMirr dHe  (1.18)  where δ is defined as a directional parameter that has a value of +1 if dH/dt > 0 and −1 if dH/dt < 0.  Provided that k = 0 and the denominator of Equation 1.18 is not zero, Equation 1.16 can be substituted into Equation 1.18 to yield: dMirr Man − Mirr = dH kδ − α(Man − Mirr )  (1.19)  where dMirr /dH is called the differential irreversible susceptibility. Equation 1.19 constitutes the first of two equations that define the Jiles-Atherton hysteresis model. 22  Chapter 1. Introduction As mentioned above, the bending of the domain walls is a reversible process. Therefore, a reversible component of the total magnetization of the material is present due to the domain walls bending. Since the bending is primarily influenced by difference between the anhysteretic magnetization and the irreversible magnetization, the differential reversible susceptibility dMrev /dH can obtained by:  dMrev =c dH  dMan dMirr − dH dH  (1.20)  where c is a parameter that determines the amount of domain wall bending. Equation 1.20 constitutes the second equation that defines the Jiles-Atherton hysteresis model. Equations 1.19 and 1.20 can be combined to yield the total differential susceptibility dM/dH: dM Man − Mirr dMan = (1 − c) +c dH kδ − α(Man − Mirr ) dH  (1.21)  One of the main touted benefits of this model is it only requires five parameters to be determined: namely, Ms , γ, α, k, and c. These parameters can be determined by a set of experimental magnetization measurements [46, 48]. There have been some reported issues with using the model as is written above. In particular, the direct solution of Equation 1.19 can lead to a negative differential susceptibility in certain circumstances. This results in a unphysical solution. One of these circumstances can occur just after the direction of H reverses at the extremity of the hysteresis loop. If in this region the irreversible magnetization is below the anhysteretic magnetization in the first quadrant of the H-B plane or above the anhysteretic magnetization in the third quadrant then a negative differential susceptibility occurs as the field is reduced. This is avoided if dMirr /dH is set to zero in these conditions. Physically, this is justified since the domain walls remain pinned on defect sites as the field is reduced. The bulging of the walls, however, is allowed to relax as the field decreases. Since the bulging of the walls is deemed to be reversible, dM/dH = dMrev /dH in these cases. Another circumstance when a negative differential susceptibility can occur is in the generation of minor hysteresis loops. The basic model can be modified without the need for additional parameters to better model the behaviour of minor loops [49]. This reformulation ensures that minor loops close since the vast majority of minor loops do actually close. The error that is produced by the model in cases in which the minor loop does not close is extremely small. Thus, the validity of this approach is quite good. The modification to the basic Jiles-Atherton model is based on the concept of a working volume. The concept of a working volume can be seen by considering the case of a small minor loop. If the H field reverses at H = H1 and then reverses again sometime later at H = H2 , the change in the position of the domain walls (and the amount of rotation of the domains) is small if  23  H = H2 − H1  Chapter 1. Introduction is small. Thus, the change that is necessary to return the magnetization to the original state at H = H1 does not require the entire volume of the material to be changed i.e. the change in H from H2 to H1 only acts on a small potion of the material. This potion of the material is called the working volume. It is clear that as the change in H given by  H increases, then the working  volume increases as well. For the part of the magnetization that is irreversible, the fraction of the total volume that is acted on can be obtained by: vf =  H+ H−  Mirr (H+ ) − Mirr (H− ) Man (H) − Mirr (H) dH kδ − α(Man (H) − Mirr (H))  (1.22)  where H+ is the value of H of the positive extremum of the minor loop and H− is the value of H  at the negative extremum of the minor loop.  The new definition of dMirr /dH is now obtained by: dMirr Man − Mirr = vf dH kδ − α(Man − Mirr )  (1.23)  There are a few comments that can be made about Equations 1.22 and 1.23. Firstly, the value of vf is constant for a given minor loop. Secondly, the model requires the reversal points in the trajectory along with the values of vf for each set of reversal points to be stored. Finally, for the case of major loops the working volume is the entire material. As expected vf = 1 for major loops. A working volume for the reversible magnetization can be defined similar to the irreversible magnetization: vf =  H+ H−  Mrev (H+ ) − Mrev (H− ) dMan (H) dMirr (H) c − dH dH dH  (1.24)  Likewise, the new definition of dMrev /dH is: dMrev = vf c dH  dMan dMirr − dH dH  (1.25)  The same comments that are given above for the use of dMirr /dH apply to the use of dMrev /dH. Equations 1.22 - 1.25 constitute the equations that define the modified Jiles-Atherton model of hysteresis. This formulation is able to successfully model the behaviour of both major and minor hysteresis loops. The modified Jiles-Atherton model could be used as the hysteresis model for this work. However, the modified Preisach model that is described in Section 2.2 is significantly easier to implement than the modified Jiles-Atherton model. This is particularly true when the relationship between H and B is represented by a constant µ and B-intercept for a predefined range of H. This 24  Chapter 1. Introduction piecewise linearization of the relationship between H and B has significant advantages in terms of computational speed and the convergence of the resulting solution. This will be become clear in light of the discussion in Chapter 5.  1.6  Outline of this Thesis  This chapter gives an introduction to sensorless SRM drives. The perceived limitations in the preexisting models for SRMs provides the motivation for undertaking the work that is presented in this thesis. The basic concepts in magnetics theory that are relevant to ferromagnetic materials is then given to provide a basis for the discussions in the chapters to come. Finally, this chapter ends with an overview of the existing body of knowledge for the modeling of ferromagnetic materials. The hysteresis model that is utilized in this work is presented in Chapter 2. The hysteresis model forms the backbone of the model that is the result of this work. This chapter also includes the basic details that are necessary to implement a specific form of the class of hysteresis models that is used. This implementation uses piecewise linear elements to represent the relationship between H and B. The benefits for doing this are detailed in Chapter 5. Chapter 3 presents the basic details of circuit-based ferromagnetic models. Following this presentation is a summary of some trends in the performance of the most basic form of this type of model. These trends provide some insight into what modifications are necessary to achieve the stated objectives of this work. A new methodology for statically adjusting the parameters of the basic circuit model is included in this chapter. The dynamic model that is developed in Chapter 4 builds on this initial modification to the basic circuit model. Chapter 3 ends with a discussion on the performance of preexisting circuit-based models in order to highlight the need for this work. Chapter 4 provides the details for the two mechanisms that are the main contributions of this work. A method for obtaining the parameters of the resulting dynamic model is then given. Finally, Chapter 4 concludes with an analysis of the accuracy of the new model. This is performed with a specific metric that is based on least squares. Additionally, the results for a comparison between the new dynamic model and a static model is graphically given. Further waveforms that characterize the behaviour of the resulting model are given in Appendix B. The implementation details for the piecewise linearized version of the model that is developed in this work is given in Chapter 5. Specifically, the issues that are associated with the implementation of the two mechanisms are addressed in this chapter. The basic details of the implementation of the hysteresis model that is given in Chapter 2 is also expanded upon in this chapter. ANSI C is used to code the algorithms that are given in this chapter; the code can be found in Appendix C. Chapter 5 closes with the presentation of a feasibility study for using this model in the sensorless control of SRMs. Concluding remarks are given in Chapter 6. The specific contributions of this work are also 25  Chapter 1. Introduction listed. The modeling work that is presented in this work is only for one specific material with a set geometry. Thus, Chapter 6 also highlights the possible extensions to this work. Appendix A gives the experimental setup that generated all of the results that are shown in this work. Some of the issues that are present in the determination of the experimental waveforms are also discussed in this appendix. As mentioned above Appendix B provides additional waveforms that are generated with the model that is proposed in this work. It also presents the tabulation of the results of the numerical comparison that is given in Chapter 4. Finally, Appendix C lists the C code that was written to produce the results of the implemented model.  26  Chapter 2  Hysteresis Model Hysteresis is an integral part of any accurate model describing the behaviour of ferromagnetic materials. As was mentioned in Chapter 1, there are two major approaches to representing hysteresis in magnetic materials: the Jiles-Atherton and Preisach models. An introduction to the Jiles-Atherton modeling approach is given in Chapter 1. The Preisach approach is detailed in this chapter. Ultimately, the Preisach approach was chosen for the hysteresis model because it is significantly easier to implement as part of a circuit-based ferromagnetic model compared to the Jiles-Atherton approach. This Chapter details the Preisach approach to hysteresis modeling and how it is incorporated into a circuit-based model. The basic details regarding the implementation of this type of approach using piecewise linear elements is also described.  2.1  The Classical Preisach Model  In 1935, the German physicist F Preisach published his paper proposing a model of magnetic hysteresis [50]. The basic ideas in this seminal paper have been focus of numerous papers describing improvements or explanations in the years since its publication. Krasnoselskii further expanded the applicability Preisach’s model by representing the model in a pure mathematical form [51]. The model can, therefore, be applied to any physical phenomenon that exhibits hysteresis. Furthermore, Krasnoselskii’s mathematical representation can also be used to establish the limitations of the applicability of Preisach’s model. The classical Preisach model as represented by Krasnoselskii (called the Preisach–Krasnoselskii model in this work) is purely phenomenological in nature i.e. it does not attempt to describe the cause of hysteresis but rather it attempts to represent the effects of hysteresis. This is in contrast to the Jiles-Atherton model which, in part, tries to represent the physical nature of hysteresis. The Preisach–Krasnoselskii model is based on a weighted double integral of an infinite set of elementary hysteresis operators. Before the model can be formulated, however, the definition of the elementary hysteresis operator needs to be given.  27  Chapter 2. Hysteresis Model  2.1.1  The Hysteresis Operator γˆαβ  The Preisach-Krasnoselskii model utilizes an infinite set of elementary hysteresis operators γˆαβ . This operators act on an input u(t). They are represented by a rectangular loop in the u − γˆαβ u  plane as shown in Figure 2.1. As can be seen in Figure 2.1, the output γˆαβ u(t) can assume only two values: +1 and -1. The output changes from -1 to +1 at u(t) = α and from +1 to -1 at u(t) = β. Due to this switching action, the output depends not only on the input u(t) but also on the previous state of each operator. Therefore, the operators have their own localized memory. γ^αβu  1  β  α  u  -1  Figure 2.1: The elementary hysteresis operator γˆαβ  2.1.2  The Preisach-Krasnoselskii Model  The elementary hysteresis operators γˆαβ are integrated using an arbitrary weight function ρ(α, β). The arbitrary weight function ρ(α, β) is a surface with unique values inside and on the triangular region that is defined in Figure 2.2 and is zero elsewhere. The weighting function is typically called the Preisach (density) function in the literature. The double integration that forms the basis of the Preisach-Kransnoselskii model is given by: y(t) =  ρ(α, β)ˆ γαβ u(t) dα dβ α β  28  (2.1)  Chapter 2. Hysteresis Model The double integration is performed in the plane that is defined by the switching points β and α. The β − α plane can be split into two regions corresponding to hysteresis operators that have  a value of +1 or -1. The two regions along with the interface that divides the regions is shown in Figure 2.2.  α  S-(t) I(t)  α=β  β S+(t)  Figure 2.2: The β − α plane showing the geometric interpretation of Equation 2.1 S + (t) is the region of operators with a value of +1 whereas S − (t) is the region of operators with a value of -1. Notice that the shape of the interface I(t) is a staircase. Vertical lines in the staircase not including the line that connects to the α = β line are the result of u(t) following a negative going trajectory in the past. Conversely, horizontal lines not including the line that connects to the α = β line represent u(t) following positive going trajectory in the past. The line connecting the α = β line represents the current trajectory of u(t). This final link in the interface moves as the value of the input changes i.e. a horizontal final link moves upwards as the input becomes more positive and a vertical final link moves to the left as the input becomes more negative. If the final link joins the line that represents the most recent previous trajectory in the same direction as the current trajectory then the model returns to its original state before the two most recent trajectories were taken. As a result, the information pertaining to the last two reversals in the trajectory are wiped from the memory of the model. This wiping property is one of the two main features of the Preisach model of hysteresis. From Figure 2.2 and the discussion above, it follows that the output at any time depends on the shape of the interface I(t). The interface I(t) in turn depends on the reversal points of u(t) in 29  Chapter 2. Hysteresis Model the past. This illustrates the extraordinary fact that the superposition of the γˆαβ operators with local memory results in a model that exhibits nonlocal memory. It can be seen from Figure 2.2 that Equation 2.1 can be rewritten as: ρ(α, β) dα dβ −  y(t) = S + (t)  ρ(α, β) dα dβ  (2.2)  S − (t)  The two double integrations that are defined in Equation 2.2, therefore, describe the multiplication of the volume under the surface that is defined by ρ(α, β) by either +1 in the S + (t) region or −1  in the S − (t) region. The addition of the two integrals becomes the output of the model y(t). The double integration probably makes Preisach’s model seem too unwieldy for practical applications. However, as will be seen, this can be avoided through the use of an explicit form of Equation 2.1. The explicit formulation greatly enhances the appeal of Preisach’s model for practical applications. Up to this point the discussion of Preisach’s model has been performed in very general terms. Equation 2.1 can potentially describe any physical phenomenon that exhibits hysteresis. In the case of magnetic systems the input u(t) is typically the magnetic intensity H, and the output y(t) is the magnetic field density B or the magnetization M . In terms of a magnetic system, Equation 2.1 can be rewritten as: B(t) =  ρ(α, β)ˆ γαβ H(t) dα dβ  (2.3)  α β  The determination of an appropriate weighting function ρ(α, β) for magnetic materials has been the topic of vigorous research in recent years [52–54]. The final form of the weighting function depends on many things including what and how experimental data from the actual material is used. Furthermore, since the Classical Preisach model has some inherent limitations, the model has been modified in numerous ways to remove the limitations of the base model. This, in turn, requires ρ(α, β) to be redefined as is appropriate for the new model. Equation 2.3 describes a scalar system i.e. a magnetic system with no orientation. The literature also contains several papers that propose vector based Preisach models [55, 56]. The incorporation of this type of hysteresis model into the overall model presented in this work is the topic for further research.  2.1.3  Explicit Formulation of the Preisach-Krasnoselskii Model  The double integration that is necessary for Equations 2.1 – 2.3 is troublesome for practical implementations of the Preisach model. This can be avoided if an explicit formulation such as the one that is proposed by Mayergoyz is used [57]. In his formulation, a function that is defined by experimentally determined first order reversal curves is used in the calculation of the output. This 30  Chapter 2. Hysteresis Model function is defined as: F (α, β) = (Bα − Bαβ )/2  (2.4)  where Bα and Bαβ are the values of magnetic field density at H = α and H = β respectively on a first order reversal curve. A first order reversal curve is obtained by first starting from a state of either positive (+Hsat ) or negative (−Hsat ) saturation. The field is then either decreased or increased corresponding to starting from positive or negative saturation respectively to a value H = α. Finally, at H = α the trajectory of H is reversed to bring the material back into its original state of saturation. Since the direction of the trajectory of H is changed only once, the resulting reversal curve is deemed to be first order. Bαβ is the value of the magnetic field density at H = β along the path that returns the material to a state of either positive or negative saturation. An example of a typical first order reversal curve that starts from negative saturation is shown below in Figure 2.3.  B  Bα  β α  H  Bαβ  Figure 2.3: A typical first order reversal curve With the definition of F (α, β) in Equation 2.4, the output at any time is given by the explicit equation:  n  B(t) = −F (α0 , β1 ) + 2  k=1  (F (αk , βk ) − F (αk , βk+1 ))  (2.5)  where n is the number of horizontal links in the interface I(t) shown in Figure 2.2. The validity of Equation 2.5 can be seen by examining a typical sequence of reversals in the trajectory of H. The state of the model in the β − α plane along with the trajectory that the material takes in the H − B plane is shown below in Figure 2.4. 31  Chapter 2. Hysteresis Model  α B  (α0, β 1)  S-(t) (α1, β 1)  (α1, β 2)  Bα1β 2 Bα1  β  S+(t) α0 β1  α1 β2  H  Bα0 Bα0β 1 Bα1β 1 B  α (α0, β 1)  Bα1  S (t) -  (α1, β 1)  (α1, β 2)  S+(t)  β β2 α1  Bα0 Bα0β 1 Bα1β 1  H  Bα1β 2  Figure 2.4: The β − α plane and the path of the material for sequence of reversals of H  32  Chapter 2. Hysteresis Model  α (α0, β 1)  S-(t) (α1, β 1)  B  (α1, β 2) (α2, β 3)  S+(t)  Bα1  β  (α2, β 2)  Bα2 Bα2β 3 β2 α2 β3  α1  H  Bα1β 2 Bα2β 2  Figure 2.4 cont.: The β − α plane and the path of the material for sequence of reversals of H cont. The correspondence between the state of the model and the trajectory of its output is greatly facilitated when the value of F (α, β) is related to the β − α plane. The value of F (α, β) is equal  to the double integral of ρ(α, β) in the area of the triangle T (α, β) that is defined by its vertex at (α, β) and the line β = α i.e.: F (α, β) =  ρ(α, β) dα dβ  (2.6)  T (α,β)  where the definition of T (α, β) is shown in Figure 2.5. Keeping the geometric interpretation of F (α, β) in mind, it follows that the explicit formula that is given in Equation 2.5 is equal to the addition and subtraction of triangular areas in the β − α plane with output values equal to F (α, β). This is demonstrated in the sequence of reversals  of H that is shown in Figure 2.4. As the number of reversals increases, then so does the number of triangular areas that are required to make up the interface between the two regions S + (t) and S − (t).  33  Chapter 2. Hysteresis Model  α  α=β (α, β )  T(α, β )  β  Figure 2.5: Definition of the triangular area T (α, β)  2.1.4  The Everett Function  A function that appears regularly in papers that use some form of Preisach’s model is called the Everett function. The Everett function is the change of magnetization  M from a turning point  H1 in the applied magnetic field intensity to some field H2 . It is given by: E(H1 , H2 ) =  H2  dα  H1  α  ρ(α, β) dβ  (2.7)  H1  Note that the Everett function could also be defined for a change in magnetic field density B. Comparing the definition of the Everett function to that of F (α, β) shows that the value of E(H1 , H2 ) = 2F (α, β) when the Everett function is defined for changes in the magnetic field density. Additionally, if the output of the model is the magnetization M , then the definition of F (α, β) in Equation 2.4 would use magnetizations instead of magnetic field densities. In other words, the use of the magnetization as the output of the model only requires instances of B to be replaced with M and instances of  B with  M.  The definition of the Everett function has lead to characterizing ρ(α, β) by arranging experimental data into a two-dimensional map, the so-called Everett Map, and then double differentiating the map to obtain ρ(α, β). The numerical double differentiation, however, can lead to spurious results when it used as part of the calculation for the output B(t). Thus, this approach must be applied 34  Chapter 2. Hysteresis Model with caution.  2.1.5  Limitations of the Classical Preisach Model  The classical Preisach-Krasnoselskii model exhibits the two following properties: • Wiping-out property • Congruency property The wiping out property is discussed above in reference to the movement of the final link of the interface I(t) in Figure 2.2. The congruency property states that all hysteresis loops between the same two extremum points in H are congruent. This is seen by observing that the movement of the links in I(t) between any two extremum points produces the same change in magnetization  M and magnetic field density  B. As discussed below this property poses serious limitations to the applicability of the model. It is a well known fact that the behaviour of magnetic materials depends not only on the past extremum values of the input as in the classical Preisach–Krasnoselskii Model but also on the present state of the material. Real materials, therefore, do not exhibit congruent behaviour. This poses a serious problem in the identification of model using first order reversal curves. Since the Preisach function ρ(α, β) is symmetrical [58], it follows that Everett’s function is also symmetrical i.e.: E(Hk , Hk+1 ) = E(−Hk+1 , −Hk )  (2.8)  If the Preisach–Krasnoselskii model is identified using measured first order reversal curves then the observed changes in magnetization can be equated to Everett’s function as given by: E(Hk , Hk+1 ) = where  M (Hk , Hk+1 ), Hk+1 > Hk  (2.9)  M is the change in magnetization along a given first order reversal curve.  Due to the symmetry in Everett’s function as given in Equation 2.8, metrical too. However, in general, this is not the case i.e.  M is required to be sym-  M (Hk , Hk+1 ) =  Not surprisingly, this is also true if the Everett function is defined for  M (−Hk+1 , −Hk ).  B instead of  M . The end  result is the same. This implies that if the first order reversal curves are used to identify the model then the output of the model will not predict closed minor loops. This is a serious shortcoming of the model because, to a good approximation, minor loops close in actual magnetic materials. This problem can be evaded by using other experimental data such as the limiting hysteresis curve [37, 43, 59, 60] or the initial magnetization curve [61] instead of the first order reversal loops. However, these methods cannot reproduce the first order curves. The accuracy of these methods 35  Chapter 2. Hysteresis Model is therefore limited. The next section details a modification to the classical Preisach–Krasnoeslskii model that can successfully identify Everett’s function using experimental first order reversal curves.  2.2  The Modified Preisach Model  Kurt Wiesen and Stanley Charap proposed a simple modification to the Preisach–Krasnoselskii model that can successfully identify Everett’s function using experimental first order reversal curves [62]. This is not the only way to modify the classical Preisach model to successfully identify Everett’s function. Another major approach is to modify the definition of the Preisach function to include other components that cannot be modeled using the classical model such as other irreversible components or offsets. Other methods use Gaussian or Lorentzian type functions to define the Preisach function. The use of these functions or other non-linear mathematical functions are not appropriate for the type of model that was developed in this work so they were not investigated. Mayergoyz proposed several new schemes that require second order reversal curves [63–67]. Given that the variation in the properties of the material from one sample to another is likely to create a larger error in the response of the model compared to any gain in accuracy that results from using second order reversal curves, it was decided that the extra effort of using the additional data was not worthwhile. This is substantiated by the fact that the actual initial magnetization curves provided by manufacturers give only the statistical mean of the curve over a large sample of the material. The actual variance of the initial magnetization curve is quite large for low values of H. Furthermore, mechanical stress on the material will further change the microstructure of the material. This in turn modifies the magnetic behaviour of the material. For the above stated reasons it was decided to implement the model proposed by Wiesen and Charap over others.  2.2.1  The Model Formulation  The model proposed by Wiesen and Charap ensures that minor hysteresis loops close. This is achieved by using a correction factor to modify  M from the experimental first order curves.  If the magnetic field density is used instead of the magnetization then all instances of replaced with  M are  B. This has already been done where appropriate. The correction factor is given  by:  C(Hk+1 , Hk ) =  where     −          −  M (Hk , Hk+1 ) M (−Hk+1 , −Hk )  for Hk < Hk+1  M (Hk , Hk+1 ) M (Hk+1 , Hk )  for Hk > Hk+1  (2.10)  M (Hk , Hk+1 ) is the change in magnetization for the previous trajectory. 36  Chapter 2. Hysteresis Model Consequently, the change in magnetization for the current trajectory is given by:  M (Hk+1 , Hk+2 ) =     −          −  Notice that as Hk+2 → − Hk ,  M (Hk , Hk+1 ) M (−Hk+1 , −Hk+2 ) for Hk+2 < Hk+1 M (−Hk+1 , −Hk ) M (Hk , Hk+1 ) M (Hk+1 , Hk+2 ) M (Hk+1 , Hk )  (2.11)  for Hk+2 > Hk+1  M (Hk+1 , Hk+2 ) → − − M (Hk , Hk+1 ) and the minor loop closes.  For this scheme the output B(t) now becomes: m−1  B(t) = B0 +  B (Hk+1 , Hk+2 )  (2.12)  k=−1  where m is the number of reversals of the field H and B0 is the initial value of the magnetic field B at H0 = −Hsat .  Note that for k = −1,  B (H0 , H1 ) =  B(H0 , H1 ) since the experimental first order curves  already close. Also note that Equations 2.10 - 2.12 assume that the first order reversal curves are referenced to H = +Hsat . The initial trajectory from H = +Hsat that the first order curves are attached to is itself a reversal curve for the case when H reverses at H = −Hsat . Therefore,  Equation 2.12 is defined when B0 corresponds to H0 = −Hsat and the first reversal occurs when  the trajectory changes from positive going to negative going.  The modified Preisach model has the following symmetry properties: •  M (Hk , Hk+1 ) = − M (−Hk , −Hk+1 )  •  M (Hk , Hk+1 ) = − M (Hk+1 , Hk )  The first property states the experimentally observed phenomenon that the first order curves that are generated using positive saturation as the start point are the negated version of the curves that are generated from starting at negative saturation. As with the limiting hysteresis loop any loop that starts at H = ±Hp , reverses at H = ∓Hp , and finally returns to H = ±Hp , closes.  Furthermore, the first order loop that is used for the returning trajectory is the negated version of the first order loop that is used for the initial trajectory. The correction factor for both trajectories is identical. Therefore, it follows that the first property must hold. The second property states that minor hysteresis loops close. As mentioned above the correction factor guarantees that this occurs. Unfortunately, the values of the magnetic field density along the initial magnetization curve are not as easily obtained for this scheme compared to some implementations of the classical Preisach model. For example, the values along the initial magnetization curve for models that just use a 37  Chapter 2. Hysteresis Model limiting hysteresis loop to identify Everett’s function are given by E(−H, H)/2. In this case, the model needs to be fed a sequence of trajectories that makes up an AC demagnetization. Once the current state of the model is H = 0 and B ≈ 0, H can be increased monotonically to obtain the  initial magnetization curve. Note that it would require and infinite number of turning points obtain B = 0.  2.2.2  Model Implementation  This section details the basic implementation of the modified Preisach model. Further details can be found in Chapter 5. As mentioned in Chapter 1, the model that was proposed for this work utilizes piecewise linear resistances and inductances. The rest of the model requires the hysteresis model to output a permeability µ and either a B or H intercept that are valid over a certain range of H. The first step in the implementation of the hysteresis model is to piecewise linearize the experimentally obtained first order reversal curves. The regions where the slope of the curves are high require more pieces to reasonably fit the data. Of course, adding more pieces will result in a more accurate model but at the expense of the computational time of the overall model. This tradeoff will become more apparent in Chapter 5 when the overall implementation issues of the proposed model are discussed. Figure 2.6 shows the first order curves that were obtained from the test material in this work. The experimental setup that was used to obtain these curves is described in Appendix A. Notice the significant deviations in the responses near the positive saturation point +Hsat . The reason behind these deviations is also described in Appendix A. The actual error in the piecewise linear curves due to these deviations is quite small since the enclosed area of the hysteresis loops in this region is small compared to the region near H = 0. The best fit piecewise linear curves for the first order reversal curves of the test material is shown in Figure 2.7. Looking at Equation 2.12 might suggest that the more reversals in the trajectory of H in the past of the material, the higher the computational time should be for the model. This is not the case. In fact, the summation in Equation 2.12 is not required if the value of the magnetic field density B at the reversal points of H is stored along with the value of H. Furthermore, if the correction factor is also stored then in the event that the current trajectory wipes out part of the history of the model, the new correction factor can be retrieved from memory instead of recalculated. With the above in mind, Equation 2.12 can be rewritten as: B(t) = B(Hn ) + C(Hn , Hn−1 ) B(±Hn , ±H)  (2.13)  where Hn is the most recent reversal point in the trajectory of H. Hn−1 is the previous reversal point. The signs for the arguments of  B are chosen as in Equation 2.11. 38  Chapter 2. Hysteresis Model  1.5  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  Figure 2.6: Experimental first order reversal curves for test material  The value of  B needs to be interpolated between the experimentally obtained piecewise lin-  earized first order reversal curves. The pieces of each curve are defined for explicit ranges of H. The ranges are the same for every curve. Thus, only one index is required to determine the position of a given value of H with respect to the regions defined for the first order curves. The endpoints of the pieces of the descending limiting hysteresis curve are also the start points of the first order curves. However, there are fewer first order curves than endpoints. First order curves for the remaining endpoints are generated by weighting the slopes of the first order curve above and below the interpolated curve by: µm∗ = (µm∗ −1 − µm+j )rm∗ + µm+j  (2.14)  where m∗ = m, m + 1, . . . , m + j − 1. The slopes µm−1 and µm+j correspond to the bounding  experimental first order curves. Note that the relationship between the various variables that are  used to determine the interpolated curves are depicted in Figure 2.8 below. The value of rm∗ is 39  Chapter 2. Hysteresis Model  1.5  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  Figure 2.7: Piecewise linearized first order reversal curves for test material  defined as: rm∗ =  Bm∗ (Hm∗ −1 ) − Bm+j (Hm∗ −1 ) Bm∗ −1 (Hm∗ −1 ) − Bm+j (Hm∗ −1 )  (2.15)  Note that an upper bounding curve has an index lower than the lower bounding curve. The reason for this will become apparent later. The value of rm∗ is determined at the start point of the m∗ − 1 first order curve i.e. Hm∗ −1 in Equation 2.15 is the value of the magnetic intensity  at the start point of the m∗ − 1 first order curve. Bm∗ , Bm∗ −1 , and Bm+j are the magnetic field  densities at Hm∗ −1 of the interpolated, upper bounding, and lower bounding first order curves  respectively. Note that for m∗ = m the upper bounding curve is itself an interpolated curve. Thus, the interpolated curves need to be calculated in a specific order: from m∗ = m to m∗ = m + j − 1.  Since the bounding curves are linear, the value of rm∗ does not change along the interpolated curve. The value of Bm∗ (Hm∗ −1 ) requires the trajectory of the interpolated curve to be determined for 40  Chapter 2. Hysteresis Model values of H less than the start point of the m∗ − 1 order curve. The initial slopes of the interpolated curves between the experimental curves need to be determined first. The initial slope µm∗ of these interpolated curves is given by:  µm∗ = (µm−1 − µm+j )rm∗ + µm+j  (2.16)  where µm+j and µm−1 are the initial slopes of of the m + j and m − 1 experimental first order curves. The value of rm∗ is defined as:  rm∗ =  Bm∗ − Bm+j Bm−1 − Bm+j  (2.17)  where Bm∗ , Bm−1 , and Bm+j are the values of the magnetic field density at the start points of the m∗ , m − 1, and m + j first order curves respectively. Bm∗ (Hm∗ −1 ) is now obtained by: Bm∗ (Hm∗ −1 ) = Bm∗ + µm∗ (Hm∗ −1 − Hm∗ )  (2.18)  where Hm∗ is the value of H at the start point of the m∗ interpolated curve. After the initial slopes of the interpolated curves are determined, Equations 2.14 and 2.15 can be used to complete the interpolated curves.  m-1  m*-1  ′* µm  m*  (Hm* , B′m* )  m+j  ′ µm-1 ′ -1 ) (Hm -1 , Bm  (Hm*-1 , Bm*-1)  (Hm*-1 , Bm* )  (Hm*-1 , Bm+j )  ′ µm+j  ′ ) (Hm+j , Bm+j  Figure 2.8: The relationship between the variables that are used to interpolate other first order reversal curves This interpolation scheme assumes that the trajectory follows the slope of the j + 1 first order curve for values of H between the start of the j + 1 and j first order reversal curves. 41  Chapter 2. Hysteresis Model With the addition of the interpolated first order curves, the path between the first order curves can be determined. As is mentioned above, only one index is required to determine the position of a given value of H with respect to the definition of the regions of the first order curves. The boundary ˆ = [+Hsat , . . . , −Hsat ]. values that define the regions can be stored in a constant array of the form H  ˆ For a given value of H, the corresponding index i satisfies the constraints H(i) > ηˆH  ˆ H(i+1).  ηˆ is an operator that is +1 if the trajectory of H is positive going and −1 if it is negative going. Thus, as the current trajectory progresses the index i decreases. If the most recent reversal point  Hn lies between the j and j + 1 first order curves then the value of r for the new trajectory is defined as: r= ˆ where i satisfies H(i) > ηˆHn  ˆ ηˆHn − H(i+1) ˆ − H(i+1) ˆ H(i)  (2.19)  ˆ H(i+1). The direction of the trajectory is defined as the direction  of the new trajectory. Note that the use of H in the determination of r is the equivalent of using B since µ is constant ˆ ˆ between H(i) and H(i+1). The correction factor C(Hn , Hn−1 ) as given in Equation 2.10 can be rewritten as: C(Hn , Hn−1 ) =  |B(Hn ) − B(Hn−1 )| | Bj,j+1 (Hn , Hn−1 )|  where the magnitude of the change in the magnetic field density  (2.20)  B using the weighted first order  curves j and j + 1 from H = Hn to H = Hn−1 is: ˆ − ηˆHn ) | Bj,j+1 (Hn , Hn−1 )| = µj+1 (i+1)(H(i) +  + where  Bj (Hn−1 ) and  Bj (Hn−1 ) −  Bj+1 (Hn−1 ) r  (2.21)  Bj+1 (Hn−1 )  Bj+1 (Hn−1 ) are defined as: i−1  Bj (Hn−1 ) = l=im i=im  i−1  Bj+1 (Hn−1 ) = l=im i=im  ˆ − H(l+1)) ˆ ˆ m ) − ηˆHn−1 ) µj (l+1)(H(l) − µj (im +1)(H(i  ˆ − H(l+1)) ˆ ˆ m ) − ηˆHn−1 ) µj+1 (l+1)(H(l) − µj+1 (im +1)(H(i  42  (2.22)  (2.23)  Chapter 2. Hysteresis Model ˆ m ) > ηˆHn−1 where im satisfies the constraints H(i  ˆ m +1). H(i  The summations in Equations 2.22 and 2.23 can be done offline and stored in a lookup table. Using the definitions in Equations 2.19 - 2.23, the current slope of the model can be written as: µ(H, Hn , Hn−1 ) = C(Hn , Hn−1 ) (µj (i+1) − µj+1 (i+1))r + µj+1 (i+1)  (2.24)  ˆ where H is the current value of the magnetic intensity and i satisfies the constraints H(i) > ηˆH ˆ H(i+1). Notice that the index of µj and µj+1 is equal to i + 1. This is because the value of µ for index ˆ ˆ i + 1 is defined for H = H(i+1) to H = H(i). As previously mentioned, C(Hn , Hn−1 ) and r only need to be calculated when the trajectory of H changes direction. A graphical representation of the variables in the above equations is shown in Figure 2.9 below.  (H n-1 , B(Hn-1) ) µj (i m+1)  B(Hn) B(Hn-1)  H(i m+1)  µj+1 (i m+1)  Bj  H(i-1) H(i)  B j+1  (H n , B(Hn)) µj+1 (i+1)  Figure 2.9: The relationship between the variables that are defined in Equations 2.19 – 2.24 The intercept of the B-axis called the B pivot point Bpv here is given by: Bpv (H, Hn , Hn−1 ) = B ∗ (H ∗ ) − µ(H, Hn , Hn−1 )H ∗  (2.25)  where the value of H ∗ depends on the state of the model. If the trajectory of H just reversed then ˆ the value of H ∗ is equal to the reversal point Hn otherwise the value of H ∗ is equal to H(i+1). The value of B ∗ (H ∗ ) is calculated based on the current values of µ, Bpv and H ∗ i.e. B ∗ (H ∗ ) = µo H ∗ + Bpv 43  (2.26)  Chapter 2. Hysteresis Model Thus, Bpv can be obtained by: Bpv (H, Hn , Hn−1 ) = Bpv + µo − µ(H, Hn , Hn−1 ) H ∗  (2.27)  where Bpv and µo are the previous values of Bpv and µ respectively. Finally, the output of the model is given by: B(t) = µ(H, Hn , Hn−1 )H(t) + Bpv (H, Hn , Hn−1 )  (2.28)  The equations describing the model here are based on the assumption that the first order curves are arranged in a specific order. The order was chosen to facilitate the implementation of the model. Specifically, the order was chosen to minimize the number of required calculations when the trajectory of H reverses. The slopes of the first order curves are arranged in a two dimensional lookup table. The data structure for the slopes is given in Table 2.1. Table 2.1: Data structure for µ +750  +600  +750  µ1 (1)  µ2 (2)  +600  µ2 (1)  µ2 (2)  µ3 (3)  .. .  .. .  .. .  .. .  ..  j +1  .. .  .. .  .. .  µj+1 (i+1)  ..  .  .. .  .. .  .. .  .. .  .. .  ..  .  −750  µ29 (1)  µ29 (2)  ···  ···  ···  µ29 (29)  µ30 (30)  −1000  µ30 (1)  µ30 (2)  ···  ···  ···  µ30 (29)  µ30 (30)  ···  i+1  ···  −750  −1000  .  ..  .  Table 2.1 illustrates several features of the data structure of µ that benefit the implementation of the model. For example, notice that the last entry in every row except for the last row is the start point of the first order curve below. This allows the use of Equation 2.24 with no exceptions. Even more beneficial is the justification of the data. As the current trajectory progresses, i decreases while j remains the same. When the trajectory of H reverses, the required value of im in Equations 2.22 and 2.23 is equal to 30 − j. Furthermore, the value of 30 − i before the trajectory reverses is 44  Chapter 2. Hysteresis Model ˆ − 1 that is used the new value of j. Note that the number 30 is equal to the length of the array H in this work. Finally, as expected, the starting value of i is equal to the new value of j.  As mentioned above, the summations in Equations 2.22 and 2.23 can be performed offline and stored in a look-up table. The data structure for the precalculated differences in B is given in Table 2.2. Table 2.2: Data structure for +1000  +1000 +750  +750  ···  im  Mj  ···  −750  −1000  0 B2 (1)  0  .. .  .. .  .. .  ..  j  .. .  .. .  .. .  .. .  .. .  .. .  .. .  .. .  ..  . ˆ µj H .  −750  B30 (1)  B30 (2)  ···  ···  ···  −1000  B31 (1)  B31 (2)  ···  ···  ···  0 B31 (30)  0  To use Table 2.2 as shown a slight modification needs to be made to Equation 2.23. The summation is performed to i not i − 1 as given in Equation 2.23 i.e. the summation is performed  from the start of the first order curves. While this is not a problem for Equation 2.22 since the summation starts from its start point anyway, this does pose a problem for Equation 2.23. The  correct value of the summation for Equation 2.23 requires the rightmost nonzero value of the data of row j +1 to be subtracted from the column corresponding to im . When the trajectory of H changes direction five pieces of information are stored in memory. The variables that are stored in memory are: 1. Hn 2. j 3. C(Hn , Hn−1 ) 4. r 45  Chapter 2. Hysteresis Model 5. B(Hn ) If at any time the current value of |H| becomes larger than |Hn−1 | then the current trajectory  has closed a minor loop. In this case the history of the minor loop has been wiped from the memory  of the model. This is implemented by decrementing a pointer that points to the top of the stack of reversal data by two increments of Hn . This assumes that the reversal data is stored in blocks such that the pointer always points to the first variable, namely Hn . The new values of r, j, etc. on the top of the stack are now used in Equation 2.24. The old value of Hn−1 is used for H ∗ in Equation 2.27. The value of Hn one increment of Hn below the top of the stack becomes the new value for Hn−1 . Finally, it is important to remember that data structure of µ as shown in Table 2.1 insures ˆ ˆ that the value of i only needs to be modified when the relationship H(i) > ηˆH H(i+1) does not hold or when the trajectory of H changes direction.  2.3  Chapter Summary  This chapter presents the Preisach approach to modeling hysteresis. The Preisach model is defined by the double integral of an infinite set of elementary hysteresis operators that are weighted by an arbitrary weight function. The double integration, however, can be avoided with the use of an explicit formula that relies on the first order reversal curves of the material. Unfortunately, the Classical Preisach model has some features that limit its applicability. In particular, the model is based on the assumption that all of the trajectories between the same set of extremum values in the input are congruent. In actual magnetic materials this is rarely the case. As a result, the identification of the model with first order reversal curves is not consistent. There are many approaches that have been given in the literature that address this issue. A modified Preisach model that uses a correction factor to guarantee the closure of minor loops was chosen for this work. This technique, therefore, allows for the consistent identification of the model from experimental first order reversal data. One of the primary advantages of this approach over others is it still only requires the first order reversal curves of the material. This is in contrast to many other techniques that require second order reversal curves or other details. The chapter closes with the basic details of the implementation of the modified Preisach model. The implementation relates the H and B fields as a slope and intercept that is valid over a set range of values of H. This piecewise linearization has specific advantages that can be used in the implementation of the overall model that is presented in this work. These advantages along with the details that are specific to the implementation of the algorithm in the overall model of this work are given in Chapter 5. Unless otherwise stated the following chapters use this model to represent the effects of hysteresis for any results that are presented.  46  Chapter 3  Existing Circuit-Based Ferromagnetic Models The performance of existing circuit-based ferromagnetic models are shown within this chapter to highlight some of their deficiencies and to justify the need for some improvements. The deficiencies of these models are specifically their inability to perform well over large ranges in frequency and input excitation magnitude. This chapter also gives the basic structures and ideas that are used by the newly developed mechanisms that are presented in the following chapter. The discussion starts with a description of circuit-based modeling in general. Some trends in the performance of the basic circuit are then given along with some typical output responses. This is followed by a method for methodically modifying the values of the circuit resistances. Finally, the methodology and results from two existing mechanisms is presented to show some of the difficulties with the currently available models.  3.1  Circuit Based Modeling: A Preamble  Circuit based models are based on the theory behind four of the most recognized equations of electromagnetism: namely, Maxwell’s equations. This basis will be shown here. Maxwell’s equations are:  ∇·E =  1  (3.1)  ρ  0  ∇·B = 0 ∇×E = −  (3.2) ∂B ∂t  ∇ × B = µ0 J + µ0  (3.3)  0  ∂E ∂t  (3.4)  where ρ in Equation 3.1 is the total charge density not the Preisach density function used in Chapter 2. The SI unit for ρ is C/m3 . The field E is called the electric field whereas J is the 47  Chapter 3. Existing Circuit-Based Ferromagnetic Models current density. The SI units for E and J are V/m and A/m2 respectively. The constants  0  µ0 are the permittivity of free space and permeability of free space respectively. The value of equal to  1/c2 µ0  ≈ 8.854 ×  10−12  F/m where c is the speed of light (≈ 3 ×  108  and 0  is  m/s).  In matter, Maxwell’s equations are usually rewritten in terms of free charges and currents. This affects Equations 3.1 and 3.4 as given by: ∇ · D = ρf  (3.5)  ∇ × H = Jf +  ∂D ∂t  (3.6)  where Jf and ρf are the free current and charge densities respectively. The field D is called the electrical displacement. The SI unit for D is C/m2 . The second term in Equation 3.6 can be neglected because the frequencies of interest in this work are comparatively very low i.e. the displacement current is so small in the operating frequencies that are considered here that it can be ignored. The free current and charge densities represent the external currents and charges that we can directly control. In contrast, bound currents with density Jb involve the spin and orbital motion of electrons in the material that we have no direct control over. The bound currents are, therefore, associated with the magnetization of the material. There is also a third component of the current density called the polarization current (Jp ). It is the result of the linear motion of charge when the electrical polarization changes. Associated with the polarization current is the polarization charge density (ρ b ). This is, in fact, the bound charge density in the material thus the subscript b. The total current density is J = Jf + Jb + Jp whereas the total charge density is ρ = ρf + ρ b . Of particular interest to circuit based models are Equations 3.3 and 3.6. The usefulness of these equations is more apparent when they are written in their integral form:  E · dl = −  d dt  L  B · da  (3.7)  S  H · dl = Ifenc  (3.8)  L  for any surface S bounded by the closed loop L where Ifenc is the enclosed free current. Equation 3.8 is the well known Amp`ere’s law. Circuit based models are lumped parameter models. As such, the models assume that for a specified volume of magnetic material, the magnetic fields are invariant in space. Therefore, for a given volume of material, Equation 3.8 can be rewritten  48  Chapter 3. Existing Circuit-Based Ferromagnetic Models as: Hl = N i =  (3.9)  F  where l is the magnetic path length, N is the number of turns of an externally connected coil carrying a current i that are enclosed by the path l, and F is called the magnetomotive force (mmf). The SI units for F is A. Sometimes the unit for mmf is written as A-t (ampere-turn). The well known magnetic circuits equivalent of Ohm’s law equates F to the flux and reluctance of a path in the material by: F = φR  (3.10)  where φ is the flux through an area A of the material and R is the non-linear reluctance of the path. The SI units for the flux and reluctance are Wb and A/Wb respectively. The direction of the flux is perpendicular to the area A. There is an inherent danger with the magnetic equivalent of Ohm’s law. The danger is it is easy to forget that flux does not exist. Thus, flux does not actually flow in the material. This is where the analogy to electric circuits breaks down because in an electric circuit current does actually flow. However, even with this physical inaccuracy, the magnetic equivalent circuit is still a very useful tool in analyzing magnetic systems. Physically, the flux is a measure of the number of magnetic field lines in a given area. If the magnetic field density B is assumed to be invariant in space over an area A then the flux is given by: φ = BA  (3.11)  where the field B is perpendicular to A. Equation 3.11 can be substituted into Equation 3.7 to obtain: E · dl = −  dΦ dt  (3.12)  L  This is just Faraday’s law in its integral form. Note that φ has been replaced with Φ to indicate that the flux is formally a vector. The right-hand side of Equation 3.12 is equal to the electromotive force (emf) or the voltage as it is more commonly known in circuit theory. Using Ohm’s law to replace the emf yields: E · dl = E = − L  49  dφ dt  Chapter 3. Existing Circuit-Based Ferromagnetic Models  iR = −  dφ dt  (3.13)  where R is the resistance of the closed path bounding the flux φ. The negative sign in front of the derivative of the flux indicates that the generated voltage is setup to oppose the change of flux. Thus, the current that flows in the material along a closed path tends to shield the material enclosed within the path from the externally applied mmf in order to limit the rate of change of the flux. The closer a piece of the material is to the center of the material, the more that piece is shielded from the external source. With the relationships given in Equations 3.10 - 3.13 the following circuit can be proposed.  3.1.1  Basic Circuit  The circuit shown in Figure 3.1 represents the ubiquitous basic circuit that models, in part, the effect of the currents given in Equation 3.13. As is mentioned in Chapter 1, these currents are called eddy currents. However, the circuit is most often shown in its electrical equivalent form. Before the electric equivalent circuit is shown, a few comments on the magnetic equivalent circuit will be given.  R1 R2  1 dφ1 R1 dt  φ1  1 dφ2 R2 dt  φ2 φn-1  Rn  φn  1 dφn Rn dt  F Figure 3.1: Basic circuit that exhibits eddy current effects Notice that the basic circuit tries to mimic the shielding effect of the eddy currents given in Equation 3.13. The mmf drop across the inductors reduces the effect of the externally applied 50  Chapter 3. Existing Circuit-Based Ferromagnetic Models field on the elements below the inductor – “below” in this case refers to elements that are closer to the center of the material. Each pair of reluctance and inductance, e.g. R1 and the inductor involving R1 , are on the same layer in the material. This layer represents a tube of flux in which the magnetic fields H and B are spatially invariant i.e. the fields are uniform in space within a given tube. An example of a magnetic material with a circular cross-section that has been split into three flux tubes is shown in Figure 3.2.  1 dφ3 R3 dt  1 dφ2 R2 dt 1 dφ1 R1 dt  φ3 φ 2  H  φ2 φ 1  φ1  Figure 3.2: Three tube model with its magnetic equivalent circuit parameters defined The electrical equivalent circuit of the circuit shown in Figure 3.1 is found more often in the literature. This is likely because it is usually part of a larger electrical circuit describing devices such as power transformers. Using the duality between electrical and magnetic circuits [34], it can be shown that the magnetic circuit given in Figure 3.1 is equivalent to the electrical circuit given in Figure 3.3 below. Note that L1 , L2 , . . . , Ln in Figure 3.3 are equal to N 2 /Rn . The resistances are the same as those in Figure 3.1 since the turns ratio for the resistances is effectively one i.e. the currents generated in the material are modeled as coils with one turn. Magnetic equivalent circuits are used throughout this work because they give a more intuitive connection between the actual physical material and the circuits that try to model the response of the material to certain input conditions. The duality between the equivalent circuits allows any of the circuit-based models shown in this work to be implemented with either equivalent. The choice of which equivalent to use depends on the particular application e.g. as mentioned, power transformers are usually modeled using electrical circuits whereas a lumped parameter model for a sensorless switched reluctance application typically uses a magnetic equivalent circuit. The basic circuit actually represents a discretized version of the classical eddy current model. It is discretized in the sense that the values of the fields within the material do not vary continuously but have certain discrete values that change in steps between tubes. At a glance you would think that as more layers are added to the model, the model’s response should better approximate the 51  Chapter 3. Existing Circuit-Based Ferromagnetic Models  in Ln  V  i2 L2 i1 R1  L1  R2  Rn  Figure 3.3: Electrical equivalent circuit of the basic eddy current model  behaviour of the actual material. While this is in general true, the response of the basic circuit becomes worse as tubes are added if the parameters of the model are not adjusted properly i.e. the response of this type of model does improve as the number of tubes increases but the basic circuit with no modifications eventually performs worse as the number of tubes increases. The reasons for this will be given later in this chapter. The basic circuit as either a magnetic or electrical equivalent circuit mimics the behaviour of a magnetic material that exhibits eddy currents that flow in the classical sense. It was discovered in the 1940’s that the classical eddy current model could not account for all of the losses in ferromagnetic materials. These excess losses as they are called are due to the fact that the actual material is composed of many magnetic domains. As the domain walls move, local fluctuations in B are created by the shifting of the walls. As a result, additional localized eddy currents are induced to inhibit the movement of the domain walls. A domain model was proposed to account for the discrepancy in the behaviour of the actual material and the classical eddy current models. A graphical representation of the difference between the classical and domain model is shown in 52  Chapter 3. Existing Circuit-Based Ferromagnetic Models  H M  M  H  M (a) classical model  (b) domain model  Figure 3.4: Classical and domain eddy current models Figure 3.4. Note that the domain model as shown in Figure 3.4(b) is rotated by 90o compared to the classical model that is shown in Figure 3.4(a). It also only represents a small portion of the material i.e. the width of the material is significantly smaller than its height as is shown in the depiction of the classical model. The illustration of the domain model in Figure 3.4(b) is an oversimplification of the actual domain structure since, in general, the orientation of the domains is in three dimensions. However, if the dominant external H field is along one axis of the material then the domains will tend to become 1–dimensional since the torque on the magnetic dipoles due to B align the dipoles parallel to the field. Given that the basic circuit model exhibits the general behaviour of the classical eddy current model as shown in Figure 3.4(a), it is not surprising that the basic circuit model has limitations to its accuracy. The classical model breaks down when the number of domains in the material is large. As will be seen later in this chapter, this error is significant when the material is not allowed to saturate.  53  Chapter 3. Existing Circuit-Based Ferromagnetic Models  3.1.2  Tube Structure  Most circuit based models make the assumption that, for laminations with rectangular crosssections, the height of the lamination h is significantly larger than its width w. In these cases, the lamination is typically split into plates with widths that have even symmetry about the major axis. Plates that are equal distance from the center of the material form the tube for that layer. While this assumption is valid for the majority of cases, it fails for devices that have square or circular cross-sections such as solenoids. The tube structure that is used in this work is shown in Figure 3.5. Notice that no assumption is made about the dimensions in this definition. Furthermore, this structure models the path of classical eddy currents more closely since these currents tend to curve around the ends of the lamination instead of abruptly change direction. The half-widths w1 and w2 are chosen so that the area in each tube is identical. Note that the area of the outermost tube includes the corners of the lamination outside the curved dashed lines. However, the path of the eddy currents in this tube is restricted to the path between the outer wall of the next lower tube and the curved dashed lines. Therefore, the calculated reluctance of the outermost tube includes the corners whereas the calculated resistance does not. The resistance of the kth tube not including the innermost tube is: Rk =  2(h − w) 2π + σl(wk − wk−1 ) σl  1  ln  wk wk−1  ,  k>1  (3.14)  where l is the length of the magnetic path in the lamination and σ is the conductivity of the material. In Figure 3.5 this is perpendicular to the plane of the page. For the innermost tube, the resistance is given by: R1 =  2(h − w) 2π + σlw1 σl  (3.15)  The reluctance of the tubes depends on the current permeability of the tubes. As shown in Chapter 2, the permeability is dependent on the previous history of the material. The reluctance of the tubes is: Rk (µk ) =  l µk A  (3.16)  where the area A of every tube is equal to wh/n and n is the total number of tubes. The restriction on the areas of the tubes does not reduce the applicability of this tube structure. Rather it allows the implementation of the model to be simplified. In cases where the equal area criterion is too restrictive then the areas can be allowed to vary without changing the main features of the structure.  54  Chapter 3. Existing Circuit-Based Ferromagnetic Models  w  w1  w2  h  Figure 3.5: Tube Structure  3.2  Performance Trends in the Existing Circuits  The trends in the performance of the basic circuit given above and other major existing circuit based models are given in this section. These trends are important because they give the range of validity of the different models. The performance trends of the basic circuit are the most useful since all of the circuit based models presented here including the proposed circuit of this work are derivatives of the base circuit. The sample material was tested using the same apparatus that was used to generate the first order reversal curves for the hysteresis model. The test setup is given in Appendix A. The test material was excited using sinusoidal current waveforms. As a result, H is sinusoidal not B. Most of the existing circuits are tested using sinusoidal B waveforms. Using sinusoidally impressed H waveforms over sinusoidal B waveforms was chosen more for experimental convenience than any other factor. As previously mentioned, the aim of this work is to develop a model that can approximate the behaviour of a given material of a given geometry over a large range of input frequencies and 55  Chapter 3. Existing Circuit-Based Ferromagnetic Models excitation magnitudes. Since the response of the material is extremely nonlinear, it is important that the enough data is collected in order to sufficiently characterize its behaviour. The test material and its geometry as given in Chapter 1 was used to produce all of the experimental results in this chapter. The modified hysteresis model as described in Chapter 2 is used for all of the circuit models described here except where noted otherwise.  3.2.1  Basic Circuit Performance with Fixed Rk  The response of the basic circuit with three and five tubes is used as a baseline of comparison between the various circuits in this chapter. Initially, the values of Rk are the calculated DC resistances of the tubes as given by Equations 3.14 and 3.15. The effect of changing the values of Rk on the circuit performance is then explored as this type of modification is the simplest to perform. This initial change is not dynamic i.e. the values of Rk are changed but then remain fixed during the run-time of the model. Consider the response of the base circuit with the calculated DC values of Rk for various frequencies that is shown in Figures 3.6–3.8. 1.5  experimental data three tube model five tube model  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 H (A/m)  200  400  600  800  1000  Figure 3.6: 60 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels  56  Chapter 3. Existing Circuit-Based Ferromagnetic Models  1.5  experimental data three tube model five tube model  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  Figure 3.7: 250 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels  Notice that the response of the basic model with five tubes is actually worse than the response with three tubes. As will be formalized next, increasing the number of tubes requires the values ¯ represents the average value of of Rk to be modified. The value of the magnetic field density B B in the material. It is obtained by integrating the voltage on the sense winding and dividing the resulting flux by the cross-sectional area of the test sample. As can be seen in Figures 3.6 - 3.8 the ¯ do not correspond effect of the eddy currents is significant. In fact, notice that the peak values of B to the peak values of H for many of the cases. This behaviour is the result of the effective H inside the material becoming phase shifted compared to the excitation H. Thus, the peak of H inside the material becomes delayed compared to the input H. At the same time, the peak magnitude of H in the material becomes smaller as the field passes through the material. The combined effects of the delay and damping cause H to become increasingly non-sinusoidal as the field penetrates deeper into the material. Although the shape of the response of the model is generally accurate, the damping provided by the basic circuit is insufficient. For example, the width of the resulting 60 Hz curves for Hpeak = 500 ¯ are too large. In both cases, and 1000 is too small, whereas for Hpeak = 125 the peak values of B 57  Chapter 3. Existing Circuit-Based Ferromagnetic Models  1.5  experimental data three tube model five tube model  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  Figure 3.8: 500 Hz curves comparing the basic circuit with 3 and 5 tubes for three excitation levels  this is the result of insufficient damping. The logical first step to rectify this problem is to decrease the values of Rk in the circuit. The reduction in Rk that is required for a given k is not necessarily the same as the reduction for different values of k. The modification to the values of Rk does improve the performance of the circuit to a point. As the values of Rk are decreased the 60 Hz ¯ decrease for Hpeak = 125 curves for Hpeak = 500 and 1000 become wider and the peak values of B but eventually the damping for the higher frequency curves becomes too much while the damping for the 60 Hz curves is still insufficient. Furthermore, the reduction in Rk that is required for Hpeak = 125 is 2-3 times more than that of Hpeak = 500 and 1000. Clearly, the values of Rk need to be modified as the states of the model change.  3.2.2  Static Modification to Rk  Looking at Figures 3.6 - 3.8 shows the performance of the basic circuit for five tubes being distinctly worse than the performance with three tubes. This seems to be counter-intuitive. In fact, the response of the basic circuit with the initially calculated values of Rk is misleading. Actually, as 58  Chapter 3. Existing Circuit-Based Ferromagnetic Models the number of tubes increases, the values of Rk need to be reduced. This is not surprising since the time constants, τ , of the model decrease significantly as n increases. The time constants are given by: τ=  L 1 = R RR  (3.17)  As n increases the cross-sections of the eddy current paths decrease causing R to increase. Additionally, the reluctances of the tubes also increase. The increase of both R and R really reduces the time constants of the model. This description lacks detail because R varies significantly in time; thus, the use of linear circuit theory is limited in characterizing the behavior of the model. Unfortunately, there is a limit to the effectiveness of reducing the values of Rk as was described above. The model can be tuned by modifying the values of Rk for narrow ranges of frequency to yield very accurate results for cases with saturation. However, large deviations from the tuned range in frequency significantly degrade the performance of the model. Using this scheme alone is not enough for a model that is expected to operate over a large frequency. It is still, however, a vital part of the overall model proposed here. Note that the following analysis and commentary has not explicitly appeared in the literature before this work was undertaken. The first step in the procedure for systematically changing the values of Rk is to rewrite Equations 3.14 - 3.15 in terms of the number of tubes:  2π  h−w Rk (n) =  σl (h − w)2 + πkwh n − (h − w)2 + π(k − 1)wh n    −(h − w) + (h − w)2 + πkw n   +1 ln −(h − w) + (h − w)2 + π(k − 1)wh n  The equation for Rk (n) is valid for 2  resistance is:  k  (3.18)  n − 1. For the innermost and outermost tubes the     2π  h−w R1 (n) = 1+ σl  −(h − w) + (h − w)2 + πwh n    2π  h−w Rn (n) = σl  πw 2 + (h − w) − (h − w)2 + π(n − 1)wh n    πw 2   +1 ln −(h − w) + (h − w)2 + π(n − 1)wh n  59  (3.19)  (3.20)  Chapter 3. Existing Circuit-Based Ferromagnetic Models where the equation for Rn (n) is valid for n > 1. The variation of the resistance with n is a strong function of the geometry of the material to be modeled. However, the variation of the reluctance with n is linear due to the restriction on the area of the tubes i.e. if the number of tubes is increased by one, then the reluctance increases by l/wh. Furthermore, keeping the area of the tubes the same has the advantage that the change in the reluctance due to a change in µk affects every tube equally. In general, this reduces the effort required to modify the values of Rk . Looking at Equation 3.20 reveals a potential limitation to the number of tubes. If n is greater than  4h w(4−π)  then the resistance becomes negative. In particular, as h → w the maximum number  of tubes becomes increasingly limited. In these cases the areas of the tubes can no longer remain equal. For the geometry utilized in this work, the number of tubes is limited to 35. This limitation is not an issue for this case. The DC resistance of the tubes for n = 3, 4, 5, 8, and 10 is shown in Figure 3.9 for reference below. There are some features of Figure 3.9 that are important to highlight. Firstly, observe that the resistance of the outermost tube increases dramatically as n increases. This is not surprising since the outer edge of the outermost tube is fixed. As n increases the inner edge of the outermost tube approaches the outer edge of the tube until the limit described above is reached. After this point, the inner edge is actually outside the outer edge. Secondly, and more importantly, notice that the resistance increases as k increases. This is primarily the result of the width of the tubes decreasing as k → n. As is repeatedly pointed out in the literature, the effective H field in the material falls off rapidly in the presence of significant eddy currents. To capture the rapid change in the effective H and, therefore in B, the tube widths need to become narrower as k → n. This is the  reported motivation for decreasing the widths of the tubes as k increases in the tube structure that assumes h  w. Recall in that tube structure the tubes are plates with even symmetry about the  major axis. In the tube structure for this work, keeping the area of the tubes the same automatically ensures that this is the case. However, as h becomes large compared to w then the tube structure presented in this work approaches the tube structure that assumes h  w. Inevitably, this requires  the areas to be modified in the same way as described above. A similar modification is also required in cases in which keeping the areas of the tubes the same overly restricts the maximum number of tubes. The procedure for tuning the values of Rk assumes that the widths of the tubes are chosen appropriately. Thus, the initial selection of the tube structure and tube widths can be considered as the first step in this procedure. Since the above mentioned variation in the widths of the tubes is the most desirable, this procedure was not tested for cases in which the tubes are arranged in a different way. The values of Rk are initially modified by tuning the response of the circuit at one frequency for a single peak value of H. In this case, the 60 Hz curve for Hpeak = 500 was chosen. Consider the 60  Chapter 3. Existing Circuit-Based Ferromagnetic Models 0.14  0.12  Resistance (ohms)  0.1  0.08  0.06  0.04  0.02 1  2  3  4  5 6 Tube number (k)  7  8  9  10  Figure 3.9: Variation of tube DC resistances with n  trajectory from H = −500 to H = +500. The initial part of the trajectory is matched by weighting the resistances of the outermost tubes. The middle part of the trajectory is matched by weighting  the resistances of the middle tubes. Finally, the last part of the trajectory is matched by weighting the resistances of the innermost tubes. Formally the weights ζ1 , ζ2 , . . . , ζn can be determined by minimizing the vertical distance between the experimental curve and the curve generated by the model in the least squares sense i.e. minimize the objective function R2 given by: R2 = min i  ¯i − B ¯i∗ (Hi , ζ1 , ζ2 , . . . , ζn ) B  2  (3.21)  ¯i are the sample points in the trajectory of the response of the actual material and where B  ¯ ∗ are points in the trajectory generated by the model. The minimization has to be performed B i iteratively since the model is highly nonlinear. This procedure can be repeated for higher frequencies. However, the response of the model is dominated by the values of the resistance in the outermost tubes. In general, only the resistances  61  Chapter 3. Existing Circuit-Based Ferromagnetic Models 0.14 original modified 0.12  Resistance (ohms)  0.1  0.08  0.06  0.04  0.02 1  2  3  4  5 6 Tube number (k)  7  8  9  10  Figure 3.10: Modification to Rk for n = 4 and 10  of the outermost tubes need to be varied as the frequency varies. Furthermore, the outermost resistances need to be varied as the peak magnitude of the input excitation varies. Typical results of this procedure for n = 4 and 10 are shown in Figure 3.10. This method essentially shapes the response of the model for the H field inside the material. As expected, as the number of tubes increases, the accuracy of the circuit improves since the H field inside the material is better approximated. This is particularly true for higher frequencies i.e. the accuracy of the n = 4 circuit is the about the same as the n = 10 circuit for 60 Hz inputs, but at 1 kHz the accuracy of the n = 4 circuit is starting to deteriorate whereas the accuracy of n = 10 circuit remains unchanged. The main advantage of this approach is it is systematic. It also emphasizes the need for varying the resistances of the circuit as the input changes. If the use of the basic circuit was to model the behaviour of a device for a narrow range of frequencies and variation in the magnitude of H then this modification by itself would be sufficient. This approach provides a static change to the values of Rk . Two of the more promising currently available modifications that provide dynamic changes to the values of the circuit resistances of the 62  Chapter 3. Existing Circuit-Based Ferromagnetic Models basic circuit are presented next.  3.2.3  Variation of Rk Based on the Variation of J  Zhu et al. noted that even though B is assumed to be uniform in every tube, the electric field E is not [43]. Equation 3.11 is a bit misleading because it gives the total flux perpendicular to a given surface S. In the case of the tubes of the basic circuit, the surface is the area of each tube. Actually, in a tube of flux, the total enclosed flux varies as: φ(w) = l  w  B(w) dw  (3.22)  w0  = lB(w − w0 )  if B(w) = B  As w − w0 approaches the width of the tube, φ(w) approaches φ in Equation 3.11. Since the  derivative of φ in Equation 3.12 is defined for the flux enclosed within the bounding path L it follows that E and, therefore, E varies within the tube. As a result, the current density J varies along the width of the tube. The basic circuit uses the total enclosed flux to calculate a value of E . It is assumed that this E is constant across the width of the tube. Thus, the resistances calculated in Equations 3.14 and 3.15 can be used directly. A correction factor was proposed by Zhu et al. to account for the variation of J across the width of the tube [43]. The derivation of the correction factor will be partially repeated below. First, note that: J = σE  (3.23)  ˆ where k ˆ is a unit vector along the z-axis. The direction of J is normal Assume that B = −B k ˆ and parallel to the sides of the tubes. Call this unit vector p. to k ˆ Therefore, the current density J can be written as J p. ˆ Note that in the end pieces of the tubes, pˆ will follow a circular path. Hence, from Equation 3.3: dJ dBz =σ dw dt  (3.24) k  where the direction of w is perpendicular to pˆ and goes from the inside to the outside wall of the tube. Call this unit vector n ˆ . Bz is the value of B in the kth tube as denoted by the subscript k. The preceding definitions of the unit vectors are shown in Figure 3.11. Integrating 3.24 along the width of the tube yields: Jk = σ  dBz dt  k  (wk − wk−1 ) + Jk−1  where Jk and Jk−1 are the current densities at w = wk and w = wk−1 respectively. 63  (3.25)  Chapter 3. Existing Circuit-Based Ferromagnetic Models  nˆ  ˆp  ˆk  ˆp  ˆk  nˆ  Figure 3.11: Definition of unit vectors for Equations 3.23 - 3.25  The variation of J along the width of the tube as given in Equation 3.25 is identical to what is reported in [43] except that the direction of J is simply along the y-axis in that case because the tubes are defined as plates. The power per unit volume for classical eddy current losses is given by: Peddy =  1 2 J σ  (3.26)  Equation 3.26 is integrated over the straight sections of the tube with the use of Equations 3.24 and 3.25 to obtain the relationship: Peddy = where: rJk =  2(h − w)l(wk − wk−1 ) σ 1 Jk−1 1+ 1+ 3 Jk  Jk2 rJk  Jk−1 Jk  (3.27)  (3.28)  A similar derivation can be made with the curved sections of the tube except that in this case the path length is not constant but instead depends on the radius of the path. For the curved 64  Chapter 3. Existing Circuit-Based Ferromagnetic Models sections Peddy is: Peddy =  πl(wk − wk−1 )2 2 Jk RJkθ 2σ  where: 1−  RJkθ =  1−  (3.29)  4 Jk−1 Jk4  (3.30)  Jk−1 2 Jk  Noting that the voltage induced along the straight sections of the tubes at w = wk is given by 2(h−w) Jk σ  and R = Ek2 Peddy , the effective resistance of the straight sections is: Rk =  where  2(h−w) σl(wk −wk−1 )  2(h − w) σl(wk − wk−1 )rJk  (3.31)  is just the DC resistance of the straight sections of the kth tube.  Similarly, the effective resistance of the curved sections of the tube is given by: Rk =  = =  8π σl 1 − 2π σl  wk−1 2 RJkθ wk  1  ln    wk wk−1     RDCθk Rθk RJkθ  where: Rθk =  1 4  1−  wk−1 wk  2  ln  1    k 4 ln wwk−1   2 w − wk−1 R Jk θ k  wk wk−1  ,  k>1  (3.32)  (3.33)  Rθk is just a constant factor similar to the 1/3 factor in Equation 3.28 except that it different for every tube. RDCθk is the DC resistance of the curved section of the kth tube. For k = 1, Rθk is equal to 1/4. Notice that if Jk is larger than Jk−1 then the effective resistance increases. This is also true for the curved sections of the tube but the rate of variation of the effective resistance is different. Since for this particular case h is still over 10 times larger than the width of the tubes, it was decided to ignore the end effects in the study of the effectiveness of this modification. In the curves presented here the entire resistance was modified based on the following: rJk = γ 1 + 1 + where γ is a constant gain.  65  Jk−1 Jk  Jk−1 Jk  (3.34)  Chapter 3. Existing Circuit-Based Ferromagnetic Models It was noticed that if rJk was implemented strictly as given in Equation 3.28 then the damping is even worse than the basic circuit case. The modified Rk for the generation of the curves below is now given by: Rk =  Rk rJk  (3.35)  Note that J0 = 0 A/m2 since the enclosed flux is zero. Also notice that there are numerical problems with this method if Jk is close to or equal to zero since rJk → ∞ as Jk → 0.  The behaviour that results from using this dynamic modification to the basic circuit model  for a three tube model at 60 Hz and 500 Hz is shown in Figures 3.12 and 3.13 along with the experimental data. 1.5  experimental data model  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 H (A/m)  200  400  600  800  1000  Figure 3.12: 60 Hz curves for γ = 2/3 at three excitation levels  Comparing Figure 3.12 to Figure 3.6 shows the effectiveness of using the modification based on the variation of J and a constant gain. Notice the distortion in the response of the model. This distortion becomes even more pronounced for the response of the model to a 500 Hz excitation as shown in Figure 3.13. 66  Chapter 3. Existing Circuit-Based Ferromagnetic Models  1.5  experimental data model  1  B (T)  0.5  0  -0.5  -1  -1.5 -1000  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  Figure 3.13: 500 Hz curves for γ = 2/3 at three excitation levels  The sharp corners in the response of the model as shown in Figure 3.13 is mostly due to the problem when Jk approaches zero. They can be reduced by setting a maximum for the change in Rk from its initial value. This effectively turns off the algorithm when the value of the current density Jk is near zero. As the maximum change in Rk is increasingly clamped, the region near Jk = 0 where the algorithm is turned off becomes larger. The inward bulging of the response of the model for both sets of frequencies is due to the sharp decrease of the value of Rk as the excitation changes sign and the lagged field inside the material creating a current density that is larger inside the material than on the outer surface of the lamination The response of the model with the inclusion of the correct modifications to Rk based on the curved sections of the tubes does not make a noticeable difference. In this case, the same pronounced effects will still be present. Although this type of dynamic modification to the tube resistances has strong theoretical merit, it produces results that have undesirable distortions. These distortions prompted the continuation of the search for better modifications to the basic circuit.  67  Chapter 3. Existing Circuit-Based Ferromagnetic Models  3.2.4  Variation of Rk Based on a Correction Factor for the Excess Currents  This technique dynamically corrects the values of the circuit resistances based on the empirical equations for the classical and excess eddy current losses in thinly laminated materials. Through empirical studies, for sinusoidal excitation the power loss due to classical eddy currents has been found to be: Peddy = Cc  ¯ dB dt  2  (3.36)  where Cc is a empirically determined constant of the material. Similarly, the power loss associated with the excess eddy currents is found to be: Pexcess = Ce  ¯ dB dt  3/2  (3.37)  where Ce is a empirically determined constant of the material. It is important to realize that these relationships assume that the field is mostly uniform inside the material. Since the field is assumed to be uniform within every tube these equations are usually applied on a per tube basis. The total loss due to the eddy currents is the sum of these two components i.e. PT = Peddy + Pexcess . As shown in [43] the total eddy current loss can be rearranged to yield: 2  dBz dt  PT = Cc  rexk  (3.38)  k  where: Ce  rexk = 1 + Cc  dBz dt k  (3.39)  The resulting modification of the DC resistance can be shown to be: Rk = Notice that rexk → ∞ as  division by zero.  dBz dt k  Rk rexk  (3.40)  → 0. As with Equation 3.28 care must be taken to avoid a  This mechanism was not tried for the following reasons: 1. This modification is only approximate at best because, as mentioned above, the field becomes increasingly non-sinusoidal as it penetrates the material. Furthermore, the excitation itself is not necessarily sinusoidal either such as in the case for high speed operation of SRMs.  68  Chapter 3. Existing Circuit-Based Ferromagnetic Models 2. Notice that Rk → 0 as what is desired  dBz dt k  → 0. As will be seen later this trend is actually opposite to  As is discussed in Section 1.5.3, the use of Equations 3.36 and 3.37 is quite widespread in the modeling of ferromagnetic materials. In particular, many strictly mathematical implementations of magnetic models use some form of Equations 3.36 and 3.37.  3.3  Chapter Summary  This chapter gives a theoretical basis for the basic circuit-based model for ferromagnetic materials. It was shown that the basic circuit attempts to emulate the behaviour of electromagnetic fields inside matter. The emulation, however, is not perfect because ferromagnetic materials have magnetic domains. The movement of these domains generates additional currents that are not predicted by the basic circuit. To understand how the basic circuit needs to be modified the trends in the performance of the basic circuit are investigated. From the behaviour of the basic circuit for different frequencies and excitation levels it is found that the values of the circuit resistances need to be dynamically changed. It is also found that the initial values of the circuit resistances need to be statically modified from their initially calculated DC values. A technique for systematically doing this is also provided in this chapter. The chapter closes with two existing techniques that dynamically vary the values of the circuit resistances. It is found that, although there is some theoretical merit in these techniques, the modified models produce distortions in their output responses that are undesirable. The main results of this chapter were used in the development of the two mechanisms that are the main contributions of this work. This development is given in the next chapter.  69  Chapter 4  New Mechanisms for Circuit-Based Ferromagnetic Models This chapter discusses the main focus of this thesis. Namely, the modification of existing circuitbased models for better performance over a larger range of operating conditions. The preexisting models are modified by two newly developed mechanisms. The details of these mechanisms along with a procedure for identifying their parameters is contained within this chapter. This chapter also provides an analysis of the accuracy of the newly proposed model in comparison to the base model shown in Figure 3.1 that is tuned at specific operating conditions. This discussion also includes other methods that ultimately failed. The reasons for their failures are highlighted to emphasize the difficulty in achieving the seemingly easy task of adding frequency dependence to the parameters of the model.  4.1  Mechanisms that Failed  Several other approaches were explored before the final mechanism was developed. Given the trends presented in Chapter 3, the first logical step would be to add a direct rate dependance to the values of Rk . One potential problem with using derivatives is they are generally very noisy. The noise from the derivatives can cause unwanted oscillations in the output of the model if used improperly. In a magnetic circuit there are two potential rates that can be used: rate of change of flux and rate of change of mmf. Since the presence of current produces the B field it seems reasonable that the rate of change of mmf should be used. However, the rate of change of the flux is more convenient to use since the basic circuit already incorporates the derivatives of the fluxes in the circuit whereas the derivatives of the mmfs in the circuit need to be separately obtained. In the end, two approaches were tried. The first approach uses just the estimated derivatives of the mmfs in the circuit. The second approach uses a combination of both derivatives.  4.1.1  Direct Use of the Derivatives of the Circuit Mmfs  The rate of change of the mmfs of the basic circuit need to be estimated. This estimation will be covered in detail in Chapter 5. Assume for now that the derivatives of any of the mmfs in the basic circuit are available to be used.  70  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models The first step is to determine which mmfs to use. It was decided that, for the kth layer, the derivative of the k + 1 layer mmf is used to modify Rk as given by: Rk = f −1 (F˙k+1 )ζk Rk  (4.1)  where f is a function to be determined that depends on the derivative of the mmf of the k + 1 layer, F˙k+1 . The derivative of the input mmf is used for the nth layer. For a given layer k, the value of ζk is the static adjustment to the value of the calculated DC resistance Rk that is described in Section 3.2.2. The function f is obtained by fitting the response of the modified model to the experimental data. The general shape of the curve can be anticipated by the observations that were made with the unmodified basic circuit i.e. f should be large for low values of F˙ and small for high values of F˙ . Note that the inverse of f is used in Equation 4.1 since the inductances in the basic circuit are  proportional to 1 Rk . The same function is used for every layer. The use of a different function for every layer is unlikely to improve the accuracy by very much. Furthermore, the time that would be required to obtain separate functions is prohibitively high for models with many layers. Unfortunately, the performance of this mechanism is unsatisfactory. The results that were obtained using this approach were less than ideal for the following reasons: 1. The shape of f that is required for a given input frequency is different than the shape for another input frequency in some narrow bands of F˙ . Thus, it is impossible to determine a single function that can cover a large range of input frequencies. 2. The use of F˙ directly allows the inherently noisy derivatives to directly affect the output of the model. This mechanism was abandoned after the preliminary results showed it to be inadequate. Even if different functions for different layers lessens or removes the issue of point 1, the noise issue is insurmountable. No reasonable amount of filtering of the derivatives is able to reduce the effects of the noise to an acceptable level. Thus, a method that uses the derivatives of the mmfs to modify the values of Rk in a more indirect way is required.  4.1.2  The Use of the Flux and Mmf Derivatives Together  The second approach that was tried was the use of both the derivatives of the circuit fluxes and mmfs. Consider the following modification to the circuit resistances: Rk =  ζk Rk 1 + g(F˙k+1 )φ˙ k  71  (4.2)  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models where g is a function that is similar in shape to the function f above and φ˙ k is the derivative of the φk flux as defined in Figure 3.1. The derivative of the fluxes can not be used directly because as the frequency increases so would the value of the circuit inductance. This trend is opposite to what is required. Thus, the derivatives of the mmfs are used to roll off the gain introduced by φ˙ k . As the frequency decreases the gain needs to be substantially increased to account for the decrease in the derivative of the flux. This is also provided for by g. The required shape for g is determined by matching the experimental curves to the output of the model for various frequencies. For similar reasons as the above described method, only one definition of g is used for every tube. The result of this procedure for a ten tube model is shown below. Notice in Figure 4.1 that the high frequency gain of g is actually negative. This is required to further decrease the circuit inductances for high frequency, high peak magnitude, input excitations. Care must be taken that the resulting resistance does not “blow-up” for excessively high derivatives of the mmfs. Therefore, a minimum value of the denominator of Equation 4.2 is set to avoid this situation. Note that Equation 4.2 could have been written as follows: Rk = ζk Rk g0 + g (F˙k+1 )φ˙ k  (4.3)  where g0 is a predetermined constant and g = g.  The resulting surface that is mapped by Rk (F˙k+1 , φ˙ k ) is the same for either definition so only  the results for Equation 4.2 are necessary to validate this type of mechanism. Although the derivatives of the mmfs are used in this approach, the impact of the noise on the circuit’s output is substantially smaller than the previously described mechanism. Furthermore, the problems that occur while trying to define a single function for f are significantly reduced in the definition for g. Looking at Figure 4.1, however, reveals a potential drawback to this scheme. The extreme change in the slope of g requires a relatively small value of the time step in the digital implementation of this modified circuit compared to the original circuit. For online applications such as the sensorless control of SRMs this could prove to be a severe limitation. The mechanism described by Equation 4.1 was implemented in a magnetic equivalent circuit with three, four and ten tubes. This allowed the behaviour of the modification to be examined as the number of tubes is changed. The response of the ten tube model for 60 Hz and 500 Hz input excitations is shown in Figure 4.2. Notice that even for a model with ten tubes the performance of this mechanism for the 60 Hz case is undesirable. The damping in the 60 Hz case is still insufficient as highlighted by the error in the circuit’s response near middle and ends of the curves. In particular, the error near the middle of the curves generally becomes worse as the number of tubes is deceased. The performance of this mechanism for the 500 Hz case is acceptable. However, the model’s response at 500 Hz is bought with a cost; namely, the degradation of the performance of the model at 60 Hz. The independence 72  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models 300  250  200  g  150  100  50  0 0  1000  2000  3000  4000 5000 | dF /dt | (A/s)  6000  7000  8000  Figure 4.1: Gain function g(F˙ )  of g on the input excitation frequency is still not completely achieved. Finally, this mechanism was eventually abandoned because, for the ten tube case, a 10µs timestep was still not able to completely eliminate the oscillations in the response of the circuit due to the extreme change in the slope of g. The above two mechanisms are an improvement over the original basic circuit but they still have too many problems. Although it is not detailed here, a mechanism that used just φ˙ was also tried i.e. a correction factor 1 + g ∗ (φ˙ k ) was employed to modify the values of Rk . The determination of a suitable shape for the function g ∗ is similar to the other mechanisms in this section. The performance of this scheme is generally even worse than the two mechanisms described here so it was quickly discarded. The remainder of this Chapter details the mechanisms that are the final result of this work.  73  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  1.5  experimental data model 60 Hz  1  B (T)  0.5  0 500 Hz -0.5  -1  -1.5 -500  -400  -300  -200  -100  0 100 H (A/m)  200  300  400  500  Figure 4.2: Performance of a 10 tube model with the 1 + g(F˙k+1 )φ˙ k correction factors  4.2  Proposed New Circuit Model  The development of the model that is the final result of this work was carried out in three phases. The first phase involved the testing of an idea for a model that only used the initial magnetization curve to characterize the relationship between H and B and eddy currents that flow in the classical sense. At that time the results from the actual material were not available. When the results from the actual material were made available the initial attempt was shown to have problems. The second phase in the development of the final model included the testing of the ideas that are presented in the previous section and the modification of the initial attempt in the first phase. The end result of the second phase is a mechanism that can match the behaviour of the actual material when it is allowed to partially or fully saturate over a wide range of frequencies with good accuracy. However, the model still can not match the behaviour of the material very well when it does not saturate to any extent. The result of the third phase handles this discrepancy by adding a second 74  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models mechanism that corrects for the observed error. It is thought that the error can be attributed to the effect of the additional eddy currents that flow due to the shifting of the domain walls. The combination of the two mechanisms gives a model that can match the behaviour of the actual material for a large range in both input frequency and magnitude to a high level of accuracy.  4.2.1  A Partially Successful Attempt  The resulting mechanism from the first attempt to solve the modeling problem of this work matched the behaviour of models that just exhibit classical eddy currents quite well but was not as successful at modeling the real material. Initially, the response of a similar circuit to the basic circuit was tested without the effect of hysteresis. The initial magnetization curve was used to characterize the static relationship between H and B. An analytical non-linear representation of a core with a circular cross-section was solved in Matlab to compare the response of the circuit with the analytical model. The response of the model was also compared to the results that were produced with 3D finite element software for a rectangular cross-section. In the case of the analytical solution, the following diffusion equation in cylindrical coordinates (r, θ, z) was solved: µσ  ∂Hz 1 ∂ ∂Hz = r ∂t r ∂r ∂r  (4.4)  subject to the boundary conditions: ∂Hz (0, t) = 0 ∂r  (4.5)  Hz (rm , t) = Hf (t)  (4.6)  where rm is the radius of the core, and Hf (t) is the value of the excitation field on the outer surface of the core. ˆ Since Hz only varies along r, Equation 4.4 does not contain θ. Equation Note that H = Hz k. 4.4 can be derived directly from Maxwell’s equations and B = µH. Since µ is nonlinear this has to be solved numerically. Equation 4.4 is a 1-dimensional parabolic partial differential equation. Matlab has a built in solver for this type of equation. The finite element solution was implemented with a very fine mesh. The cross-section of one lamination was modeled with 20 layers of quadratic elements. The 3D dynamic solver from Infolytica was used to produce the results. The circuit that was used is a variation of the basic circuit. Instead of using inductors, flux  75  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models dependent mmf sources were used. The value of the mmf sources are given by:  Lk∗ (φk−1 or φk ) =   1 dφk−1       Rk dt     1 dφk   Rk dt  k>1 (4.7) k=1  For k > 1 the value of Lk∗ depends on the derivative of the sum of the fluxes of the tubes below the kth tube. The mmf source for the innermost tube is the same as the inductor in the basic circuit. Comparing the results from thus circuit with the two above described magnetic models yielded two very general trends: 1. The damping for values of H less than the knee point of the initial magnetization curve was about the required amount. However, the damping for values of H above the knee point is insufficient. 2. Adding more tubes to the model improves the accuracy of the model. This is particularly noticeable when the circuit is modified in order to mitigate the error described in point 1. In particular, point 2 is very interesting because this trend seems to be boundless i.e. adding more layers always extends the frequency range of the model without degrading the low frequency performance of the model. This might explain the multitude of papers in the literature that implement models without hysteresis with 10 or more tubes. On the other hand, increasing the number of tubes is also a way of artificially increasing the damping to compensate for the loss in width of the generated B − H loops of the model due to not utilizing a hysteresis model. Nevertheless, the behaviour of this circuit is indicative of the behaviour of circuits that include a full hysteresis model instead of an initial magnetization curve. The error described in point 1 was significantly reduced by modifying the values of Rk based on a function of µ. In this way, the time constants τ = L ∗ R of the L ∗R circuits are adjusted to compensate for the large increase in R as the material saturates. With this new modification the mmf sources given in Equation 4.7 now become:  Lk∗ (φk−1 or φk , µk ) =   1 dφk−1     R R dt   µk k        1 dφk Rµk Rk dt  76  k>1 (4.8) k=1  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models where: Rµk (µk ) = 1 − pk + pk  µk , µ(0)  pk ∈ [0, 1]  (4.9)  Note that µ(0) is the value of µ for H = 0. The value of µk is equal to the value of µ that would be obtained if the flux φk−1 was in one tube with an area equal to the sum of the areas of the 1, 2, . . . , k − 1 tubes. Thus, the value of B that corresponds to φk−1 needs to be calculated. From this the value of µk is obtained from the initial magnetization curve. The response from the  analytical model or the finite element model for a case with and without saturation for a single frequency was compared to the response of the circuit in order to tune the value of pk . In general pk can be different for every tube but it is was found that having the same value of pk for every tube was sufficient. Thus, really only one parameter needs to be tuned for this approach. It was hoped that the success of this technique with the simplified magnetic model would carry over to a model with hysteresis with little or no modification. Unfortunately, the resulting performance is not as good as was hoped. It was understood that the performance of this technique was likely to worsen compared to the simple case because the generation of eddy currents due to the domain structure is not captured in this approach. However, the required frequency dependance of pk was not anticipated. The implementation of this modification for the basic circuit with hysteresis requires minor modifications. The values of Rk are now multiplied by Rµk (µk ) in Figure 3.1. The value of µk is now obtained from φk instead of φk−1 . Similarly to above, µk is determined by assuming that φk is in a single tube of total area equal to the 1, 2, . . . , k tubes. In this case, however, the resulting B is related to H via the hysteresis model instead of the initial magnetization curve. The value of µ(0) becomes the largest value of µ in the set of the first order reversal curves that are used by the modified hysteresis model. The same value of pk was used for all of the tubes. The only other modification to the basic circuit is the static adjustment of the values of Rk that is described in Section 3.2.2. Note that some of the gains that are obtained from that procedure need to be reduced otherwise the model produces results that are overly damped. This reduction can be preformed by iteratively changing the resistances of the tubes that use this mechanism for one case until the model’s results match the behaviour of the actual material. The response of this model to 60Hz and 500Hz excitation inputs for Hpeak = 500 A/m is shown in Figure 4.3. Notice that the response of the model for the 500 Hz case is overly damped. The overdamping becomes increasingly severe as the frequency increases. This can also be seen in the 60 Hz case. The damping is too much near the knee points of the response but is then underdamped after the knee points. The frequency response of this mechanism prompted the search for ways to modify the parameters of the model as the frequency changes.  77  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  1.5  experimental data model 60 Hz  1  B (T)  0.5  0 500 Hz -0.5  -1  -1.5 -500  -400  -300  -200  -100  0 100 H (A/m)  200  300  400  500  Figure 4.3: Performance of a 4 tube model with the modification Rµk (µk )  4.2.2  Variation of Rk Based on Λk (F˙k+1 )  As is clearly seen in Figure 4.3, pk needs to vary as the frequency varies. This is achieved by using the derivatives of the mmfs of the circuit. The issues that are associated with using derivatives are the same for this modification as the cases that are detailed in Section 4.1 so they are not repeated here. If the values of the gain pk are allowed to vary in response to the variation of the derivatives of the circuit mmfs then Equation 4.9 can be redefined as: µ Rµk (µk , Λk ) = 1 − Λk (F˙k+1 ) + Λk (F˙k+1 ) k , µ(0)  Λk ∈ [0, 1]  (4.10)  However, if Equation 4.10 is implemented as is then the response of the model for cases when the material is subjected to high frequency, high peak magnitude input excitations is overdamped near the endpoints of the response compared to the actual material. Thus, the lower limit of the allowed range of Λk needs to be relaxed. The third term on the right had side of Equation 4.10 78  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models 0.7 0.6 0.5 0.4  Λ  0.3 0.2 0.1 0 -0.1 -0.2 -0.3 0  1000  2000  3000  4000 5000 | dF /dt | (A/s)  6000  7000  8000  Figure 4.4: Variation of Λ with |F˙ | still needs to be restricted to the original range otherwise the increase in Rµk due to a negative Λk will be reduced by the negative third term. With the above considerations in mind, the modified circuit resistances are finally given by: Rk = ζk Rk Rµk (µk , Λk ) where:  µ Rµk (µk , Λk ) = 1 − Λk (F˙k+1 ) + Λk (F˙k+1 ) k , µ(0) Λk (F˙k+1 ) =  Λk  Λk  0  0  Λk < 0  (4.11)  Λk ∈ [−∞, 1]  (4.12)  (4.13)  The value of ζk is the adjusted static modification to Rk that is described near the end of Section 4.2.1. The static adjustment to the value of the resistance remains unchanged for tubes that do 79  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models not use this mechanism i.e., ζk = ζk for these tubes. Note that although Λk could theoretically approach negative infinity, for practical reasons it is capped at a sufficiently large number. The variation of Λk as a function of F˙ is obtained by iteratively modifying the shape of the curve for different input frequencies and peak magnitudes of H. The resulting piecewise linearized variation of Λk for a ten tube model is shown in Figure 4.4. Although a smooth variation could be used, a piecewise linear variation is more convenient to implement. Notice that the variation of Λk with F˙ is less abrupt than the variation of g with F˙ . Consequently, the maximum allowable timestep for this scheme is higher than that for the mechanism that modifies the resistances based on the factors 1 + g(F˙k+1 )φ˙ k . Equations 4.11–4.13 along with Figure 4.4 define the first of two mechanisms that are the main contributions of this work. The typical results for this mechanism are presented near the end of this chapter along with the results for the mechanism that is presented next. Notice the significant errors produced by this mechanism for cases when the material does not saturate to any extent. Clearly, this mechanism by itself can not account for all of the eddy currents that are flowing in the material.  4.2.3  Accounting for Eddy Currents due to Domain Wall Motion  The modeling work so far has been primarily based on the classical model for eddy currents. No explicit correction has been made for the eddy currents that flow due to the motion of the domain walls. The error that can occur when the effect of these currents is ignored can be very significant as is shown by the response of all of the models presented so far for Hpeak = 125 A/m. The second mechanism that is proposed in this work is designed specifically to correct for the error that occurs due to these additional currents. The development of this mechanism is based on the following assumptions: 1. Any localized eddy currents that may flow due to domain rotation are small enough that they can be neglected. 2. As a ferromagnetic material becomes more demagnetized the number of domains in the material increase. Therefore, the eddy currents that flow due to the domain walls shifting increase as the material becomes more demagnetized 3. Along any given trajectory as the path taken by the material approaches the origin the number of domains increase whereas as the path moves away from the point that is the closest to the origin the number of domains decrease. The state of a piece of the material can be broadly defined as either being saturated or unsaturated. Based on the assumptions that are given above, the mechanism described here deals with 80  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models the material when it is in an unsaturated state. The first assumption pertains to the rotation of entire domains as the material saturates. As a material approaches saturation the number of domains in the material decrease until the material is dominated by a few domains. After this point an increase in H only further aligns the magnetic moments within these domains with the field. This assumption appears to be justified because the excess currents are commonly attributed to the localized disturbance of B in the vicinity of moving domain walls whereas domain rotation strictly describes the rotation of the magnetic moments within the remaining domains within the material. An illustration of the difference between the two is provided in Section 1.4.2. The second and third assumptions give a basis to define a function that provides additional gain to dampen the response of the model when it is unsaturated. The function is generated from symmetrical hysteresis loops. These loops are provided by the modified Preisach model that is detailed in Chapter 2. Specifically, the hysteresis model is first brought into a demagnetized state. The model is then perturbed by a symmetrical input with peaks corresponding to the desired curve. According to point 2, curves that are closer to the origin are given a larger gain. Furthermore, as the trajectory goes from either extreme points in H the gain increases until the path is the closest to the origin. Thereafter, the gain decreases until the trajectory returns to the initial magnetization curve at the other extremum point. The gains are chosen such that the peak gain on a hysteresis loop that is further away from the origin than another is smaller than the gain at the extremum on the closer loop. The gain along the curve that connects the closest points of the hysteresis loops to the origin is defined as: gz (di ) = 1 x=  a1 x4 + a2 x3 + a3 x2 + a4 x + a5 (4.14)  di dc  where 1 a5 is the value of the gain at the origin, a1 + a2 + · · · + a5 = 1, and di is given by: di =  Hi Hm  2  +  Bi Bm  2  (4.15)  Hm and Bm correspond to the values of H and B on the initial magnetization curve at the outermost curve. The gain at this point and along the outermost hysteresis curve is equal to one. The distance as defined by Equation 4.15 for the endpoint of the curve that connects the closest points of the hysteresis curves to the origin is equal to dc . This point also lies on the outermost hysteresis curve.  81  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models A similar curve can be defined for the gains along the initial magnetization curve. This curve is defined as: gz (di ) = 1 y=  b1 y 4 + b2 y 3 + b3 y 2 + b4 y + b5 (4.16)  d √i 2  where b5 = a5 and b1 + b2 + · · · + b5 = 1.  The definitions of Equations 4.14 and 4.16 may seem to be too unwieldy given the number of  constants that need to be determined. For this particular case a fourth order equation was the minimum order equation that was able to fit the required shape for the gain function. The number of constants can be significantly reduced by forcing the ratio of the maximum gain at the closest point to the origin and the minimum gain at the extremum points on the initial magnetization to be the same for every hysteresis loop. The ratio was initially chosen to be 0.8. Varying the ratio about this value did not seem to overly affect the results produced by this mechanism so it was retained for the final model. Once the constants a1 , a2 , a3 , a4 , and the ratio are fixed then the constants b1 , b2 , b3 , and b4 can be obtained by any reasonable curve fitting algorithm. The constants a1 , a2 , a3 , and a4 are obtained by fitting the response of the model to the response of the actual material for various frequencies. The gain along the path from the points on the initial magnetization curve to the point closest to the origin for a given hysteresis curve is obtained by: gz (di ) = gz (H , B ) 1 +  1 − rp rp  √ di − 2 √ dp − 2  (4.17)  where dp is the distance from the closest point on the hysteresis curve to the origin, rp is the ratio that is described above, and gz (H , B ) is the value of the gain on the initial magnetization curve that corresponds to the hysteresis curve. With the use of Equations 4.14 - 4.17, the definition of the gain gz that was developed for the test material is shown in Figure 4.5. Note that this definition is for only one specific model – a 10 tube model that uses a 25 µs timestep. If the timestep or number of tubes is changed then the definition of gz needs to be identified again. More on this is discussed in the section on the accuracy of the new model that is given later in this chapter. If the definition of gz is used as is then this mechanism can produce results that excessively attenuate the H and, therefore, B magnetic fields inside the model of the material. This is particularly true of models that use this mechanism for every tube. A function called Γ is defined to roll off the gain for higher frequencies. An example of a suitable shape for Γ is shown in Figure 4.6. This is for the same case as the definition of gz i.e. a 10 tube model with a 25 µs timestep.  82  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  Figure 4.5: Definition of gz for a ten tube model Notice in Figure 4.6 that the gain actually becomes larger than one for rates less than 1000 A/s. This allows more gain for lower frequencies without overly affecting higher frequencies. Also note that the derivatives of the circuit mmfs are used in this mechanism for the same reasons that are discussed in Section 4.1. The definition of gz and the frequency dependent roll-off gain Γ are combined to become a mechanism that can correct for the errors that occur due to ignoring the eddy currents that are produced by the motion of the domain walls.  83  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  2 1.8 1.6 1.4  Γ  1.2 1 0.8 0.6 0.4 0.2 0 0  500  1000  1500  2000 2500 | dF /dt | (A/s)  3000  3500  4000  Figure 4.6: Variation of Γ with |F˙ | Thus, with the definitions of gz and Γ in mind, the modifications to the circuit resistances for this mechanisms are: Rk =  Rk Rgz k  (4.18)  where: Rgz k = 1 + (gz (Hk , Bk ) − 1)Γk (F˙k+1 )  (4.19)  The values of Rk are the modified circuit resistances from the Rµk mechanism that is given by Equation 4.11. The benefit of using this mechanism is clearly seen in the figures in the next section. As with the mechanism that is described in Section 4.2.2, increasing the number of tubes increases the accuracy of the model. The number of tubes that are required for this mechanism compared to the mechanism in Section 4.2.2 is higher because the falloff of H in the material is more severe for 84  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models cases without saturation compared to cases with partial or full saturation. A final note needs to be made about the tuning of the values of the constants a1 , a2 , a3 , and a4 and the determination of Γ. Initially, the lower frequency gains of Γ are set to one. The required roll-off of the gain and the constants are determined by ensuring that the amount of damping at the ends of the waveforms is correct for the entire frequency range of inputs. This process is iterative, however, suitable values of the constants and the roll-off can be determined with only a few iterations. Finally, the lower frequency gain of Γ is increased until the damping at the ends starts to be affected. The increase of the lower frequency gain tends to tighten the response of the mechanism while leaving the damping at the ends mostly intact.  4.2.4  Procedure for Identifying the Parameters of the Model  This section gives the procedure for generating the necessary parameters for the proposed model that is described in this chapter. The parameters should be derived in such a way that they can be directly used in the implementation of the model that is described in Chapter 5. The identification of the model requires the following pieces of information: 1. a set of first order reversal curves that are referred to either +Hsat or −Hsat ; 2. a set of H and B (or M ) data at three or more frequencies for peak input excitation values that correspond to a DC magnetization that is unsaturated, near the middle of the saturation region and almost completely saturated; 3. dimensions of the magnetic structure to be modeled; The data for items 1 and 2 can be obtained with the use of the experimental setup that is described in Appendix A or by any other suitable means. The magnetic material should be excited such that either a sinusoidal H or sinusoidal B waveform is generated for the sets of frequency dependent data. Furthermore, the frequencies that are used to produce the data should span the entire operation range of the model. The value of the nominal value of the resistivity of the material can be obtained from the manufacturer of the magnetic material. If the type of material is unknown then either σ can be experimentally found or it can be found as part of the identification process of the model in Step 4 below. The procedure that was used to identify all of the parameters of the models that were developed for this work is as follows. Step 1. Generate the two data structures given in Tables 2.1 and 2.2 for the hysteresis algorithm from piecewise linearized first order reversal curves. Step 2. Decide on the number of tubes for the model. 85  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models Step 3. Calculate R(µk ) and Rk (σ) from the geometry of the material as given in Section 3.1.2. Step 4. Determine the static change ζk to the values of Rk as outlined in Section 3.2.2 and optionally a value for σ if it is unknown. Step 5. Generate Λ(|F˙ |) by fitting data for cases when the material is allowed to saturate to some extent. This is done by:  i. readjusting ζk for tubes that use the Rµk mechanism that is described in Section 4.2.2 to obtain ζk ; ii. adjusting the gain of Λ for values of |F˙ | corresponding to low, mid, and high excitation frequencies starting with low frequencies and then progressing to increasingly higher frequencies. Step 6. Obtain gz (H, B) and Γ(|F˙ |) by: i. obtaining an estimate of the gain that is required for gz at different frequencies by statically changing the modified resistances ζk Rk and ζk Rk while the Rµk mechanism is still active; ii. based on Step 6(i), determine the initial values of a1 , a2 , . . . that are defined in Section 4.2.3 to fit the estimate of the required gain as a function of |F˙ | for gz ;  iii. fix the ratio rp that is described in Section 4.2.3 to 0.8;  iv. readjust gz by fitting the response of the model for low to mid range frequencies while initially fixing the value of Γ = 1; v. reduce Γ for higher frequencies while keeping gz fixed; vi. increase Γ while keeping gz fixed for low frequencies to tighten the response of the model until the damping at the ends of the response starts to be affected. Step 7. If the accuracy of the final model is insufficient then increase the number of tubes of the model and return to Step 3. The procedure for the identification of the model assumes that the timestep of the solution is fixed based on the time constraints that are imposed on the implementation of the model. In general, reducing the time step of the model increases the accuracy of the solution but at the expense of increased computational effort. This will become clearer in light of the discussion in the next section and in Chapter 5. The procedure also assumes that the geometry of the material is simple i.e. the cross-section of the material as seen by the magnetic path is constant and is either rectangular or circular. 86  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models Thus, complex structures such as the stator and rotor of machines need to be divided into several more elementary shapes that are fitted with individual models separately. Generally each section of a more complex device can be approximated with an equivalent geometry that allows for the calculation of the reluctance of the magnetic path and the resistance of the eddy current paths. A good approach for doing this can be found in the book Dynamics of Saturated Electric Machines by Ostovi´c [68]. This approach is beyond the scope of this work so it is not included in this discussion. Fortunately, the vast majority of structures that are composed of ferromagnetic materials can be approximated with sections that have either rectangular or circular cross-sections. Thus, the tube structure that is defined in Section 3.1.2 can be used without major adjustments for most of the cases that are present. When this procedure is applied to complex structures the models of each section of the device need to be determined with the use of separate pieces of the same material with an equivalent simple geometry. It is hoped that general trends in the parameters of the model exist for cross sections of different dimensions of the same material. Thus, the parameters for models with dimensions that are bounded by existing fitted models can be obtained by interpolating the parameters of the existing bounding models. Finally, a quick comment about the first-order reversal curves of the material should be given. The first-order reversal curves are principally dependent on the composition of the material. Changing the geometry of the material has generally little or no impact on the shape of these curves. However, mechanical stress that causes the permanent deformation of the material can cause the shape of the curves to change. The shape is also dependent on the ambient temperature surrounding the material. These effects among others are important but are left for future consideration. Since hysteresis by itself is deemed to be time and geometry independent, only one set of first order reversal curves is necessary to construct the hysteresis model for a given material.  4.3  Accuracy of the Proposed Model  The accuracy of the proposed model is explored in comparison to the basic model that is depicted in Figure 3.1. The initially calculated DC values of the tube resistances of the basic model are statically modified based on the procedure in Section 3.2.2. This tuning of the circuit is performed for two operating conditions: 250 Hz and 500 Hz for a peak value of H of 500 A/m. The parameters of the proposed models are determined based on the procedure that is given in the previous section. The accuracy is shown here in two ways. The first way is to compare the results of the various models with a metric. As a result, trends in the behaviour of the models can be determined. The second way is to present the response of two specific models graphically. A dynamic ten tube model is compared to a static ten tube model to highlight the advantages of the proposed model in this work. 87  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  4.3.1  Analytical Determination of the Accuracy  A specific metric is used as the basis for the comparison. The metric is the normalized least squares error of the output of a model. The output of the various models are compared to the experimental data that was measured using the apparatus described in Appendix A. Since the models operate at specific fixed timesteps, the number of output points for a single cycle of the input decrease as the input frequency increases. In order to compensate for this trend, a scaling factor for the error is introduced to allow the response of the models to be compared for different frequencies. The metric that is used to generate the error in response of a given model is given by: E2 =  n60 n  n i=1  ¯ −B ¯∗ B i i ¯p B  2  (4.20)  ¯ where: n is the number of data points, n60 is the number of data points for the 60 Hz waveforms, B i ∗ ¯ is an array of the output values is an array containing the output response of the actual material, B i  ¯p is the maximum value of the output of the experimental that are generated by the model, and B curve. Note that since the difference between the model’s response with the experimentally determined curve is divided by the peak of the output response of the actual material, the resulting error E is dimensionless. Thus, the division with the peak value provides the normalization that is mentioned above. Besides comparing the improvement of the proposed model with the basic circuit, the effectiveness of increasing the number of tubes and reducing the timestep of the new model was also investigated. All of the comparisons are performed by computing the metric that is given in Equation 4.20 for twelve different operating conditions. These operating conditions are tabulated below in Table 4.1. In Table 4.1, for all cases, the input waveform H is sinusoidal with a peak amplitude of Hp and frequency f . The cases when Hp is equal to 125 A/m correspond to a DC magnetization that does not saturate the material to any degree. The cases when Hp is equal to 500 A/m and 1000 A/m correspond to DC magnetizations that are near the middle of the saturation region and almost fully saturated respectively. Thus, at the very least, part of the material will saturate to some degree in these cases. Three separate studies of the accuracy are presented here. The first study compares the output of three models with four tubes that are solved with the same timestep of 50 µs. Of the three models one uses both of the mechanisms and the other two are tuned for two different operating conditions. These operating conditions correspond to cases 5 and 8 in Table 4.1. The dynamic model only uses the Rµk mechanism in the outermost tube whereas the Rgz k mechanism is used for every tube. The reason for this choice is explained below. 88  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models Table 4.1: Operating conditions for comparing the models Case  Hp (A/m)  f (Hz)  Case  Hp (A/m)  f (Hz)  1  1000  1000  7  1000  250  2  500  1000  8  500  250  3  125  1000  9  125  250  4  1000  500  10  1000  60  5  500  500  11  500  60  6  125  500  12  125  60  The second study compares the effect of changing the timestep. The accuracy of two models that have four tubes are compared for timesteps of 25 µs and 50 µs. Both of the models use the Rµk mechanism in the outermost tube and the Rgz k mechanism for every tube. The third and final study compares the accuracy of a ten tube model to a four tube model. Both of the models are solved with a timestep of 25 µs. The four tube model that was used is the same one as in the second study. The ten tube model uses both the Rµk and Rgz k mechanisms on the four outermost tubes. In these studies, one fact that became very apparent is the two mechanisms are not necessary for every tube. Initially the mechanisms were only added to the outermost tubes of the model. It is found that as the mechanisms are added to more tubes, starting with tubes nearer to the outside surface of the material, the improvement in the response of the model becomes increasingly smaller. This is not surprising since the response of the outermost tubes dominates the response of the entire model. They dominate in the sense that a change in a parameter of an outermost tube has a larger impact on the response of the model compared to a similar change in the parameter of an inner tube. The extent of this behaviour was confirmed when the values of the resistances were statically changed while performing the procedure in Section 3.2.2. In general, the drop off in the improvement of the model’s response is more severe for the Rµk mechanism compared to the Rgz k mechanism. The results of the first study are shown in Figure 4.7. Notice the large error in the output of the models that are tuned for specific operating conditions when the material is not allowed to saturate to any degree. Also notice that the model that was tuned at f = 500 Hz is more accurate than the model that is tuned at f = 250 Hz for higher frequencies. Conversely, the model that is 89  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models 10 static adjustment at 250 Hz static adjustment at 500 Hz with both mechanisms  9 8 7  E  6 5 4 3 2 1 0  1  2  3  4  5  6 Case  7  8  9  10  11  12  Figure 4.7: Comparison between a dynamic and two static four tube models with 50 µs timesteps  tuned at f = 250 Hz is more accurate for lower frequencies and values of the peak H compared to the model that was tuned at f = 500 Hz. These trends are consistent when the gains of the circuit inductors are considered. What probably seems surprising is the error for the tuned models actually decreases for cases above 250 Hz when the material does not saturate whereas the error for the dynamic model increases. This trend will be explained in the discussion that follows the presentation of all of the results of the three studies. The error that is produced by the dynamic model is either lower or at worst only slightly higher than the best of the two models that are tuned. For the cases when the material is not allowed to saturate, the error produced by the dynamic model is significantly lower than the tuned models. This is mostly due to the action of the Rgz k mechanism. Although not shown here, the advantage of the dynamic model over the tuned models becomes more significant as the timestep of the solution is reduced and/or the number of tubes for the model increases. Appendix B gives data for these cases that clearly demonstrates this fact. 90  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  25 us timestep 50 us timestep  6  5  E  4  3  2  1  0  1  2  3  4  5  6 Case  7  8  9  10  11  12  Figure 4.8: Comparison between dynamic four tube models for two timesteps  The results of the second study are given in Figure 4.8. Notice that the accuracy of the model that uses a 25 µs timestep is generally better than the model that uses a 50 µs timestep for cases when the material is allowed to saturate to some extent. This is as one might expect. However, the accuracy of the 25 µs model is actually worse than the 50 µs model when the material is not allowed to saturate. This might come as a surprise but there is a good reason for this to happen. The rationale for this behaviour is similar to the reason why the accuracy appears to decrease for the tuned models in the first study. The explanation follows the results of the last study. The results of the final study are shown in Figure 4.9. With the exception of Case 7, the accuracy of the ten tube model is significantly better or approximately the same as the four tube model. This result shows that adding more tubes generally improves the accuracy of the resulting model. Conversely, adding more tubes to a statically adjusted model actually decreases the accuracy of the model as shown in Appendix B. This can be explained by remembering that the static adjustment of the values of the tube resistances is based on shaping the H field as it penetrates deeper into 91  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  four tube model ten tube model  6  5  E  4  3  2  1  0  1  2  3  4  5  6 Case  7  8  9  10  11  12  Figure 4.9: Comparison between dynamic four and ten tube models with 25 µs timesteps  the model of the material. The variation in the values of the resistances of the outermost tubes that is required to properly shape the H field as the frequency changes increases as the number of tubes increases. Thus, static models with more tubes are more sensitive to changes in frequency than models with fewer tubes. The three studies that are presented above show some results that are surprising based on the trends that are presented in Chapter 3. With the exception of the 10 tube dynamic model, the error in the response of the models tends to increase as the frequency increases for inputs that saturate the core to some extent. However, as previously mentioned, the error in the response of the four tube static models for the unsaturated cases actually deceases. This phenomenon is attributed to how the circuit is discretized. Specifically, the circuit inductances need to be discretized. All of the models that are presented in this work are discretized using the backward Euler (BE) rule of integration. While Chapter 5 covers this discretization in detail, its effect on the response of models is given here to facilitate the explanation of the errors that are seen in the figures above. 92  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models The discretization of the circuit inductances with the use of the backward Euler rule of integration distorts the value of the inductance based on the frequency of the change in the input [69]. Additionally, the BE rule also introduces additional damping that depends on the original value of the inductance and the timestep that is used for the solution of the model. This additional damping reduces the effect of the circuit inductors. Thus, the magnetic H field and, therefore, the B field is attenuated less due to this additional damping. The equivalent circuit model of an inductor that has been discretized with the BE rule is illustrated in Figure 4.10.  Le  L  Re  (a) original inductor  (b) discretized inductor  Figure 4.10: Effect of discretizing an inductor with the backward Euler integration rule The values of the circuit parameters that are shown in Figure 4.10 are given by: tan Le = L  Re =  ωT 2 ωT 2  2L T  The frequency distortion of the value of L is relatively small as long as ω  (4.21)  (4.22) 1/2T where 1/2T  is called the Nyquist frequency. Since the Nyquist frequency of the discrete time solution is chosen to be significantly higher than the maximum frequency that exists in the response of the circuit this effect is negligible. Conversely, the effect of Re can not, in general, be ignored unless the timestep of the solution is very small. Certainly, in the cases that are presented in this work, the effect of Re is very significant. The existence of Re also raises an important issue with using the BE integration rule. Namely, the response of the magnetic equivalent circuit is different from the electric equivalent circuit for the same identified parameters because the reluctances in the magnetic equivalent circuit become inductors in the electric equivalent circuit whereas the “inductors” in the magnetic equivalent circuit become resistances in the electric equivalent circuit. Since the circuit elements that are discretized are different for the equivalent circuits, the extra damping that is added due to Re is 93  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models in different places in the circuits and has different values. Thus, the parameters would need to be identified again if the equivalent circuit is changed. This is not really a problem because typically the application dictates which equivalent circuit to use. Thus, the parameters would only need to be identified for one of the two equivalent circuits. As a side note, the trapezoidal rule of integration does not have this issue because Re is infinite in this case i.e. the trapezoidal rule does not introduce any additional damping. This might suggest that the trapezoidal rule should be used in place of the BE rule. However, the additional damping that is provided by BE rule tends to make the output more stable compared to the trapezoidal rule. Also, the response of the magnetic equivalent circuit that is discretized using the trapezoidal rule tends to be overly attenuated compared to the BE rule. For these reasons the BE rule was chosen over the trapezoidal rule for the discretization method of the circuit. With the above discussion in mind, the response of the static four tube models for unsaturated cases can be explained. Clearly, the frequency response of all of the models is modified by the presence of the additional reluctances in parallel with the inductors. In the case of the static four tube models, the increase in the damping of the H field inside the actual material becomes better matched with the damping that is given by the model as the frequency increases. Note that this is not necessarily true for every case. For example, a static four tube model that is solved with a 25 µs timestep instead of a 50 µs timestep shows a slight increase in the error at 500 Hz before it drops off at 1 kHz for the cases that do not saturate the material. Thus, a clear trend can not be given for the results of the static cases when the material does not saturate to any extent. The results that are produced by the static four tube model that is solved with a 25 µs timestep are given in Appendix B. In the dynamic models the value of the additional reluctances becomes frequency dependent since the value of L depends on frequency. Since the values of the reluctances are directly proportional to the inductance values and the inductances decreases with frequency, the reluctances become smaller as the frequency increases. The combination of the decrease of both the inductance and the reluctance actually allows a more accurate model to be identified compared to an equivalent model that has been discretized using the trapezoidal rule of integration. As is mentioned above, the accuracy of a four tube dynamic model that is solved with a 25 µs timestep performs worse when the material is not allowed to saturate to any extent than a dynamic four tube model that is solved with a 50 µs timestep. The reason behind this is a little subtle. As explained above a larger timestep provides a greater cancellation of the effect of the inductances. Thus, for the same amount of damping at the extremums of the input, the response of a model with a larger timestep to a symmetrical input tends to be thinner i.e. encompasses less area in the B–H plane. Additionally, the gain of gz is allowed to be uniformly greater for the 50 µs model compared to the 25 µs model. The combination of these two factors provides a greater apparent attenuation of the fields inside the model of the material for the dynamic four tube model with a 94  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models 50 µs timestep compared to the dynamic four tube model with a 25 µs timestep. Note that for these same reasons the response of the 50 µs model is generally worse than the 25 µs model for inputs that saturate the material to some extent. In these cases the attenuation that is provided by the 50 µs model tends to be insufficient.  4.3.2  Graphical Comparison Between a Dynamic and a Static Ten Tube Models  The results of a ten tube model that was identified using the procedure in Section 4.2.4 are graphically compared to a ten tube model that has its tube resistances statically modified based on the procedure in Section 3.2.2. The dynamic model uses both the Rµk and Rgz k mechanisms for the four outermost tubes of the model. The static model is tuned at 250 Hz for a peak input excitation of 500 A/m. Both of the models are solved with a 25 µs timestep. The following pages show the results for three different levels of input excitation at 60 Hz, 250 Hz, 500 Hz, and 1 kHz. These conditions correspond to the cases that are given in Table 4.1 above. Some of the apparent errors in the response of the models are actually due to the experimental curves being not completely symmetrical. Furthermore, the extremum values of the input excitation are not identical either. This is particularly true of the curves for Hp ≈ 125 A/m. For example,  the apparent error in the 60 Hz case is misleading because the experimental curve is heavily skewed and has extremum values that are not identical. In the worst cases, such as the 60 Hz case, the model is excited with a non-symmetrical input that corresponds to the input in the experimental case. Notice that the response of the static model is overly attenuated for the cases with saturation at 500 Hz and 1 kHz. This illustrates the overriding problem with the static circuits. Namely, a single set of parameters for the static model can not, in general, produce a response that matches the frequency response of the actual material over a large range of frequencies and input excitation levels. The gain in accuracy by using the Rgz k mechanism is clearly demonstrated in the shown curves. The errors that are produced by the dynamic model are clearly significantly smaller than the errors that are produced by the static model. Figures B.1 – B.4 in Appendix B show the same sets of curves as below for a dynamic and a static four tube models that are solved with a 50 µs timestep. Some typical variations in time of the circuit inductance values due to the two new mechanisms and the resulting profile of the H field as it penetrates into the material are also shown in Figures B.5 and B.6 in Appendix B.  95  B (T)  96  Figure 4.11: Response of ten tube models for 60 Hz input excitations  -1000  -1.5  -1  -0.5  0  0.5  1  1.5  -800  -600  -400  -200  0 H (A/m)  experimental data 10 tube model with both mechanisms 10 tube model with static adjustment only  200  400  600  800  1000  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  B (T)  97  Figure 4.12: Response of ten tube models for 250 Hz input excitations  -1000 -800  -1.5  -1  -0.5  0  0.5  1  1.5  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 10 tube model with both mechanisms 10 tube model with static adjustment only  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  98  Figure 4.13: Response of ten tube models for 500 Hz input excitations  -1000  -1  -0.5  0  0.5  1  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 10 tube model with both mechanisms 10 tube model with static adjustment only  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  B (T)  B (T)  99  Figure 4.14: Response of ten tube models for 1 kHz input excitations  -1000  -0.8  -0.6  -0.4  -0.2  0  0.2  0.4  0.6  0.8  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 10 tube model with both mechanisms 10 tube model with static adjustment only  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  Chapter 4. New Mechanisms for Circuit-Based Ferromagnetic Models  4.4  Chapter Summary  This chapter is primarily concerned with the development of two new mechanisms that form the main contribution of this work. Two other failed approaches are also given to highlight the difficulty in achieving a dynamic variation of the values of the tube resistances that suits the required variation in the resistances that is observed by statically tuning the model. Both of the mechanisms require the derivatives of the circuit mmfs to be determined. The discussion that is presented in this chapter assumes that these derivatives are available. Chapter 5 details how the derivatives are obtained along with providing solutions to the other implementation issues of the proposed model. This chapter gives a procedure for identifying all of the parameters that are required to obtain a new model from the geometry of the material and some experimental sets of data. The procedure assumes that the geometry of the material is simple. A basic guideline for cases when the geometry is not simple is also given. The chapter closes with an analytical study of the effectiveness of the new proposed model followed by a graphical comparison of a model that uses the mechanisms with a static model. The study clearly shows the benefits of using the two newly developed mechanisms over the traditionally used static model. The output curves of the two models further emphasizes the improvement of the newly developed dynamic model over the preexisting static model.  100  Chapter 5  Implementation Issues The discussion up to this point has mostly avoided the issues that pertain to the practical implementation of the proposed new modifications to the preexisting ubiquitous basic circuit. The details of the realization of the hysteresis model other than its data structure and the basic circuit itself are also absent. This chapter addresses these concerns along with providing a measure of the computational complexity of the new model. This chapter begins with the implementation of the final circuit starting with the basic circuit. In order to assess the feasibility of using this implementation for the purpose of predicting the position of the rotor of a SRM, this chapter then concludes with the determination of the computational complexity of the proposed algorithm based on the analysis of the timing of the algorithm.  5.1  An Implementation of the Modified Basic Circuit  There are numerous ways that the modified basic circuit can be implemented. The choice of the solution that was ultimately realized is heavily influenced by the goals of this work. One of the stated goals of this work is to produce a model that can be potentially run in real time. The major difficulty with achieving this goal is the model is extremely nonlinear. The seemingly best approach to achieve this goal is to piecewise linearize the relationship between B and H. This allows the circuit to be discretized using an implicit integration technique. The resulting discretized circuit needs to be iterated to find the solution at any given timestep. However, the number of iterations is bounded by the rate of change of the input. Thus, an estimate of the upper bound on the number of iterations can be determined. This is a major advantage over other nonlinear solution techniques since there is no guaranteed way of knowing the required number of iterations for an arbitrary input for these approaches. The justification for these comments is given later in this chapter. The stability of the solution is also of utmost importance especially for applications in which this model is part of an overall control scheme. Again, it is believed that the discretized circuit that utilizes piecewise linearized elements has specific advantages over other available solution techniques.  101  Chapter 5. Implementation Issues  5.1.1  Discretization of the Basic and Modified Basic Circuits  The basic circuit that is shown in Figure 3.1 and its modified version are discretized using the backward Euler integration rule. Specifically, the Laplace variable s is approximated by: 1 T ≈ s 1 − z −1  (5.1)  where T is the timestep of the discretized model and z is the z-domain variable. The backward Euler integration rule is used because it provides additional damping. This tends to dampen out any numerical oscillations that might occur in the response due to changes in the typology of the circuit or the values of its elements. In this case the topology remains fixed, however, the values of the circuit elements can change from one timestep to another. The damping that is provided by the backward Euler rule also has the benefit that it does not distort the resulting waveform. This is seen by examining the phase response of the rule. The phase response of the backward Euler rule is linear. This is similar to digital finite impulse response (FIR) filters. It is an established fact in signal processing that filters with linear phase response do not distort the input waveform [70]. Of the two elements in the (modified) basic circuit only the inductors need to be discretized since the resistors do not vary based on the a time derivative. However, the resistors do vary based on the current values of H and B. The modified hysteresis model that is discussed in Chapter 2 outputs a value of µ and the B-axis intercept Bpv . These values are valid for a certain range of H. Alternately, the H-axis intercept Hpv can be calculated by: Hpv = −  Bpv µ  (5.2)  The use of Bpv or Hpv depends on how the circuit elements are represented in the overall model. The nonlinear resistances in the (modified) basic circuit can be replaced by the circuit representation that is shown in Figure 5.1.  F φ  R  Fpv  Figure 5.1: Circuit representation of the circuit elements  102  Chapter 5. Implementation Issues The value of R in Figure 5.1 is equal to  l µA .  The mmf source Fpv is given by Hpv l = −  lBpv µ .  As the values of µ and Bpv change the circuit values of R and Fpv need to be updated. The inductances are discretized by first examining their definition: F =  d Lφ dt  (5.3)  The value of L is in general nonlinear. Like the resistances the value of L can be represented by a slope and an intercept. Thus, Equation 5.3 can be rewritten as: F =  d Lm φ + Lpv dt  (5.4)  where Lm is the slope of the inductance and Lpv is the intercept. Now consider the case in which L (t) = L (t − T ). Although this condition does not exist in  the basic circuit, it does in the modified basic circuit so the following will include this condition. Using the approximation for s in Equation 5.1 for the time derivative in Equation 5.4 yields: F (t) = where  Lm (t) Lm (t − T ) φ(t) − φ(t − T ) + T T  Lpv T  (5.5)  Lpv = Lpv (t) − Lpv (t − T ).  The value of  Lpv can be determined by letting the previous value of the flux be the point  where the two lines that represent Lm φ + Lpv at time t and t − T cross. This is shown graphically in Figure 5.2.  Lφ  L pv (t)  L pv (t  L m (t  L m (t)  T)  T)  φ (t  Figure 5.2: Determination of  103  φ  T) Lpv  Chapter 5. Implementation Issues With the aid of Figure 5.2 the value of  Lpv is given by:  Lpv = Lm (t − T ) − Lm (t) φ(t − T ) The definition of  (5.6)  Lpv in Equation 5.6 can be substituted into Equation 5.5 to yield: F (t) =  Lm (t) φ(t) − φ(t − T ) T  (5.7)  The basic and modified basic circuits can now be completely represented by resistances and mmf sources. Before the techniques for solving this network are given, the practical implementation of the modified hysteresis model and the two new mechanisms is discussed.  5.1.2  Practical Implementation of the Modified Preisach Model  Chapter 2 contains the basic information for implementing the Modified Preisach Model. This includes all of the relevant equations that are necessary to calculate the current relationship between B and H. Two data structures are given there that reduce the number of necessary calculations. The details in Chapter 2 are sufficient if the value of H remains fixed during every timestep in the solution of the model. However, the iterative nature of finding the solution for the (modified) basic circuit requires that the algorithm be expanded to include the potential variation of H during the timestep. The required additions to the algorithm can be seen by examining the effect of varying H about the solution of the model (H0 , B0 ) in the previous timestep. Consider three possible branches in the trajectory of the solution that are depicted in Figure 5.3. All other possible branches near (H0 , B0 ) can be handled in a similar way as these three branches. The branch that is shown in Figure 5.3(a) illustrates a change of direction in the trajectory. The branch in Figure 5.3(b) shows the closure of a minor loop within the same segment as (H0 , B0 ) whereas Figure 5.3(c) shows the closure of a minor loop outside of the current segment. Besides being able to determine the necessary changes in the state of the model as the result of taking a new branch, the hysteresis algorithm must also be able to reverse the changes if it is deemed in a later iteration that the new branch should not be taken. In order for the solution of the model to remain stable, the algorithm must guarantee that the final solution of the current timestep lies on either the original branch or one of the many possible new branches. The following discussion is made in reference to the flowchart of the hysteresis algorithm that is shown in Figure 5.4. Note that the notation that is used in the flowchart is for ANSI C e.g. STATE ptr−= 2 is equivalent to STATE ptr = STATE ptr−2. For the case of closing a minor loop, |H| needs to be larger than the end point of the current  minor loop and the end point must also lie in the same segment as the current definitions of µ and Bpv . If this is the case then the new branch is automatically taken. Figure 5.3(b) illustrates this 104  Chapter 5. Implementation Issues  ( H0,B0 )  ( H0,B0 )  (a) branch A  (b) branch B  ( H0,B0 )  (c) branch C  Figure 5.3: Three possible new branches of the solution near (H0 , B0 ) condition if the current definitions of µ and Bpv are in the same segment as (H0 , B0 ). Notice that if the minor loop closes in a segment that is not the same as the current definitions of µ and Bpv , as is shown in Figure 5.3(c), then the validity of the solution is checked against the endpoint of the current segment not the closure of the minor loop. To ensure that errors due to rounding or quantization do not cause the solution to drift over time, the values of H and B that were stored in the reversal data stack are used to update the new values of µ and Bpv when a minor loop closes. For the case of a potential reversal of the trajectory, the previous solution point (H0 , B0 ) must lie on the same segment that is defined by the current definitions of µ and Bpv . If this is not the case then the change of direction is ignored. As mentioned above, if a temporary solution of H later dictates that the solution does not take a new branch even though previous temporary values of H indicated so then the effects of taking  105  Chapter 5. Implementation Issues Start Valid = FALSE  Upwards Going Trajectory  As the upwards going trajectory except that the formula for the conditional branches are different  No  Yes Already Yes Closed A Minor Loop  Minor loop closed  No  Yes Toggle value of direction variable  Change In Direction  No  Reversal Data Stack Not Empty  No Reverse Change In Direction  Yes  Yes  No j = 29 - i i=j  Minor Loop Closure In This Segment  No STATE ptr  Yes  Reversal Previously Calculated  Yes  j = 29 - i i=j  Minor Loop Closed  No No Calculate r and C for new branch  Retrieve r and C Yes  STATE ptr++  STATE ptr++ Store H n , j, C, r, B n on top of reversal data stack  Retrieve r and C  Reversal calculated = TRUE Calculate µ and B pv Return  Calculate H* and B* i Retrieve r and C  Retrieve H* and B* STATE ptr = 2 Retrieve r and C  No  Calculate µ and B pv H< Lower Bound  Calculate µ and B pv Return  Yes  H >= Upper Bound  No  Return  Valid = TRUE Yes Calculate H* and B* i++  Return  Retrieve r and C Calculate µ and B pv Return  Figure 5.4: Flowchart for the hysteresis algorithm 106  Chapter 5. Implementation Issues  Minor loop closed  No  Reversal Data Stack Not Empty Yes  No  Minor Loop Closure In This Segment Yes Minor Loop Closed  No  H >= Upper Bound  Retrieve H* and B* Yes  No  Valid = TRUE Return  Reverse Minor Loop Closure  Calculate µ and B pv  Yes  Retrieve r and C  i  Return  Retrieve r and C Calculate µ and B pv  No  Calculate H* and B* STATE ptr = 2  Calculate H* and B*  Minor Loop Already Closed In This Segment  H< Lower Bound  STATE ptr = 2 Retrieve r and C  No  Yes  Yes  Return No  Valid = TRUE Yes Calculate H* and B* i++  Calculate µ and B pv  Retrieve r and C  Return  Calculate µ and B pv  Return  Return  Figure 5.4 cont.: Flowchart for the hysteresis algorithm cont.  107  Chapter 5. Implementation Issues the new branch need to be reversed. The reversal of the effects of taking new branches is performed in the reverse order that the branches were taken i.e. the most recently processed branch is reversed first followed by the next most recent branch, etc. If along any given path a temporary value of H indicates that the solution may exist on the next segment in the current trajectory then the solution is resolved with the values of µ and Bpv for the next segment. Similarly, if a temporary value of H latter falls on a segment before the current segment and (H0 , B0 ) is not located on the current segment then the model is resolved for the values of µ and Bpv for the previous segment. However, if the temporary value of H also indicates that the effects of closing a minor loop needs to be reversed then resolving the model for the previous segment of the new path takes priority over reversing the effects of the path so long as the boundary between the segments falls after the start point of the new branch in the direction of the current trajectory. The handling of the model is slightly different when there are no previous reversals in the trajectory of the model. In this case, the trajectory updated based on the values of µ and Bpv for the limiting first order reversal curve. The closure of minor loops is not checked in this case since the data that the algorithm looks for does not exist i.e the reversal stack is empty. The number of iterations per time step is limited in order to ensure that the solution does not infinitely “bounce” between values at the boundaries of the model such as at the start point of a new branch and the current branch. This may occur due to the effects of rounding or quantization. The maximum number of iterations that is allowed is set high enough that it does not interfere with a legitimate number of iterations for a high frequency high peak value input. If the values of µ and Bpv are not required to be changed then the solution for this instance of the hysteresis model is deemed to be valid. The above rules constitute all of the additional actions that may need to be performed as the solution of the model is iterated. The ANSI C code that realizes the Modified Preisach Model is given in Appendix C. There are two significant variations of this methodology that are required for the practical implementation of this algorithm as part of the overall model that is presented in this thesis. The first variation is particularly relevant to the estimation of the position of the rotor in a SRM. These are given next.  5.1.3  Elimination of Stack Overflow Errors  There still remains a disastrous situation that will most likely occur when the practical implementation of the modified Preisach model is implemented as is presented above. Presently, there is no bounds on the amount of memory that is required to store the reversal data. Actual devices have a very finite amount of memory. Thus, if the number of reversals becomes excessive then the reversal stack overflows and the model crashes. This section presents a way of rectifying this 108  Chapter 5. Implementation Issues problem without overly effecting the accuracy of the model. Consider the modification of the trajectory of the material in the H–B plane that is shown in Figure 5.5. 1 3  4  2  Figure 5.5: Modified trajectory of the material Instead of going from the reversal point 4 to the reversal point 3, the trajectory returns to the reversal point 1; thus, ignoring the reversal at point 3. Any further reversals from positive going H to negative going H overwrite the reversal at point 3 because it is no longer needed. The decision on whether a reversal point should be ignored or not is based on how close the two relevant reversal points are in terms of H. If the absolute difference in H is smaller than some value δ then the actual reversal point is ignored in favor of the next reversal point in the same direction. It is important to note that the reversal at 3 is still put on the reversal stack. The closeness of each pair of reversal points is only checked when the trajectory is to return the model to the reversal point that is to be potentially ignored. For instance, if the trajectory from 3 actually returns to 2 then the reversals at 2 and 3 are removed from the stack as before. This approach requires the reversal stack to be split into two separate stacks since the order of a single stack becomes disrupted when reversal points are overwritten in the above fashion. One stack contains the reversals from positive going H to negative going H and the other contains reversals from negative going H to positive going H. Each stack has its own stack pointer to the most recent reversal data. The additional overhead compared to the implementation in the previous section is minor since the algorithm already splits up the handling of positive going and negative going trajectories. The value of δ fixes the maximum number of entries on each stack. For example if δ = 1 A/m then each stack will contain at most 1000 entries if the trajectory of the path starts 109  Chapter 5. Implementation Issues from H = +1000 A/m. Naturally, there is a tradeoff between the accuracy of the model and the amount of memory that is required to store the reversal data. As δ increases the amount of memory that is required decreases but at the expense of the accuracy of the model.  5.1.4  Update of the Modified Preisach Model Based on the Value of B  The following discussion is made in reference to the flowchart in Figure 5.6. Start Valid = FALSE  Upwards Going Trajectory  As the upwards going trajectory except that the formula for the conditional branches are different  No  Yes  Yes Toggle value of direction variable  Change In Direction  No  No  j = 29 - i i=j Calculate r and C for new branch  Reversal Data Stack Not Empty Yes  No  STATE ptr++ Store H n , j, C, r, B n on top of reversal data stack  Minor Loop Closure In This Segment Yes  Calculate µ and B pv  No  Return Yes Calculate H* and B* i  B >= Upper Bound No  Retrieve r and C Calculate µ and B pv  Valid = TRUE  Minor Loop Closed Yes Retrieve H* and B* STATE ptr = 2 Retrieve r and C Calculate µ and B pv Return  Return  Return  Figure 5.6: Flowchart for the hysteresis algorithm based on B As will be explained later, the number of divisions that are required to calculate the output and 110  Chapter 5. Implementation Issues update the state of the model need to be minimized. The newly proposed Rµk mechanism requires an instance of the hysteresis model for every tube that uses it except for the innermost tube. The input to these models is based on an average value of the magnetic field density as opposed to the magnetic field intensity. In order to use the algorithm as presented in the previous section, the estimate of the value of µ would need to be inverted for every iteration of the solution. This is ¯ that is used is calculated after the computationally very expensive. Furthermore, the value of B updated state of the overall model is obtained. Thus, the algorithm that is presented above can be ¯ does not vary as the state of the hysteresis model is iterated. greatly simplified since the value of B The validity of the solution of the hysteresis model is checked based on values of B instead of ¯ is larger the values of H. For example, a closure of a minor loop is detected if the magnitude of B than the magnitude of B at the end of the current minor loop and the minor loop closes in the current segment. This approach is possible since B either increases or decreases monotonically as H increases or decreases. ¯ remains fixed as the state of the hysteresis model is obtained. As mentioned above, the value of B As Figure 5.6 shows, this greatly simplifies the algorithm from its original form in Figure 5.4. The ANSI C code that implements this algorithm is given in Appendix C.  5.1.5  Modification of the Basic Circuit  The previous sections provide the necessary tools for the implementation of the basic circuit. This section provides the additional details that are required to implement the mechanisms that are presented in Sections 4.2.2 and 4.2.3. Specifically, the derivatives of the mmfs of the circuit and the lookup tables for Λ, Γ, and gz need to be obtained. As was mentioned in Section 4.1, the derivatives of most quantities tend to be quite noisy. The derivatives of the circuit mmfs are no exception. The derivatives are determined in a two step process. First the derivative is calculated by using the backward Euler integration rule that is defined in Equation 5.1. The derivative is then filtered with a lowpass digital filter. An infinite impulse response (IIR) filter was chosen because compared to a FIR filter, the order of an IIR filter is lower for the same amount of attenuation. Thus, the number of calculations that are necessary to compute the current output and the data storage that is required for an IIR filter are lower than an equivalent FIR filter. However, IIR filters can suffer stability problems and their phase response is in general nonlinear. The phase response of the designed filter in the frequency range of interest is almost linear so the phase response was not deemed to be an issue. The poles of the resulting filter need to be checked to ensure that they are not too close to the unit circle in the z-domain. Rounding and quantization errors can cause IIR filters to become unstable if the coefficients of the filter are inappropriately selected. A second order maximally flat filter was designed to filter the generated derivatives. A cutoff frequency is set to be 5 kHz. This ensures that the filter does not overly affect the frequencies of 111  Chapter 5. Implementation Issues interest. The transfer function of this filter is given by: fLP (z) =  Kz −1 (1 − z −1 ) 1 + a1 z −1 + a2 z −2  (5.8)  The block diagram of the minimal realization of the filter is shown in Figure 5.7 below. The parameters of the filter are tabulated in Table 5.1 for two timesteps. The filter is primarily used to filter the noise that occurs for high frequency excitations. As a result, the noise that is generated at lower frequencies is mostly unaffected by the filter. This does not pose a significant problem because the effect of the noise at lower frequencies is far less than at higher frequencies. x  0.5  2K  z  y  -1  a1  0.5  z  -1  a2  Figure 5.7: Minimal realization of the IIR filter  Table 5.1: Parameters of the IIR filter Parameter  Value T = 25 µs  T = 50 µs  K  +0.3636759  +0.9151538  a1  −0.9653129  −0.1895345  a2  +0.3289887  +0.1046883  The lookup tables for Λ and Γ are relatively easy to implement. The values between the data points are linearly interpolated. In order to speed up the execution of the lookup table, the previous 112  Chapter 5. Implementation Issues region for the past value of F˙ can be stored as a start point in the search for the region of the present value of F˙ . The lookup table for gz is more challenging to implement. The values of the function of gz could be resampled in a grid with fixed cell sizes in order to simplify the implementation of the lookup table. However, the extreme variation of the slope requires a very fine mesh. This can greatly increase the time that is required to search for the correct region of the current values of H and B. Furthermore, anomalies can be potentially present in the resampled curve. This issues are avoided if the data that defines gz is not changed. Consider a typical cell that is present in the definition of gz that is depicted in Figure 5.8 below.  B  BH  (H2 ,B2H ,h2H ) (H1 ,B1H ,h1H ) (H,B, gz ) (H2 ,B2L ,h2L )  BL (H1 ,B1L ,h1L )  H Figure 5.8: A typical cell in the definition of gz  The value of gz at (H, B) can be determined by first defining the following ratios based on the values at the corners of the cell:  rH = = and  (BL − B1L )2 + (H − H1 )2 (B2L − B1L )2 + (H2 − H1 )2  (5.9)  H − H1 H2 − H 1  rB =  B − BL BH − BL  (5.10)  where BL and BH are obtained by storing the slopes and B-intercepts of the data e.g. BL = 113  Chapter 5. Implementation Issues µH + Bpv . How the data is stored and looked up is discussed next. Given the definitions of rH and rB , the height of the function gz can be obtained by: gz (H, B) = (hH − hL )rB + hL  (5.11)  = (h2H − h1H )rH + h1H  (5.12)  where hH  hL = (h2L − h1L )rH + h1L  (5.13)  The values of h2h , h1H , etc. need to be stored in a very specific order. The required order is the result of how the current cell is found. For a given (H, B) the correct cell is determined with the use of two lookup tables: one for the values of µ and the other for the B-intercepts Bpv . The data is stored with the format that is given in Table 5.2. Note that fm (n) is either µ(m, n) or Bpv (m, n). Table 5.2: Data structure for µ and Bpv 1  2  3  Bindex  13  14  15  −125 .. .  f1 (1) .. .  f1 (2) .. .  f1 (3) .. .  ..  Hindex  .. .  .. .  .. .  fm (n)  ..  −25  f7 (1)  f7 (2)  f7 (3)  ···  ···  f7 (13)  f7 (14)  f7 (15)  0 .. . .. . +100  f8 (1) .. . .. . f14 (1)  f8 (2) .. . .. . f14 (2)  f8 (3) .. . .. . f14 (3)  ··· . .. . ..  ··· . ..  f8 (13)  f8 (14)  f8 (15)  ···  . .  The correct cell is found but first finding the index for H. The index for B is determined by comparing B to the values of the magnetic field on the boundaries of the potential cell as shown in Figure 5.8 as BL and BH . The index is incremented by one if B  BH and decremented by one  if B < BL . For cases in which either the index for B or the index for H falls outside of the bounds of the tables for µ and Bpv then gz (H, B) = 1. With the indices determined the ratios rH and rB can be calculated. 114  Chapter 5. Implementation Issues Similar to the lookup tables for Λ and Γ for the region of F˙ , the indices for H and B can be stored from the previous timestep as a start point. While this does not pose a problem for determining the index for H, care must be taken for determining the index for B. If the index for H changes from the previous timestep then it is possible that using the index for B from the previous timestep will not result in finding the correct region. This is the case if the starting index for B is too large for the new index of H. Thus, the previous index for B is checked first for the new index of H and if the index for B is too large then it is set to a predetermined maximum value for that given index of H. The values of gz at the corners of the cells are stored similarly to µ and Bpv except that the data for the top and bottom boundaries are stored together. This is required because the shapes of all of the cells do not have four sides. In particular, the cells that are adjacent to the initial magnetization curve only have three sides. Although the search mechanism that utilizes tables for µ and Bpv can find the correct cell, it can not distinguish between a cell that has four sides or three sides. To mitigate this problem the data for the corners that lie on the initial magnetization curve is repeated three times. For example, consider the two cases that are shown in Figure 5.9. n 1  }nn 1  n 1 n 1 n  n n 1  }  n 1 n n 1  H1  n 1  H2  H2  H1  (a) H1 < 0  (b) H2 > 0  Figure 5.9: Three sided cells near the initial magnetization curve For the case shown in Figure 5.9(a) the values of gz for H1 are the same for n − 1, n, and n + 1  since they all describe the same point. Similarly, for the case in Figure 5.9(b), the values of gz for H2 are the same for n − 1, n, and n + 1. The remaining values of gz in both cases are in general different.  The table that stores the corner values of gz is constructed with double the number of rows as the tables for µ and Bpv . The row index for the table of stored h-values (values of gz at the corners of the cells) is given by 2m − 1. This row corresponds to the values of h for H1 . The value of the column index that corresponds to the lower boundary of the cell that contains (H, B) in Figure 5.8 is equal to n. Given its similarity to the tables for µ and Bpv , the table of h-values is not shown herein. With the values stored at h(2m − 1, n), h(2m − 1, n + 1), etc. the value of gz (H, B) can be determined.  115  Chapter 5. Implementation Issues In order to minimize the number of divisions that are required, the denominator for Equation 5.9 is inverted beforehand and stored as a array. Likewise, Equations 5.9 – 5.13 are lumped together so that only one devision is made after the resulting numerator and denominator is computed. The benefit for doing this is described later. The resulting ANSI C code that was written for the implementation of the lookup tables can be found in Appendix C as part of the determination of the scaling factor for the tube resistances.  5.1.6  Putting it All Together  The preceding sections give the basic building blocks that are necessary to represent the modified basic circuit in its digital form. However, the discussion as yet has not made any reference to how the overall model is solved. An approach that can be used to iteratively solve the model is detailed here. Ideally, solving the circuit should not require several iterations to find the solution. It was found that it is most likely impossible to solve the circuit without resorting to resolving the equations until all of the constraints on the circuit values are met. Even with a timestep of 1 µs, the model still did not remain stable when no iterations were performed. Unfortunately, iteratively solving the model makes it difficult to guarantee that the algorithm can perform in realtime. The best that can be done for an iterative approach is to calculate a theoretical upper bound on the number of iterations. A hybrid approach that allows the solution to iterate but then limits the total number of iterations per timestep to a predetermined number could be used. In this approach, if the limit is reached then the most recent solution is used as the output of the current timestep. In fact, as described above, it is this approach that is implemented since the maximum number of iterations is limited to avoid the solution infinitely “bouncing” between two values. In the implementation that is presented in this work, the Rµk and Rgz mechanisms are only allowed to modify the values of the circuit resistances at the beginning of the current timestep. Both of the mechanisms could be allowed to vary the values of resistances during the iterations of the solution. However, the improvement in the output of the model is negligible compared to the computational effort that is required to produce the output. Thus, the limitation of only allowing the values to change at the beginning of the timestep is imposed on the implementation that is given here. The first step in the formulation of the solution is to write the circuit equations in matrix form i.e. the circuit values can be expressed in the following form: F =  Z  φ  (5.14)  The values for F , Z, and φ in Equation 5.14 are obtained by systematically deriving the equations of the discretized basic circuit using Kirchhoff’s voltage law i.e. the mmf drops around 116  Chapter 5. Implementation Issues the paths that are taken by φ1 , φ2 , . . . , φn are equated to zero. A set of n equations can, therefore, be written. Consider the specific case of a three tube model that has been discretized as shown in Figure 5.10 below.  R1  F R1  R2  F R2  R3  F R3  φ1  L m1  FL 1  T  L m2  φ2  T  FL 2  L m3  φ3  T  FL 3  F Figure 5.10: Discretized three tube model Using the variables that are given in Figure 5.10, the resulting system of equations can be written as:    Lm1 FR 2 − FR 1 − FL 1  R1 + R2 + T       FR 3 − FR 2 − FL 2  =  − R2          F − FR 3 − FL 3 0  −R2 R2 + R3 +  Lm2 T  −R3    0  φ1        −R3   φ2    Lm3    R3 + φ3 T  (5.15)  The system of equations in Equation 5.15 assumes that F is known. If φ3 is known, such as  in the case of the determination of the position of the rotor of a SRM, or the magnetic equivalent circuit is part of a larger electric equivalent circuit then the systems of equations needs to be reformulated. For instance, in the latter case, F is replaced by: F =  Nl Rw  v(t) − N  φ3 (t) − φ3 (t − T ) T  (5.16)  where v(t) is the externally applied voltage, N is the number of turns of the coil that couples the 117  Chapter 5. Implementation Issues electric circuit to the magnetic circuit, and Rw is the winding resistance of the coil. In all of these cases the procedure for solving the Equation 5.14 or its equivalent remains the same. One thing that became very clear with the formulation of the circuit in this way is the values of µ for the tubes need to be inverted every time that they change value. This is because the reluctances of the circuits are inversely proportional to µ as given in Equation 3.16. Divisions take significantly more time to compute than multiplications. This holds true from both general purpose CPUs or DSPs. The solution of the circuit in this manner requires potentially many divisions per iteration of the solution. The number of divisions that are required per iteration is greatly reduced if the circuit that is shown in Figure 5.10 is represented using Norton equivalents instead of Th´evenin equivalents i.e the series mmf sources and reluctances can be transformed into equivalent flux sources and reluctances in parallel. The result of doing this for a three tube model is shown in Figure 5.11. The values of φR1 , φR2 , etc. are given by −Bpv A where Bpv corresponds to the B pivot point of  the appropriate hysteresis model. Similarly, the values of φL 1 , φL 2 , etc. are given by −φ1 (t − T ), −φ2 (t − T ), etc. respectively.  The circuit shown in Figure 5.11 is solved using Kirchhoff’s current law i.e. the fluxes entering  each node of the circuit must add up to zero. The resulting system of equations that correspond to the three tube circuit that is shown in Figure 5.11 can be written as:       1 T φR1 − φL 1   − R1 − Lm1        T  = φR2 − φL 2 + φL 1    Lm2       1 − φR1 − φR2 − φR3 − φ3 R1  T Lm2 1 T T − − − R2 Lm1 Lm2 1 R2    1  F1  R1     1  F2    R2   1 1 1   F3 − − − R1 R2 R3 (5.17)  where: φ3 =  T F − F3 Lm3  (5.18)  Note that it is written in this way because for the determination of the position of the rotor of a SRM, the flux is known instead of the total mmf. Equation 5.17 can be solved first to determine F3 . F can then be computed from Equation 5.18 once F3 is known. Like the circuit in Figure 5.10 that uses Th´evenin equivalents, Equation 5.17 can be reformulated based on what inputs are known. Examining Equation 5.17 reveals that it is written in the form: φ =  G  118  F  (5.19)  Chapter 5. Implementation Issues  L1  φ  φR1  F1  L m1  R1  L2  φ  T  φR2  F2 F3  φ3  R2  φR3  R3  L m2 T  F  L m3 T  L3  φ  L m3 T  Figure 5.11: Norton equivalent discretized three tube model  For the discussion that follows, the matrix G refers to a matrix of the form given in Equation 5.17. Notice that the reluctances in the G matrix are inverted. Thus, the values of µ that are obtained from the hysteresis model do not need to be inverted. The values of the circuit “inductances” can be calculated such that they are already inverted. However, the matrix G itself still needs to be inverted. For matrices of low order it is generally more efficient to determine the form of the inverse and calculate the coefficients of the inverse directly. The inverse of the matrix G can be obtained by: G−1 =  1 adj(G) det(G)  119  (5.20)  Chapter 5. Implementation Issues where: det(G) and adj(G) are the determinant and adjoint of the matrix G respectively. For the example of the three tube model, the adjoint of G is given by:   a11 a12 a13   adj(G) = a21 a22 a23  a31 a32 a33  (5.21)  where: a11 =  T T 1 + + R2 Lm1 Lm2  1 1 1 + + R1 R2 R3  a12 =  T 1 1 + R1 R2 Lm2  1 1 1 + + R1 R2 R3  a13 =  1 T 1 + R2 Lm2 R1  1 T T + + R2 Lm1 Lm2  −  1 R22  a21 = a12 a22 = a23 =  1 1 1 + + R1 R2 R3 1 T 1 + R1 Lm2 R2  1 T + R1 Lm1  −  1 R12  1 T + R1 Lm1  a31 = a13 a32 = a23 a33 =  1 T + R1 Lm1  1 T T + + R2 Lm1 Lm2  −  T2 2 Lm2  while the determinant of G is: det(G) = −  1 T + R1 Lm1  a11 +  T 1 a21 − a31 Lm2 R1  (5.22)  Notice that the G matrix is symmetrical. As a result, its inverse is also symmetrical. The implication of this is some of the entries of the inverse are repeated and do not need to be recomputed. If any of the parameters of the tubes change then the adjoint and determinant of G need to be recalculated. Additionally, the column vector of fluxes also needs to be updated as the parameters of the tubes change. As mentioned above the solution is iterated until the solution is bounded for the current definitions of the reluctances of the tubes or the number of iterations hits a predefined limit. The flow of the overall algorithm that was implemented is shown in Figure 5.12. 120  Chapter 5. Implementation Issues Initialize turning point history of hysteresis models Initialize all other variables  Get new value of input flux Calculate the new values of the model inductances iterations = 0 changed = TRUE  iterations++ changed = FALSE Calculate the terms of the adjoint of the G matrix Calculate 1 det [G] Calculate the flux column vector Calculate H of the outermost flux tube Update the state of the hysteresis model of the outermost flux tube  Hysteresis Model Is Valid  No Update tube reluctance changed = TRUE  Yes  Repeat the items in the dashed box for the other tubes  iterations = 15  Yes changed = FALSE  No  No  Model Output Is Valid Yes  Value Of µk′ Is Valid  No Update hysteresis model of µk′  Yes Store state of model Calculate derivatives of circuit mmfs Filter derivatives of circuit mmfs Calculate output F of the model  Figure 5.12: Main flowchart for the implemented model 121  Chapter 5. Implementation Issues The flowchart for the main function is given for the case that is used for determining the position of the rotor of a SRM i.e. for each instance of model, the total flux is known and the mmf drop across the element of material needs to be determined. The ANSI C code for the main function of the algorithm is given in Appendix C.  5.2  Solution Convergence, Stability, and Computation Time  This section details some of the issues that are associated with the realtime implementation of the model that is presented in this work. With the exception of the computation time, these issues are only tersely addressed due to their complexity.  5.2.1  Solution Convergence  The convergence of the solution in every timestep is required. If at any timestep the solution fails to converge then the model fails. As a result, it is important that the convergence of the solution is guaranteed. For this reason the methodology for solving the model was chosen. Unfortunately, it is difficult to rigorously prove the convergence of the model that is proposed in this work. After the software code was fully debugged, the solution always converged at every timestep. The author of this work believes that the convergence of the solution at every timestep is ensured by the shape of the relationship between H and B in the hysteresis model. An increase in H always produces an increase in B. Likewise, a decrease in H always produces a decrease in B. The implication of these trends is the slope of the relationship between H and B is always positive; thus, the reluctance of the tubes is always positive. Note that this is distinct from the relationship between the value of H on the surface of the material and the average value of B in the material. As is seen in Chapter 4, the slope can be negative for this case. Similar to the circuit reluctances the circuit “inductances” are always positive. Consequently, there are no local minima or maxima in the relationship between F and φ for any of the circuit elements. A local minima or maxima can cause the solution to not converge as is shown in the fictitious example below. Consider the iterative solution at one timestep for a two tube model below. In the figures that are presented below the bold lines in the definitions of the tube reluctances indicate the current segment that is being used to solve the circuit. Also the “inductance” of the innermost tube that is given by the 0.5 A-t/Wb resistor and 5 A-t mmf source remains fixed throughout the iterative process – as it is in the actual implementation of the model. The input to the circuit is the total flux of 15 Wb. In the first iteration of the solution of the model, the values of φ1 and φ2 can determined by solving the circuit in Figure 5.13(c). This results in φ1 = 5 Wb and φ2 = 10 Wb.  122  Chapter 5. Implementation Issues  F  F 19.5  0.25  1  1  0.25 0.5  φ1  2  0  (a) Tube 1 reluctance definition  φ2  9.75  (b) Tube 2 reluctance definition  φ1 0.5  0.5  5  φ2 15  1 (c) Circuit diagram  Figure 5.13: Iteration 1  F  F 19.5  0.25  1  1  0.25 0.5  φ1  2  0  (a) Tube 1 reluctance definition  φ2  9.75  (b) Tube 2 reluctance definition  φ1 0.25  15  0.25  0.5  φ2  1 (c) Circuit diagram  Figure 5.14: Iteration 2 123  5  Chapter 5. Implementation Issues  F  F 19.5  0.25  1  1  0.25 0.5  φ1  2  0  (a) Tube 1 reluctance definition  φ2  9.75  (b) Tube 2 reluctance definition  φ1 0.25  15  1  0.25  0.5  φ2  5  19.5 (c) Circuit diagram  Figure 5.15: Iteration 3 As can be seen by the definitions of the tube reluctances in Figures 5.13(a) and 5.13(b), the current segment that is being used for the innermost tube is incorrect whereas the current segment for the outermost tube is correct. The correct definition for the innermost tube reluctance is then used in the second iteration. The circuit in Figure 5.14(c) is then solved to obtain new values of circuit fluxes φ1 = 5.43 Wb and φ2 = 9.57 Wb. Notice that the value of φ1 increases whereas φ2 decreases. The values of the circuit fluxes follow a “waterbed” effect – the increase of one value comes at the expense of the decrease in other values. The solution of the second iteration results in the definition of the outermost tube being violated. Thus, the circuit needs to be resolved for the correct definition of the reluctance of the outermost tube. Solving the circuit in Figure 5.15(c) yields φ1 = 4 Wb and φ2 = 11 Wb. This indicates that the definition of the reluctance of the outermost tube should be the one that is used in the second iteration. However, the solution of the previous iteration indicates that the current definition should be used. Since there is no way of rectifying this problem, the solution of the model fails to converge. The solution of this simple two tube circuit illustrates the problem with local extremum. In this case, a local minima exists at φ1 = 9.75 Wb. This condition can never occur in the solution of the real model because local minima and maxima do not exist in the space that defines the solution of the model. However, as is discussed above, care needs to be taken in the practical implementation of the model to ensure that quantization and rounding errors do not cause the solution to “bounce” 124  Chapter 5. Implementation Issues between two solution points as is shown in the example above.  5.2.2  Solution Stability  Besides converging at every timestep, the solution of the model must remain stable. Most of control theory deals with linear time invariant (LTI) systems. Clearly the model that is presented in this work is not a LTI system. Therefore, it is more difficult to analytically prove the stability of the model. The stability analysis is further complicated by the fact that the pivot points (Hpv or Bpv ) of the tube reluctances need to be modeled as inputs since their values do not solely depend on the previous states of the model. Unfortunately, this necessitates the use of multivariable control theory. In this case, the resulting model for stability analysis is a multiple input, single output (MISO) system. A MISO system is a specific instance of a multiple input, multiple output (MIMO) system. Generally, the stability analysis of MIMO systems is more involved compared to single input, single output (SISO) systems. As was mentioned above, the actual analysis of the stability was not performed in this work. However, the framework for the analysis is given below. Using of a set of nodal or loop equations as given in Equations 5.14 or 5.19 is an efficient way of solving the model; however, they are not convenient for determining the stability of the model. The stability is better determined with a state space model of the system. In this case, a discrete state space representation of the modified basic circuit can be obtained. A linear time varying discrete state space system is characterized by the following equations: x(k + 1) = Ψ(k)x(k) + ∆(k)u(k)  (5.23)  y(k) = C(k)x(k) + D(k)u(k)  (5.24)  where x(k) is a n row state column vector y(k) is a m row output column vector u(k) is a r row input column vector Ψ(k) is a n × n state matrix  ∆(k) is a n × r input matrix  C(k) is a m × n output matrix  D(k) is a m × r direct transmission matrix There are an infinite number of possible state space representations for any system since the choice of states for the state vector x(k) do not necessarily need to correspond to the physical states of the system. However, there are disadvantages to choosing states with no physical meaning. In 125  Chapter 5. Implementation Issues this case, the natural choice of the states are the values of φ1 , φ2 , . . . , φn from the previous timestep. The chosen states physically represent the past history of the circuit “inductors”. As with the circuit representation above, the values of Ψ(k), ∆(k), C(k), and D(k) depend on the validity of the states in the next timestep. Thus, if this state space representation is used to solve the circuit then the solution needs to be iterated until the calculated next states are valid. With the above comments in mind, the equivalent state space representation of a n tube circuit is given by:     φ1 (t) Ψ11  .   .  ..   ..     . = .  .   .  .   . φn (t)  ··· .. .  Ψn1 · · ·  φn (t) = Ψn1 · · ·  ··· ..  .  ···  ···     Ψ1n φ1 (t − T ) ∆11     ..   ..   ... .  .    + . ..  ..    . .  .   .  Ψnn  Ψnn  φn (t − T )    ··· .. .  ∆n1 · · ·   φ1 (t − T )   ..   .     + ∆n1 · · · ..   .   φn (t − T )  ··· ..  .  ···  ···    ∆1n+1 F (t)   ..    .    FR 1    ..    ..  .  .   ∆nn+1  ∆nn+1  (5.25)  FR n    F (t)    FR 1     .   ..    FR n  (5.26)  Equations 5.25 and 5.26 assume that the input mmf F is known. If φn or the voltage of the coil that is driving the magnetic system is known instead then F becomes one the states of the x(k) vector. The output of the model then would likely become F as well. The state space system that is described in Equations 5.25 and 5.26 can be used to determine the stability of the model. However, the values of the Ψ and ∆ matrices depend on the trajectory of the input F and the pivot points of the tube reluctances. For a given periodic input it is possible to track the movement of the gains of the system. However, it is important to note that the since the proposed model is not a SISO system, the values of the gains have an associated input direction vector as well. If the time dependent gains of a set of periodic inputs are determined then any input that is bounded by this set of periodic inputs has bounded gains. In this way the stability of the model can be predicted for a range of periodic inputs. Fortunately, most real world electromagnetic systems are excited by periodic inputs; thus, a good measure of the stability can be determined. This determination is left for future work One point that has been overlooked thus far is the effect of the coupling between the total flux and total mmf. Equation 5.18 shows the relationship for a three tube system. It was found that if the total mmf is used as input then the total flux is smooth. However, if the total flux is used as the input then the output periodically rings. This is due to the coupling of the input and output by the Lmn inductance. The ringing can be significantly reduced if the rate of change of the mmf that is 126  Chapter 5. Implementation Issues used for the Lmn inductance value is the nth layer mmf and not the output mmf. The output can ring because the input is infinitely stiff; thus, any numerical ringing is directly seen on the output if the circuit can not absorb it. If the input is significantly decoupled from the output then the output will not ring. This can be the case in circuits that are driven by a voltage source. In this case the input flux is the integral of the coil voltage minus the product of the coil resistance and current. As long as there is enough resistance between the stiff voltage source and the coil current then the output mmf (coil current) will not ring. In any case, this “issue” does not diminish the applicability of the model that is developed in this work – only that care must be taken on how the model is implemented as part of a larger model.  5.2.3  Solution Complexity  The whole direction for the choice of the implementation that is presented in this chapter is based on the need for the proposed model to be solved in realtime. This section provides the analysis that was performed to determine whether or not it is likely that the model can be used as part of the position estimation algorithm for a SRM that is presented in Chapter 1. Consider the multiphase lumped parameter model of a 6/4 SRM that is given in Figure 1.2. Due to the symmetry of the model only half of the circuit actually needs to be solved. Therefore, twelve position independent instances of the proposed model need to be solved every timestep. The timing for position dependent instances of the proposed model are more difficult to determine since the models would potentially need to be resolved several times before the position is determined. Furthermore, errors in the position from previous timesteps may cause the position estimate to oscillate. These issues can be avoided if the stator and rotor pole tips are modeled with time independent lumped reluctances. The loss in accuracy is likely to be far outweighed by the gain in solution speed and the avoidance of oscillations in the predicted rotor position. This analysis assumes that this choice is taken. As is mentioned throughout this chapter, the implementation that is given in this chapter was coded in ANSI C. It is this code that was used to time one instance of the model. The input flux to the model is a triangular waveform that generates a peak value of H that roughly corresponds to the cases in the previous chapter with Hp = 1000 A/m. The flux varies from zero to its peak value with a frequency of 1kHz. A triangular waveform was chosen because the flux varies in this manner in the poles of the machine if the leakage flux paths are ignored. The flux in the backplane of the stator and the body of the rotor follows a more complicated waveform. However, the rate of change of the flux in these parts of the machine is no more than in the poles. Thus, the triangular waveform gives a good indicator of the numerical complexity of the proposed model for a sensorless SRM application. The flux waveform would generate a rotation speed of 10,000 rpm in a 6/4 SRM. It is important to note that the timing is ultimately dependent on the rate of change of the mmfs in the model. A higher rate of change requires more iterations of the hysteresis models; therefore, 127  Chapter 5. Implementation Issues the time required to find the solution of the model increases as the rate of change increases. The timing analysis was done on a 1.8 GHz Pentium 4 desktop computer. The model was solved for 10,000 timesteps in order to improve the accuracy of the timing. The ANSI C code that was used to measure the time to solve the model is given in Appendix B. The average time to solve the model was found to be 1.3 µs per instance of the proposed model when the above described input flux waveform was used. Therefore, the average total time to calculate the twelve position independent instances of the proposed model is 15.6 µs. If the algorithm was solved with a 50 µs timestep then only 31% of the available time is being used. If a 25 µs timestep is used then 62% of the available time is used. For both timesteps there is a large margin available to make the necessary calculations and table lookups to determine an estimate of the position. The margins are likely to improve if the algorithm is optimized on a DSP processor. The maximum speed of the machine dictates the timestep that is required to solve the model. In order to minimize the error that is introduced by discretizing the flux waveform, at minimum of 10 samples per period are required [69]. In the case of a 1kHz waveform this corresponds to a minimum timestep of 100 µs. Thus, the model that is solved with a 50 µs timestep is suitable for 6/4 SRMs with rotation speeds up to 20,000 rpm. Similarly, a 25 µs solution timestep is likely to be able to sufficiently model a 6/4 SRM with rotation speeds up to 40,000 rpm. The above timing analysis strongly indicates that it is feasible to use the model that is proposed in this work as part of the multi-phase lumped parameter model for the purpose of determining the position of the rotor of a SRM.  5.3  Chapter Summary  This chapter details a specific implementation of the model that is proposed in this work. The implementation of the model has definite advantages over other similar approaches. The piecewise linearization of the relationship between H and B in the modified Preisach hysteresis model coupled with discretization of the circuit elements of the model with the Backward Euler integration rule provides an upper bound on the number of the iterations that are required per timestep. Consequently, a solid measure of the numerical complexity of the model can be determined. The practical considerations of implementing the Modified Preisach model is given in this chapter. This includes a new method for ensuring that the stack that contains the reversal data does not overflow. Flowcharts are also given to illustrate how the integrity of hysteresis model is maintained as the input H is varied within a given timestep as the overall model is iterated. The details of the implementation of the lookup tables is given in this chapter. In particular, the details for the structure and lookup of the 2D table for the Rgz k mechanism are given since its implementation is not trivial. The determination of the rate of change of the circuit mmfs is also given. A simple numerical differentiator is used in conjunction with a low order IIR filter to 128  Chapter 5. Implementation Issues produce the derivatives of the mmfs. As is described in this chapter, a Norton equivalent circuit is used to represent the overall model. The circuit equations that result contain the minimum number of divisions that are required to solve for the circuit mmfs. This is advantageous because divisions are very expensive to compute. This chapter closes with a discussion on the proposed model’s convergency, stability, and computation complexity. The convergence and stability of the model were only tersely examined; therefore, further work needs to be done in these areas. The numerical complexity of the model was explored with a specific case. The results of this case strongly indicate that the proposed model is suitable for use as part of the multi-phase lumped parameter model that is used to determine the position of the rotor of a SRM.  129  Chapter 6  Conclusions and Future Work As is stated in the beginning of Chapter 1 the purpose of this work was to develop a ferromagnetic model that has certain specific features. These features are determined by the need to model the behaviour of the stator and rotor of a switched reluctance machine for either the offline simulation of the machine or for the online determination of the position of the rotor. Given the requirements of the intended application of this model, the desirable features for the model are: • accurate over a wide range of input frequencies and saturation levels of the material; • only requires to be initially tuned — thereafter the parameters of the model remain fixed; • can be potentially used in realtime. As the results at the end of Chapter 4 show, the first point is achieved. The model’s performance is shown to be sufficiently accurate over both a wide range of frequencies and saturation levels of the material. Furthermore, the performance of the model is achieved without resorting to retuning the model as is required by the second point. The newly proposed model was compared to a model that was tuned for a specific input waveform with the use of a normalized vertical least-squares metric. The results clearly show that the proposed model outperforms a model that has static tube resistances. The last point is addressed in Chapter 5. The solution any model that is to be used in realtime is required to converge at every timestep, remain stable, and be computed predictably within a fixed time frame. These constraints motivated the choice of the implementation that is given in Chapter 5. Unfortunately, the highly non-linear nature of the relationship between H and B in the hysteresis model requires the solution to be iterated at every timestep. The backward Euler integration rule coupled with the piecewise linearization of the relationship between H and B does theoretically allow the solution to be solved in one iteration. However, testing of the hysteresis algorithm showed that no reasonable value of the timestep produced a solution that is stable. Requiring iteration does not overly diminish the appeal of the presented implementation since the author of this work believes that the solution is guaranteed to converge at every timestep and remain stable. Furthermore, an upper bound on the number of iterations can be predicted to ensure that the realtime operation of the model can be maintained. Chapter 5 contains the starting point for assessing the convergence and stability of the model with the presented implementation. Further work is required to formally prove the author’s belief. The time complexity of the algorithm was 130  Chapter 6. Conclusions and Future Work explored by coding the model in ANSI C. One instance of the model for a 1 kHz triangular input flux took on average 1.3 µs per timestep to compute on a 1.8 GHz PC computer. This result shows that the proposed model will most likely be feasible for use as part of the multi-phase lumped parameter model for the prediction of the position of the rotor of a SRM.  6.1  Contributions  The academic contributions that are produced as the result of this work are spread throughout this thesis. This section summarizes these contributions. Specifically, the contributions that the author of this work considers to be significant are: 1. the piecewise linearized implementation of the modified Preisach model including: i. basic implementation details (Chapter 2) ii. modification of the basic implementation that can account for the variation of H as the solution iterates during a single timestep (Chapter 5) iii. modification to the basic model that prevents stack overflows (Chapter 5) iv. modification to the basic model that uses B instead of H to check whether the solution of the model is valid or not (Chapter 5) 2. the proposed structure for the flux tubes of the model (Chapter 3); 3. the method for systematically adjusting the values of the calculated DC resistances of the flux tubes in order to fit the response of the model to the response of the actual material (Chapter 3); 4. the first (Rµk ) mechanism that dynamically adjusts the values of the tube resistances in order to allow for a large range of frequencies and for a large range of input magnitudes that cause the material to saturate to some extent (Chapter 4); 5. the second (Rgz k ) mechanism that dynamically adjusts the values of the tube resistances for cases in which the material is not allowed to saturate to any extent (Chapter 4); 6. the systematic procedure for obtaining the lookup tables for the two mechanisms that are proposed in this work from experimentally obtained data (Chapter 4); 7. the implementation details of the model besides the hysteresis model including: i. discretization of the tube “inductances” that allows the value of the inductance to vary at any time during the solution of the model (Chapter 5) ii. the implementation of the lookup table for the Rgz k mechanism (Chapter 5) 131  Chapter 6. Conclusions and Future Work iii. the determination of the derivatives of the circuit mmfs with the use of a basic differentiator followed by a IIR filter (Chapter 5) iv. use of a Norton equivalent circuit for the minimization of the number of divisions in the computation of the solution (Chapter 5) 8. the analysis of the accuracy of the proposed model with the use of a normalized vertical least-squares metric (Chapter 4); 9. the timing analysis of the overall implementation with the use of ANSI C code running on a standard PC computer (Chapter 5). The resulting model that is the product of this work is the first, albeit major, step in the development of a class of models that can be used as part of the multi-phase lumped parameter model that describes a switched reluctance machine.  6.2  Future Work  The continuation of the work that is presented in this work has many potential avenues for future work. Some of the more promising future endeavours that can be pursued are given below. One of the more critical areas that needs to be addressed is how do the parameters of the model change as the geometry of the material changes. If the parameters can be shown to change in a predictable way then the model could be used as part of an optimization program for the design of devices such as SRMs or fast acting solenoids. Furthermore, it would lessen the burden of experimentally testing different shapes of the material after the trends are determined. The implementation of the model in the context of sensorless control of a SRM can be further explored. As was mentioned in Chapter 5, the mmf drop of each section of the core can be calculated separately in the multi-phase lumped parameter model for a SRM. Once the mmf drop of a given section is known then it does not need to be recalculated. The only potential exception to this is the position dependent pole tips in the stator and rotor. The solution of the pole tips along with the linear airgaps could be iterated until the incremental position that minimizes the error between the calculated mmf drop due to the position independent reluctances and the mmf generated by the pole tips and airgap at is found. However, this approach has two drawbacks; namely, it would add significant time to the overall computational time of the model and it would also potentially introduce oscillations in the predicted position of the rotor. As an alternative, it was proposed in Chapter 5 that the tip reluctances be modeled with the time independent flux tubes. A tradeoff study between the two approaches needs to be undertaken to determine the best approach. The model needs to be checked for grain orientated materials. One of the major differences between non-oriented and oriented materials is oriented materials lack of domain rotation in the preferred direction of magnetization. The other is the permeability of the material depends on the 132  Chapter 6. Conclusions and Future Work orientation of the magnetic field. The incorporation of a vector based Preisach hysteresis model could be used to model the orientation of the material. However, it is unclear how this would affect the definitions of the lookup tables for the two mechanisms that are proposed in this work. Finally, as is mentioned above and in Chapter 5, the proof of the stability of the model that is proposed in this work along with the proof that the solution is guaranteed to converge need to be generated. It is likely that the framework that is given in Chapter 5 can be the start point in this investigation.  133  Bibliography [1] Longya Xu and Chuanyang Wang. Accurate rotor position detection and sensorless control of SRM for super-high speed operation. In IEEE Transactions on Power Electronics, volume 17, pages 757–763, 2002. [2] Chris S. Edrington and Ray B. Sepe Jr. Sensorless super-high-speed switched reluctance generators. In IECON 02, volume 2, pages 1026–1031, 2002. [3] Babak Fahimi, Ali Emadi, and Raymond B. Sepe Jr. Four-quadrant position sensorless control in SRM drives over the entire speed range. In IEEE Transactions on Power Electronics, volume 20, pages 154–163, 2005. [4] Debiprasad Panda and V. Ramanarayanan. Accurate position estimation in switched reluctance motor with smooth starting. In Proceedings of IEEE International Conference on Industrial Technology, volume 1, pages 388 –393, 2000. [5] Debiprasad Panda and V. Ramanarayanan. An accurate position estimation method for switched reluctance motor drive. In Proceedings of I998 International Conference on Power Electronic Drives and Energy Systems for Industrial Growth, volume 2, pages 523–528, 1998. [6] J. P. Lyons, S. R. MacMinn, and M. A. Preston. Flux/current methods for SRM rotor position estimation. In Conference Record of the 1991 IEEE Industry Applications Society Annual Meeting, pages 482–487, 1991. [7] M. A. Preston and J. P. Lyons. A switched reluctace motor model with mutual coupling and multi-phase excitation. In IEEE Transactions on Magnetics, volume 27, pages 5423–5425, 1991. [8] Mehrdad Ehsani and Babak Fahimi. Elimination of position sensors in switched reluctance motor drives: State of the art and future trends. In IEEE Transactions on Industrial Applications, volume 49, pages 40–47, 2002. [9] Gabriel Gallegos-L´opez, Philip C. Kjaer, and T. J. E. Miller. High-grade position estimation for SRM drives using flux linkage/current correction model. In IEEE Transactions on Industrial Applications, volume 35, pages 859–869, 1999. [10] M. Ehsani, I. Husain, S. Mahajan, and K. R. Ramani. New modulation encoding technique for indirect rotor position sensing in switched reluctance motors. In IEEE Transactions on Industrial Applications, volume 30, pages 584–588, 1994. [11] G. Suresh, B. Fahimi, and M. Ehsani. Improvement of the accuracy and speed range in sensorless control of switched reluctance motors. In Proceedings of IEEE APEC’98, pages 770–777, 1998. 134  Bibliography [12] W. D. Harris and J. H. Lang. A simple motion estimator for variable reluctance motors. In IEEE Transactions on Industrial Applications, volume 26, pages 237–243, 1990. [13] A. Brosse and G. Henneberger. Different models of the SRM in state space format for the sensorless control using a kalman filter. In Seventh International Conference on Power Electronics and Variable Speed Drives, pages 269–274, 1998. [14] G. Suresh, B. Fahimi, K. M. Rahman, and M. Ehsani. Inductance based position encoding for sensorless SRM drives. In Proceedings of IEEE PESC’99, volume 2, pages 832–837, 1999. [15] J. Bu and L. Xu. Eliminating starting hesitation for reliable sensorless control of switched reluctance motors. In Conference Record of the 1998 IEEE IAS Annual Meeting, volume 1, pages 693–700, 1998. [16] S. Saha, K. Ochiai, T. Kosaka, N. Matsui, and Y. Takeda. Developing a sensorless approach for switched reluctance motors from a new analytical model. In Conference Record of the 1999 IEEE IAS Annual Meeting, volume 1, pages 525–532, 1999. [17] Tingna Shi, Changliang Xia, Mingchao Wang, and Qian Zhang. Single neural PID control for sensorless switched reluctance motor based on RBF neural network. In Proceedings of the 6th World Congress on Intelligent Control and Automation, volume 2, pages 8069–8073, 2006. [18] A. Khalil, S. Underwood, I. Husain, H. Klode, B. Lequesne, S. Gopalakrishnan, and A. Omekanda. Four-quadrant pulse injection and sliding mode observer based sensorless operation of a switched reluctance machine over entire speed range including zero speed. In Conference Record of the 2005 IEEE IAS Annual Meeting, volume 3, pages 2147–2154, 2005. [19] Nisai H. Fuengwarodsakul, Stefan E. Bauer, Johannes Krane, Christian P. Dick, and Rik W. De Doncker. Sensorless direct instantaneous torque control for switched reluctance machines. In 2005 European Conference on Power Electronics and Applications, page 10 pp, 2005. [20] Won-Sik Baik, Min-Huei Kim, Nam-Hun Kim, Dong-Hee Kim, Kyeong-Ho Choi, Don-Ha Hwang, and Jung-Soo Jang. Improved rotor position estimation for the sensorless control system of SRM. In Proceedings of IEEE ISIE 2005, volume 3, pages 877–880, 2005. [21] Mahesh Krishnamurthy, Chris S. Edrington, and Babak Fahimi. Prediction of rotor position at standstill and rotating shaft conditions in switched reluctance machines. In IEEE Transactions on Power Electronics, volume 21, pages 225–233, 2006. [22] Akitomo Komatsuzaki, Kazumasa Yoshida, and Ichiro Miki. A position sensorless drive technique for switched reluctance motor with consideration of magnetic saturation at low and medium speeds. In Conference Record of the 2006 IEEE IAS Annual Meeting, volume 4, pages 1995–2000, 2006. [23] Hongwei Gao, Farzad Rajaei Salmasi, and Mehrdad Ehsani. Inductance model-based sensorless control of the switched reluctance motor drive at low speed. In IEEE Transactions on Power Electronics, volume 19, pages 1568–1573, 2004.  135  Bibliography [24] Mohammad S. Islam, Iqbal Husain, Robert J. Veillette, and Celal Batur. Design and performance analysis of sliding-mode observers for sensorless operation of switched reluctance motors. In IEEE Transactions on Control Systems Technology, volume 11, pages 383–389, 2003. [25] X. D. Xue, K. W. E. Cheng, S. L. Ho, and D. K. W. Cheng. New estimation scheme of the arbitrary rotor position at standstill for the sensorless switched reluctance motor drive. In Proceedings of IEEE PESC’04, pages 1232–1238, 2004. [26] Syed A. Hossain, Iqbal Husain, Harald Klode, Bruno Lequesne, Avoki M. Omekanda, and Suresh Gopalakrishnan. Four-quadrant and zero-speed sensorless control of a switched reluctance motor. In IEEE Transactions on Industry Applications, volume 39, pages 1343–1349, 2003. [27] Virginie Raulin, Art Radun, and Iqbal Husain. Modeling of losses in switched reluctance machines. In IEEE Transactions on Industrial Applications, volume 40, pages 1560–1569, 2004. [28] Keunsoo Ha, Seok-Gyu Oh, Brian MacCleery, and R. Krishnan. An automated reconfigurable FPGA-based magnetic characterization of switched reluctance machines. In IEEE ISIE 2005, pages 839–844, 2005. [29] M. Krishnamurthy, D. Kaluvagunta, and B. Fahimi. Effects of high frequency excitation on the behaviour of a switched reluctance machine. In 2005 IEEE International Conference on Electric Machines and Drives, pages 186–192, 2005. [30] F. Sixdenier, L. Morel, and J. P. Masson. Introducing dynamic behavior of magnetic materials into a model of a switched reluctance motor drive. In IEEE Transactions on Magnetics, volume 42, pages 398–404, 2006. [31] J. T. Charton, J. Corda, J. M. Stephenson, and S. P. Randall. Dynamic modelling of switched reluctance machines with iron losses and phase interactions. In IEE Proc.-Electr. Power Appl., volume 153, pages 327–336, 2006. [32] T. J. E. Miller. Switched Reluctance Motors and their Control. Magna Physics Publishing and Clarendon Press, 1993. [33] T. J. E. Miller, editor. Electronic Control of Switched Reluctance Machines. Newnes, 2004. [34] Gordon Slemon. Magnetoelectric Devices Transducers, Transformers, and Machines. John Wiley and Sons, 1966. [35] W. MacLean. Theory of strong electromagnetic waves in massive iron. In Journal of Applied Physics, volume 25, 1954. [36] P. D. Agarwal. Eddy-current losses in solid and laminated iron. In Transactions AIEE, volume 78, pages 169–171, 1959. [37] S. R. Naidu. Time domain model for the ferromagnetic core, including the effects of hysteresis and eddy currents. In IEE Proceedings-A, volume 138, pages 44–50, 1991. 136  Bibliography [38] R. L. Stoll. The Analysis of Eddy Currents. Oxford University Press, 1974. [39] Enrico Dallago, Gabriele Sassone, and Giuseppe Venchi. High-frequency power transfomer model for circuit simulation. In IEEE Transactions on Power Electronics, volume 12, pages 664–670, 1997. [40] H¨ useyin Ak¸cay and Dogan G¨ okhan Ece. Modeling of hysteresis and power losses in transformer laminations. In IEEE Transactions on Power Delivery, volume 18, pages 487–492, 2003. [41] A. M. Oliveira, P. Kuo-Peng, M. V. Ferreira da Luz, N. Sadowski, and J. P. A. Bastos. Generalization of coupled circuit-field calculation for polyphase structures. In IEEE Transactions on Magnetics, volume 37, pages 3444–3447, 2001. [42] W. Chandrasena, P. G. McLaren, U. D. Annakkage, R. P. Jayasinghe, and E. Dirks. Simulation of eddy current effects in transformers. In IEEE Canadian Conference on Electrical and Computer Engineering, pages 122–126, 2002. [43] Jian G. Zhu, S. Y. R. Hui, and V. S. Ramsden. A generalized dynamic circuit model of magnetic cores for low- and high-frequency applications-part I: Theorectical calculation of the equivalent core loss resistance. In IEEE Transactions on Power Electronics, volume 11, pages 246–250, 1996. [44] Stanley H. Charap. Magnetic hysteresis model. In IEEE Transactions on Magnetics, volume MAG-10, pages 1091–1096, 1974. [45] D. C. Jiles and D. L. Atherton. Theory of ferromagnetic hysteresis. In Journal of Magnetism and Magnetic Materials, volume 61, pages 48–60, 1986. [46] D. C. Jiles and J. B. Thoelke. Theory of ferromagnetic hysteresis: Determination of model parameters from experimental hysteresis loops. In IEEE Transactions on Magnetics, volume 25, pages 3928–3930, 1989. [47] Z. J. Chen and D. C. Jiles. Modelling of reversible domain wall motion under the action of magnetic field and localized defects. In IEEE Transactions on Magnetics, volume 29, pages 2554–2556, 1993. [48] D. C. Jiles, J. B. Thoelke, and M. K. Devine. Numerical determination of hysteresis parameters for the modeling of magnetic properties using the theory of ferromagnetic hysteresis. In IEEE Transactions on Magnetics, volume 28, pages 27–35, 1992. [49] D. C. Jiles. A self consistent generalized model for the calculation of minor loop excursions in the theory of hysteresis. In IEEE Transactions on Magnetics, volume 28, pages 2602–2604, 1992. [50] F. Preisach. Uber die magnetische nachwirkung. In Zeitschhrift f¨ ur Physik, volume 94, pages 277–302, 1935. [51] M. A. Krasnosel’skii and A. V. Pokrovskii. Systems with Hysteresis. Springer Verlag, 1989.  137  Bibliography [52] G. Consolo, G. Finocchio, M. Carpentieri, E. Cardelli, and B. Azzerboni. About indentification of scalar Preisach functions of soft magnetic materials. In IEEE Transactions on Magnetics, volume 42, pages 923–926, 2006. [53] Marc De Wulf, Lieven Vandevelde, Jehudi Maes, Luc Dupr´e, and Jan Melkebeek. Computation of the Preisach distribution function based on a measured everett map. In IEEE Transactions on Magnetics, volume 36, pages 3141–3143, 2000. [54] J´ anos F¨ uzi. Analytical approximation of Preisach distribution functions. In IEEE Transactions on Magnetics, volume 39, pages 1357–1359, 2003. [55] Kurt Wiessen and Stanley H. Charap. Vector Preisach modeling. In Journal of Applied Physics, volume 61, pages 4019–4021, 1987. [56] I. D. Mayergoyz. Vector Preisach hysteresis models (invited paper). In MMM Conference, 1987. [57] I. D. Mayergoyz. Mathematical models of hysteresis. In IEEE Transactions on Magnetics, volume MAG-22, pages 603–608, 1986. [58] G. Biorci and D. Pescetti. Analytical theory of the behavior of ferromagnetic materials. In Nuovo Cimento, volume 7, pages 829–842, 1958. [59] S. R. Naidu. Simulation of the hysteresis phenomenon using Preisach’s theory. Proceedings-A, volume 137, pages 73–79, 1990.  In IEE  [60] S. Y. R. Hui, Jian G. Zhu, and V. S. Ramsden. A generalized dynamic circuit model of magnetic cores for low- and high-frequency applications-part II: Circuit model formulation and implementation. In IEEE Transactions on Power Electronics, volume 11, pages 251–259, 1996. [61] R. M. Del Vecchio. An efficient procedure for modeling complex hysteresis processes in ferromagnetic materials. In IEEE Transactions on Magnetics, volume MAG-16, pages 809–811, 1980. [62] Kurt Wiessen and Stanley H. Charap. A better scalar Preisach algorithm. In IEEE Transactions on Magnetics, volume 24, pages 2491–2493, 1988. [63] I. D. Mayergoyz and G. Friedman. Generalized Preisach model of hysteresis. In IEEE Transactions on Magnetics, volume 24, pages 212–217, 1988. [64] I. D. Mayergoyz, A. A. Adly, and G. Friedman. New Preisach-type models of hysteresis and their experimental testing. In Journal of Applied Physics, volume 67, pages 5373–5375, 1990. [65] I. D. Mayergoyz, G. Friedman, and C. Salling. Comparison of the classical and generalized Preisach hysteresis models with experiments. In IEEE Transactions on Magnetics, volume 25, pages 3925–3927, 1989. [66] A. A. Adly and I. D. Mayergoyz. Experimental testing of the average Preisach model of hysteresis. In IEEE Transactions on Magnetics, volume 28, pages 2268–2270, 1992. 138  Bibliography [67] I. D. Mayergoyz and A. A. Adly. Numerical implementation of the feedback Preisach model. In IEEE Transactions on Magnetics, volume 28, pages 2605–2607, 1992. [68] Vlado Ostovi´c. Dynamics of Saturated Electric Machines. Springer Verlag, 1989. [69] J. R. Marti. EECE560 Class Notes. The University of British Columbia, 1994. [70] Emmanuel C. Ifeachor and Barrie W. Jervis. Digital Signal Processing: A Practical Approach. Addison-Wesley, 1993.  139  Appendix A  Acquisition of the Experimental Data The experimental setup that was developed to obtain the experimental curves in this work is described here. The experimental apparatus can be divided into three main components: the test material along with its driving and sense coils, the driving circuit, and the data acquisition equipment. Each component is described in detail. The description of the test setup is then followed by some discussion on the limitations of this approach to obtaining the necessary data.  A.1  Test Material and Its Associated Coils  The measurement of the properties of the test material requires it to be driven in a very specific manner. The proper layout of the test material, the driving coil, and the sense coil is critical in order to minimize the effects of leakage flux paths. Ideally, the test material is driven with a completely uniform H field. This in turn gives rise to a uniform B field inside the material at a given depth along the magnetic path. The presence of leakage flux causes the magnetic material to have a nonuniform B field. Thus, the H field on the surface of the material is no longer uniform with the presence of leakage flux. The leakage flux can be minimized in three ways: 1. wind the driving coil around the test material as uniform as possible; 2. situate the driving coil as far away from the test material as is practical; 3. situate the sense coil as close to the test material as is possible. Typically, setups that are used for measuring the properties of magnetic materials use a different coil for driving the material and sensing the material’s response. This allows the sense coil to be left open-circuited; thus, the induced voltage on the sense coil can be integrated directly to obtain the average B field in the material. If the driving coil was also used as the sense coil then the product of the current flowing in the coil and the coil resistance would be required as well as the voltage across the coil in order to calculate the average magnetic field. Since the resistance can vary over time this leads to more experimental error. The housing for the test material, the test material, and the two coils are shown in Figure A.1. Note that the outer diameter of the housing is 205 mm. A stack of seven laminations of the test 140  Appendix A. Acquisition of the Experimental Data material forms the magnetic core. Since the pressure that is applied to the stack of laminations is relatively small, the effects of eddy currents between laminations is negligible.  Figure A.1: Test material, driving, and sense coils The driving coil was wound with 27 turns of AWG 12 magnetic wire. The sense coil was wound with 120 turns of AWG 32 magnetic wire. Two sense coils were wound to check the variation of the magnetic fields in the material. The sense coils produced results that are within 5% of each other. This error was deemed to be acceptable for the verification of the models that are shown in this work.  A.2  The Drive Circuit  With the introduction of increasingly more powerful power amplifiers, an inexpensive linear driving circuit for this type of testing has become more feasible. Two power amplifiers from Burr-Brown with peak driving currents of 10 A each were used in a master-slave arrangement to produce a total peak current of 20 A. The physical layout of the drive circuit is shown in Figure A.2 whereas the schematic of the driving circuit is shown in Figure A.3. The distortion that is produced by the driving circuit is quite low. The region of the output response that has the most distortion is near the zero crossing of the response. This becomes 141  Appendix A. Acquisition of the Experimental Data increasingly more apparent in the low current responses of the higher frequency waveforms. This distortion is produced by the limitation of the slew rate of the op-amp.  Figure A.2: Drive circuit for the magnetic core The input signal was provided by a 33220A signal generation from Argilent. The reversal curves were programmed with included PC software from Arglent that allows the programed curve to be transfered to the unit via a USB interface. The reversal curves were generated at approximately 35 mHz. However, as the first order reversal curves reverse sooner (at larger values of H) the rate of change of the section of the curve that returns the state of the material to positive saturation needs to increase otherwise the induced voltage on the sense coil is not detectable. The frequencies that were used were as low as possible to minimize eddy current effects. The minimal achievable frequency, however, is limited by the minimal detectable voltage on the sense coil and, more critically, the error in the integration of the sensed voltage due to drift. The error due to drift will be described in more detail in the section on the data acquisition equipment.  142  Appendix A. Acquisition of the Experimental Data  +15 V  10 µF 0.1 µF  10,11 1.1 kΩ  V in  OPA549 4  1.1 kΩ  6.8 kΩ  3  5,7  6  6.8 kΩ  1,2 8 3.2 kΩ  0.1 Ω 30 W  UUT  0.5 Ω 100 W  0.1 µF 10 µF  -15 V +15 V 10 µF 0.1 µF  10,11 3 OPA549 4 5,7  6  1,2 8 3.2 kΩ 0.1 µF  0.1 Ω 30 W All resistors 0.25 W, 5 % unless otherwise specified  10 µF  -15 V  Figure A.3: Schematic of the drive circuit for the magnetic core  143  Appendix A. Acquisition of the Experimental Data  A.3  The Data Acquisition Equipment  A closed-loop current sensor from LEM was used to sense the current in the coil that drives the test material. Both the output of the current sensor and the induced voltage of the sense coil were measured using a digital oscilloscope from LeCroy. The oscilloscope is able to sample the data at a very high rate. Thus, the signals can be filtered without distorting the original signals. The sampled waveforms were processed using Matlab by first filtering the data with a 100 point FIR filter and then decimating the filtered signal by 100. The filtered induced voltage is integrated using the trapezoidal rule of digital integration. The voltage waveform is first shifted to remove the voltage offset before it integrated. This procedure was used for all of the data to produce the waveforms that are shown in this work. As is mentioned above, there was evidence of drift in the signals. This was particularly apparent when the data for the first order reversal curves was obtained. If the frequency was too low then the integrated signal was not useable because the distortion in the waveform due to drift was excessively large. The first order reversal curves that were obtained using this testing procedure are shown in Chapter 2. As is mentioned in Chapter 2, the waveforms near the positive saturation point +Hsat tend to be rather noisy. This is not surprising since the level of the voltage signal at this point is very low compared to the signal that produces the waveform near zero. It is difficult to improve the resolution of the voltage signal for small values of input signal because of the dynamic range of the signal. The voltage input of the oscilloscope dictates the maximum range of the input signal. In order to capture the narrow width spikes of voltage near zero current requires a large range for the input signal. Thus, the resolution for small levels of the input is limited. Fortunately, this issue is not a big concern since the width of the hysteresis loop in saturation is narrow compared to the width of the hysteresis loop when the material is unsaturated.  A.4  Test Setup  Figure A.4 below shows a picture of the entire testing apparatus except for the oscilloscope and the DC voltage supplies for ±15 V. Notice that the 100 W power resistor is actually a precision  shunt resistor. The LEM current sensor is part of the metal box that is on the right hand side of the picture. Normally the test material was situated as far from the drive circuit and other sources of EMI as was practical in order to minimize their influence on the test.  144  Appendix A. Acquisition of the Experimental Data  Figure A.4: Testing apparatus  A.5  Limitations of this Testing Approach  Some of the issues that were encountered with using this testing approach have already been mentioned. However, there are other issues with this setup that haven’t been discussed yet. One of the advantages of using the geometry of the test material that was used is there are no breaks or abnormalities in the magnetic path. Unfortunately, the path length is not the same across the width of the material due to its circular shape. Since the width of the test material is small compared to the diameter of its circular path, the error in using the mean path length is small. If the testing of wider materials is required then using this approach would require the diameter of the material to become increasingly larger as the width increases. At some point this is likely to become impractical. The geometry of the test material is suitable for non-oriented materials. For grain oriented materials the geometry is not suitable since the grains are not oriented in circular paths but in straight paths. For these materials the standard Epstein test is still required. In brief, the Epstein test uses an Epstein frame to test the material. Rectangular stripes of the material with tapered ends are positioned into four legs of the frame to make a square geometry. The coils are driven by uniformly distributed windings on all four legs of the apparatus. Underneath the driving coils are wound sense coils to measure the induced voltage. One of the issues of the Epstein test is the field needs to bend around the corners of the material. This causes the field to become nonuniform near 145  Appendix A. Acquisition of the Experimental Data the corners of the material. This, in turn, creates errors in the measured data. For the tests that were performed in this work the test apparatus produced reasonable results. Ideally, the results from this test should be compared to the standard Epstein test to see the effects of the choice of geometry on the response of the material.  146  Appendix B  Analysis Data and Supporting Curves This appendix gives the raw data that was generated from the normalized least-squares metric that is defined in Chapter 4. A graphical comparison between the proposed dynamic model and a static resistance model is also given for a four tube structure. Finally, curves that depict the variation of the tube resistances and the magnetic intensity H through the material in time are shown.  B.1  Error Data Table B.1: Error data for the comparison of various models Error 4 Tube Models 50 µs timestep 25 µs timestep tuned tuned tuned dynamic @250 Hz @500 Hz dynamic @250 Hz  Hp (A/m)  f (Hz)  1000  1000  0.8006  0.9810  0.7138  0.5257  1.2282  0.3134  1.3570  500  1000  0.4260  0.8704  0.5320  0.4280  1.0601  0.3081  0.9604  125  1000  3.9988  7.3603  8.2862  5.9729  8.3986  3.2882  10.0828  1000  500  0.5249  0.6889  0.4357  0.5864  0.9686  0.2842  0.8832  500  500  0.3498  0.5359  0.1224  0.3213  0.7120  0.3650  0.7656  125  500  2.5215  8.2814  9.0593  3.2291  8.9002  2.1031  9.0216  1000  250  0.2745  0.2820  0.2745  0.2197  0.4697  0.3828  0.3054  500  250  0.4688  0.3638  0.4428  0.3762  0.3706  0.3283  0.3067  125  250  1.9686  8.5733  9.1469  2.4219  8.7278  1.7989  8.3629  1000  60  0.1863  0.2140  0.3670  0.1109  0.1077  0.1536  0.1949  500  60  0.3480  0.3555  0.5401  0.2054  0.2369  0.1860  0.3362  125  60  1.3748  4.7264  4.9704  1.8671  4.5542  1.4202  4.6384  147  10 Tube Models 25 µs timestep tuned dynamic @250 Hz  Appendix B. Analysis Data and Supporting Curves  A Graphical Comparison Between Four Tube Dynamic and  -200 -400 -600 -800  Figure B.1: Response of four tube models for 60 Hz input excitations  148  -1000  -1.5  -1  -0.5  0  0.5  1  1.5  experimental data 4 tube model with both mechanisms 4 tube model with static adjustment only  0 H (A/m)  200  400  600  800  1000  Static Models  B (T)  B.2  B (T)  149  Figure B.2: Response of four tube models for 250 Hz input excitations  -1000  -1.5  -1  -0.5  0  0.5  1  1.5  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 4 tube model with both mechanisms 4 tube model with static adjustment only  Appendix B. Analysis Data and Supporting Curves  150  Figure B.3: Response of four tube models for 500 Hz input excitations  -1000  -1  -0.5  0  0.5  1  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 4 tube model with both mechanisms 4 tube model with static adjustment only  Appendix B. Analysis Data and Supporting Curves  B (T)  B (T)  151  Figure B.4: Response of four tube models for 1 kHz input excitations  -1000  -0.8  -0.6  -0.4  -0.2  0  0.2  0.4  0.6  0.8  -800  -600  -400  -200  0 200 H (A/m)  400  600  800  1000  experimental data 4 tube model with both mechanisms 4 tube model with static adjustment only  Appendix B. Analysis Data and Supporting Curves  Appendix B. Analysis Data and Supporting Curves  Variation of Tube Resistances and Magnetic Intensity  -150  -100  -50  0  50  100  150  0  0.005  0.01  time (s)  0.015  0.02  0.025  Profile Inside the Material  H (A/m)  B.3  Figure B.5: Magnetic intensity profile inside the material in time for a 10 tube model  152  153  100  300 200  50  100  150  200  100 50  150  200  250  100  200  300  400  L10 ( Ω-1)  L9 ( Ω-1)  L7 ( Ω-1)  L8 ( Ω-1)  400  0  0  0  0  0.005  0.005  0.005  0.005  0.01  0.01  0.01  0.01  time (s)  0.015  0.015  0.015  0.015  0.02  0.02  0.02  0.02  0.025  0.025  0.025  0.025  Appendix B. Analysis Data and Supporting Curves  Figure B.6: Variation of the outermost tube resistances of a 10 tube model for the profile above  Appendix C  ANSI C Code of the Realized Model C.1  stdafx.h  // s t d a f x . h : i n c l u d e f i l e f o r s t a n d a r d system i n c l u d e f i l e s // and magnetic model h e a d e r f i l e s #pragma once #define WIN32 LEAN AND MEAN headers #include <s t d i o . h> #include <t c h a r . h> #include < s t d l i b . h> #include <math . h> #include <s t r i n g . h> #include <windows . h> #include ” h y s t e r e s i s . h” #include ” l o o k u p g a i n . h” #include ” c p u t i m e . h”  C.2  // E x c l u d e r a r e l y −used s t u f f from Windows  main.C  // m o d i f i e d m o d e l . cpp : D e f i n e s t h e e n t r y p o i n t f o r t h e magnetic model application . #include ” s t d a f x . h” int tmain ( int argc , TCHAR∗ argv [ ] ) { h y s t i n s t a n c e tube1 , tube2 , tube3 , tubex ; h y s t i n s t a n c e ∗ t u b e 1 p t r = &tube1 ; h y s t i n s t a n c e ∗ t u b e 2 p t r = &tube2 ; h y s t i n s t a n c e ∗ t u b e 3 p t r = &tube3 ; h y s t i n s t a n c e ∗ t u b e x p t r = &tubex ; i n i t i a l i z e h y s t i n s t a n c e ( tube1 ptr ) ; i n i t i a l i z e h y s t i n s t a n c e ( tube2 ptr ) ; i n i t i a l i z e h y s t i n s t a n c e ( tube3 ptr ) ;  154  Appendix C. ANSI C Code of the Realized Model i n i t i a l i z e h y s t i n s t a n c e ( tubex ptr ) ; const f l o a t dt = 5 e−5 f ; const f l o a t h = 4 . 8 e−3 f ; const f l o a t w = 0 . 6 3 5 e−3 f ; const f l o a t Lp = 1 e−3 f ; const f l o a t inv L p = 1 / Lp ; const f l o a t w1 = 1 . 1 6 8 2 1 8 1 e −004 f ; const f l o a t w2 = 2 . 2 4 8 6 7 2 8 e −004 f ; const f l o a t A = 1 . 0 1 6 0 e −006 f ; const f l o a t i n v A t = 1 / ( 3 ∗A) ; const f l o a t sigMa = 3 . 5 e 6 f ; const double p i = 3 . 1 4 1 5 9 2 6 5 3 5 8 9 7 9 ; const f l o a t R3 base = dt ∗ ( 2 ∗ ( h−w) / ( sigMa ∗Lp ∗ (w/2 − w2) ) + 2∗ p i / ( sigMa ∗Lp ) / l o g ( w/2 / w2) ) ; const f l o a t i n v R 3 b a s e = 1 / R3 base ; const f l o a t R2 base = dt ∗ ( 2 ∗ ( h−w) / ( sigMa ∗Lp ∗ (w2 − w1) ) + 2∗ p i / ( sigMa ∗Lp ) / l o g ( w2 / w1) ) ; const f l o a t R1 base = dt ∗ ( 2 ∗ ( h−w) / ( sigMa ∗Lp∗w1) + 2∗ p i / ( sigMa ∗Lp ) ) ; const f l o a t i n v R e l b a s e = A / Lp ; int H int H int H float float float float  i n d e x o l d 1 = t u b e 1 p t r −>H index ; i n d e x o l d 2 = t u b e 1 p t r −>H index ; i n d e x o l d 3 = t u b e 1 p t r −>H index ; Hold 1 = 0 ; Hold 2 = 0 ; Hold 3 = 0 ; B old 1 = t u b e 1 p t r −>Bpv ;  float float float float float float  B old B old Bold flux flux flux  2 3 x 1 2 3  = B old 1 ; = B old 1 ; = B old 1 ; o l d = Bold x ∗ A; o l d = 2 ∗ ( Bold x ∗ A) ; o l d = 3 ∗ ( Bold x ∗ A) ;  int p a s s e d 1 = 0 ; int p a s s e d 2 = 0 ; int p a s s e d 3 = 0 ; int ∗ p a s s e d 1 p t r = &p a s s e d 1 ; int ∗ p a s s e d 2 p t r = &p a s s e d 2 ; int ∗ p a s s e d 3 p t r = &p a s s e d 3 ;  155  Appendix C. ANSI C Code of the Realized Model  int c a l c r e v e r s e 1 = 0 ; int c a l c r e v e r s e 2 = 0 ; int c a l c r e v e r s e 3 = 0 ; int ∗ c a l c r e v e r s e 1 p t r = &c a l c r e v e r s e 1 ; int ∗ c a l c r e v e r s e 2 p t r = &c a l c r e v e r s e 2 ; int ∗ c a l c r e v e r s e 3 p t r = &c a l c r e v e r s e 3 ; int v a l i d = 0 ; int changed = 1 ; float float float float float  H H H B H  1 2 3 x x  = = = = =  0; 0; 0; B old 1 ; 0;  f l o a t Fout [ 1 0 0 0 0 ] ; f l o a t F3 [ 1 0 0 0 0 ] ; float float float float float float float float float  inv inv inv inv inv  R1 = i n v R e l b a s e ∗ t u b e 1 R2 = i n v R e l b a s e ∗ t u b e 2 R3 = i n v R e l b a s e ∗ t u b e 3 L 1 = R1 base ; L 2 = R2 base ; L3 = 1 / R3 base ; G11 = −(inv R1 + i n v L 1 ) ; G22 = −(inv R2 + i n v L 1 + i n v G33 = −(inv R1 + inv R2 + inv  p t r −>m ; p t r −>m ; p t r −>m ;  L2 ) ; R3 ) ;  f l o a t inv G row1 [ 3 ] = { ( G22∗G33 − inv R2 ∗ inv R2 ) , ( inv R1 ∗ inv R2 − i n v L 1 ∗G33 ) , ( i n v L 1 ∗ inv R2 − inv R1 ∗G22 ) } ; f l o a t inv G row2 [ 3 ] = { inv G row1 [ 1 ] , ( G11∗G33 − inv R1 ∗ inv R1 ) , ( i n v L 1 ∗ inv R1 − G11∗ inv R2 ) } ; f l o a t inv G row3 [ 3 ] = { inv G row1 [ 2 ] , inv G row2 [ 2 ] , ( G11∗G22 − i n v L 1 ∗ i n v L 1 ) }; f l o a t i n v d e t G = 1 / ( G11∗ inv G row1 [ 0 ] + i n v L 1 ∗ inv G row1 [ 1 ] + inv R1 ∗ inv G row1 [ 2 ] ) ; float hist [ 3 ] ;  156  Appendix C. ANSI C Code of the Realized Model float input flux [ 1 0 0 0 0 ] ; int i ; f o r ( i =0; i <10000; i ++) i n p u t f l u x [ i ] = 0 . 7 5 ∗ 2 . 4 e −6∗ s i n ( 2∗ p i ∗60∗ i ∗ dt ) ; /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ /∗ Generate i n p u t s a w t o o t h waveform ∗/ const int s t e p s = 2 0 ; int num steps = 0 ;  /∗ number o f s t e p s f o r 1 k h z ∗/  f o r ( i =0; i < 1 0 0 0 0 ; i ++) { i f ( num steps <= s t e p s / 2 ) { i n p u t f l u x [ i ] = 0 . 7 5 ∗ 2 . 4 e −6∗num steps / s t e p s ∗ 4 ; num steps++; } else { i f ( num steps < s t e p s ) { i n p u t f l u x [ i ] = 0 . 7 5 ∗ 2 . 4 e −6∗( s t e p s −num steps ) / s t e p s ∗ 4 ; num steps++; } else { num steps = 1 ; input flux [ i ] = 0; } } } /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ int i t e r a t i o n s = 0 ; int c o u n t i t e r = 0 ; int g a i n int g a i n int ∗ g H int ∗ g B  H index B index index 1 index 1  1 = 1 = ptr ptr  7; 7; = &g a i n H i n d e x 1 ; = &g a i n B i n d e x 1 ;  int g a i n int g a i n int ∗ g H int ∗ g B  H index B index index 2 index 2  2 = 2 = ptr ptr  7; 7; = &g a i n H i n d e x 2 ; = &g a i n B i n d e x 2 ;  157  Appendix C. ANSI C Code of the Realized Model int g a i n int g a i n int ∗ g H int ∗ g B int g a i n int ∗ g T  H index B index index 3 index 3 T index index =  3 = 7; 3 = 7; p t r = &g a i n H i n d e x 3 ; p t r = &g a i n B i n d e x 3 ; = 0; &g a i n T i n d e x ;  const float float float float  f l o a t Kgain [ 3 ] = { 0 . 9 1 5 1 5 3 8 f , −0.1895345 f , 0 . 1 0 4 6 8 8 3 f } ; t u b e 1 f i l t e r [ 3 ] = {0 ,0 ,0}; ftube1 old = 0; abs derv 1 = 0; x1 ;  float float float float  t u b e 2 f i l t e r [ 3 ] = {0 ,0 ,0}; ftube2 old = 0; abs derv 2 = 0; x2 ;  float float float float  t u b e 3 f i l t e r [ 3 ] = {0 ,0 ,0}; ftube3 old = 0; abs derv 3 = 0; x3 ;  float test derv [ 1 0 0 0 0 ] ; S ta rt T i m e r ( ) ;  // s t a r t t i m e r f o r t i m i n g a n a l y s i s  f o r ( i =0; i <10000; i ++) { i n v L 1 = R1 base ∗ f i n d L m u l t ( Hold 1 , Bold 1 , a b s d e r v 1 , g H i n d e x 1 p t r , g B index 1 ptr ) ; i n v L 2 = R2 base ∗ f i n d L m u l t ( Hold 2 , Bold 2 , a b s d e r v 2 , g H i n d e x 2 p t r , g B index 2 ptr ) ; L3 = i n v R 3 b a s e ∗ find Lmod ( t u b e x p t r −>m, Hold 3 , Bold 3 , a b s d e r v 3 , g H index 3 ptr , g B index 3 ptr , g T index ) ; iterations = 0; changed = 1 ; while ( changed ) {  158  Appendix C. ANSI C Code of the Realized Model changed = 0 ; i t e r a t i o n s ++; G11 G22 G33 inv inv inv inv inv inv inv inv inv  = = = G G G G G G G G G  −(inv R1 + i n v L 1 ) ; −(inv R2 + i n v L 1 + i n v L 2 ) ; −(inv R1 + inv R2 + inv R3 ) ; row1 [ 0 ] = G22∗G33 − inv R2 ∗ inv R2 ; row1 [ 1 ] = inv R1 ∗ inv R2 − i n v L 1 ∗G33 ; row1 [ 2 ] = i n v L 1 ∗ inv R2 − inv R1 ∗G22 ; row2 [ 1 ] = G11∗G33 − inv R1 ∗ inv R1 ; row2 [ 2 ] = i n v L 1 ∗ inv R1 − G11∗ inv R2 ; row3 [ 2 ] = G11∗G22 − i n v L 1 ∗ i n v L 1 ; row2 [ 0 ] = inv G row1 [ 1 ] ; row3 [ 0 ] = inv G row1 [ 2 ] ; row3 [ 1 ] = inv G row2 [ 2 ] ;  h i s t [ 0 ] = −A∗ t u b e 1 p t r −>Bpv + f l u x 1 o l d ; h i s t [ 1 ] = −A∗ t u b e 2 p t r −>Bpv + f l u x 2 o l d − f l u x 1 o l d ; h i s t [ 2 ] = A∗ ( t u b e 1 p t r −>Bpv + t u b e 2 p t r −>Bpv + t u b e 3 p t r −>Bpv ) − i n p u t f l u x [ i ]; i n v d e t G = inv L p / ( G11∗ inv G row1 [ 0 ] + i n v L 1 ∗ inv G row1 [ 1 ] + inv R1 ∗ inv G row1 [ 2 ] ) ; H 3 = i n v d e t G ∗ ( inv G row3 [ 0 ] ∗ h i s t [ 0 ] + inv G row3 [ 1 ] ∗ h i s t [ 1 ] + inv G row3 [2]∗ hist [2]) ; v a l i d = output m Bpv ( H i n d e x o l d 3 , p a s s e d 3 p t r , c a l c r e v e r s e 3 p t r , t u b e 3 p t r , H 3 , Hold 3 ) ; if (! valid ) { inv R3 = i n v R e l b a s e ∗ t u b e 3 p t r −>m ; changed = 1 ; } H 2 = H 3 − i n v d e t G ∗ ( inv G row2 [ 0 ] ∗ h i s t [ 0 ] + inv G row2 [ 1 ] ∗ h i s t [ 1 ] + inv G row2 [ 2 ] ∗ h i s t [ 2 ] ) ; v a l i d = output m Bpv ( H i n d e x o l d 2 , p a s s e d 2 p t r , c a l c r e v e r s e 2 p t r , t u b e 2 p t r , H 2 , Hold 2 ) ; if (! valid ) { inv R2 = i n v R e l b a s e ∗ t u b e 2 p t r −>m ; changed = 1 ; }  159  Appendix C. ANSI C Code of the Realized Model H 1 = H 3 − i n v d e t G ∗ ( inv G row1 [ 0 ] ∗ h i s t [ 0 ] + inv G row1 [ 1 ] ∗ h i s t [ 1 ] + inv G row1 [ 2 ] ∗ h i s t [ 2 ] ) ; v a l i d = output m Bpv ( H i n d e x o l d 1 , p a s s e d 1 p t r , c a l c r e v e r s e 1 p t r , t u b e 1 p t r , H 1 , Hold 1 ) ; if (! valid ) { inv R1 = i n v R e l b a s e ∗ t u b e 1 p t r −>m ; changed = 1 ; } i f ( i t e r a t i o n s == 1 5 ) { changed = 0 ; } } valid = 0; B x = i n p u t f l u x [ i ] ∗ inv At ; while ( ! v a l i d ) v a l i d = simple output m Bpv ( t u b e x p t r , B x , Bold x ) ; Bold x = B x ; H x = ( B x − t u b e x p t r −>Bpv ) / t u b e x p t r −>m; Hold 1 = H 1 ; B old 1 = H 1∗ t u b e 1 p t r −>m + t u b e 1 p t r −>Bpv ; H i n d e x o l d 1 = t u b e 1 p t r −>H index ; ∗( p a s s e d 1 p t r ) = 0 ; ∗( c a l c r e v e r s e 1 p t r ) = 0 ; Hold 2 = H 2 ; B old 2 = H 2∗ t u b e 2 p t r −>m + t u b e 2 p t r −>Bpv ; H i n d e x o l d 2 = t u b e 2 p t r −>H index ; ∗( p a s s e d 2 p t r ) = 0 ; ∗( c a l c r e v e r s e 2 p t r ) = 0 ; Hold 3 = H 3 ; B old 3 = H 3∗ t u b e 3 p t r −>m + t u b e 3 p t r −>Bpv ; H i n d e x o l d 3 = t u b e 3 p t r −>H index ; ∗( p a s s e d 3 p t r ) = 0 ; ∗( c a l c r e v e r s e 3 p t r ) = 0 ; f l u x 1 o l d = Lp∗H 1∗ inv R1 + A∗ t u b e 1 p t r −>Bpv ; f l u x 2 o l d = f l u x 1 o l d + Lp∗H 2∗ inv R2 + A∗ t u b e 2 p t r −>Bpv ; Fout [ i ] = Lp∗H 3 + L3 ∗ ( i n p u t f l u x [ i ] − f l u x 3 o l d ) ; flux 3 old = input flux [ i ] ;  160  Appendix C. ANSI C Code of the Realized Model  t u b e 1 f i l t e r [ 0 ] = H 2∗Lp − f t u b e 1 o l d ; f t u b e 1 o l d = H 2∗Lp ; x1 = t u b e 1 f i l t e r [ 0 ] ∗ Kgain [ 0 ] − t u b e 1 f i l t e r [ 1 ] ∗ Kgain [ 1 ] − t u b e 1 f i l t e r [ 2 ] ∗ Kgain [ 2 ] ; a b s d e r v 1 = f a b s ( 0 . 5 ∗ ( x1 + t u b e 1 f i l t e r [ 1 ] ) ) ; tube1 filter [2] = tube1 filter [1]; t u b e 1 f i l t e r [ 1 ] = x1 ; t u b e 2 f i l t e r [ 0 ] = H 3∗Lp − f t u b e 2 o l d ; f t u b e 2 o l d = H 3∗Lp ; x2 = t u b e 2 f i l t e r [ 0 ] ∗ Kgain [ 0 ] − t u b e 2 f i l t e r [ 1 ] ∗ Kgain [ 1 ] − t u b e 2 f i l t e r [ 2 ] ∗ Kgain [ 2 ] ; a b s d e r v 2 = f a b s ( 0 . 5 ∗ ( x2 + t u b e 2 f i l t e r [ 1 ] ) ) ; tube2 filter [2] = tube2 filter [1]; t u b e 2 f i l t e r [ 1 ] = x2 ; t u b e 3 f i l t e r [ 0 ] = H x∗Lp − f t u b e 3 o l d ; f t u b e 3 o l d = H x∗Lp ; x3 = t u b e 3 f i l t e r [ 0 ] ∗ Kgain [ 0 ] − t u b e 3 f i l t e r [ 1 ] ∗ Kgain [ 1 ] − t u b e 3 f i l t e r [ 2 ] ∗ Kgain [ 2 ] ; a b s d e r v 3 = f a b s ( 0 . 5 ∗ ( x3 + t u b e 3 f i l t e r [ 1 ] ) ) ; tube3 filter [2] = tube3 filter [1]; t u b e 3 f i l t e r [ 1 ] = x3 ; } double dtime = StopTimer ( ) ; p r i n t f ( ” e x e c u t i n g l o o p took %f s e c o n d s \n” , dtime ) ; FILE ∗ f p ; errno t err ; i f ( ( e r r = f o p e n s (&fp , ” t e s t m o d i f i e d m o d e l C . t x t ” , ”wt” ) ) != 0 ) { p r i n t f ( ” Cannot open f i l e . \ n” ) ; exit (1) ; } f o r ( i =0; i <10000; i ++) { f p r i n t f ( fp , ”%f \ t ” , i n p u t f l u x [ i ] / ( 3 ∗A) ) ; f p r i n t f ( fp , ”%f \n” , Fout [ i ] ∗ inv L p ) ; } i f ( f c l o s e ( fp ) )  161  Appendix C. ANSI C Code of the Realized Model { }  p r i n t f ( ”The f i l e was not c l o s e d \n” ) ; return 0 ;  }  C.3  cpu time.h  void St ar tT im e r ( ) ; double StopTimer ( ) ;  C.4  cpu time.C  #include ” s t d a f x . h” LARGE INTEGER LARGE INTEGER LARGE INTEGER LARGE INTEGER double  s t a r t T i c k s ; /∗ f o r High−r e s o l u t i o n performance c o u n t e r ∗/ timerfrq ; /∗ f o r High−r e s o l u t i o n performance c o u n t e r ∗/ stopTicks ; totalTicks ; totalTime ;  /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ /∗ S T A R T T I M E R ∗/ /∗ ∗/ /∗ S t a r t g e n e r a l p u r p o s e t i m e r ∗/ /∗ Use StopTimer ( ) t o s t o p and r e t u r n t h e t i m e r v a l u e ∗/ /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ void St a r tT im e r ( ) { /∗ s e t up h i g h −p r e c i s i o n c l k ∗/ QueryPerformanceFrequency(& t i m e r f r q ) ; /∗ Use High Performance Counter f o r W2000 and NT ∗/ QueryPerformanceCounter(& s t a r t T i c k s ) ; } /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ /∗ S T O P T I M E R ∗/ /∗ ∗/ /∗ Returns t i m e r v a l u e i n m i c r o s e c o n d s ∗/ /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/  162  Appendix C. ANSI C Code of the Realized Model double StopTimer ( ) { /∗ Use High Performance Counter f o r W2000 and NT ∗/  }  C.5  QueryPerformanceCounter(& s t o p T i c k s ) ; t o t a l T i c k s . QuadPart = s t o p T i c k s . QuadPart − s t a r t T i c k s . QuadPart ; totalTime = ( double ) ( ( double ) t o t a l T i c k s . QuadPart / ( double ) t i m e r f r q . QuadPart ) ; return ( ( ( double ) t o t a l T i m e ) ∗ 1 0 0 0 0 0 0 ) ;  hysteresis.h  struct STATE struct { float int float float float };  H; j; C; r; B;  struct h y s t i n s t a n c e { int STATE struct STATE struct ∗ int float float };  up ; STATE [ 1 0 0 ] ; STATE ptr ; H index ; m; Bpv ;  void i n i t i a l i z e h y s t i n s t a n c e ( h y s t i n s t a n c e ∗ ) ; int output m Bpv ( int , int ∗ , int ∗ , h y s t i n s t a n c e ∗ , f l o a t , f l o a t ) ; int simple output m Bpv ( h y s t i n s t a n c e ∗ , f l o a t , f l o a t ) ; const f l o a t data m [ 3 0 ] [ 3 0 ] = { . . . } ; const f l o a t data dB [ 3 1 ] [ 3 1 ] = { . . . } ; const f l o a t H bounds [ 3 1 ] = { . . . } ; int c o u n t e r ; const f l o a t inv dH [ 3 0 ] = { . . . } ;  163  Appendix C. ANSI C Code of the Realized Model  C.6  lookup gain.h  f l o a t f i n d L m u l t ( f l o a t , f l o a t , f l o a t , int ∗ , int ∗ ) ; f l o a t find Lmod ( f l o a t , f l o a t , f l o a t , f l o a t , int ∗ , int ∗ , int ∗ ) ; const f l o a t m check [ 1 4 ] [ 1 6 ] = { . . . } ; const f l o a t Bpv check [ 1 4 ] [ 1 5 ] = { . . . } ; const f l o a t h e i g h t v a l u e s [ 2 8 ] [ 1 5 ] = { . . . } ; const f l o a t H c o r n e r s [ 1 5 ] = { . . . } ; const f l o a t i n v H c o r n e r s [ 1 4 ] = { . . . } ; const f l o a t d F d t d a t a [ 8 ] = { . . . } ; const f l o a t f a l l o f f s l o p e [ 7 ] = { . . . } ; const f l o a t p i v o t p o i n t [ 7 ] = { . . . } ; const const const const  C.7  float float float float  dF dt data2 [ 1 4 ] = { . . . } ; f a l l o f f s l o p e 2 [13] = { . . . }; pivot point2 [13] = { . . . }; inv max m = 2 . 0 4 4 6 e +001 f ;  lookup gain.C  #include ” s t d a f x . h” f l o a t f i n d L m u l t ( f l o a t H, f l o a t B, f l o a t a b s d e r v , int ∗ H index , int ∗ B index ) { float k ; int k i n d e x = 1 ; int n o t d o n e = 1 ; i f ( a b s d e r v >= 0 . 2 ) return 1 ; while ( n o t d o n e ) ( d F d t d a t a [ k i n d e x ] < a b s d e r v ) ? k i n d e x++ : n o t d o n e = 0 ; k i n d e x −−; k = f a l l o f f s l o p e [ k index ]∗ abs derv + pivot point [ k index ] ; i f ( f a b s (H) >= 1 2 5 ) return 1 ; not done = 1 ; while ( n o t d o n e ) { i f (H >= H c o r n e r s [ ( ∗ H index ) +1])  164  Appendix C. ANSI C Code of the Realized Model  else {  ( ∗ H index )++; i f (H < H c o r n e r s [ ∗ H index ] ) ( ∗ H index )−−; else not done = 0 ;  }  } switch ( ∗ H index ) { case 0 : case 1 3 : case 1 : case 1 2 : case 2 : case 1 1 : case 3 : case 1 0 : case 4 : case 9 : case 5 : case 8 : default :  i f ( ∗ B index > 1 ) ∗ B index = 1 ; break ; i f ( ∗ B index > 1 ) ∗ B index = 1 ; break ; i f ( ∗ B index > 3 ) ∗ B index = 3 ; break ; i f ( ∗ B index > 3 ) ∗ B index = 3 ; break ; i f ( ∗ B index > 5 ) ∗ B index = 5 ; break ; i f ( ∗ B index > 5 ) ∗ B index = 5 ; break ; i f ( ∗ B index > 7 ) ∗ B index = 7 ; break ; i f ( ∗ B index > 7 ) ∗ B index = 7 ; break ; i f ( ∗ B index > 9 ) ∗ B index = 9 ; break ; i f ( ∗ B index > 9 ) ∗ B index = 9 ; break ; i f ( ∗ B index > 1 1 ) ∗ B index = 1 1 ; break ; i f ( ∗ B index > 1 1 ) ∗ B index = 1 1 ; break ; i f ( ∗ B index > 1 3 ) ∗ B index = 1 3 ; break ;  } not done = 1 ; while ( n o t d o n e ) { i f (B >= H∗ m check [ ∗ H index ] [ ( ∗ B index ) +1] + Bpv check [ ∗ H index ] [ ( ∗ B index ) +1]) { ( ∗ B index )++; i f ( m check [ ∗ H index ] [ ∗ B index ] == 0 ) return 1 ;  165  Appendix C. ANSI C Code of the Realized Model } else {  i f (B < H∗ m check [ ∗ H index ] [ ∗ B index ] + Bpv check [ ∗ H index ] [ ∗ B index ] ) { ( ∗ B index )−−; i f ( ( ∗ B index ) == −1) { ∗ B index = 0 ; return 1 ; } } else not done = 0 ;  }  } r e g i s t e r int h i n d e x 1 = 2 ∗ ( ∗ H index ) ; r e g i s t e r f l o a t r 1 = (H − H c o r n e r s [ ∗ H index ] ) ∗ i n v H c o r n e r s [ ∗ H index ] ; r e g i s t e r f l o a t h e i g h t l o w = ( h e i g h t v a l u e s [ h i n d e x 1 + 1 ] [ ∗ B index ] − h e i g h t v a l u e s [ h i n d e x 1 ] [ ∗ B index ] ) ∗ r 1 ; h e i g h t l o w = h e i g h t l o w + h e i g h t v a l u e s [ h i n d e x 1 ] [ ∗ B index ] ; r e g i s t e r f l o a t h e i g h t h i g h = ( h e i g h t v a l u e s [ h i n d e x 1 + 1 ] [ ( ∗ B index ) +1] − h e i g h t v a l u e s [ h i n d e x 1 ] [ ( ∗ B index ) +1]) ∗ r 1 ; h e i g h t h i g h = h e i g h t h i g h + h e i g h t v a l u e s [ h i n d e x 1 ] [ ( ∗ B index ) + 1 ] ; r e g i s t e r f l o a t r2 num = B − (H∗ m check [ ∗ H index ] [ ∗ B index ] + Bpv check [ ∗ H index ] [ ∗ B index ] ) ; r e g i s t e r f l o a t r 2 d e n = H∗ ( m check [ ∗ H index ] [ ( ∗ B index ) +1] − m check [ ∗ H index ] [ ∗ B index ] ) ; r 2 d e n = r 2 d e n + Bpv check [ ∗ H index ] [ ( ∗ B index ) +1]− Bpv check [ ∗ H index ] [ ∗ B index ] ; return r 2 d e n / ( r 2 d e n + ( ( h e i g h t h i g h − h e i g h t l o w ) ∗ r2 num +( h e i g h t l o w −1)∗ r 2 d e n ) ∗k ) ; } /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ f l o a t find Lmod ( f l o a t m, f l o a t H, f l o a t B, f l o a t a b s d e r v , int ∗ H index , int ∗ B index , int ∗ T index ) { f l o a t k , T, den ;  166  Appendix C. ANSI C Code of the Realized Model int k i n d e x = 1 ; int n o t d o n e = 1 ; i f ( a b s d e r v >= 0 . 4 ) T = 0.95 f ; else { while ( n o t d o n e ) { i f ( d F d t d a t a 2 [ ( ∗ T index ) +1] < a b s d e r v ) ( ∗ T index )++; else i f ( d F d t d a t a 2 [ ∗ T index ] > a b s d e r v ) ( ∗ T index )−−; else not done = 0 ; } T = f a l l o f f s l o p e 2 [ ∗ T index ] ∗ a b s d e r v + p i v o t p o i n t 2 [ ∗ T index ] ; } i f (T > 1 ) den = T ; else den = T + (1−T) ∗ inv max m ∗m; i f ( a b s d e r v >= 0 . 2 ) return ( 1 / den ) ; n o t d o n e =1; while ( n o t d o n e ) ( d F d t d a t a [ k i n d e x ] < a b s d e r v ) ? k i n d e x++ : n o t d o n e = 0 ; k i n d e x −−; k = f a l l o f f s l o p e [ k index ]∗ abs derv + pivot point [ k index ] ; i f ( f a b s (H) >= 1 2 5 ) return ( 1 / den ) ; not done = 1 ; while ( n o t d o n e ) { i f (H >= H c o r n e r s [ ( ∗ H index ) +1]) ( ∗ H index )++; else { i f (H < H c o r n e r s [ ∗ H index ] ) ( ∗ H index )−−; else not done = 0 ; } } switch ( ∗ H index ) { case 0 : i f ( ∗ B index > 1 ) ∗ B index = 1 ;  167  Appendix C. ANSI C Code of the Realized Model  case 1 3 : case 1 : case 1 2 : case 2 : case 1 1 : case 3 : case 1 0 : case 4 : case 9 : case 5 : case 8 : default :  break ; i f ( ∗ B index > 1 ) ∗ B index = 1 ; break ; i f ( ∗ B index > 3 ) ∗ B index = 3 ; break ; i f ( ∗ B index > 3 ) ∗ B index = 3 ; break ; i f ( ∗ B index > 5 ) ∗ B index = 5 ; break ; i f ( ∗ B index > 5 ) ∗ B index = 5 ; break ; i f ( ∗ B index > 7 ) ∗ B index = 7 ; break ; i f ( ∗ B index > 7 ) ∗ B index = 7 ; break ; i f ( ∗ B index > 9 ) ∗ B index = 9 ; break ; i f ( ∗ B index > 9 ) ∗ B index = 9 ; break ; i f ( ∗ B index > 1 1 ) ∗ B index = 1 1 ; break ; i f ( ∗ B index > 1 1 ) ∗ B index = 1 1 ; break ; i f ( ∗ B index > 1 3 ) ∗ B index = 1 3 ; break ;  } not done = 1 ; while ( n o t d o n e ) { i f (B >= H∗ m check [ ∗ H index ] [ ( ∗ B index ) +1] + Bpv check [ ∗ H index ] [ ( ∗ B index ) +1]) { ( ∗ B index )++; i f ( m check [ ∗ H index ] [ ∗ B index ] == 0 ) return ( 1 / den ) ; } else { i f (B < H∗ m check [ ∗ H index ] [ ∗ B index ] + Bpv check [ ∗ H index ] [ ∗ B index ] ) { ( ∗ B index )−−; i f ( ( ∗ B index ) == −1) { ∗ B index = 0 ; return ( 1 / den ) ; } }  168  Appendix C. ANSI C Code of the Realized Model else not done = 0 ; }  } r e g i s t e r int h i n d e x 1 = 2 ∗ ( ∗ H index ) ; r e g i s t e r f l o a t r 1 = (H − H c o r n e r s [ ∗ H index ] ) ∗ i n v H c o r n e r s [ ∗ H index ] ; r e g i s t e r f l o a t h e i g h t l o w = ( h e i g h t v a l u e s [ h i n d e x 1 + 1 ] [ ∗ B index ] − h e i g h t v a l u e s [ h i n d e x 1 ] [ ∗ B index ] ) ∗ r 1 ; h e i g h t l o w = h e i g h t l o w + h e i g h t v a l u e s [ h i n d e x 1 ] [ ∗ B index ] ; r e g i s t e r f l o a t h e i g h t h i g h = ( h e i g h t v a l u e s [ h i n d e x 1 + 1 ] [ ( ∗ B index ) +1] − h e i g h t v a l u e s [ h i n d e x 1 ] [ ( ∗ B index ) +1]) ∗ r 1 ; h e i g h t h i g h = h e i g h t h i g h + h e i g h t v a l u e s [ h i n d e x 1 ] [ ( ∗ B index ) + 1 ] ; r e g i s t e r f l o a t r2 num = B − (H∗ m check [ ∗ H index ] [ ∗ B index ] + Bpv check [ ∗ H index ] [ ∗ B index ] ) ; r e g i s t e r f l o a t r 2 d e n = H∗ ( m check [ ∗ H index ] [ ( ∗ B index ) +1] − m check [ ∗ H index ] [ ∗ B index ] ) ; r 2 d e n = r 2 d e n + Bpv check [ ∗ H index ] [ ( ∗ B index ) +1]− Bpv check [ ∗ H index ] [ ∗ B index ] ; return ( r 2 d e n + ( ( h e i g h t h i g h − h e i g h t l o w ) ∗ r2 num +( h e i g h t l o w −1)∗ r 2 d e n ) ∗k ) / ( r 2 d e n ∗ den ) ; }  C.8  output m Bpv.C  #include ” s t d a f x . h” void i n i t i a l i z e h y s t i n s t a n c e ( h y s t i n s t a n c e ∗ model ) { model −>up = 1 ; ( model −>STATE [ 0 ] ) . B = −1.50465 f ; ( model −>STATE [ 0 ] ) .C = 1 ; ( model −>STATE [ 0 ] ) .H = −1000; ( model −>STATE [ 0 ] ) . j = 2 8 ; ( model −>STATE [ 0 ] ) . r = 0 ; model −>STATE ptr = &(model −>STATE [ 0 ] ) ; model −>H index = 2 9 ; model −>m = 9 . 6 8 6 4 e −005 f ;  169  Appendix C. ANSI C Code of the Realized Model model −>Bpv = −1.4078 e +000 f ; const double p i = 3 . 1 4 1 5 9 2 6 5 3 5 8 9 7 9 ; int H i n d e x o l d = 2 9 ; int p a s s e d d a t a = 0 ; int c a l c d a t a = 0 ; int ∗ p a s s e d = &p a s s e d d a t a ; int ∗ c a l c r e v e r s e = &c a l c d a t a ; int output = 0 ; int i ; const f l o a t dt = 1 e−4 f ; f l o a t Hold = −1000; f l o a t Hin ; f o r ( i =0; i <9876; i ++) { Hin = −999.99∗ c o s ( 4 0 ∗ p i ∗ ( i +1)∗ dt ) ∗ exp(−dt ∗ 5 ∗ ( i +1) ) ; output = 0 ; while ( output != 1 ) output = output m Bpv ( H i n d e x o l d , passed , c a l c r e v e r s e , model , Hin , Hold ) ; H i n d e x o l d = model −>H index ; ∗ passed = 0 ; ∗ calc reverse = 0; Hold = Hin ; } return ; } /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ int simple output m Bpv ( h y s t i n s t a n c e ∗ h y s t d a t a , f l o a t B, f l o a t Bold ) { int v a l i d = 0 ; i f ( h y s t d a t a −> up == 1 ) { i f (B < Bold ) { h y s t d a t a −> up = 0 ; h y s t d a t a −>H index = 29 − h y s t d a t a −>H index ; f l o a t dB1 = f a b s ( Bold − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ) ; f l o a t Hold = ( Bold − h y s t d a t a −>Bpv ) / h y s t d a t a −>m; f l o a t r = −(Hold + H bounds [ ( h y s t d a t a −>H index ) +1]) ∗ inv dH [ h y s t d a t a −>H index ] ;  170  Appendix C. ANSI C Code of the Realized Model int H end = 28 − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ; f l o a t dH u = H bounds [ H end ] + ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H; f l o a t dB u = data dB [ h y s t d a t a −>H index ] [ H end ] − data m [ ( h y s t d a t a −> H index ) −1][ H end ] ∗ dH u ; f l o a t dB l = data dB [ ( h y s t d a t a −>H index ) + 1 ] [ H end ] − data m [ h y s t d a t a −>H index ] [ H end ] ∗ dH u ; dB l = dB l − data dB [ ( h y s t d a t a −>H index ) + 1 ] [ h y s t d a t a −>H index ] ; f l o a t dB2 dB2  =(dB u − dB l ) ∗ r + dB l ;  = dB2 + data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ∗ ( H bounds [ h y s t d a t a −>H index ]+ Hold ) ;  f l o a t C f a c t o r = dB1 / dB2 ; ( h y s t d a t a −>STATE ptr )++; ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j  = = = = =  C factor ; r; Hold ; Bold ; h y s t d a t a −>H index −1;  f l o a t mH = ( data m [ h y s t d a t a −>H index − 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = Bold − m∗ Hold ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } e l s e { /∗ not a change o f d i r e c t i o n ∗/ i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( ( ∗ ( h y s t d a t a −>STATE ptr −1) ) . B <= ( H bounds [ h y s t d a t a −> H index ] ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ) ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (B >= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) . B) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H;  171  Appendix C. ANSI C Code of the Realized Model f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr−1) ) . B ; ( h y s t d a t a −>STATE ptr ) −=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; return v a l i d ; }  } } i f (B >= ( H bounds [ h y s t d a t a −>H index ] ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ) ) { f l o a t Hstar = H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −> H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1;  172  Appendix C. ANSI C Code of the Realized Model  }  }  } e l s e { /∗ d i r e c t i o n i s downwards ∗/ i f (B > Bold ) { h y s t d a t a −> up = 1 ; h y s t d a t a −>H index = 29 − h y s t d a t a −>H index ; f l o a t dB1 = f a b s ( Bold − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ) ; f l o a t Hold = ( Bold − h y s t d a t a −>Bpv ) / h y s t d a t a −>m; f l o a t r = ( Hold − H bounds [ ( h y s t d a t a −>H index ) +1]) ∗ inv dH [ h y s t d a t a −> H index ] ; int H end = 28 − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ; f l o a t dH u = H bounds [ H end ] − ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H; f l o a t dB u = data dB [ h y s t d a t a −>H index ] [ H end ] − data m [ ( h y s t d a t a −> H index ) −1][ H end ] ∗ dH u ; f l o a t dB l = data dB [ ( h y s t d a t a −>H index ) + 1 ] [ H end ] − data m [ h y s t d a t a −>H index ] [ H end ] ∗ dH u ; dB l = dB l − data dB [ ( h y s t d a t a −>H index ) + 1 ] [ h y s t d a t a −>H index ] ; f l o a t dB2 dB2  =(dB u − dB l ) ∗ r + dB l ;  = dB2 + data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ∗ ( H bounds [ h y s t d a t a −>H index ]−Hold ) ;  f l o a t C f a c t o r = dB1 / dB2 ; ( h y s t d a t a −>STATE ptr )++; ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j  = = = = =  C factor ; r; Hold ; Bold ; h y s t d a t a −>H index −1;  f l o a t mH = ( data m [ h y s t d a t a −>H index − 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = Bold − m∗ Hold ;  173  Appendix C. ANSI C Code of the Realized Model h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } e l s e { /∗ not a change o f d i r e c t i o n ∗/ i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( ( ∗ ( h y s t d a t a −>STATE ptr −1) ) . B >= (−H bounds [ h y s t d a t a −> H index ] ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ) ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (B <= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) . B) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr−1) ) . B ; ( h y s t d a t a −>STATE ptr ) −=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; return v a l i d ; }  }  } i f (B <= (−H bounds [ h y s t d a t a −>H index ] ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ) ) { f l o a t Hstar = −H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −> H index ] ) ;  174  Appendix C. ANSI C Code of the Realized Model f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  }  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } return v a l i d ; } /∗−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−∗/ int output m Bpv ( int H i n d e x o l d , int ∗ passed , int ∗ c a l c r e v e r s e , h y s t i n s t a n c e ∗ h y s t d a t a , f l o a t H, f l o a t Hold ) { int v a l i d = 0 ; i f ( h y s t d a t a −> up == 1 ) { i f ( ∗ p a s s e d != 0 ) { i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H <= H bounds [ h y s t d a t a −> H index ] ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (H >= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr−1) ) . B ; ( h y s t d a t a −>STATE ptr ) −=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ;  175  Appendix C. ANSI C Code of the Realized Model f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; return v a l i d ; }  }  } /∗ no minor l o o p c l o s u r e i n t h i s segment ∗/ i f (H >= H bounds [ h y s t d a t a −>H index ] ) { f l o a t Hstar = H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −> H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ;  } else {  h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; i f ( ( ∗ ( h y s t d a t a −>STATE ptr +1) ) .H >= H bounds [ h y s t d a t a −> H index +1]) { /∗ c u r r e n t segment c o n t a i n s p r e v i o u s l y p r o c e s s e d minor l o o p c l o s u r e ∗/ i f ( H < ( ∗ ( h y s t d a t a −>STATE ptr +1) ) .H) { /∗ i s t h e r e v e r s a l o f t h e c l o s u r e o f a minor l o o p r e q u i r e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr + 1 ) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ;  176  Appendix C. ANSI C Code of the Realized Model  B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr+1) ) . B ; ( h y s t d a t a −>STATE ptr ) +=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; ( ∗ p a s s e d )−−;  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } e l s e { /∗ r e v e r s a l o f minor l o o p not r e q u i r e d ∗/ i f (H < H bounds [ h y s t d a t a −>H index +1]) { f l o a t Hstar = H bounds [ h y s t d a t a −>H index + 1 ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )++; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m;  177  Appendix C. ANSI C Code of the Realized Model  }  }  h y s t d a t a −>Bpv = Bpv ; } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } e l s e { /∗ not p r o c e s s e d minor l o o p c l o s u r e t h i s t i m e s t e p ∗/ i f ( (H < Hold ) && ( ( h y s t d a t a −>H index == H i n d e x o l d ) | | ( 2 9 − h y s t d a t a −>H index == H i n d e x o l d ) ) ) { h y s t d a t a −> up = 0 ; h y s t d a t a −>H index = 29 − h y s t d a t a −>H index ; f l o a t Bold = Hold ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ; f l o a t dB1 = f a b s ( Bold − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ) ; i f ( dB1 == 0 ) ( h y s t d a t a −>STATE ptr )−−; e l s e { /∗ p r o c e s s change i n d i r e c t i o n ∗/ i f ( ∗ c a l c r e v e r s e == 1 ) /∗=1 i f d a t a f o r r e v e r s a l was c a l c u l a t e d i n a p r e v i o u s i t e r a t i o n ∗/ ( h y s t d a t a −>STATE ptr )++; else { f l o a t r = −(Hold + H bounds [ ( h y s t d a t a −> H index ) +1]) ∗ inv dH [ h y s t d a t a −>H index ] ; int H end = 28 − ( ∗ ( h y s t d a t a −>STATE ptr ) ) .j; f l o a t dH u = H bounds [ H end ] + ( ∗ ( h y s t d a t a −> STATE ptr ) ) .H; f l o a t dB u = data dB [ h y s t d a t a −>H index ] [ H end ] − data m [ ( h y s t d a t a −>H index ) −1][ H end ] ∗ dH u ; f l o a t dB l = data dB [ ( h y s t d a t a −>H index ) + 1 ] [ H end ] − data m [ h y s t d a t a −>H index ] [ H end ] ∗ dH u ; dB l = dB l − data dB [ ( h y s t d a t a −>H index ) + 1 ] [ h y s t d a t a −>H index ] ; f l o a t dB2  178  =(dB u − dB l ) ∗ r + dB l ;  Appendix C. ANSI C Code of the Realized Model dB2  = dB2 + data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ∗ ( H bounds [ h y s t d a t a −> H index ]+ Hold ) ;  f l o a t C f a c t o r = dB1 / dB2 ;  } float H float H float  ( h y s t d a t a −>STATE ptr )++; ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j H index −1; ∗ calc reverse = 1;  = = = = =  C factor ; r; Hold ; Bold ; h y s t d a t a −>  mH = ( data m [ h y s t d a t a −>H index − 1 ] [ h y s t d a t a −> index ] ) ; mL = ( data m [ h y s t d a t a −>H index ] [ h y s t d a t a −> index ] ) ; m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL;  m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = Bold − m∗ Hold ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } } e l s e { /∗ not a change o f d i r e c t i o n ∗/ i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H <= H bounds [ h y s t d a t a −>H index ] ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (H >= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr−1) ) . B ;  179  Appendix C. ANSI C Code of the Realized Model ( h y s t d a t a −>STATE ptr ) −=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; return v a l i d ; }  }  } i f (H >= H bounds [ h y s t d a t a −>H index ] ) { f l o a t Hstar = H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ;  } else {  h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; i f (H < H bounds [ h y s t d a t a −>H index +1]) { f l o a t Hstar = H bounds [ h y s t d a t a −>H index + 1 ] ;  180  Appendix C. ANSI C Code of the Realized Model f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )++; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  }  }  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } } e l s e { /∗ d i r e c t i o n i s downwards ∗/ i f ( ∗ p a s s e d != 0 ) { i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( −(∗( h y s t d a t a −>STATE ptr −1) ) .H <= H bounds [ h y s t d a t a −> H index ] ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (H <= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) . B ; ( h y s t d a t a −>STATE ptr ) −=2;  181  Appendix C. ANSI C Code of the Realized Model f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; ( ∗ p a s s e d )++; return v a l i d ; }  }  } /∗ no minor l o o p c l o s u r e i n t h i s segment ∗/ i f (−H >= H bounds [ h y s t d a t a −>H index ] ) { f l o a t Hstar = −H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −> H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } else { i f ( −(∗( h y s t d a t a −>STATE ptr +1) ) .H >= H bounds [ h y s t d a t a −> H index +1]) { /∗ c u r r e n t segment c o n t a i n s p r e v i o u s l y p r o c e s s e d minor l o o p c l o s u r e ∗/ i f ( H > ( ∗ ( h y s t d a t a −>STATE ptr +1) ) .H) { /∗ i s t h e r e v e r s a l o f t h e c l o s u r e o f a minor l o o p r e q u i r e d ∗/  182  Appendix C. ANSI C Code of the Realized Model f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr + 1 ) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr+1) ) . B ; ( h y s t d a t a −>STATE ptr ) +=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; ( ∗ p a s s e d )−−;  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } e l s e { /∗ r e v e r s a l o f minor l o o p not r e q u i r e d ∗/ i f (−H < H bounds [ h y s t d a t a −>H index +1]) { f l o a t Hstar = −H bounds [ h y s t d a t a −>H index + 1 ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )++; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ;  183  Appendix C. ANSI C Code of the Realized Model h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  }  }  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } e l s e { /∗ not p r o c e s s e d minor l o o p c l o s u r e t h i s t i m e s t e p ∗/ i f ( (H > Hold ) && ( ( h y s t d a t a −>H index == H i n d e x o l d ) | | ( 2 9 − h y s t d a t a −>H index == H i n d e x o l d ) ) ) { h y s t d a t a −> up = 1 ; h y s t d a t a −>H index = 29 − h y s t d a t a −>H index ; f l o a t Bold = Hold ∗ h y s t d a t a −>m + h y s t d a t a −>Bpv ; f l o a t dB1 = f a b s ( Bold − ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ) ; i f ( dB1 == 0 ) ( h y s t d a t a −>STATE ptr )−−; e l s e { /∗ p r o c e s s change i n d i r e c t i o n ∗/ i f ( ∗ c a l c r e v e r s e == 1 ) /∗=1 i f d a t a f o r r e v e r s a l was c a l c u l a t e d i n a p r e v i o u s i t e r a t i o n ∗/ ( h y s t d a t a −>STATE ptr )++; else { f l o a t r = ( Hold − H bounds [ ( h y s t d a t a −>H index ) +1]) ∗ inv dH [ h y s t d a t a −>H index ] ; int H end = 28 − ( ∗ ( h y s t d a t a −>STATE ptr ) ) .j; f l o a t dH u = H bounds [ H end ] − ( ∗ ( h y s t d a t a −> STATE ptr ) ) .H; f l o a t dB u = data dB [ h y s t d a t a −>H index ] [ H end ] − data m [ ( h y s t d a t a −>H index ) −1][ H end ] ∗ dH u ; f l o a t dB l = data dB [ ( h y s t d a t a −>H index ) + 1 ] [ H end ] − data m [ h y s t d a t a −>H index ] [ H end ] ∗ dH u ; dB l = dB l − data dB [ ( h y s t d a t a −>H index ) + 1 ] [ h y s t d a t a −>H index ] ; f l o a t dB2  184  =(dB u − dB l ) ∗ r + dB l ;  Appendix C. ANSI C Code of the Realized Model  dB2  = dB2 + data m [ h y s t d a t a −>H index ] [ h y s t d a t a −>H index ] ∗ ( H bounds [ h y s t d a t a −> H index ]−Hold ) ;  f l o a t C f a c t o r = dB1 / dB2 ;  } float H float H float  ( h y s t d a t a −>STATE ptr )++; ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r ( ∗ ( h y s t d a t a −>STATE ptr ) ) .H ( ∗ ( h y s t d a t a −>STATE ptr ) ) . B ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j H index −1; ∗ calc reverse = 1;  = = = = =  C factor ; r; Hold ; Bold ; h y s t d a t a −>  mH = ( data m [ h y s t d a t a −>H index − 1 ] [ h y s t d a t a −> index ] ) ; mL = ( data m [ h y s t d a t a −>H index ] [ h y s t d a t a −> index ] ) ; m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL;  m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = Bold − m∗ Hold ;  }  h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  } e l s e { /∗ not a change o f d i r e c t i o n ∗/ i f ( h y s t d a t a −>STATE ptr != &( h y s t d a t a −>STATE [ 0 ] ) ) { /∗ Does s t a c k p o i n t e r not p o i n t t o f i r s t e n t r y ∗/ i f ( −(∗( h y s t d a t a −>STATE ptr −1) ) .H <= H bounds [ h y s t d a t a −>H index ] ) { /∗ c u r r e n t segment c o n t a i n s a c l o s u r e o f a minor l o o p ∗/ i f (H <= ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H) { /∗ has t h e minor l o o p c l o s e d ∗/ f l o a t Hstar = ( ∗ ( h y s t d a t a −>STATE ptr −1) ) .H; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ;  185  Appendix C. ANSI C Code of the Realized Model B s t a r = ( ∗ ( h y s t d a t a −>STATE ptr−1) ) . B ; ( h y s t d a t a −>STATE ptr ) −=2; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; ( ∗ p a s s e d )++; return v a l i d ; }  } } i f (−H >= H bounds [ h y s t d a t a −>H index ] ) { f l o a t Hstar = −H bounds [ h y s t d a t a −>H index ] ; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )−−; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ;  } else {  h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ; i f (−H < H bounds [ h y s t d a t a −>H index +1]) {  186  Appendix C. ANSI C Code of the Realized Model f l o a t Hstar = −H bounds [ h y s t d a t a −>H index +1]; f l o a t B s t a r = ( h y s t d a t a −>m) ∗ Hstar + h y s t d a t a −>Bpv ; ( h y s t d a t a −>H index )++; f l o a t mH = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j ] [ h y s t d a t a −>H index ] ) ; f l o a t mL = ( data m [ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . j + 1 ] [ h y s t d a t a −>H index ] ) ; f l o a t m = (mH−mL) ∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) . r + mL; m = m∗ ( ∗ ( h y s t d a t a −>STATE ptr ) ) .C ; f l o a t Bpv = B s t a r − m∗ Hstar ; h y s t d a t a −>m = m; h y s t d a t a −>Bpv = Bpv ;  }  }  }  } e l s e { /∗ s o l u t i o n i s bounded and v a l i d ∗/ v a l i d =1; }  } return v a l i d ; }  187  

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.24.1-0064768/manifest

Comment

Related Items