PWM CONTROLLER'S MODELS FOR INVESTIGATION ACS IN SPICE-FAMILY ECAD PROGRAMS

Purpose. To improve simulation and design of Automatic Control Systems in the SPICE-compatible programs and to obtain separate economic and universal macromodels of PWM controller. Development of an PWM controller economical macromodel for the study of automatic control systems (ACS) in computer-aided design (ECAD) programs, which does not generate algorithmic failures in comparison with the existing models of PWM. Findings. Analysis of SPICE-family applications’ mathematical basis allowed to classifying existing models of PWM-controllers, defining their suitability for ACS simulation. The criteria for the synthesis of new models have been defined. For the SPICE 3G algorithms, the Switch and Averaged models based on behavioral elements has been developed. Universal and economical PWM controller macromodel based on the simple algorithm for determining the output signal with minimum numbers of input parameters has been designed. For the Automated Measuring magnetic susceptibility System, the macromodel of quasi-PWM signal generator have been designed, which is used in the compensation subsystem. This model is different from the existing ones: it synthesizes the staircase output signal instead the pulse one, thus, there is direct control of the amplitude of the output signal, which is taken averaged. The adequacy of the models is confirmed as comparison of the simulation results during investigations of the model already existing in the SPICE program, as well as the results of experiments with real ACS. The modeling of the PWM controller was carried out on the basis of behavioral elements from the ECAD library, simulation (solution of algebra-differential equations systems with programming elements) is based on SPICE algorithms. The object of the study was the simulation process of ACS with the pulse-width principle of adjusting the output value. The subject of the research are the models of PWM controllers . Originality. The new macromodel of PWM controller that meets the criteria of adequacy, reliability and economy, synthesized on the basis of a new approach in modeling objects at the macro level in accordance with the theory of automatic control. Macromodels based in capabilities of behavioral modeling in the program of computer-aided design in Electronics (ECAD). As part of the compensation system studying, the new controller model has been developed, that turns pulse-width modulated signal into amplitude-modulated signal by a certain algorithm. This approach (obtaining a quasi-PWM signal) made it possible to significantly simplify the control unit model, and the model of ACS at whole. Practical value. PWM macromodels expands the mathematical support of ECAD, reduces the probability of the appearance of algorithmic failures and accelerates the modeling of ACS in ECAD. Approach, which used during its synthesis, allows us to build similar models for other software (CAS, CAE).


I. INTRODUTION
Pulse width modulator (PWM) switches the power on and off in order to control the level of voltage or current in the load. This modulation technique produces a series of pulses whose duty cycle varies depending upon a reference signal. PWM is a key principle for the regulation in many devices: Uninterruptible Power Supplies, Switch Mode Power Supplies (SMPS), DC-to-DC Converters, Frequency Converters, voltage/current or speed Automated Control Systems (ACS), etc. As a modulation signal typically used sawtooth waveform.
To study ACS and mechatronic systems on high level of abstraction, ECAD programs are used [1]. Unfortunately, as a rule, models for the PWM controller are quite complicated in ECAD [2].Usually, models for the PWM controller only for specialized controllers and DCto-DC Converters are represented in libraries of SPICEcompatible programs. For example, for 100V Current Mode PWM Control (LM50201), Integrated Power Ethernet PD Interface and PWM Controller (LM5070), PWM Current-Mode Controller for Low-Power Universal Off-Line Supplies (NCP1200/ON), etc. [2]. These complex models combine elements of schematic diagrams and behavioral elements and they are written in a specialized modeling language (Spice). SPICE-family ECAD programs have in their libraries a set of macromodels for different types of SMPS (Buck, Boost, Buck-Boost and other converters). The core ISSN 2521-6244 (Online) Розділ«Електротехніка» of these models is the encapsulated macromodel of the control system (PWM). They can be constructed on the basis of the principle electric circuit (Switch models) [2,3] or obtained as a Black Box (Averaged models) [4]. The Switch models are much more complicated than the Averaged macromodels, the number of external outputs of Switch models equal to number of pins of real IC (models for specialized controller for Modular Power Systems UC1846, controller of Power Supplies TL494, etc [3,4]). Averaged models are obtained for the Small Signal Mode on the base of Laplace Transform and used for frequency response analysis; they are not adequate in the transient analysis.

