FSM Model of a Simple Photovoltaic System

The paper describes a simulation model of a simple photovoltaic system intended as a tool for testing the use of finite state machines for simulations representing a long-term operation of renewable energy sources. The mathematical model of the photovoltaic system is described first. Then it is used to build a finite state machine model that calculates a power output of the photovoltaic system for changing values of a solar irradiance and a temperature. Data measured on a real photovoltaic installation are used to verify model’s accuracy through its comparison with a previously created and verified Matlab model. The finite state machine model presented in this paper was created using Ptolemy II software.


Introduction
Photovoltaic (PV) is a technology that deals with the direct conversion of solar irradiation energy into electrical energy.The development of semiconductor technology in the fifties of the last century, P-N junction preparation and knowledge of physical processes in the PN junction created the conditions for the production of solar cells with a reasonable efficiency.For practical applications, a large number of photovoltaic cells are interconnected and encapsulated into units called photovoltaic panels.The advantage of photovoltaic panels is that their operation is safe, quiet and they need no fuel, produce no waste, in most installations have no moving parts and therefore need a minimal maintenance [1], [2], [3].On the other hand, an output of PV power plant strongly depends on weather condi-tions (a solar irradiance and a temperature).Moreover, these changes can influence the operation of an electric power network, in which PV systems (power plants) are installed.Since the changes of PV production could be very fast, it is necessary to use dynamic modelling to evaluate PV systems' influence on network's operation.It could be quite challenging when a larger part of a power system is modelled, especially if the influence is analysed from a longer-term point of view.To solve this problem, it seems to be very useful to design PV systems models using finite state machines (FSM), to represent both steady state as well as dynamic characteristics in only one model.

Mathematical Model of the PV System
The model of PV system consists of mathematical models of a PV array, a DC boost converter loaded by constant resistive load and a maximum power point tracking (MPPT) controller (Fig. 1).The inputs of the PV array model are solar irradiance λ (kW•s −2 ), temperature T (K) and load current I(A).They are used to calculate the PV array voltage V that is used as an input for the model of DC boost converter.Converter calculates the increased output voltage V o and the load current I.
The switching of the DC boost converter is controlled by MPPT controller, which changes the duty cycle D of the converter according to the voltage from PV array and load current.The MPPT controller's algorithm determines the duty cycle needed to operate the PV array in a point of its maximum power.

Mathematical Model of the PV Array
Solar cell is basically a p-n junction and so the Shockley equation can be used for its mathematical description: where and T is a temperature dependence of the diode saturation current.An equivalent circuit of solar cell based on this equation is shown in Fig. 2.
The circuit consists of the current source, a diode, a shunt resistance R SH and a series resistance R S , which represents an internal resistance of the cell [3].Because a typical PV cell produces approximately 2 W, the cells have to be connected in series-parallel connection to produce enough power.The generalized equation for the solar array connected of N p parallel and N s series cell is [4]: where A is an ideality factor.
Using Eq. ( 2) the voltage V can be expressed as: (3)

Mathematical Model of the DC Boost Converter
A topology of the DC boost converter is shown in Fig. 3.It is modelled in two modes of operation, which are given by the operation state of the switch.The output variables are inductor current i L and the capacitor voltage v C [5].When the switch is on (closed), the inductor stores the energy from PV array and the load is supplied only by the capacitor [5]: When the switch if off (open), the inductor current flows to the load and the stored energy of the inductor is transferred to the capacitor and the load [5]:

Algorithm of the MPPT Controller
The DC boost converter is controlled by MPPT controller to achieve maximum power point of the PV array.Controller changes duty cycle D of the converter.
There are many methods for the MPPT, such as perturb and observe method, incremental conductance method, etc.The most common one is perturb and observe method.Its flowchart is shown in Fig. 4 [6].

