Buildings.Electrical.DC.Lines.Examples

Package with example models

Information

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

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

Package Content

Name Description
Buildings.Electrical.DC.Lines.Examples.DCLine DCLine Example model to test the DC lines
Buildings.Electrical.DC.Lines.Examples.DCLines DCLines Example model to test the possible combinations between line and load models
Buildings.Electrical.DC.Lines.Examples.DCLinesLinearized DCLinesLinearized Example model to test the possible combinations between line and load models
Buildings.Electrical.DC.Lines.Examples.RCModel RCModel Example model to test for the DC RC two port model
Buildings.Electrical.DC.Lines.Examples.Resistance Resistance Example model to test for the DC resistance two port model

Buildings.Electrical.DC.Lines.Examples.DCLine Buildings.Electrical.DC.Lines.Examples.DCLine

Example model to test the DC lines

Buildings.Electrical.DC.Lines.Examples.DCLine

Information

This model is a simple test case that show how to use a line model and parametrize it using a commercial cable.

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

Modelica definition

model DCLine "Example model to test the DC lines" extends Modelica.Icons.Example; Line line( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=100) "Transmission line"; Sources.ConstantVoltage E(V=50) "Voltage source"; Line line1( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=100) "Transmission line"; Line line2( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=100) "Transmission line"; Modelica.Electrical.Analog.Basic.Ground ground; Loads.Conductor load1( mode=Types.Load.VariableZ_y_input, V_nominal=50, linearized=false, P_nominal=-50) "Variable load"; Loads.Conductor load2( V_nominal=50, linearized=false, P_nominal=-150) "Load"; Loads.Conductor load3( V_nominal=50, linearized=false, P_nominal=-200) "Load"; Modelica.Blocks.Sources.Ramp varLoad( height=0.8, duration=0.5, offset=0.2, startTime=0.3) "Load consumption profile"; equation connect(E.terminal, line.terminal_n); connect(E.terminal, line1.terminal_n); connect(E.terminal, line2.terminal_n); connect(load1.terminal, line.terminal_p); connect(line1.terminal_p, load2.terminal); connect(line2.terminal_p, load3.terminal); connect(varLoad.y, load1.y); connect(E.n, ground.p); end DCLine;

Buildings.Electrical.DC.Lines.Examples.DCLines Buildings.Electrical.DC.Lines.Examples.DCLines

Example model to test the possible combinations between line and load models

Buildings.Electrical.DC.Lines.Examples.DCLines

Information

This model shows a DC grid with 10 loads and 16 cables. Each cable is of length l = 10 meters, a parameter that can be modified. Each load can be either be a full nonlinear model, or be replaced by the linearized version. The parameter linearLoads = false can be used to switch between linear and nonlinear implementation.

This model can be used to test how the linearized loads are affected by the voltage drop caused by the lines. The longer the distance between the load and the source, the bigger is the voltage drop and thus the error introduced by the linearization.

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

Parameters

TypeNameDefaultDescription
BooleanlinearLoadsfalseFlag that selects between linearized or nonlinear load models
RealL10Length of each cable

Modelica definition