II. ANALYSIS OF LAST RESEARCHES
In article [5] we'll see how to find the output power stage transfer function H(s), called the Control-to-Output function, of the most switching power supplies: BUCK, BOOST, BUCK-BOOST, HALF-BRIDGE, FULL BRIDGE, both in voltage mode (VM) control and current mode (CM) control. According to Bode plots, we can choose the most suitable compensator (Transfer function G(s)), implementing the compensation network with the operational amplifiers embedded in the microcontrollers. The SPICE simulation of the open loop transfer function G(s)·H(s), will allows us to evaluate the results for the system stability. Once the components for the specific power supply have been parametrizied, we can estimate with good approximation the transfer function which describes mathematically the output power stage. Models of subsystems are averaged for the Small Signal Mode and are obtained as blocks with transfer functions by the Laplace transform.
Article [6] describes some guidelines which will help to write new generic models for the ECAD. An effective PWM model that is easily modeled includes functions that are common and in Small Signal Mode it is not necessary to model the internal architecture of specific converters. In this article models are constructed on simple linear equations, which describe idealized behavior. Some passive elements added to include various effects (propagation delay, input voltage offset, etc. Article [7] presents the simple model PWM controller for the DC driver`s simulation in Matlab (library Sim-PowerSystem). This model is an algebraic summation of signals from the sawtooth generator and a reference volt-age generator, the resultant signal is supplied to the relay, which model is quite complicated.
In the article [8], the PWM model for a three-phase frequency converter with a rectifier and a voltage inverter is presented as a source of noise, which is then suppressed by analog filters with compensators that well eliminate noise caused by PWM and do not distort the phases and amplitudes of the main harmonics. This model adequate only for this specific occasion.
The paper [9] presents the basic equations on which the model of the PWM can be based, and model as Block Diagram for the Perturbation Case has been obtained. PWM signal of constant frequency has been obtained by comparing the ramp signal (or carrier signal) with the error between the desired and the actual output voltage signal (compensator voltage signal).This model is valid for continuous conduction mode (CCM) and is accurate only for frequencies much lower thanf s /2 (Nyquistrate).
For DC-to-DC converter, PWM reference signal (Vr) is constant value and independent from modulation technique employed for the steady state. For the dynamic purpose, the reference signal can be considered to be the sum of DC value corresponding to the steady state and a sinusoidal signal signifying the small signal perturbation.
The macro circuit in ECAD program which based upon the article [10] featured a very workable model for the UC1845 pulse width modulator. This macro is the version with an integral T flip-flop. Its schematic is complicated and based on the manufacturer's specifications and block diagram of the UC1845 PWM IC, and uses most of the same concepts as in the macromodel of 555 Timer.
In Micro Cap 11 (SPICE-family ECAD program) [4], there is interesting PWM signal generator model that is an integral part of the DC-to-DC converter (file DSP_SAMPLE circuit).
The macromodel of PWM has six parameters: ModHigh, ModLow, ModFreq, ModType, PWMHigh, and PWMLow. ModHigh and ModLow define the high and low voltage values of the modulating signal. The ModFreq parameter defines the frequency of the modulating signal. ModType defines whether the modulating signal is a trailing edge sawtooth, a leading edge sawtooth, or a triangle waveform. The PWMHigh and PWMLow parameters define the high and low voltage values of the PWM output signal.
The ModPeriod variable converts the ModFreq parameter into its equivalent period in units of seconds. The internal parameter ModTrans variable is used to set the transition time for the sawtooth modulation signal. It sets the transition time to the modulation period divided by 10000. ModRamp source creates the sawtooth signal. Behavioral element Voltage source creates the PWM output signal Vout. The function source has been defined with the following expression: (1) The hyperbolic tangent operator produces a value between 1 and -1. The 1·10 5 provides a high gain that minimizes the transition between the two limits. Essentially, when the differential voltage between nodes In and Ramp is positive, the tanh function returns 1. When the differential voltage is negative, the tanh function returns -1. The Vo and Va variables are set through the two following define statements (syntaxes of Spice language): .define Va (PWMHigh-PWMLow)/2; .define Vo (PWMHigh+PWMLow)/2. These two variables force the output voltage of the pulse signal to the high and low values of PWMHigh and PWMLow respectively.
This model is quite simple, based on the behavioral element, but the calculation of the hyperbolic tangent can give rise to problems of convergence of the computational algorithm. In addition, this model is not embedded in the library of Micro Cap, thus, there is no separate model of the PWM signal generator.

III. FORMULATION OF THE WORK PURPOSE
Analysis of ECAD's mathematical support has shown that there is no separate simple model of PWM as block, suitable for investigating the dynamics of processes in the ACS, or it is not available. As you can see, these PWM models evolved mainly as a component of DC-DC Converters and they are adequate in Small Signal Mode.
But it would be desirable to have simple model of PWM, suitable for use in any Switched Mode electronic devices, especially those that are part of the ACS. Therefore, the criteria for developing such models are universality, cross-platformism, minimum set of input and internal parameters, and lack of algorithmic failures to accelerate and improve the reliability of the simulation process. The model should provide the ability to monitor and predict dynamic performance in real time mode. The accuracy of simulation is always the main criteria. So, we need to develop a separate model suitable fo the ACS analysis

IV. NEW MACROMODEL`S MODELING AND SIMULATION
Universal and economical PWM controller model is shown in Figure 1,а. This model is similar to the model discussed above, but based on a simple algorithm for determining the output signal and has three times smaller set of input parameters. The IN is the input pin for the reference signal. In this scheme generator V1 emulate the variable input / reference signal. The OUT is the output pin for the PWM signal. The modulation signal is generated by the Sawtooth generator within the macro (leading edge sawtooth) by the multipurpose Voltage Source V2.
The macro has three internal (local) parameters: the PWM_High and PWM_Low, which define the high and low voltage values of the PWM output signal respectively and PWM_Period, which set the period of Sawtooth signal. In this example the frequency of the modulating signal is 8kHz. The R1 resistor (resistance 1MOhm) provides a DC path to ground at the input node.
Behavior of output programmed by the functional source E1. This creates a comparator function which produced the pulse of the modulator. Input and sawtooth signals are compared in it: if the value of input/references signal greater than the one in sawtooth signal, output voltage is set to low value; in vice versa, if the input signal less than the sawtooth -to high value.
This algorithm is written in the conditional operator:

IF V(IN)≥V(SAWTOOTH) THEN PWM_Low ELSE PWM_High
The PWM_High and PWM_Low values of output voltage levels are given in the respective «define» operators. This form of statement is used to create and define the value of a symbolic variable. In Spice-language the Conditional operator IF(b,z 1 ,z 2 ): if b is true, the function returns z 1 , else it returns z 2 ).
The result of simulation of corresponding modulation signals are shown below in the fig.1 Figure 2,a shows the model from DSP_SAMPLE circuit [4] and new model. In Figure 2,b the results of their simulation are presented (upper graph -new model, lower graph -model from [4]).
As can be seen, the results are almost identical; there are slight differences at the beginning of the modeling time, which is due to the features of initial conditions calculation (DC Operation Point computation).
Another model is a simplified version in which compensating signal produced as a constant continuous signal with variation of its amplitude (staircase signal). This assumption is acceptable provided if the output signal is smoothing effectively by filter. Since the PWM signal regulates the average value of the voltage by changing the duty cycle, it is possible to directly use the variation of the mean/average value during PWM simulation. If the duty cycle (D.C.) varies linearly, and the amplitude of the signal is constant, we can assume that the average value of the signal V AVG : . .
where V AVG -amplitude of output voltage; T -period; τ − pulse duration. Such model developed during designing of compensating subsystem in the System for measuring of magnetic susceptibility [11]. This information-measuring system is an AСS (magnetometric scales with the registration of the zero position on the basis of determining the frequency change of LC generator) [11]. Control of the measurement process is carried out by a microprocessor. ACS is designed to compensate for the displacement of the rod caused by the magnet's impact on the magnetic material, for measuring and fixing the current of a power magnet, resulting displacement of the rod, frequency difference, and PWM signal generation for the compensating choke.
The resulting scheme of Automated System is shown in figure 3. The total model consists of subsystems: 1 -Power Magnet; 2 -tested sample; 3 -the rod; 4 -Measurement subsystem on Colpitts variable frequency oscillator; 5 -Compensating subsystem (implemented on an inductive choke); 6 -Microprocessor Control System).

