PVSystems.Examples.Validation

Simple examples for validation of library's components

Information

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
PVSystems.Examples.Validation.IdealCBSwitchValidation IdealCBSwitchValidation Ideal current bidirectional switch validation
PVSystems.Examples.Validation.MPPTControllerValidation MPPTControllerValidation Model to validate MPPT controller
PVSystems.Examples.Validation.ParkValidation ParkValidation Validation of the Park transformations
PVSystems.Examples.Validation.PLLValidation PLLValidation PLL validation example
PVSystems.Examples.Validation.PVArrayValidation PVArrayValidation Model to validate PVArray
PVSystems.Examples.Validation.SignalPWMValidation SignalPWMValidation Simple model to validate SignalPWM behaviour
PVSystems.Examples.Validation.SimpleBatteryValidation SimpleBatteryValidation Validation of SimpleBattery

PVSystems.Examples.Validation.IdealCBSwitchValidation PVSystems.Examples.Validation.IdealCBSwitchValidation

Ideal current bidirectional switch validation

PVSystems.Examples.Validation.IdealCBSwitchValidation

Information

IdealCBSwitchValidation presents a simple circuit to validate the behaviour of the corresponding component. The circuit is composed of a resistor in series with a sinusoidal AC voltage source and the ideal current bidirectional switch. The switch is operated by a step block that changes from 0 to 1 in the middle of the simulation. This changes the state of the switch from open to closed.

To use the example, simulate the model as provided and plot the source voltage as well as the switch voltage, the plot should look like this:

IdealCBSwitchValidationResults.png

Notice how at the begining of the simulation, when the switch is not closed, it blocks all the positive voltage, preventing current from flowing. On the other hand, the negative voltage is not blocked, so the current can flow (through the parallel diode). When the switch is closed using the firing signal, it never blocks voltage, allowing bidirectional flow of current.

Plot the voltage drop in the result to confirm these results or play with the parameter values to see what effects they have.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model IdealCBSwitchValidation "Ideal current bidirectional switch validation" extends Modelica.Icons.Example; Electrical.IdealCBSwitch idealCBSwitch; Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage(freqHz=5); Modelica.Blocks.Sources.BooleanStep booleanStep(startTime=0.45); Modelica.Electrical.Analog.Basic.Ground ground; Modelica.Electrical.Analog.Basic.Resistor resistor(R=2); equation connect(booleanStep.y, idealCBSwitch.fire); connect(idealCBSwitch.p, resistor.n); connect(idealCBSwitch.n, sineVoltage.n); connect(resistor.p, sineVoltage.p); connect(ground.p, sineVoltage.n); end IdealCBSwitchValidation;

PVSystems.Examples.Validation.MPPTControllerValidation PVSystems.Examples.Validation.MPPTControllerValidation

Model to validate MPPT controller

PVSystems.Examples.Validation.MPPTControllerValidation

Information

This examples places the MPPT controller closing the loop for a voltage source connected to a PV array. The MPPT controller senses the power coming out of the PV array and provides a setpoint for the voltage source. This changes the operation point of the PV array with the goal of maximizing its output power for any given solar irradiation and junction temperature conditions.

The model is designed to challenge the control by ramping solar irradiation, temperature at different times and by injecting a perturbation into the control loop. The MPPT controller successfully deals with these changing conditions as shown in the following plot:

MPPTControllerValidationResults.png

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model MPPTControllerValidation "Model to validate MPPT controller" extends Modelica.Icons.Example; Modelica.Electrical.Analog.Basic.Ground ground; Electrical.PVArray pVArray; Modelica.Electrical.Analog.Sources.SignalVoltage sink; PVSystems.Control.ControllerMPPT controller( vrefStep=1, sampleTime=1, pkThreshold=0.01); Modelica.Electrical.Analog.Sensors.CurrentSensor CS; Modelica.Electrical.Analog.Sensors.VoltageSensor VS; Modelica.Electrical.Analog.Sensors.PowerSensor PS; Modelica.Blocks.Sources.Ramp G( offset=1000, height=-500, startTime=30, duration=10); Modelica.Blocks.Sources.Ramp T( height=-25, offset=273.15 + 25, duration=50, startTime=50); Modelica.Blocks.Math.Add add; Modelica.Blocks.Sources.Ramp Perturbation( height=10, offset=0, duration=20, startTime=130); equation connect(ground.p, sink.n); connect(pVArray.n, sink.n); connect(pVArray.p, CS.p); connect(CS.i, controller.u2); connect(VS.p, sink.p); connect(VS.n, ground.p); connect(VS.v, controller.u1); connect(CS.n, PS.pc); connect(PS.nc, sink.p); connect(PS.pv, sink.p); connect(PS.nv, sink.n); connect(G.y, pVArray.G); connect(T.y, pVArray.T); connect(add.u1, controller.y); connect(add.y, sink.v); connect(Perturbation.y, add.u2); end MPPTControllerValidation;

PVSystems.Examples.Validation.ParkValidation PVSystems.Examples.Validation.ParkValidation

Validation of the Park transformations

PVSystems.Examples.Validation.ParkValidation

Information

This example provides some easy input for the Park transform blocks to check that calculations are being done as expected. Run the simulation and you should get something like the following figure:

ParkValidationResults.png