FSM Model of the PV System
Finite state machines are used to model system behaviour in many types of engineering and scientific applications.The state of a system is defined as its condition at a particular point in time.A state machine is a system whose outputs depend not only on the current inputs, but also on the current state of the system.The state of a system is a summary of everything the system needs to know about previous inputs in order to produce outputs.It is represented by a state variable s ∈ , where is the set of all possible states for the system.A FSM is a state machine where is a finite set.In a finite state machine, a system's behaviour is modelled as a set of states and the rules that govern transitions between them [7].
A FSM model of PV system, created in the software Ptolemy II, is shown in Fig. 5.The model uses input values of solar irradiance (lam), temperature T and their changes (∆lam and ∆T , respectively) to calculate the output values of current (Im), the voltage (V m) and the power (P m) of PV array at the point of its maximum power (MPP) as well as the output voltage of the converter (V o).The FSM model consists of two states, a steadystate and a transientstate.The transientstate represents the dynamic of PV system by calculating the changes of output parameters at each change of the solar irradiance (∆lam) or/and the temperature (∆T ), expressed by the lower guard in Fig. 5.If there is no change of any of these input parameters, the FSM model returns to the steadystate, the upper guard in Fig. 5, in which the steady state operation of PV system is simply simulated through the repeating sending of the last calculated values of output parameters (in transientstate) to the model output ports.Such arrangement significantly reduces model's execution time.The model is intended for using in simulations representing a longer time of PV system operation.To test a FSM approach for such a modelling, the decision was made to simplify the boost converter model.Instead of using the before mentioned MPPT algorithm and Eq. ( 4) to Eq. ( 7), the direct calculation of the current (I M ) and the voltage (V M ) at the point of maximum power using a fill factor of PV array was applied.It of course influences the model's dynamic, but the model is still able to represent the changes in PV system operation.Fill factor (FF) is a parameter, which in conjunction with the open circuit voltage (V oc ) and the short-circuit current (I sc ), determines the maximum power of a solar cell.The FF is defined as the ratio of the maximum power to the product of the open circuit voltage and the short-circuit current [8].The maximum power is calculated as a multiplication of the fill factor, the short-circuit current obtained from Eq. ( 2) and the open circuit voltage obtained from Eq. (3).Then a set of equations, consisting of following equation for maximum power: and Eq. ( 2), are used to calculate PV array voltage (V M ) and current (I M ) in MPP.
The model of DC boost converter in Fig. 6 represents an ideal DC boost converter and its mathematical representation consists of following equations: The duty cycle D is derived from Eq. ( 9) and then used in Eq. ( 10) to calculate the converter's output voltage V o .

Verification of the Created Model
A dataset representing 24 hours long measurement of the solar irradiance and the temperature, measured on a real PV installation with one minute resolution, was used to test the accuracy of created FSM model.The PV array of FSM model was parametrized to represent a real installation of two series connected PV panels.Their parameters are presented in Tab. 1.The average value of panels' fill factor, calculated from the dataset, was FF = 0.74.
A static data flow (SDF) director (Fig. 6) was used instead of a continuous time (CT) director [7], in order to reduce the simulation's execution time.
The current (I) and voltage (V ) curves of simulated PV array are shown in Fig. 7 and Fig. 8, respectively.The curve of the DC boost converter's output voltage (V o) is shown in Fig. 9.The power curve calculated by the FSM model of the PV system (Fig. 10) was compared to the power curve calculated by mathematical nonlinear model created in Matlab (Fig. 11).The Matlab model is more described in [9].It determines the maximum of power curve calculated in each simulation step for given values of the  solar irradiance and the temperature.Its accuracy was proved through the comparison with data measured on the real PV installation [9].
where P M atlab is an output power calculated by the Matlab model and P F SM is an output power calculated by the FSM model.system power curve for different values of solar irradiation.The other is the difference in how the voltages and currents representing the point of maximum power are calculated in the models.The Matlab model uses more precise method, but it needs two and a half longer execution time than FSM model.

Conclusion
The bigger integration of renewable energy sources to electric power network is based on better and deeper understanding of their operation, which depends strongly on weather conditions and can change within different time scales.That's the reason why their influence on power system operation needs to be analysed with respect to different time scales as well.Therefore there is a need for such simulation models that can properly represent both their steady state as well as transient operation.
The use of finite state machine seems to be a good approach for this kind of modelling.Models based on finite states machines consist of different states, represented by submodels, each of them suitable for modelling different operating conditions, but still cooperating together.Presented FSM model proved a good ability and accuracy to model one-day PV system operation, even at sudden changes of solar irradiance.As the FSM model was tested on a real data set, the as-sumption can be made that it would be able to model correctly a longer period of PV system operation as well.
Therefore FSM models seem to be a good solution for simulating long-term operation of renewables, or any other part of electric power system, with defined accuracy and acceptable simulations' execution times.

Fig. 7 :
Fig. 7: The current curve of the PV array per 24 hours.

Fig. 8 :
Fig. 8: The voltage curve of the PV array per 24 hours.

Fig. 9 :
Fig. 9: The output voltage curve of the converter per 24 hours.