Figure 2. Structural diagram of the ACS model
Here the variables: POSITION1 -displacement of the rod (ejection/retraction of the tested sample from the power magnet); POSITION2 -result displacement (ejection/retraction from compensating system).
Macromodel of PWM for Micro Cap 11 is shown in figure 4,a, it's created by the rules of SPICE 3G simulation algorithms and based on B elements [10]. The output PWM signal controlled the current of the choke with inductance 10 mH. The displacement of the rod is calculated in two subsystems -in the measuring one (subsystems for finding the frequency difference (FREQUENCY) and displacement of the rod (POSITION1)) and in compensating subsystem (scheme for finding the resulting displacement (POSITION2)). The difference between them makes it necessary to change the Duty Cycle of PWM signal (frequency 8 kHz), which corresponds to changing of signal amplitude in current /voltage generator for compensating system. So, the average level of quasi-PWM signal can be changed.
The calculation of the current value of the rod`s position in the measuring and compensating subsystems occurs separately according to the corresponding algorithms. For visibility of the results, the found value PO-SITION1 in measuring subsystem is fixed (3·10 -6 m), the ISSN 2521-6244 (Online) Розділ«Електротехніка» change of POSITION2 in compensation subsystem occurs by incrementing the PWM signal.
The PWM substitution scheme based on staircase voltage source X1, which emulates PWM signal. In this element, the value of the function (the voltage with respect to T) is averaged at each step, and then the increment for the next step takes place at a specified frequency. Founded value INCREMENT then transferred to the source E1 for determine the rod position changing (POSITION2) with coefficient K=1·10 -3 . It reproduces the process of its ejection from the inductor by the action of PWM signal that varies stepwise. The choke in compensating system is emulated by the inductance L1=1·10 -3 H. The R2 resistor (resistance 0.5 kOhm) provides a DC path to ground for ensure algorithmic reliability and emulated the total resistance of subsystem.
The compensation signal stops changing when the values of POSITION1 and POSITION2 become equal ( fig.4,b,  Found value of POSITION2 fixed ( fig.4,b, lower graph) and transferred to further processing: in the general model, the frequency of generator in the measuring subsystem and the current of the power electromagnet are calculating. All internal variables are written in operator .define. In fact, this model represents a proportional integration block of ACS [12]. Both models are used the causal approach [1], [12]. The model also makes it possible to investigate tasks in which the POSITION1 is also changing. Model of measurement system was investigated in static and dynamic modes in ECAD program Micro-Cap 11. Its speed and stability have been evaluated during the Transient Analysis. The delay of operation of the compensation system is found (3 μs±10%).
Directions of its parametric optimization and improvement on criteria of accuracy and versatility are found.

V. CONCLUSION
In this section, necessary to state the results obtained a result of the research. The developed macromodels are distinguished by minimalism and simplicity and therefore, may be recommended for the study of ACS on the upper levels of abstraction in ECAD and in other similar mathematical processors.
After the model experiment, in which the parameters of the system has been optimized and refined on the basis of physical features of the real hardware, a prototype of compensation system was designed [11]. So, the adequacy of the models has been confirmed not only by comparison of the simulation results during investigations of the model already existing in the SPICE-family program [4], but with the results of experiments on real ACS [11].
The relative error of the model is not more than 20%, so it can be recommended for the study of such systems.