LBL logo

Buildings.Electrical.Examples

Package with example models

Information

This package contains examples for the use of models that can be found in Buildings.Electrical.

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

Package Content

Name Description
Buildings.Electrical.Examples.RenewableSources RenewableSources Example model that shows the impact of renewable sources on the electrical grid

Buildings.Electrical.Examples.RenewableSources Buildings.Electrical.Examples.RenewableSources

Example model that shows the impact of renewable sources on the electrical grid

Buildings.Electrical.Examples.RenewableSources

Information

This model shows the impact of renewables on the electric grid. The sensors show how the voltage per unit fluctuates depending on the building load and the power produced by the PV and the wind turbine. To the right of the model is the post-processing that computes the ratio of energy produced by the renewables over the energy consumed by the loads.

Ratio between energy produced by renewables and energy consumed

Th image below shows the ratio between the energy produced by renewable energy sources over the energy consumed by the loads over one year. The solid line indicates the Net-Zero Energy goal and the blue line indicates the actual ratio for the neighborhood represented by the model.

image

Voltage losses due to power generated by renewables

The scatter plots show the voltage levels at different locations in the network. In particular, the plots highlight how the voltage fluctuations are related to the power generated by the renewable sources, to the wind speed and the global horizontal irradiation. As expected, voltage increases with the power generated by the renewables, causing possible instabilities to the electrical grid.

image

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

Parameters

TypeNameDefaultDescription
Frequencyf60Nominal grid frequency [Hz]
VoltageV_nominal480Nominal grid voltage [V]
PowerPLoa_nominal3500Nominal power of a load [W]
PowerPWinPLoa_nominal*4Nominal power of the wind turbine [W]
PowerPSunPLoa_nominal*1.0Nominal power of the PV [W]
DensityOfHeatFlowRateW_m2_nominal1000Nominal solar power per unit area [W/m2]
Realeff_PV0.12*0.85*0.9Nominal solar power conversion efficiency (this should consider converion efficiency, area covered, AC/DC losses)
AreaA_PVPSun/eff_PV/W_m2_nominalNominal area of a P installation [m2]

Connectors

TypeNameDescription
BusweaBusWeather data bus

Modelica definition