model DCLines "Example model to test the possible combinations between line and load models" extends Modelica.Icons.Example; parameter Boolean linearLoads=false "Flag that selects between linearized or nonlinear load models"; parameter Real L=10 "Length of each cable"; Modelica.SIunits.Power Sloads=load1.S[1] + load2.S[1] + load3.S[1] + load4.S[1] + load5.S[1] + load6.S[1] + load7.S[1] + load8.S[1] + load9.S[1] + load10.S[1] "Sum of the power consumed by the loads"; Line line( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Sources.ConstantVoltage E(V=50) "Voltage source"; Line line1( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line2( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Modelica.Electrical.Analog.Basic.Ground ground; Loads.Conductor load1( mode=Types.Load.VariableZ_y_input, V_nominal=50, linearized=linearLoads, P_nominal=-150) "Load"; Loads.Conductor load2( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-120) "Load"; Loads.Conductor load3( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-200) "Load"; Modelica.Blocks.Sources.Trapezoid varLoad1( offset=0.4, amplitude=0.6, rising=600, width=1000, falling=800, period=3600, startTime=1800) "Power consumption profile"; Loads.Conductor load4( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-120) "Load"; Line line3( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line4( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line5( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line0( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Modelica.Blocks.Sources.Trapezoid varLoad2( startTime=1800, amplitude=0.8, rising=400, width=1300, falling=900, period=4000, offset=0.1) "Power consumption profile"; Line line6( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Loads.Conductor load5( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-200) "Load"; Modelica.Blocks.Sources.Trapezoid varLoad3( amplitude=0.7, rising=660, width=900, falling=300, period=3700, offset=0.3, startTime=200) "Power consumption profile"; Loads.Conductor load6( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-120) "Load"; Line line7( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line8( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line9( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Loads.Conductor load7( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-200) "Load"; Modelica.Blocks.Sources.Trapezoid varLoad4( rising=600, width=1000, falling=800, period=3600, amplitude=0.1, offset=0.8, startTime=3300) "Power consumption profile"; Loads.Conductor load8( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-120) "Load"; Line line10( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line11( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line12( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Loads.Conductor load9( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-200) "Load"; Modelica.Blocks.Sources.Trapezoid varLoad5( falling=800, amplitude=0.5, rising=800, width=800, period=3000, offset=0.5, startTime=0) "Power consumption profile"; Loads.Conductor load10( V_nominal=50, mode=Types.Load.VariableZ_y_input, linearized=linearLoads, P_nominal=-120) "Load"; Line line13( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=L) "Transmission line"; Line line14( P_nominal=500, V_nominal=50, mode=Types.CableMode.commercial, commercialCable=Transmission.LowVoltageCables.PvcAl16(), l=100) "Transmission line"; equation connect(load1.terminal, line.terminal_p); connect(line1.terminal_p, line.terminal_n); connect(line2.terminal_p, line3.terminal_n); connect(line3.terminal_p, load3.terminal); connect(line1.terminal_p, line4.terminal_n); connect(line4.terminal_p, load2.terminal); connect(load4.terminal, line5.terminal_p); connect(line5.terminal_n, line3.terminal_n); connect(E.terminal, line0.terminal_n); connect(line0.terminal_p, line1.terminal_n); connect(varLoad1.y, load3.y); connect(varLoad1.y, load4.y); connect(varLoad2.y, load1.y); connect(varLoad2.y, load2.y); connect(line6.terminal_p, line7.terminal_n); connect(line7.terminal_p, load5.terminal); connect(load6.terminal, line8.terminal_p); connect(line8.terminal_n, line7.terminal_n); connect(varLoad3.y, load5.y); connect(varLoad3.y, load6.y); connect(line9.terminal_p, line10.terminal_n); connect(line10.terminal_p, load7.terminal); connect(load8.terminal, line11.terminal_p); connect(line11.terminal_n, line10.terminal_n); connect(varLoad4.y, load7.y); connect(varLoad4.y, load8.y); connect(line12.terminal_p, line13.terminal_n); connect(line13.terminal_p, load9.terminal); connect(load10.terminal, line14.terminal_p); connect(line14.terminal_n, line13.terminal_n); connect(varLoad5.y, load9.y); connect(varLoad5.y, load10.y); connect(line2.terminal_n, line4.terminal_n); connect(line6.terminal_n, line3.terminal_n); connect(line9.terminal_n, line7.terminal_n); connect(line12.terminal_n, line10.terminal_n); connect(E.n, ground.p); end DCLines;

Buildings.Electrical.DC.Lines.Examples.DCLinesLinearized Buildings.Electrical.DC.Lines.Examples.DCLinesLinearized

Example model to test the possible combinations between line and load models

Buildings.Electrical.DC.Lines.Examples.DCLinesLinearized

Information

This model is the linearized version of the model Buildings.Electrical.DC.Lines.Examples.DCLines and can be used to test how the linearized loads are affected by the voltage drop caused by the lines. The longer the distance between the load and the source, the bigger is the voltage drop and thus the error introduced by the linearization.

Extends from Buildings.Electrical.DC.Lines.Examples.DCLines (Example model to test the possible combinations between line and load models).

Parameters

TypeNameDefaultDescription
BooleanlinearLoadstrueFlag that selects between linearized or nonlinear load models
RealL10Length of each cable

Modelica definition

model DCLinesLinearized "Example model to test the possible combinations between line and load models" extends Buildings.Electrical.DC.Lines.Examples.DCLines(linearLoads=true); end DCLinesLinearized;

Buildings.Electrical.DC.Lines.Examples.RCModel Buildings.Electrical.DC.Lines.Examples.RCModel

Example model to test for the DC RC two port model

Buildings.Electrical.DC.Lines.Examples.RCModel

Information

This model shows how to use a two port resistance-capacitance model. The example also shows a comparison between the dynamic and steady state version model that can be selected by changing the boolean flag use_C.

In this example the RC connects an ideal constant voltage source with a short circuit. The steady state current value passing through the RC model depends just on the value of R.

The RC model implement a T-model to represent the electric connection between the two connectors (see Buildings.Electrical.DC.Lines.TwoPortRCLine for more details).

The capacitance C see an equivalent Thevenin's resistance that is equal to REQ = 0.5 R and thus the time constant associated to the capacitance is

τ = REQ C = 0.5 R C = 2 seconds,

thus the duration of transient period is about 10 seconds.

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

Modelica definition

model RCModel "Example model to test for the DC RC two port model" extends Modelica.Icons.Example; TwoPortRCLine RC_ss( C=1, V_nominal=50, R=8) "Line resistance"; Sources.ConstantVoltage constantVoltage(V=50) "Voltage source"; Modelica.Electrical.Analog.Basic.Ground ground; Loads.Resistor sc_ss(V_nominal=50, R=0) "Short circuit load"; Sensors.GeneralizedSensor sen_ss "Sensor"; TwoPortRCLine RC_dyn( C=1, V_nominal=50, use_C=true, R=8) "Line resistance"; Loads.Resistor sc_dyn(V_nominal=50, R=0) "Load"; Sensors.GeneralizedSensor sen_dyn "Sensor"; equation connect(ground.p, constantVoltage.n); connect(constantVoltage.terminal, RC_ss.terminal_n); connect(RC_ss.terminal_p, sen_ss.terminal_n); connect(sen_ss.terminal_p, sc_ss.terminal); connect(RC_dyn.terminal_p, sen_dyn.terminal_n); connect(sen_dyn.terminal_p, sc_dyn.terminal); connect(constantVoltage.terminal, RC_dyn.terminal_n); end RCModel;

Buildings.Electrical.DC.Lines.Examples.Resistance Buildings.Electrical.DC.Lines.Examples.Resistance

Example model to test for the DC resistance two port model

Buildings.Electrical.DC.Lines.Examples.Resistance

Information

This model shows how to use a two port resistance. In this example the resistance connects an ideal constant voltage source with a short circuit. The current flowing through the circuit depends just on the value of the two port resistance.

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

Modelica definition

model Resistance "Example model to test for the DC resistance two port model" extends Modelica.Icons.Example; TwoPortResistance lineR(R=10) "Line resistance"; Sources.ConstantVoltage constantVoltage(V=50) "Voltage source"; Modelica.Electrical.Analog.Basic.Ground ground; Loads.Resistor short_circuit(V_nominal=50, R=0) "Short circuit load"; Sensors.GeneralizedSensor sen "Power sensor"; equation connect(ground.p, constantVoltage.n); connect(constantVoltage.terminal, lineR.terminal_n); connect(lineR.terminal_p, sen.terminal_n); connect(sen.terminal_p, short_circuit.terminal); end Resistance;