As expected, d is equal to the peak amplitude of the input signal and q sets at zero. Feeding the signals back to the inverse transformation block recreates the original signals.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model ParkValidation "Validation of the Park transformations" extends Modelica.Icons.Example; Control.Park park; Control.InversePark inversePark; Modelica.Blocks.Sources.SawTooth sawTooth(amplitude=2*Modelica.Constants.pi, period=0.02); Modelica.Blocks.Math.Sin sin; Modelica.Blocks.Math.Cos cos; equation connect(park.d, inversePark.d); connect(park.q, inversePark.q); connect(cos.u, sawTooth.y); connect(sin.u, sawTooth.y); connect(cos.y, park.alpha); connect(sin.y, park.beta); connect(park.theta, sawTooth.y); connect(inversePark.theta, sawTooth.y); end ParkValidation;

PVSystems.Examples.Validation.PLLValidation PVSystems.Examples.Validation.PLLValidation

PLL validation example

PVSystems.Examples.Validation.PLLValidation

Information

This simple example provides a sinusoidal input to the PLL block and applies the output provided by the PLL, the calculated phase of the input sine, to drive a sine block so that the synchronization capabilities of the PLL can be visualized.

Run the model and plot the output of the sinusoidal source and the output of the sine block to see how, after some short transient, the PLL successfully follows the reference:

PLLValidationResults.png

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model PLLValidation "PLL validation example" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Sine source(freqHz=50); Control.PLL pLL; Modelica.Blocks.Math.Cos sync; equation connect(source.y, pLL.v); connect(pLL.theta, sync.u); end PLLValidation;

PVSystems.Examples.Validation.PVArrayValidation PVSystems.Examples.Validation.PVArrayValidation

Model to validate PVArray

PVSystems.Examples.Validation.PVArrayValidation

Information

PVArrayValidation presents a ramp DC voltage source in parallel with an instance of the PVArray model. The voltage ramp is configured to sweep from -10 volts to 35 volts in 1 second. This provides the enough voltage range to cover all of the PV array's working range when initialized with default values.

To use the example, simulate the model and start by displaying both voltage and current of the ramp voltage source. A figure like the following should be displayed:

PVArrayValidationResults.png

Notice how the variation in the current delivered by the PV array (sinked by the voltage source) reflects the familiar PV module curve.

Modify the values for the irradiance and temperature blocks and see how these changes are reflected in a change in the PV curve, accurately reflecting the effects of these variables in the PV module performance.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model PVArrayValidation "Model to validate PVArray" extends Modelica.Icons.Example; Modelica.Electrical.Analog.Sources.RampVoltage rampVoltage( duration=1, V=45, offset=-10); Modelica.Electrical.Analog.Basic.Ground ground; Electrical.PVArray pVArray; Modelica.Blocks.Sources.Constant Gn(k=1000); Modelica.Blocks.Sources.Constant Tn(k=298.15); equation connect(Gn.y, pVArray.G); connect(Tn.y, pVArray.T); connect(pVArray.p, rampVoltage.p); connect(pVArray.n, rampVoltage.n); connect(ground.p, rampVoltage.n); end PVArrayValidation;

PVSystems.Examples.Validation.SignalPWMValidation PVSystems.Examples.Validation.SignalPWMValidation

Simple model to validate SignalPWM behaviour

PVSystems.Examples.Validation.SignalPWMValidation

Information

SignalPWMValidation presents a very simple model aimed at validating the behaviour of the SignalPWM block. It provides a changing duty cycle with the use of two step blocks. When running the simulation with the provided values, plotting the fire output generates the following graph:

SignalPWMValidationResults.png

Through inspection of the plot, it can be seen how the signal constitutes a PWM signal with a duty cycle changing in steps through the values 0.2, 0.5 and 0.8. Zoom into the signal to confirm this fact as well as the value of the period, set at 10 milliseconds.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SignalPWMValidation "Simple model to validate SignalPWM behaviour" extends Modelica.Icons.Example; Control.SignalPWM signalPWM(period=0.01); Modelica.Blocks.Sources.Step step( height=0.3, offset=0.2, startTime=0.3); Modelica.Blocks.Sources.Step step1(height=0.3, startTime=0.6); Modelica.Blocks.Math.Add add; equation connect(step.y, add.u1); connect(step1.y, add.u2); connect(add.y, signalPWM.duty); end SignalPWMValidation;

PVSystems.Examples.Validation.SimpleBatteryValidation PVSystems.Examples.Validation.SimpleBatteryValidation

Validation of SimpleBattery

PVSystems.Examples.Validation.SimpleBatteryValidation

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model SimpleBatteryValidation "Validation of SimpleBattery" extends Modelica.Icons.Example; Modelica.Electrical.Analog.Sources.SignalCurrent CC; Modelica.Blocks.Sources.RealExpression CCControl(y=4.19 - B.v); Modelica.Electrical.Analog.Basic.Ground ground; Electrical.SimpleBattery B(Q=1, DoDini=0.999); Modelica.Blocks.Continuous.LimIntegrator limIntegrator(outMax=2); equation connect(ground.p, CC.p); connect(CC.p, B.n); connect(CC.n, B.p); connect(limIntegrator.y, CC.i); connect(CCControl.y, limIntegrator.u); end SimpleBatteryValidation;

Automatically generated Sun Apr 02 18:11:59 2017.