model RenewableSources "Example model that shows the impact of renewable sources on the electrical grid" extends Modelica.Icons.Example; parameter Modelica.SIunits.Frequency f = 60 "Nominal grid frequency"; parameter Modelica.SIunits.Voltage V_nominal = 480 "Nominal grid voltage"; parameter Modelica.SIunits.Power PLoa_nominal = 3500 "Nominal power of a load"; parameter Modelica.SIunits.Power PWin = PLoa_nominal*4 "Nominal power of the wind turbine"; parameter Modelica.SIunits.Power PSun = PLoa_nominal*1.0 "Nominal power of the PV"; parameter Modelica.SIunits.DensityOfHeatFlowRate W_m2_nominal = 1000 "Nominal solar power per unit area"; parameter Real eff_PV = 0.12*0.85*0.9 "Nominal solar power conversion efficiency (this should consider converion efficiency, area covered, AC/DC losses)"; parameter Modelica.SIunits.Area A_PV = PSun/eff_PV/W_m2_nominal "Nominal area of a P installation"; AC.ThreePhasesBalanced.Sources.Grid gri( f=f, V=V_nominal, phiSou=0) "Grid model that provides power to the system"; AC.ThreePhasesBalanced.Loads.Inductive loa1(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.8, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Loads.Inductive loa2(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.9, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Loads.Inductive loa3(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.8, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Loads.Inductive loa4(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.88, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Lines.Line line1(mode=Buildings.Electrical.Types.CableMode.automatic, l=1500, V_nominal=V_nominal, P_nominal=7*(PLoa_nominal + PSun) + PWin) "Electrical line"; AC.ThreePhasesBalanced.Lines.Line line2(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=3*(PLoa_nominal + PSun)) "Electrical line"; AC.ThreePhasesBalanced.Lines.Line line3(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=2*(PLoa_nominal + PSun)) "Electrical line"; AC.ThreePhasesBalanced.Lines.Line line4(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=(PLoa_nominal + PSun)) "Electrical line"; AC.ThreePhasesBalanced.Lines.Line line5(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=3*(PLoa_nominal + PSun) + PWin) "Electrical line"; AC.ThreePhasesBalanced.Loads.Inductive loa5(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.95, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Loads.Inductive loa6(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.8, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Loads.Inductive loa7(mode=Buildings.Electrical.Types.Load.VariableZ_y_input, V_nominal=V_nominal, linearized=false, use_pf_in=false, pf=0.75, P_nominal=-PLoa_nominal) "Electrical load"; AC.ThreePhasesBalanced.Lines.Line line6(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=2*(PLoa_nominal + PSun) + PWin) "Electrical line"; AC.ThreePhasesBalanced.Lines.Line line7(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=(PLoa_nominal + PSun) + PWin) "Electrical line"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv1( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.85, lat=weaDat.lat, azi=Buildings.Types.Azimuth.S, til=0.5235987755983) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv2( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.8, lat=weaDat.lat, azi=Buildings.Types.Azimuth.E, til=0.5235987755983) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv3( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.8, lat=weaDat.lat, azi=Buildings.Types.Azimuth.W, til=0.34906585039887) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv4( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.9, lat=weaDat.lat, azi=Buildings.Types.Azimuth.S, til=0.5235987755983) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv5( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.95, lat=weaDat.lat, azi=Buildings.Types.Azimuth.W, til=0.61086523819802) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv6( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.9, lat=weaDat.lat, azi=Buildings.Types.Azimuth.E, til=0.43633231299858) "PV"; AC.ThreePhasesBalanced.Sources.PVSimpleOriented pv7( eta_DCAC=0.89, A=A_PV, fAct=0.9, eta=0.12, linearized=false, V_nominal=V_nominal, pf=0.97, lat=weaDat.lat, azi=Buildings.Types.Azimuth.S, til=0.5235987755983) "PV"; AC.ThreePhasesBalanced.Sources.WindTurbine winTur( V_nominal=V_nominal, h=15, hRef=10, pf=0.94, eta_DCAC=0.92, nWin=0.4, tableOnFile=false, scale=PWin) "Wind turbine model"; AC.ThreePhasesBalanced.Lines.Line line8(mode=Buildings.Electrical.Types.CableMode.automatic, l=300, V_nominal=V_nominal, P_nominal=PWin); BoundaryConditions.WeatherData.ReaderTMY3 weaDat( computeWetBulbTemperature=false, filNam="modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos") "Weather data model"; BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Modelica.Blocks.Sources.CombiTimeTable pow1(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.1; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.8; 10*3600,0.7; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.8; 20*3600,0.7; 22*3600,0.3; 24*3600,0.1]) "Power consumption profile for load 1"; Modelica.Blocks.Sources.CombiTimeTable pow2(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.1; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.8; 10*3600,0.7; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.8; 20*3600,0.7; 22*3600,0.3; 24*3600,0.1]) "Power consumption profile for load 2"; Modelica.Blocks.Sources.CombiTimeTable pow3(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.1; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.8; 10*3600,0.7; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.8; 20*3600,0.7; 22*3600,0.3; 24*3600,0.1]) "Power consumption profile for load 3"; Modelica.Blocks.Sources.CombiTimeTable pow4(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.2; 2*3600,0.2; 4*3600,0.2; 6*3600,0.2; 8*3600,0.8; 10*3600,0.8; 12*3600,0.6; 14*3600,0.3; 16*3600,0.3; 18*3600,0.8; 20*3600,0.8; 22*3600,0.3; 24*3600,0.3]) "Power consumption profile for load 4"; Modelica.Blocks.Sources.CombiTimeTable pow5(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.1; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.5; 10*3600,0.2; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.9; 20*3600,0.4; 22*3600,0.2; 24*3600,0.1]) "Power consumption profile for load 5"; Modelica.Blocks.Sources.CombiTimeTable pow6(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.1; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.8; 10*3600,0.7; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.8; 20*3600,0.7; 22*3600,0.3; 24*3600,0.1]) "Power consumption profile for load 6"; Modelica.Blocks.Sources.CombiTimeTable pow7(extrapolation= Modelica.Blocks.Types.Extrapolation.Periodic, table=[0,0.2; 2*3600,0.1; 4*3600,0.1; 6*3600,0.1; 8*3600,0.4; 10*3600,0.7; 12*3600,0.3; 14*3600,0.3; 16*3600,0.3; 18*3600,0.2; 20*3600,0.7; 22*3600,0.3; 24*3600,0.2]) "Power consumption profile for load 7"; AC.ThreePhasesBalanced.Sensors.Probe sen1(V_nominal=V_nominal, perUnit=true) "Voltage probe"; AC.ThreePhasesBalanced.Sensors.Probe sen2(V_nominal=V_nominal, perUnit=true) "Voltage probe"; AC.ThreePhasesBalanced.Sensors.Probe sen3(V_nominal=V_nominal, perUnit=true) "Voltage probe"; Modelica.Blocks.Continuous.Integrator EWin "Energy produced by the wind turbine"; Modelica.Blocks.Math.MultiSum PSol(nu=7, y(unit="W")) "Total produced solar power"; Modelica.Blocks.Continuous.Integrator ESol "Energy produced by the solar panels"; Modelica.Blocks.Sources.RealExpression PLoa( y=PLoa_nominal*(pow1.y[1] + pow2.y[1] + pow3.y[1] + pow4.y[1] + pow5.y[1] + pow6.y[1] + pow7.y[1])) "Total power consumed by the loads"; Modelica.Blocks.Continuous.Integrator ELoa(y_start=1E-10) "Energy consumed by the loads"; Modelica.Blocks.Math.Add EPro "Total produced power by renewables"; Modelica.Blocks.Math.Division ERat "Ratio of produced over consumed energy"; equation connect(gri.terminal, line1.terminal_n); connect(line1.terminal_p, loa1.terminal); connect(line1.terminal_p, line2.terminal_n); connect(line2.terminal_p, loa2.terminal); connect(line2.terminal_p, line3.terminal_n); connect(line3.terminal_p, loa3.terminal); connect(line3.terminal_p, line4.terminal_n); connect(line4.terminal_p, loa4.terminal); connect(line1.terminal_p, line5.terminal_n); connect(loa5.terminal, line5.terminal_p); connect(line5.terminal_p, line6.terminal_n); connect(line6.terminal_p, line7.terminal_n); connect(loa6.terminal, line6.terminal_p); connect(loa7.terminal, line7.terminal_p); connect(line1.terminal_p, pv1.terminal); connect(line2.terminal_p, pv2.terminal); connect(line3.terminal_p, pv3.terminal); connect(line4.terminal_p, pv4.terminal); connect(pv5.terminal, line5.terminal_p); connect(pv6.terminal, loa6.terminal); connect(pv7.terminal, loa7.terminal); connect(line7.terminal_p, line8.terminal_n); connect(line8.terminal_p, winTur.terminal); connect(weaDat.weaBus, pv1.weaBus); connect(weaDat.weaBus, pv2.weaBus); connect(weaDat.weaBus, pv3.weaBus); connect(weaDat.weaBus, pv4.weaBus); connect(weaDat.weaBus, weaBus); connect(weaBus.winSpe, winTur.vWin); connect(weaDat.weaBus, pv5.weaBus); connect(weaDat.weaBus, pv6.weaBus); connect(weaDat.weaBus, pv7.weaBus); connect(loa2.y, pow2.y[1]); connect(pow1.y[1], loa1.y); connect(loa3.y, pow3.y[1]); connect(loa4.y, pow4.y[1]); connect(loa5.y, pow5.y[1]); connect(loa6.y, pow6.y[1]); connect(loa7.y, pow7.y[1]); connect(sen1.term, line1.terminal_p); connect(sen2.term, line4.terminal_p); connect(sen3.term, line8.terminal_p); connect(EWin.u, winTur.P); connect(pv1.P, PSol.u[1]); connect(PSol.u[2], pv2.P); connect(PSol.u[3], pv3.P); connect(PSol.u[4], pv4.P); connect(PSol.u[5], pv5.P); connect(PSol.y, ESol.u); connect(PSol.u[6], pv6.P); connect(PSol.u[7], pv7.P); connect(ELoa.u, PLoa.y); connect(EPro.u1, ESol.y); connect(EPro.u2, EWin.y); connect(ERat.u1, EPro.y); connect(ERat.u2, ELoa.y); end RenewableSources;

http://simulationresearch.lbl.gov/modelica