diff --git a/IBPSA/Electrical/AC/Interfaces/PowerOutput.mo b/IBPSA/Electrical/AC/Interfaces/PowerOutput.mo new file mode 100644 index 0000000000..c80ee34f2e --- /dev/null +++ b/IBPSA/Electrical/AC/Interfaces/PowerOutput.mo @@ -0,0 +1,33 @@ +within IBPSA.Electrical.AC.Interfaces; +connector PowerOutput + "Connector with real power, reactive power and power factor" + output Modelica.Units.SI.Power real "Real power"; + output Modelica.Units.SI.ReactivePower apparent "Apparent power"; + output Modelica.Units.SI.Angle phi "Phase shift"; + output Real cosPhi "Power factor"; + + annotation (Icon(graphics={ Polygon( + points={{-100,100},{100,0},{-100,-100},{-100,100}}, + lineColor={0,0,127}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), Diagram(graphics={ + Polygon( + points={{-100,50},{0,0},{-100,-50},{-100,50}}, + lineColor={0,0,127}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), Text( + extent={{30,110},{30,60}}, + textColor={0,0,127}, + textString="%name")}), + Documentation(info=" +This connector contains multiple quantities that can be used to monitor +the power consumption of a generic AC systems. +", revisions=" +
+This package contains interfaces that are used by the models in the +IBPSA.Electrical.AC package. +
+")); +end Interfaces; diff --git a/IBPSA/Electrical/AC/Interfaces/package.order b/IBPSA/Electrical/AC/Interfaces/package.order new file mode 100644 index 0000000000..29b1329317 --- /dev/null +++ b/IBPSA/Electrical/AC/Interfaces/package.order @@ -0,0 +1 @@ +PowerOutput diff --git a/IBPSA/Electrical/AC/OnePhase/Basics/Ground.mo b/IBPSA/Electrical/AC/OnePhase/Basics/Ground.mo new file mode 100644 index 0000000000..77fedcefd9 --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Basics/Ground.mo @@ -0,0 +1,37 @@ +within IBPSA.Electrical.AC.OnePhase.Basics; +model Ground "Ground connection" + extends IBPSA.Electrical.Interfaces.Ground( + redeclare package PhaseSystem = PhaseSystems.OnePhase, + redeclare Interfaces.Terminal_n terminal); + annotation ( + defaultComponentName="gnd", + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={ + Line( + points={{0,90},{0,0}}, + color={0,120,120}, + smooth=Smooth.None), + Line( + points={{-80,0},{80,0}}, + color={0,120,120}, + smooth=Smooth.None), + Line( + points={{-60,-20},{60,-20}}, + color={0,120,120}, + smooth=Smooth.None), + Line( + points={{-40,-40},{40,-40}}, + color={0,120,120}, + smooth=Smooth.None)}), Documentation(info=" ++This model represents a connection to the ground. +
+", revisions=" ++This package contains simple models used in AC single phase networks. +
+", revisions=" ++This is an AC/AC converter, based on a power balance between both circuit sides. +The parameter conversionFactor defines the ratio between the RMS voltages +as +
+ ++V2 = conversionFactor V1 +
+ ++where V1 and V2 are the RMS voltages +at the primary and secondary sides of the transformer, i.e., the +connector N and P, respectively. +
+ +
+The loss of the converter is proportional to the power transmitted.
+The parameter eta
is the efficiency of the transfer.
+The loss is computed as
+
+Ploss = (1-η) Ptr, +
++where Ptr is the power transmitted. The model is bi-directional +and the power can flow from the primary to the secondary side and vice-versa. +Furthermore, reactive power on both side are set to zero. +
++This model is derived from + +Modelica.Electrical.QuasiStationary.SinglePhase.Utilities.IdealACDCConverter. +
+", revisions=" +replaceable
for the terminal.
+stateSelect
statement to use
+the current i[:]
on the connectors as iteration variable for the
+initialization problem.
++This is a simplified equivalent transformer model. +The model accounts for winding Joule losses and leakage reactances +that are represented by a series of a resistance R and an +inductance L. The resistance and the inductance represent both the +effects of the secondary and primary side of the transformer. +
++The model is parameterized using the following parameters +
+VHigh
- RMS voltage at primary side,VLow
- RMS voltage at secondary side,VABase
- apparent nominal power of the transformer,XoverR
- ratio between reactance and resistance, andZperc
- the short circuit impedance.+Given the nominal conditions,the model computes the values of the resistance and the inductance. +
+", revisions=" +replaceable
for the terminal.
+phi_1
and phi_2
that are
+used during initialization to specify the angle of the voltage phasor.
+stateSelect
statement to use
+the current i[:]
on the connectors as iteration variable for the
+initialization problem.
+
+This is an AC/DC converter, based on a power balance between both circuit sides.
+The parameter conversionFactor
defines the ratio between the RMS voltages
+as
+
+VDC = conversionFactor VAC, +
+ ++where VDC is the voltage of the DC circuit and VAC +is the RMS voltage at the primary side of the transformer. +
+ +
+The loss of the converter is proportional to the power transmitted.
+The parameter eta
is the efficiency of the transfer.
+The loss is computed as
+
+Ploss = (1-η) Ptr +
++where Ptr is the power transmitted. The model is bi-directional +and the power can flow from both the primary to the secondary side and vice-versa. +Furthermore, reactive power on both side are set to 0. +
++This model is derived from + +Modelica.Electrical.QuasiStationary.SinglePhase.Utilities.IdealACDCConverter. +
+", revisions=" +replaceable
for the terminal.
+each
.
+stateSelect
statement to use
+the current i[:]
on the connectors as iteration variable for the
+initialization problem.
++This example illustrates the use of a model that converts AC voltage to AC voltage. +The transformer model assumes a linear loss when transmitting the power. +
+", + revisions=" +P_nominal
as
+this parameter is disabled and assigned a value
+in the initial equation
section.
+This is for
+issue 426.
++This example illustrates the use of a the AC/AC transformer model. +The example shows three different configurations: +
+P_nominal
as
+this parameter is disabled and assigned a value
+in the initial equation
section.
+This is for
+issue 426.
++This example illustrates the use of a model that converts AC voltage to DC voltage. +The transformer model assumes a linear loss when transmitting the power. +
+", + revisions=" +P_nominal
as
+this parameter is disabled and assigned a value
+in the initial equation
section.
+This is for
+issue 426.
++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.AC.OnePhase.Conversion. +
+", revisions=" ++This package contains models for AC/AC and AC/DC conversion. +
+", revisions=" +Electric connector for AC one phase systems.
+"), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ Text( + extent={{-60,60},{60,-60}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{0,100},{-100,0},{0,-100},{100,0},{0,100}}, + lineColor={0,120,120}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Text( + extent={{-120,120},{100,60}}, + textColor={0,120,120}, + textString="%name"), + Text( + extent={{14,16},{114,-84}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{-50,50},{-100,0},{-50,-50},{0,0},{-50,50}}, + lineColor={0,120,120}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)})); +end Terminal_n; diff --git a/IBPSA/Electrical/AC/OnePhase/Interfaces/Terminal_p.mo b/IBPSA/Electrical/AC/OnePhase/Interfaces/Terminal_p.mo new file mode 100644 index 0000000000..6d0e6ba4fc --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Interfaces/Terminal_p.mo @@ -0,0 +1,39 @@ +within IBPSA.Electrical.AC.OnePhase.Interfaces; +connector Terminal_p "Terminal p for AC one phase systems" + extends IBPSA.Electrical.Interfaces.Terminal( + redeclare replaceable package PhaseSystem = + IBPSA.Electrical.PhaseSystems.OnePhase); + annotation (defaultComponentName = "term_p", + Documentation(info=" +Electric connector for AC one phase systems.
+"), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ Text( + extent={{-60,60},{60,-60}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{0,100},{-100,0},{0,-100},{100,0},{0,100}}, + lineColor={0,120,120}, + fillColor={0,120,120}, + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Text( + extent={{-120,120},{100,60}}, + textColor={0,120,120}, + textString="%name"), + Text( + extent={{14,16},{114,-84}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{50,50},{0,0},{50,-50},{100,0},{50,50}}, + lineColor={0,120,120}, + fillColor={0,120,120}, + fillPattern=FillPattern.Solid)})); +end Terminal_p; diff --git a/IBPSA/Electrical/AC/OnePhase/Interfaces/package.mo b/IBPSA/Electrical/AC/OnePhase/Interfaces/package.mo new file mode 100644 index 0000000000..9660e8a7ad --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Interfaces/package.mo @@ -0,0 +1,22 @@ +within Buildings.Electrical.AC.OnePhase; +package Interfaces "Package with interfaces for one phase AC systems" + extends Modelica.Icons.InterfacesPackage; + + + annotation (Documentation(info=" ++This package contains connectors that are used by the models in the +Buildings.Electrical.AC.OnePhase package. +The connectors extend the basic connectors +Buildings.Electrical.Interfaces.Terminal +and define a new graphical icon in order to be distinguished by connectors of other electrical systems (e.g. DC systems). +
+", revisions=" ++Model of an capacitive load. It may be used to model a bank of capacitors. +
++The model computes the complex power vector as +
+S = P + jQ = V ⋅ i* +
++where V is the voltage phasor and i* is the complex +conjugate of the current phasor. The voltage and current phasors are shifted +by an angle φ. +
+ +
+The load model takes as input the power consumed by the inductive load and
+the power factor pf=cos(φ). The power
+can be either fixed using the parameter P_nominal
, or
+it is possible to specify a variable power using the inputs y
or
+Pow
.
+
+The power factor can be either specified by the parameter pf
+or using the input variable pf_in
.
+
+The different modes can be selected with the parameter
+mode
and use_pf_in
, see
+IBPSA.Electrical.Interfaces.Load and
+
+IBPSA.Electrical.Interfaces.CapacitiveLoad for more information.
+
+Given the active power P and the power factor pf the complex +power Q is computed as +
+ ++Q = - P tan(arccos(pf)). +
+ ++The equations of the model can be rewritten as +
++i1 = (P V1 + Q V2)/(V12 + V22), +
++i2 = (P V2 - Q V1)/(V12 + V22), +
+ ++where i1, i2, V1, and V2 +are the real and imaginary parts of the current and voltage phasors. +
++The nonlinearity of the model is due to the fact that the load consumes the power specified by the variables P +and Q irrespectively of the voltage of the load. +
++When multiple loads are connected in a grid through cables that cause voltage drops, +the dimension of the system of nonlinear equations increases linearly with the number of loads. +This nonlinear system of equations introduces challenges during the initialization, +as Newton solvers may diverge if initialized far from a solution, as well during the simulation. +In this situation, the model can be parameterized to use a linear approximation +as discussed in the next section. +
+ ++Given the constraints and the two-dimensional nature of the problem, it is difficult to +find a linearized version of the AC load model. A solution could be to divide the voltage +domain into sectors, and for each sector compute the best linear approximation. +However the selection of the proper approximation depending on the value of the +voltage can generate events that increase the simulation time. For these reasons, the +linearized model assumes a voltage that is equal to the nominal value +
++i1 = (P V1 + Q V2)/VRMS2, +
++i2 = (P V2 - Q V1)/VRMS2, +
++where VRMS is the Root Mean Square voltage os the AC system. +Even though this linearized version of the load model introduces an approximation +error in the current, it satisfies the constraints related to the ratio of the +active and reactive powers. +
+ ++The initialization problem can be simplified using the homotopy operator. The homotopy operator +uses two different types of equations to compute the value of a variable: the actual one +and a simplified one. The actual equation is the one used during the normal operation. +During initialization, the simplified equation is first solved and then slowly replaced +with the actual equation to compute the initial values for the nonlinear systems of +equations. The load model uses the homotopy operator, with the linearized model being used +as the simplified equation. This numerical expedient has proven useful when simulating models +with more than ten connected loads. +
+
+The load model has a parameter initMode
that can be used to select
+the assumption to use during the initialization phase by the homotopy operator.
+The choices are between a null current or the linearized model.
+
replaceable
for terminal.
+PhaseSystem.thetaRef
out of
+derivative operator as this is not yet supported by JModelica.
++Model of an impedance. This model can be used to represent any type +of resistive, inductive or capacitive load. +
++Note that the power consumed by the impedance model will drecrease if its voltage +decreases. +
++The model of the impedance is +
+ ++V = Z i, +
+ +
+where Z = R + j X is the impedance. The value of the resistance R and the
+reactance X depend on the type of impedance. Different types of impedances
+can be selected using the boolean parameters inductive
, use_R_in
,
+use_L_in
, and use_C_in
. See
+
+IBPSA.Electrical.Interfaces.Impedance for more details.
+
PhaseSystem.thetaRef
out of
+derivative operator as this is not yet supported by JModelica.
+PhaseSystem
and terminal
replaceable. This was detected
+by the OpenModelica regression tests.
++Model of an inductive load. It may be used to model an inductive motor. +
++The model computes the complex power vector as +
+S = P + jQ = V ⋅ i*, +
++where V is the voltage phasor and i* is the complex +conjugate of the current phasor. The voltage and current phasors are shifted +by an angle φ. +
+ +
+The load model takes as input the power consumed by the inductive load and
+the power factor pf=cos(φ). The power
+can be either fixed using the parameter P_nominal
, or
+it is possible to specify a variable power using the inputs y
or
+Pow
.
+
+The power factor can be either specified by the parameter pf
+or using the input connector pf_in
.
+
+The different modes can be selected with the parameter
+mode
and use_pf_in
, see
+IBPSA.Electrical.Interfaces.Load and
+
+IBPSA.Electrical.Interfaces.InductiveLoad for more information.
+
+Given the active power P and the power factor pf, the complex +power Q is computed as +
+ ++Q = P tan(arccos(pf)). +
+ ++The equations of the model can be rewritten as +
++i1 = (P V1 + Q V2)/(V12 + V22), +
++i2 = (P V2 - Q V1)/(V12 + V22), +
+ ++where i1, i2, V1, and V2 +are the real and imaginary parts of the current and voltage phasors. +
++The nonlinearity of the model is due to the fact that the load consumes the power specified by the variables P +and Q, irrespectively of the voltage of the load. +
++When multiple loads are connected in a grid through cables that cause voltage drops, +the dimension of the system of nonlinear equations increases linearly with the number of loads. +This nonlinear system of equations introduces challenges during the initialization, +as Newton solvers may diverge if initialized far from a solution, as well during the simulation. +In this situation, the model can be parameterized to use a linear approximation +as discussed in the next section. +
+ ++Given the constraints and the two-dimensional nature of the problem, it is difficult to +find a linearized version of the AC load model. A solution could be to divide the voltage +domain into sectors, and for each sector compute the best linear approximation. +However the selection of the proper approximation depending on the value of the +voltage can generate events that increase the simulation time. For these reasons, the +linearized model assumes a voltage that is equal to the nominal value +
++i1 = (P V1 + Q V2)/VRMS2, +
++i2 = (P V2 - Q V1)/VRMS2, +
++where VRMS is the Root Mean Square voltage of the AC system. +Even though this linearized version of the load model introduces an approximation +error in the current, it satisfies the constraints related to the ratio of the +active and reactive powers. +
+ ++The initialization problem can be simplified using the homotopy operator. The homotopy operator +uses two different types of equations to compute the value of a variable: the actual one +and a simplified one. The actual equation is the one used during the normal operation. +During initialization, the simplified equation is first solved and then slowly replaced +with the actual equation to compute the initial values for the nonlinear systems of +equations. The load model uses the homotopy operator, with the linearized model being used +as the simplified equation. This numerical expedient has proven useful when simulating models +with more than ten connected loads. +
+
+The load model has a parameter initMode
that can be used to select
+the assumption to use during the initialization phase by the homotopy operator.
+The choices are between a null current or the linearized model.
+
replaceable
to terminal redeclaration as they are redeclared by
+
+IBPSA.Electrical.AC.ThreePhasesBalanced.Loads.Inductive.
+PhaseSystem.thetaRef
out of
+derivative operator as this is not yet supported by JModelica.
+initMode
that can be used to
+select the assumption to be used during initialization phase
+by the homotopy operator.
++Model of a resistive load. It may be used to model a load that has +a power factor of one. +
++The model computes the complex power vector as +
+S = P + jQ = V ⋅ i* +
++where V is the voltage phasor and i* is the complex +conjugate of the current phasor. +
+ +
+The load model takes as input the power consumed by the inductive load and
+the power factor pf=cos(φ). The power
+can be either fixed using the parameter P_nominal
, or
+it is possible to specify a variable power using the inputs y
or
+Pow
. The different modes can be selected with the parameter
+mode
, see
+IBPSA.Electrical.Interfaces.Load for more information.
+
+The equations of the model can be rewritten as +
++i1 = (P V1 + Q V2)/(V12 + V22), +
++i2 = (P V2 - Q V1)/(V12 + V22), +
+ ++where i1, i2, V1, and V2 +are the real and imaginary parts of the current and voltage phasors. +
+ ++Since the model represents a load with a power factor of one, the complex +power is Q = 0. This leads to the following equations where +there are nonlinear equations that relate the current to the voltage +
+ ++i1 = P V1/(V12 + V22) +
++i2 = P V2/(V12 + V22) +
+ ++The non-linearity is due to the fact that the load consumes the power specified by the variable P, +irrespectively of the voltage of the load. The figure below shows the relationship +between the real part of the current phasor and the real and imaginary voltages of the load. +
++ +
+ ++When multiple loads are connected in a grid through cables that cause voltage drops, +the dimension of the system of nonlinear equations increases linearly with the number of loads. +This nonlinear system of equations introduces challenges during the initialization, +as Newton solvers may diverge if initialized far from a solution, as well during the simulation. +In this situation, the model can be parameterized to use a linear approximation +as discussed in the next section. +
+ ++Given the constraints and the two-dimensional nature of the problem, it is difficult to +find a linearized version of the AC load model. A solution could be to divide the voltage +domain into sectors, and for each sector compute the best linear approximation. +However, the selection of the proper approximation depending on the value of the +voltage can generate events that increase the simulation time. For these reasons, the +linearized model assumes a voltage that is equal to the nominal value +
++i1 = P V1/VRMS2 +
++i2 = P V2/VRMS2 +
++where VRMS is the Root Mean Square voltage of the AC system. +Even though this linearized version of the load model introduces an approximation +error in the current, it satisfies the constraints related to the ratio of the +active and reactive powers. +
++The image below show the linearized function +
++ +
+ ++The initialization problem can be simplified using the homotopy operator. The homotopy operator +uses two different types of equations to compute the value of a variable: the actual one + and a simplified one. The actual equation is the one used during the normal operation. +During initialization, the simplified equation is first solved and then slowly replaced +with the actual equation to compute the initial values for the nonlinear system of +equations. The load model uses the homotopy operator, with the linearized model being used +as the simplified equation. This numerical expedient has proven useful when simulating models +with more than ten connected loads. +
+
+The load model has a parameter initMode
that can be used to select
+the assumption to use during the initialization phase by the homotopy operator.
+The choices are between a null current or the linearized model.
+
replaceable
for terminal.
+initMode
that can be used to
+select the assumption to be used during initialization phase
+by the homotopy operator.
++This package contains models that represent different types of AC single phase loads. +
+", revisions=" ++This example shows how to use a fixed voltage generator model. +
+")); +end FixedVoltageSource; diff --git a/IBPSA/Electrical/AC/OnePhase/Sources/Examples/VariablePowerSource.mo b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/VariablePowerSource.mo new file mode 100644 index 0000000000..b7947ef9a8 --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/VariablePowerSource.mo @@ -0,0 +1,67 @@ +within IBPSA.Electrical.AC.OnePhase.Sources.Examples; +model VariablePowerSource + "This example illustrates how using a variable power source" + extends Modelica.Icons.Example; + IBPSA.Electrical.AC.OnePhase.Sources.Generator generator(phiGen(displayUnit="deg") = 0.26179938779915, f=60) + "AC generator model" + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + Modelica.Blocks.Sources.Sine generation( + offset=200, + startTime=1, + amplitude=100, + f=0.05) "Generated power" + annotation (Placement(transformation(extent={{-92,-10},{-72,10}}))); + IBPSA.Electrical.AC.OnePhase.Loads.Inductive RL(mode=Types.Load.VariableZ_y_input, + P_nominal=-300, + V_nominal=120) "Load model" + annotation (Placement(transformation(extent={{20,-10},{40,10}}))); + IBPSA.Electrical.AC.OnePhase.Sources.Grid grid(f=60, V=120) + "AC one phase electrical grid" + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + Modelica.Blocks.Sources.Trapezoid load( + rising=2, + width=3, + falling=3, + period=10, + startTime=1, + amplitude=0.8, + offset=0.2) "Power consumption profile" + annotation (Placement(transformation(extent={{80,-10},{60,10}}))); +equation + connect(generation.y, generator.P) annotation (Line( + points={{-71,0},{-50,0}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(generator.terminal, RL.terminal) + annotation (Line( + points={{-30,0},{20,0}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(grid.terminal, RL.terminal) + annotation (Line( + points={{-10,40},{-10,0},{20,0},{20,5.55112e-16}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(load.y, RL.y) + annotation (Line( + points={{59,0},{40,0}}, + color={0,0,127}, + smooth=Smooth.None)); + annotation ( experiment(StopTime=1.0, Tolerance=1e-6), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Electrical/AC/OnePhase/Sources/Examples/VariablePowerSource.mos" + "Simulate and plot"), + Documentation(revisions=" ++This example shows how to use a variable generator model. The model has to be used +together with a voltage source generator. +
+")); +end VariablePowerSource; diff --git a/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.mo b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.mo new file mode 100644 index 0000000000..99def7f824 --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.mo @@ -0,0 +1,13 @@ +within IBPSA.Electrical.AC.OnePhase.Sources; +package Examples "Package with example models" + extends Modelica.Icons.ExamplesPackage; + + +annotation (Documentation(info=" ++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.AC.OnePhase.Sources. +
+")); +end Examples; diff --git a/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.order b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.order new file mode 100644 index 0000000000..b36bb891d8 --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Sources/Examples/package.order @@ -0,0 +1 @@ +FixedVoltageSource diff --git a/IBPSA/Electrical/AC/OnePhase/Sources/FixedVoltage.mo b/IBPSA/Electrical/AC/OnePhase/Sources/FixedVoltage.mo new file mode 100644 index 0000000000..b359c8bc47 --- /dev/null +++ b/IBPSA/Electrical/AC/OnePhase/Sources/FixedVoltage.mo @@ -0,0 +1,82 @@ +within IBPSA.Electrical.AC.OnePhase.Sources; +model FixedVoltage "Fixed single phase AC voltage source" + extends IBPSA.Electrical.Interfaces.Source( + redeclare package PhaseSystem = PhaseSystems.OnePhase, + redeclare replaceable Interfaces.Terminal_p terminal); + parameter Modelica.Units.SI.Frequency f(start=60) "Frequency of the source"; + parameter Modelica.Units.SI.Voltage V(start=110) "RMS voltage of the source"; + parameter Modelica.Units.SI.Angle phiSou=0 "Phase shift of the source"; +protected + Modelica.Units.SI.Angle thetaRel + "Absolute angle of rotating system as offset to thetaRef"; +equation + if Connections.isRoot(terminal.theta) then + PhaseSystem.thetaRef(terminal.theta) = 2*Modelica.Constants.pi*f*time; + end if; + thetaRel = PhaseSystem.thetaRel(terminal.theta); + terminal.v = PhaseSystem.phaseVoltages(V, thetaRel + phiSou); + + annotation ( + defaultComponentName="fixVol", + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100, + -100},{100,100}}), + graphics={ + Ellipse( + extent={{-60,60},{60,-60}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), Line( + points={{-44,0},{-24,40},{-4,0},{16,-40},{36,0}}, + color={0,0,0}, + smooth=Smooth.Bezier), + Text( + extent={{-120,100},{120,60}}, + textColor={0,0,0}, + textString="%name"), + Line( + points={{60,0},{90,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line(visible = definiteReference == true, + points={{80,-46},{120,-46}}, + color={0,120,120}, + smooth=Smooth.None, + thickness=0.5), + Line(visible = definiteReference == true, + points={{80,-46},{106,-20}}, + color={0,120,120}, + smooth=Smooth.None, + thickness=0.5), + Line(visible = definiteReference == true, + points={{102,-22},{114,-30},{118,-48}}, + color={0,120,120}, + smooth=Smooth.Bezier), + Text( + extent={{-118,-60},{122,-100}}, + textColor={0,0,0}, + textString="V = %V")}), + Documentation(info=" ++This is a constant voltage source. The complex voltage is specified by the RMS voltage +and the phase shift. +
+", + revisions=" +replaceable
to terminal redeclaration as they are redeclared by
+
+IBPSA.Electrical.AC.ThreePhasesBalanced.Sources.FixedVoltage.
+
+Model of a generator that produces real power
+P
with a given phase shift phiGen
.
+
+This model must be used with + +IBPSA.Electrical.AC.OnePhase.Sources.Grid +or with a voltage source from the package + +Modelica.Electrical.QuasiStatic.SinglePhase.Sources. +Otherwise, there will be no equation that defines the phase +angle of the voltage. +
+
+The boolean flags potentialReference
and
+definiteReference
allows to select the phase angle of the
+generator as reference for the models connected to it. More info about
+these flags are available in
+
+IBPSA.Electrical.AC.UsersGuide.
+
replaceable
for terminal.
++Model that can be used to represent the electrical grid supply. +
+
+The model has an output connector named P
that
+contains information about the power supplied by the grid to the network.
+The convention is that P.real
is positive if real power is
+consumed from the grid, and negative if it is fed into the grid.
+
+The parameter V
is the root means square of the voltage.
+In US households, this is 120 Volts at 60 Hz,
+in Europe it is 230 Volts at 50 Hz.
+
P
.
++This package contains models of AC sources. +
+", revisions=" +
+Package with models for alternate current (AC) single phase systems.
+The models contained in this package use the phase system
+
+IBPSA.Electrical.PhaseSystems.OnePhase and they assume 120 V as nominal RMS voltage.
+
+This model represents a simplified conversion between two AC +three-phase balanced systems. The conversion losses are represented by a +constant efficiency η. +
++See model + +IBPSA.Electrical.AC.OnePhase.Conversion.ACACConverter for more +information. +
+", revisions=" ++Simple transformer model for three-phase +balanced AC systems. The model does not include core and +magnetic losses. +
++See model + +IBPSA.Electrical.AC.OnePhase.Conversion.ACACTransformer for more +information. +
+", revisions=" ++This model represents a simplified conversion between a three-phase +balanced AC system and a DC systems. +
++See model + +IBPSA.Electrical.AC.OnePhase.Conversion.ACDCConverter for more +information. +
+", revisions=" ++This example illustrates the use of a model that converts AC voltage to AC voltage. +The transformer model assumes a linear loss when transmitting the power. +
+", + revisions=" +load.P_nominal
as it is
+not required and leads to dublicate assignments.
++This example illustrates the use of the AC/AC transformer model. +The example shows three different configurations: +
+load.P_nominal
as it is
+not required and leads to dublicate assignments.
++This example illustrates the use of a model that converts AC voltage to DC voltage. +The transformer model assumes a linear loss when transmitting the power. +
+", + revisions=" +load.P_nominal
as it is
+not required and leads to dublicate assignments.
++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.AC.ThreePhasesBalanced.Conversion. +
+")); +end Examples; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/Examples/package.order b/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/Examples/package.order new file mode 100644 index 0000000000..258cf200f1 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/Examples/package.order @@ -0,0 +1,3 @@ +ACACConverter +ACACTransformer +ACDCConverter diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/package.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/package.mo new file mode 100644 index 0000000000..96d588db92 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Conversion/package.mo @@ -0,0 +1,19 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced; +package Conversion "Package with transformers and converter models for three-phase balanced AC systems" + extends Modelica.Icons.Package; + + +annotation (Documentation(info=" ++This package contains models for three-phase balanced AC/AC +transformers and AC/DC converters. +
+", revisions=" +Electric connector with a vector of negative pins.
+"), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ Text( + extent={{-60,60},{60,-60}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{-100,100},{-100,-100},{100,-100},{100,100},{-100,100}}, + lineColor={0,120,120}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Text( + extent={{-120,120},{100,60}}, + textColor={0,120,120}, + textString="%name"), + Text( + extent={{14,16},{114,-84}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{-100,50},{-100,-50},{0,-50},{0,50},{-100,50}}, + lineColor={0,120,120}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)})); +end Terminal_n; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/Terminal_p.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/Terminal_p.mo new file mode 100644 index 0000000000..41aa21973d --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/Terminal_p.mo @@ -0,0 +1,38 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced.Interfaces; +connector Terminal_p "AC three-phase balanced terminal ('positive')" + extends IBPSA.Electrical.Interfaces.Terminal( + redeclare replaceable package PhaseSystem = PhaseSystems.OnePhase); + annotation (defaultComponentName = "term_p", + Documentation(info=" +Electric connector with a vector of positive pins.
+"), + Icon(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ Text( + extent={{-60,60},{60,-60}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{-100,100},{-100,-100},{100,-100},{100,100},{-100,100}}, + lineColor={0,120,120}, + fillColor={0,120,120}, + fillPattern=FillPattern.Solid)}), + Diagram(coordinateSystem( + preserveAspectRatio=false, + extent={{-100,-100},{100,100}}, + grid={2,2}), graphics={ + Text( + extent={{-120,120},{100,60}}, + textColor={0,120,120}, + textString="%name"), + Text( + extent={{14,16},{114,-84}}, + textColor={255,255,255}, + pattern=LinePattern.None, + textString=""), Polygon( + points={{0,50},{0,-50},{100,-50},{100,50},{0,50}}, + lineColor={0,120,120}, + fillColor={0,120,120}, + fillPattern=FillPattern.Solid)})); +end Terminal_p; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/package.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/package.mo new file mode 100644 index 0000000000..5dc1124791 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Interfaces/package.mo @@ -0,0 +1,22 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced; +package Interfaces "Package interfaces for three-phase balanced AC systems" + extends Modelica.Icons.InterfacesPackage; + + +annotation (Documentation(info=" ++This package contains connectors that are used by the models in the +IBPSA.Electrical.AC.ThreePhasesBalanced package. +The connectors extends the basic connectors +IBPSA.Electrical.Interfaces.Terminal +and define a new graphical icon in order to be distinguishable from connectors of other electrical systems (e.g. DC systems). +
+", revisions=" ++Model of a capacitive load. See + +IBPSA.Electrical.AC.OnePhase.Loads.Capacitive for more information. +
+", + revisions=" ++This model illustrates the use of the impedance models. +The impedances have unitary values such that the RMS value of the voltage and of the current are the same. +
+"), + experiment(Tolerance=1e-6, StopTime=1.0), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Electrical/AC/ThreePhasesBalanced/Loads/Examples/Impedances.mos" + "Simulate and plot")); +end Impedances; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/ParallelLoads.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/ParallelLoads.mo new file mode 100644 index 0000000000..1951abbcb8 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/ParallelLoads.mo @@ -0,0 +1,98 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced.Loads.Examples; +model ParallelLoads "Example that illustrates the use of the load models" + extends Modelica.Icons.Example; + Sources.FixedVoltage E(f=60, V=480) "Voltage source" + annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); + Resistive R(P_nominal=-2000, V_nominal=480) "Resistive load" + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + Inductive RL_pf( + pf=0.8, + P_nominal=-2000, + use_pf_in=true, + V_nominal=480) "Inductive load with variable power factor" + annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); + Modelica.Blocks.Sources.Ramp load( startTime=0.2, duration=0.3) + "Power signal profile" + annotation (Placement(transformation(extent={{60,-50},{40,-30}}))); + Inductive varRL_y( P_nominal=-2000, + V_nominal=480, + mode=IBPSA.Electrical.Types.Load.VariableZ_y_input) + "Inductive load with y as input" + annotation (Placement(transformation(extent={{-20,-36},{0,-16}}))); + Capacitive varRC_y( P_nominal=-2000, + V_nominal=480, + mode=IBPSA.Electrical.Types.Load.VariableZ_y_input) + "Capacitive load with y as input" + annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); + Inductive varRL_P(pf=0.8, + V_nominal=480, + mode=IBPSA.Electrical.Types.Load.VariableZ_P_input) + "Inductive load with P as input" + annotation (Placement(transformation(extent={{-20,14},{0,34}}))); + Modelica.Blocks.Sources.Ramp pow( + startTime=0.2, + duration=0.3, + height=4000, + offset=-2000) "Power consumption profile" + annotation (Placement(transformation(extent={{60,14},{40,34}}))); + Modelica.Blocks.Sources.Ramp pf( + height=0.2, + duration=0.2, + offset=0.8, + startTime=0.7) "Power factor profile" + annotation (Placement(transformation(extent={{60,-20},{40,0}}))); +equation + connect(E.terminal, R.terminal) annotation (Line( + points={{-60,4.44089e-16},{-40,4.44089e-16},{-40,50},{-20,50}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(E.terminal, RL_pf.terminal) annotation (Line( + points={{-60,4.44089e-16},{-40,4.44089e-16},{-40,0},{-20,0}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(E.terminal, varRL_y.terminal) annotation (Line( + points={{-60,4.44089e-16},{-40,4.44089e-16},{-40,-26},{-20,-26}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(E.terminal, varRC_y.terminal) annotation (Line( + points={{-60,4.44089e-16},{-40,4.44089e-16},{-40,-50},{-20,-50}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(load.y, varRL_y.y) annotation (Line( + points={{39,-40},{20,-40},{20,-26},{4.44089e-16,-26}}, + color={0,0,127}, + smooth=Smooth.None)); + + connect(load.y, varRC_y.y) annotation (Line( + points={{39,-40},{20,-40},{20,-50},{4.44089e-16,-50}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(E.terminal, varRL_P.terminal) annotation (Line( + points={{-60,4.44089e-16},{-40,4.44089e-16},{-40,24},{-20,24}}, + color={0,120,120}, + smooth=Smooth.None)); + connect(pow.y, varRL_P.Pow) annotation (Line( + points={{39,24},{4.44089e-16,24}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(pf.y, RL_pf.pf_in) annotation (Line( + points={{39,-10},{30,-10},{30,6},{4.44089e-16,6}}, + color={0,0,127}, + smooth=Smooth.None)); + annotation ( Documentation(revisions=" ++This model illustrates the use of the three-phase unbalanced load models. +
+"), + experiment(Tolerance=1e-6, StopTime=1.0), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Electrical/AC/ThreePhasesBalanced/Loads/Examples/ParallelLoads.mos" + "Simulate and plot")); +end ParallelLoads; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.mo new file mode 100644 index 0000000000..fd2e1ef444 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.mo @@ -0,0 +1,20 @@ +within Buildings.Electrical.AC.ThreePhasesBalanced.Loads; +package Examples "Package with example models" + extends Modelica.Icons.ExamplesPackage; + + + annotation (Documentation(revisions=" ++This package contains examples for the use of models that can be found in + +Buildings.Electrical.AC.ThreePhasesBalanced.Loads. +
+")); +end Examples; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.order b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.order new file mode 100644 index 0000000000..72bc095c01 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Examples/package.order @@ -0,0 +1,2 @@ +Impedances +ParallelLoads diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Impedance.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Impedance.mo new file mode 100644 index 0000000000..cdef976646 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Loads/Impedance.mo @@ -0,0 +1,161 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced.Loads; +model Impedance "Model of a resistive load" + extends IBPSA.Electrical.Interfaces.Impedance( + redeclare package PhaseSystem = PhaseSystems.OnePhase, + redeclare Interfaces.Terminal_n terminal); + + parameter Boolean star = true + "Type of load connection: true = star, false = triangle" annotation(Evaluate=true, choices( + choice=true "Star", + choice=false "Triangle", + __Dymola_radioButtons=true)); + +protected + Modelica.Units.SI.Angle theRef "Absolute angle of rotating reference system"; + Modelica.Units.SI.AngularVelocity omega + "Frequency of the quasi-stationary sine waves"; + Modelica.Units.SI.Reactance X(start=1) "Complex component of the impedance"; + +equation + theRef = PhaseSystem.thetaRef(terminal.theta); + omega = der(theRef); + + // Inductance of each line + if inductive then + X = omega*L_internal; + else + X = -1/(omega*C_internal); + end if; + + // Ohm's law + if star then + terminal.v = {{R_internal,-X}*terminal.i, {X,R_internal}*terminal.i}; + else + terminal.v = {{R_internal/3,-X/3}*terminal.i, {X/3,R_internal/3}*terminal.i}; + end if; + annotation ( + defaultComponentName="loa", + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={Rectangle(extent={{-100,100},{100,-100}}, + lineColor={255,255,255}), + Rectangle( + extent={{-80,80},{80,-80}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + origin={7.10543e-15,7.10543e-15}, + rotation=180), + Line(points={{-6.85214e-44,-8.39117e-60},{12,1.46953e-15}}, + color={0,0,0}, + origin={-80,0}, + rotation=180), + Text( + extent={{-120,-80},{120,-120}}, + textColor={0,0,0}, + textString="%name"), + Rectangle( + extent={{-11,30},{11,-30}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + origin={2,49}, + rotation=90), + Rectangle( + extent={{-11,30},{11,-30}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + origin={2,1}, + rotation=90), + Rectangle( + extent={{-11,30},{11,-30}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + origin={2,-49}, + rotation=90), + Line( + visible=star == true, + points={{52,50},{68,0},{52,-50}}, + color={0,0,0}, + smooth=Smooth.None), + Line(visible = star == true, + points={{68,0},{52,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-68,50},{-28,50}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-68,0},{-28,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-68,-50},{-28,-50}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{32,50},{52,50}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{32,0},{52,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{32,-50},{52,-50}}, + color={0,0,0}, + smooth=Smooth.None), + Line(visible = star == false, + points={{52,50},{52,36},{-50,14},{-50,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line(visible = star == false, + points={{52,0},{52,-14},{-50,-36},{-50,-50}}, + color={0,0,0}, + smooth=Smooth.None), + Line(visible = star == false, + points={{52,-50},{72,-50},{72,68},{-50,68},{-50,50}}, + color={0,0,0}, + smooth=Smooth.None)}), + Documentation(info=" ++Model of a three-phase balanced impedance. +
+
+If inductive=true
, then the
+inductance is a parameter, otherwise
+the capacitance is a parameter.
+
+The boolean parameter star
is used to
+select whether the star (Y) or triangle (D)
+configuration is used to connect the impedance.
+By default, the impedance is assumed to be connected
+with a star configuration.
+
+When the connection type changes from
+star
to triangle
, the value of the impedance
+is recomputed in such a way that the nominal power consumed by the impedance
+does not change.
+
PhaseSystem.thetaRef
out of
+derivative operator as this is not yet supported by JModelica.
++Model of an inductive load. See + +IBPSA.Electrical.AC.OnePhase.Loads.Inductive for more information. +
+", revisions=" ++Model of a resistive load. See + +IBPSA.Electrical.AC.OnePhase.Loads.Resistive for more information. +
+", revisions=" ++This package contains models that represent different types of three +phases balanced AC loads. +
+", revisions=" ++This example shows how to use a variable generator model. The generator model has to be used +together with a voltage source generator, which is in this example the +grid model. +
+")); +end VariablePowerSource; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.mo new file mode 100644 index 0000000000..9f9c1d0a19 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.mo @@ -0,0 +1,20 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced.Sources; +package Examples "Package with example models" + extends Modelica.Icons.ExamplesPackage; + + + annotation (Documentation(revisions=" ++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.AC.ThreePhasesBalanced.Sources. +
+")); +end Examples; diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.order b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.order new file mode 100644 index 0000000000..71cd638e22 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/Examples/package.order @@ -0,0 +1 @@ +VariablePowerSource diff --git a/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/FixedVoltage.mo b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/FixedVoltage.mo new file mode 100644 index 0000000000..8976dff9a0 --- /dev/null +++ b/IBPSA/Electrical/AC/ThreePhasesBalanced/Sources/FixedVoltage.mo @@ -0,0 +1,31 @@ +within IBPSA.Electrical.AC.ThreePhasesBalanced.Sources; +model FixedVoltage "Fixed three-phase balanced AC voltage source" + extends IBPSA.Electrical.AC.OnePhase.Sources.FixedVoltage( + redeclare Interfaces.Terminal_p terminal, + f(start=60), + V(start=480)); + annotation ( + defaultComponentName="fixVol", + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), + graphics={ Line( + points={{-34,0},{-14,40},{6,0},{26,-40},{46,0}}, + color={120,120,120}, + smooth=Smooth.Bezier), Line( + points={{-24,0},{-4,40},{16,0},{36,-40},{56,0}}, + color={215,215,215}, + smooth=Smooth.Bezier)}), + Documentation(info=" ++This is a constant voltage source, specifying the complex voltage +by the RMS voltage and the phase shift. +
+", revisions=" ++Model of an inductive generator. +
++See +IBPSA.Electrical.AC.OnePhase.Sources.Generator for +more information. +
+", revisions=" ++Model that can be used to represent the electrical grid supply. +See +IBPSA.Electrical.AC.OnePhase.Sources.Grid for +more information. +
+", + revisions=" ++This package contains models for three-phase balanced AC sources. +
+", revisions=" +
+Package with models for alternate current (AC) three phase balanced systems.
+Because the phases are balanced, the models in this
+package extend the models of the package
+
+IBPSA.Electrical.AC.OnePhase.
+
+The models that are part of this package assume by default 480 V as nominal RMS phase +to phase voltage. This default value can be changed. +
+", revisions=" ++The package +IBPSA.Electrical.AC +models alternate current electrical systems. +
+ +
+The package IBPSA.Electrical.AC contains
+component models for AC systems. The mathematics that describes AC systems is contained in the package
+IBPSA.Electrical.PhaseSystems.OnePhase,
+in which n = 2
and m = 1
. The AC models that are part of the library can use two different assumptions.
+
+The first assumption is that the frequency is modeled as quasi-stationary, assuming a perfect sine +wave with no higher harmonics. Voltages and currents are considered as sine waves and just their +amplitudes and phase shifts are taken into account during the analysis. +With such an assumption, electric quantities can be represented with a phasor, i.e., a vector +in the complex plane. +
++The second assumption is the so-called dynamic phasorial representation. The basic idea of the +dynamic phasorial representation is to account for dynamic variations of the amplitude and +the angle of the phasors. With such an approach, it is possible to analyze faster dynamics +without directly representing all the electromagnetic effects and high-order harmonics +(for more details, see Stankovic Et Al. 1999, and +Stankovic A.M. and Aydin T.). +
+ ++Both the quasi-stationary and the dynamic phasors represent electric +quantities such as voltages and currents using phasors. +The phasors are described by complex numbers that internally are represented as a vector +with two components. The vectors can be represented in the so called Argand plane where on the x-axis +are represented Real numbers while on the y-axis imaginary numbers. +
++With such a representation the complex voltages, currents, and powers are represented as +
++V = VRe + j VIm, +
++I = IRe + j IIm, +
++S = P + j Q, +
+ ++The images below shows how the complex power vector S +changes depending on the type of load. +
+ ++ +
+ ++where the subscripts indicates a +
+ +
+The AC connector has an additional vector that represents the
+reference angle theta[PhaseSystem.m]
. The reference angle is used, for example in the
+AC single phase systems to describe the phase angle of the reference voltage.
+This extra information in the connector makes it overdetermined
+because the number of effort variables is higher than the number of flow variables.
+The over-determined connectors are defined and used in such a way that a Modelica tool is able
+to remove the superfluous but consistent equations, arriving at a balanced set of equations based on a
+graph analysis of the connection structure. The models in the library uses constructs specified
+by the Modelica language to handle this situation, as described by Olsson et al. (2008).
+
+The reference angles are usually defined by the sources (e.g., voltage sources or generators) and
+their values need to be propagated to all the components connected to them.
+If more than one generator are connected to the same network, the Modelica tool is able to remove the superfluous equations,
+arriving at a balanced set of equations based on a graph analysis of the connection structure.
+The flags potentialReference
and definiteReference
are used to help the
+Modelica tool during the selection of the reference angle. If definiteReference = true
,
+then the reference angle of the source has to be used as reference, while if
+potentialReference = true
, the reference angle is used only if there are no
+definite sources defined.
+
+When a model is set as definite source an icon representing a phase angle is placed close to its +electrical terminal. +
+ + +
+
+A.M. Stankovic, B.C. Lesieutre, T. Aydin; Modeling and analysis of single-pahse
+induction machines with dynamic phasors
+
+IEEE Transactions on Power Systems, 14(1), Feb. 1999, pp. 9-14.
+
+A.M. Stankovic, T. Aydin; Analysis of asymmetrical faults in power systems using
+dynamic phasors
+
+IEEE Transactions on Power Systems, 15(3), 2000, pp. 1062-1068 .
+
+Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
+
+Balanced Models in Modelica 3.0 for Increased Model Quality.
+Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.
+
+Package with models for alternating current (AC) systems. +
+", revisions=" +Electric connector for DC electrical systems.
+")); +end Terminal_n; diff --git a/IBPSA/Electrical/DC/Interfaces/Terminal_p.mo b/IBPSA/Electrical/DC/Interfaces/Terminal_p.mo new file mode 100644 index 0000000000..a7269c1220 --- /dev/null +++ b/IBPSA/Electrical/DC/Interfaces/Terminal_p.mo @@ -0,0 +1,13 @@ +within IBPSA.Electrical.DC.Interfaces; +connector Terminal_p "Terminal p for DC electrical systems" + extends IBPSA.Electrical.Interfaces.Terminal( + redeclare package PhaseSystem = + IBPSA.Electrical.PhaseSystems.TwoConductor); + annotation (Icon(graphics={ Polygon( + points={{-120,0},{0,-120},{120,0},{0,120},{-120,0}}, + lineColor={0,0,255}, + fillColor={0,0,255}, + fillPattern=FillPattern.Solid)}), Documentation(info=" +Electric connector for DC electrical systems.
+")); +end Terminal_p; diff --git a/IBPSA/Electrical/DC/Interfaces/package.mo b/IBPSA/Electrical/DC/Interfaces/package.mo new file mode 100644 index 0000000000..15af14fefb --- /dev/null +++ b/IBPSA/Electrical/DC/Interfaces/package.mo @@ -0,0 +1,15 @@ +within IBPSA.Electrical.DC; +package Interfaces "Package with interfaces for DC electrical systems" + extends Modelica.Icons.InterfacesPackage; + + +annotation (Documentation(info=" ++This package contains connectors that are used by the models in the +IBPSA.Electrical.DC package. +The connectors extends the basic connectors +IBPSA.Electrical.Interfaces.Terminal +and define a new graphical icon in order to be distinguished by connectors of other electrical systems (e.g. AC systems). +
+")); +end Interfaces; diff --git a/IBPSA/Electrical/DC/Interfaces/package.order b/IBPSA/Electrical/DC/Interfaces/package.order new file mode 100644 index 0000000000..d23ecfc486 --- /dev/null +++ b/IBPSA/Electrical/DC/Interfaces/package.order @@ -0,0 +1,2 @@ +Terminal_n +Terminal_p diff --git a/IBPSA/Electrical/DC/Lines/Examples/DCLine.mo b/IBPSA/Electrical/DC/Lines/Examples/DCLine.mo new file mode 100644 index 0000000000..d183199dd2 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Examples/DCLine.mo @@ -0,0 +1,92 @@ +within IBPSA.Electrical.DC.Lines.Examples; +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" + annotation (Placement(transformation(extent={{0,0},{20,20}}))); + Sources.ConstantVoltage E(V=50) "Voltage source" + annotation (Placement(transformation(extent={{-80,0},{-60,20}}))); + Line line1( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=100) "Transmission line" + annotation (Placement(transformation(extent={{0,-20},{20,0}}))); + Line line2( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=100) "Transmission line" + annotation (Placement(transformation(extent={{0,-40},{20,-20}}))); + Modelica.Electrical.Analog.Basic.Ground ground + annotation (Placement(transformation(extent={{-90,-20},{-70,0}}))); + Loads.Conductor load1(mode=Types.Load.VariableZ_y_input, + V_nominal=50, + linearized=false, + P_nominal=-50) "Variable load" + annotation (Placement(transformation(extent={{40,0},{60,20}}))); + Loads.Conductor load2( + V_nominal=50, + linearized=false, + P_nominal=-150) "Load" + annotation (Placement(transformation(extent={{40,-20},{60,0}}))); + Loads.Conductor load3( + V_nominal=50, + linearized=false, + P_nominal=-200) "Load" + annotation (Placement(transformation(extent={{40,-40},{60,-20}}))); + Modelica.Blocks.Sources.Ramp varLoad( + height=0.8, + duration=0.5, + offset=0.2, + startTime=0.3) "Load consumption profile" + annotation (Placement(transformation(extent={{96,0},{76,20}}))); +equation + connect(E.terminal, line.terminal_n) annotation (Line( + points={{-60,10},{-4.44089e-16,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(E.terminal, line1.terminal_n) annotation (Line( + points={{-60,10},{-30,10},{-30,-10},{0,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(E.terminal, line2.terminal_n) annotation (Line( + points={{-60,10},{-30,10},{-30,-30},{0,-30}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(load1.terminal, line.terminal_p) annotation (Line( + points={{40,10},{20,10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line1.terminal_p, load2.terminal) annotation (Line( + points={{20,-10},{40,-10}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line2.terminal_p, load3.terminal) annotation (Line( + points={{20,-30},{40,-30}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(varLoad.y, load1.y) annotation (Line( + points={{75,10},{60,10}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(E.n, ground.p) annotation (Line( + points={{-80,10},{-80,0}}, + color={0,0,255}, + smooth=Smooth.None)); + annotation (experiment(StopTime=1.0,Tolerance=1e-06), +__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Electrical/DC/Lines/Examples/DCLine.mos" + "Simulate and plot"), + Documentation(info=" ++This model is a simple test case that show how to use a line model +and parametrize it using a commercial cable. +
+")); +end DCLine; diff --git a/IBPSA/Electrical/DC/Lines/Examples/DCLines.mo b/IBPSA/Electrical/DC/Lines/Examples/DCLines.mo new file mode 100644 index 0000000000..3b4c7e17a6 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Examples/DCLines.mo @@ -0,0 +1,427 @@ +within IBPSA.Electrical.DC.Lines.Examples; +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.Units.SI.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, + terminal_n(v(each start=0))) "Transmission line" + annotation (Placement(transformation(extent={{-2,70},{18,90}}))); + Sources.ConstantVoltage E(V=50) "Voltage source" + annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); + Line line1( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-32,70},{-12,90}}))); + + Line line2( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-34,30},{-14,50}}))); + + Modelica.Electrical.Analog.Basic.Ground ground + annotation (Placement(transformation(extent={{-100,50},{-80,70}}))); + Loads.Conductor load1(mode=Types.Load.VariableZ_y_input, + V_nominal=50, + linearized=linearLoads, + P_nominal=-150) "Load" + annotation (Placement(transformation(extent={{30,70},{50,90}}))); + Loads.Conductor load2( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-120) "Load" + annotation (Placement(transformation(extent={{30,50},{50,70}}))); + Loads.Conductor load3( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-200) "Load" + annotation (Placement(transformation(extent={{30,30},{50,50}}))); + Modelica.Blocks.Sources.Trapezoid + varLoad1( + offset=0.4, + amplitude=0.6, + rising=600, + width=1000, + falling=800, + period=3600, + startTime=1800) "Power consumption profile" + annotation (Placement(transformation(extent={{86,30},{66,50}}))); + Loads.Conductor load4( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-120) "Load" + annotation (Placement(transformation(extent={{30,12},{50,32}}))); + Line line3( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,30},{22,50}}))); + + Line line4( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{0,50},{20,70}}))); + + Line line5( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,12},{22,32}}))); + + Line line0( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-64,70},{-44,90}}))); + + Modelica.Blocks.Sources.Trapezoid + varLoad2( + startTime=1800, + amplitude=0.8, + rising=400, + width=1300, + falling=900, + period=4000, + offset=0.1) "Power consumption profile" + annotation (Placement(transformation(extent={{86,70},{66,90}}))); + Line line6( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-34,-10},{-14,10}}))); + + Loads.Conductor load5( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-200) "Load" + annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + Modelica.Blocks.Sources.Trapezoid + varLoad3( + amplitude=0.7, + rising=660, + width=900, + falling=300, + period=3700, + offset=0.3, + startTime=200) "Power consumption profile" + annotation (Placement(transformation(extent={{86,-10},{66,10}}))); + Loads.Conductor load6( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-120) "Load" + annotation (Placement(transformation(extent={{30,-28},{50,-8}}))); + Line line7( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,-10},{22,10}}))); + + Line line8( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,-28},{22,-8}}))); + + Line line9( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-34,-50},{-14,-30}}))); + + Loads.Conductor load7( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-200) "Load" + annotation (Placement(transformation(extent={{30,-50},{50,-30}}))); + Modelica.Blocks.Sources.Trapezoid + varLoad4( + rising=600, + width=1000, + falling=800, + period=3600, + amplitude=0.1, + offset=0.8, + startTime=3300) "Power consumption profile" + annotation (Placement(transformation(extent={{86,-50},{66,-30}}))); + Loads.Conductor load8( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-120) "Load" + annotation (Placement(transformation(extent={{30,-68},{50,-48}}))); + Line line10( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,-50},{22,-30}}))); + + Line line11( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,-68},{22,-48}}))); + + Line line12( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{-34,-90},{-14,-70}}))); + + Loads.Conductor load9( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-200) "Load" + annotation (Placement(transformation(extent={{30,-90},{50,-70}}))); + Modelica.Blocks.Sources.Trapezoid + varLoad5( + falling=800, + amplitude=0.5, + rising=800, + width=800, + period=3000, + offset=0.5, + startTime=0) "Power consumption profile" + annotation (Placement(transformation(extent={{86,-90},{66,-70}}))); + Loads.Conductor load10( + V_nominal=50, + mode=Types.Load.VariableZ_y_input, + linearized=linearLoads, + P_nominal=-120) "Load" + annotation (Placement(transformation(extent={{30,-108},{50,-88}}))); + Line line13( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=L) "Transmission line" + annotation (Placement(transformation(extent={{2,-90},{22,-70}}))); + + Line line14( + P_nominal=500, + V_nominal=50, + mode=Types.CableMode.commercial, + commercialCable=Transmission.LowVoltageCables.PvcAl16(), + l=100) "Transmission line" + annotation (Placement(transformation(extent={{2,-108},{22,-88}}))); + +equation + connect(load1.terminal, line.terminal_p) annotation (Line( + points={{30,80},{18,80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line1.terminal_p, line.terminal_n) annotation (Line( + points={{-12,80},{-2,80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line2.terminal_p, line3.terminal_n) annotation (Line( + points={{-14,40},{2,40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line3.terminal_p, load3.terminal) annotation (Line( + points={{22,40},{30,40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line1.terminal_p, line4.terminal_n) annotation (Line( + points={{-12,80},{-6,80},{-6,60},{0,60}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line4.terminal_p, load2.terminal) annotation (Line( + points={{20,60},{30,60}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(load4.terminal, line5.terminal_p) annotation (Line( + points={{30,22},{22,22}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line5.terminal_n, line3.terminal_n) annotation (Line( + points={{2,22},{-8,22},{-8,40},{2,40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(E.terminal, line0.terminal_n) annotation (Line( + points={{-70,80},{-64,80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line0.terminal_p, line1.terminal_n) annotation (Line( + points={{-44,80},{-32,80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(varLoad1.y, load3.y) annotation (Line( + points={{65,40},{50,40}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad1.y, load4.y) annotation (Line( + points={{65,40},{58,40},{58,22},{50,22}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad2.y, load1.y) annotation (Line( + points={{65,80},{50,80}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad2.y, load2.y) annotation (Line( + points={{65,80},{58,80},{58,60},{50,60}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(line6.terminal_p,line7. terminal_n) annotation (Line( + points={{-14,0},{2,0}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line7.terminal_p,load5. terminal) annotation (Line( + points={{22,0},{30,0}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(load6.terminal,line8. terminal_p) annotation (Line( + points={{30,-18},{22,-18}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line8.terminal_n,line7. terminal_n) annotation (Line( + points={{2,-18},{-8,-18},{-8,0},{2,0}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(varLoad3.y,load5. y) annotation (Line( + points={{65,0},{50,0}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad3.y,load6. y) annotation (Line( + points={{65,0},{58,0},{58,-18},{50,-18}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(line9.terminal_p, line10.terminal_n) + annotation (Line( + points={{-14,-40},{2,-40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line10.terminal_p, load7.terminal) + annotation (Line( + points={{22,-40},{30,-40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(load8.terminal, line11.terminal_p) + annotation (Line( + points={{30,-58},{22,-58}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line11.terminal_n, line10.terminal_n) + annotation (Line( + points={{2,-58},{-8,-58},{-8,-40},{2,-40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(varLoad4.y,load7. y) annotation (Line( + points={{65,-40},{50,-40}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad4.y,load8. y) annotation (Line( + points={{65,-40},{58,-40},{58,-58},{50,-58}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(line12.terminal_p, line13.terminal_n) + annotation (Line( + points={{-14,-80},{2,-80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line13.terminal_p, load9.terminal) + annotation (Line( + points={{22,-80},{30,-80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(load10.terminal, line14.terminal_p) + annotation (Line( + points={{30,-98},{22,-98}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line14.terminal_n, line13.terminal_n) + annotation (Line( + points={{2,-98},{-8,-98},{-8,-80},{2,-80}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(varLoad5.y,load9. y) annotation (Line( + points={{65,-80},{50,-80}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(varLoad5.y, load10.y) + annotation (Line( + points={{65,-80},{58,-80},{58,-98},{50,-98}}, + color={0,0,127}, + smooth=Smooth.None)); + connect(line2.terminal_n, line4.terminal_n) annotation (Line( + points={{-34,40},{-34,60},{0,60}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line6.terminal_n, line3.terminal_n) annotation (Line( + points={{-34,0},{-34,22},{-8,22},{-8,40},{2,40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line9.terminal_n, line7.terminal_n) annotation (Line( + points={{-34,-40},{-34,-18},{-8,-18},{-8,0},{2,0},{2,5.55112e-16}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(line12.terminal_n, line10.terminal_n) annotation (Line( + points={{-34,-80},{-34,-58},{-8,-58},{-8,-40},{2,-40}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(E.n, ground.p) annotation (Line( + points={{-90,80},{-90,70}}, + color={0,0,255}, + smooth=Smooth.None)); + annotation (experiment(StopTime=4000,Tolerance=1e-06), +__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Electrical/DC/Lines/Examples/DCLines.mos" + "Simulate and plot"), + Documentation(info=" +
+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. +
+")); +end DCLines; diff --git a/IBPSA/Electrical/DC/Lines/Examples/DCLinesLinearized.mo b/IBPSA/Electrical/DC/Lines/Examples/DCLinesLinearized.mo new file mode 100644 index 0000000000..2126d1b6a4 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Examples/DCLinesLinearized.mo @@ -0,0 +1,20 @@ +within IBPSA.Electrical.DC.Lines.Examples; +model DCLinesLinearized + "Example model to test the possible combinations between line and load models" + extends IBPSA.Electrical.DC.Lines.Examples.DCLines(linearLoads = true); + + annotation (Documentation(info=" ++This model is the linearized version of the model + +IBPSA.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. +
+"), +experiment(Tolerance=1e-06, StopTime=4000), +__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Electrical/DC/Lines/Examples/DCLinesLinearized.mos" + "Simulate and plot")); + +end DCLinesLinearized; diff --git a/IBPSA/Electrical/DC/Lines/Examples/package.mo b/IBPSA/Electrical/DC/Lines/Examples/package.mo new file mode 100644 index 0000000000..8f29018ddd --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Examples/package.mo @@ -0,0 +1,13 @@ +within IBPSA.Electrical.DC.Lines; +package Examples "Package with example models" +extends Modelica.Icons.ExamplesPackage; + + +annotation (Documentation(info=" ++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.DC.Lines. +
+")); +end Examples; diff --git a/IBPSA/Electrical/DC/Lines/Examples/package.order b/IBPSA/Electrical/DC/Lines/Examples/package.order new file mode 100644 index 0000000000..c5de5a360a --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Examples/package.order @@ -0,0 +1,3 @@ +DCLine +DCLines +DCLinesLinearized diff --git a/IBPSA/Electrical/DC/Lines/Line.mo b/IBPSA/Electrical/DC/Lines/Line.mo new file mode 100644 index 0000000000..2488c8ae29 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/Line.mo @@ -0,0 +1,93 @@ +within IBPSA.Electrical.DC.Lines; +model Line "Model of a DC electrical line" + extends IBPSA.Electrical.Transmission.BaseClasses.PartialLine( + redeclare package PhaseSystem_p = PhaseSystems.TwoConductor, + redeclare package PhaseSystem_n = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_n terminal_n, + redeclare Interfaces.Terminal_p terminal_p, + final modelMode=Types.Load.FixedZ_steady_state, + commercialCable = IBPSA.Electrical.Transmission.Functions.selectCable_low(P_nominal, V_nominal)); + + TwoPortRCLine lineRC( + final useHeatPort=true, + final R=R, + final V_nominal=V_nominal, + final T_ref=T_ref, + final M=M, + final C=C, + final use_C=use_C) + annotation (Placement(transformation(extent={{-10,10},{10,-10}}))); +equation + connect(terminal_n, lineRC.terminal_n) annotation (Line( + points={{-100,0},{-10,0}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(lineRC.terminal_p, terminal_p) annotation (Line( + points={{10,0},{100,0}}, + color={0,0,255}, + smooth=Smooth.None)); + connect(cableTemp.port, lineRC.heatPort) annotation (Line( + points={{-40,22},{0,22},{0,10}}, + color={191,0,0}, + smooth=Smooth.None)); + annotation ( Icon(graphics={ + Ellipse( + extent={{-70,10},{-50,-10}}, + lineColor={0,0,0}, + fillColor={96,107,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-60,10},{60,-10}}, + fillColor={96,107,255}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None, + lineColor={0,0,0}), + Ellipse( + extent={{50,10},{70,-10}}, + lineColor={0,0,0}, + fillColor={255,128,0}, + fillPattern=FillPattern.Solid), + Line( + points={{-70,0},{-90,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-60,10},{60,10}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-60,-10},{60,-10}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{96,0},{60,0}}, + color={0,0,0}, + smooth=Smooth.None)}), + Documentation(revisions=" +Terminal_n
and
+Terminal_p
as it is already declared to the be the same
+phase system, and it is not declared to be replaceable.
+This avoids a translation error in OpenModelica.
++This model represents a DC cable. The model is based on + +IBPSA.Electrical.DC.Lines.TwoPortRCLine +and provides functionalities to parametrize the values of R and C either +using commercial cables or using default values. +
+")); +end Line; diff --git a/IBPSA/Electrical/DC/Lines/TwoPortRCLine.mo b/IBPSA/Electrical/DC/Lines/TwoPortRCLine.mo new file mode 100644 index 0000000000..5d6d5c1ad1 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/TwoPortRCLine.mo @@ -0,0 +1,98 @@ +within IBPSA.Electrical.DC.Lines; +model TwoPortRCLine "Model of a two port DC resistance and capacity (T-model)" + extends IBPSA.Electrical.Transmission.BaseClasses.PartialTwoPortRLC( + redeclare package PhaseSystem_p = PhaseSystems.TwoConductor, + redeclare package PhaseSystem_n = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_n terminal_n, + redeclare Interfaces.Terminal_p terminal_p, + final L=0); + parameter Boolean use_C = false + "Set to true to add a capacitance in the center of the line" + annotation(Dialog(tab="Model", group="Assumptions")); + parameter Modelica.Units.SI.Voltage Vc_start=V_nominal + "Initial value of the voltage of the capacitance in the middle of the line"; + Modelica.Units.SI.Voltage Vc(start=Vc_start, stateSelect=StateSelect.prefer) + "Voltage of the capacitor"; +initial equation + if C>0 and use_C then + Vc = Vc_start; + end if; +equation + terminal_p.v[1] - (Vc+terminal_p.v[2]) = terminal_p.i[1]*R_actual/2; + terminal_n.v[1] - (Vc+terminal_p.v[2]) = terminal_n.i[1]*R_actual/2; + + if C>0 and use_C then + C*der(Vc) = terminal_p.i[1] + terminal_n.i[1]; + else + Vc = 0.5*(terminal_p.v[1] - terminal_p.v[2] + terminal_n.v[1] - terminal_n.v[2]); + end if; + + terminal_p.v[2] = terminal_n.v[2]; + terminal_p.i[2] + terminal_n.i[2] = 0; + + // Joule losses + LossPower = R_actual/2*terminal_p.i[1]^2 + R_actual/2*terminal_n.i[1]^2; + + annotation (Diagram(graphics={ + Rectangle(extent={{-70,30},{70,-30}}, lineColor={0,0,255}), + Line(points={{-90,0},{-70,0}}, color={0,0,255}), + Line(points={{70,0},{90,0}}, color={0,0,255})}), Icon( + coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Text( + extent={{-144,97},{156,57}}, + textColor={0,0,0}, + textString="%name"), + Line(points={{-90,0},{-70,0}}, color={0,0,255}), + Line(points={{70,0},{90,0}}, color={0,0,255}), + Rectangle( + extent={{-70,32},{70,-28}}, + lineColor={0,0,255}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Documentation(info=" ++This model represents a series of two resistances and a capacitance that connect two DC interfaces. +This model can be used to represent a cable in a DC grid. +
++The model represents the lumped resistances and capacity (T-model) as shown in the figure below. +
++ +
+
+As can be seen in the figure, the resistance R is split in two halves
+and the capacitance is located in the center.
+The capacitance in the center is optional and can be selected using the
+boolean flag use_C = true
. The model is either dynamic or static depending on the
+presence of the capacitive effect.
+
Terminal_n
and
+Terminal_p
as it is already declared to the be the same
+phase system, and it is not declared to be replaceable.
+This avoids a translation error in OpenModelica.
+Vc_start
.
++This model represents a resistance that connect two DC interfaces. This model can be used +to represent a cable in a DC grid. +
++The model represents the lumped resistance as shown in the figure below. +
++ +
+", revisions=" +Terminal_n
and
+Terminal_p
as it is already declared to the be the same
+phase system, and it is not declared to be replaceable.
+This avoids a translation error in OpenModelica.
++This package contains models for lines for DC circuits. +
+")); +end Lines; diff --git a/IBPSA/Electrical/DC/Lines/package.order b/IBPSA/Electrical/DC/Lines/package.order new file mode 100644 index 0000000000..7f10e753a9 --- /dev/null +++ b/IBPSA/Electrical/DC/Lines/package.order @@ -0,0 +1,4 @@ +Line +TwoPortRCLine +TwoPortResistance +Examples diff --git a/IBPSA/Electrical/DC/Loads/Conductor.mo b/IBPSA/Electrical/DC/Loads/Conductor.mo new file mode 100644 index 0000000000..6dfbf54263 --- /dev/null +++ b/IBPSA/Electrical/DC/Loads/Conductor.mo @@ -0,0 +1,184 @@ +within IBPSA.Electrical.DC.Loads; +model Conductor "Model of a generic DC load" + extends IBPSA.Electrical.Interfaces.ResistiveLoad( + redeclare package PhaseSystem = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_n terminal); +protected + Modelica.Units.SI.Voltage absDV + "Absolute value of the voltage difference between the two conductors (used by the linearized model)"; +equation + + absDV = abs(terminal.v[1]-terminal.v[2]); + + if linearized then + + // Linearized version of the model + if absDV <= (8/9)*V_nominal then + terminal.i[1] + P*(2/(0.8*V_nominal) - (terminal.v[1]-terminal.v[2])/(0.8*V_nominal)^2) = 0; + elseif absDV >= (12/11)*V_nominal then + terminal.i[1] + P*(2/(1.2*V_nominal) - (terminal.v[1]-terminal.v[2])/(1.2*V_nominal)^2) = 0; + else + terminal.i[1] + P*(2/V_nominal - (terminal.v[1]-terminal.v[2])/V_nominal^2) = 0; + end if; + + else + // Full nonlinear version of the model + // PhaseSystem.activePower(terminal.v, terminal.i) + P = 0; + if initMode == IBPSA.Electrical.Types.InitMode.zero_current then + i[1] = - homotopy(actual= P/(v[1] - v[2]), simplified= 0); + else + i[1] = - homotopy(actual= P/(v[1] - v[2]), simplified= P*(2/V_nominal - (v[1]-v[2])/V_nominal^2)); + end if; + + end if; + + // Since the connector is a two conductor, the sum of the currents at the terminal + // is null + sum(i) = 0; + annotation ( + Documentation(info=" +
+Model of a generic DC load. The load can be either constant or variable depending on the value of the
+parameter mode
.
+See the model IBPSA.Electrical.Interfaces.Load
+for more information.
+
+The model computes the current drawn from the load as +
++P = V i, +
+
+where P is the power, V is the voltage and i is the current.
+If the component consumes power, then P < 0.
+If it feeds power into the electrical grid, then P > 0.
+
+Consider the simple DC circuit shown in the figure below +
++ +
++where VS is a constant voltage source, and R is the line resistance. +The load has a voltage V across its electrical pins and a current i is flowing through it. +If the power consumption drawn by the load is prescribed by the variable PLOAD, + the equation that describes the circuit is +
++VS - R i - PLOAD/i = 0 +
++The unknown variable i appears in a nonlinear equation. This means that in order to compute the current +that is drawn by the load, a nonlinear equation has to be solved. If the number of loads increases (as typically +happens in real case examples) the number of nonlinear equations to be solved increases too, and the resulting system +of nonlinear equations can slow down the simulation. It is possible to avoid such a problem by introducing a linearized +model. +
+ +
+The first step to linearize the load model is to define its nominal voltage conditions Vnom,
+around which the equations will be linearized.
+The constitutive equation of the load can be linearized around the nominal voltage condition Vnom as
+
+i = PLOAD/V = PLOAD/Vnom + +(V - Vnom)[∂ (PLOAD/V)/ ∂V ]V = Vnom ++ ₒ((V - Vnom)2), +
+ ++which leads to the linearized formulation +
+ ++i ≃ PLOAD (2/Vnom - V/Vnom2). +
+ ++The linearized formulation approximates the load power consumption (or production), +with the approximation error being proportional to (V - Vnom)2. +A further approximation has been introduced to improve the +approximation of the linearized model even if the voltage is far from the nominal condition. +This piecewise linearized approximation instead of approximating the model just in the neighborhood of the nominal +voltage Vnom introduces two new points where the model is approximated. +The points are at 0.8 Vnom and 1.2 Vnom. +
+ +Equation | Condition |
---|---|
i ≃ PLOAD (2/(0.8 Vnom) - V/(0.8 Vnom2)) | +V < 8/9⋅ Vnom | +
i ≃ PLOAD (2/(1.2 Vnom) - V/(1.2 Vnom2)) | +V ≥ 12/11⋅ Vnom | +
i ≃ PLOAD (2/Vnom - V/Vnom2) | +Otherwise | +
initMode
that can be used to
+select the assumption to be used during initialization phase
+by the homotopy operator.
+This example demonstrates the use of a linealized load model IBPSA.Electrical.DC.Loads.Conductor.
+Both loads are connected to the same DC voltage source through a resistive element that represents a line. The loads consume the same amount of power that is specified by the input ramp signal.
+The nonlinear conductor model NonlinearLoad
consumes exactly the amount of power specified by the input NonlinearLoad.Pow
.
The linearized conductor model LinearizedLoad
does not consumes the amount of power specified by the input LinearizedLoad.Pow
. The voltage at the load deviates from the nominal value when the power consumption increases. Since the model is approximated in a neighbor of the nominal voltage, moving from that point introduces approximation errors. The plot below shows the error introduced with such an approximation.
+
The linearized load is tested over a voltage variation of about 30 % of the nominal voltage and within this range +the maximum error is 1.23457 % that occurs when the voltage deviation is 11.11 %.
+", revisions=" ++This example demonstrates the use of the resistor model. +
+", revisions=" ++This example shows how to use three different types of load models. +Each load is of type +IBPSA.Electrical.DC.Loads.Conductor. +
+
+The first load loa1
consumes a constant amount of power.
+The second and the third loads (loa2
and loa3
) consume a variable amount of power.
+The load loa2
has a variable input y
between 0 and 1 that specifies the portion of
+nominal power that is consumed.
+The load loa3
has a variable input Pow
that represents the actual power consumed
+(or produced) by the load.
+
+This package contains examples for the use of models that can be found in + +IBPSA.Electrical.DC.Loads. +
+")); +end Examples; diff --git a/IBPSA/Electrical/DC/Loads/Examples/package.order b/IBPSA/Electrical/DC/Loads/Examples/package.order new file mode 100644 index 0000000000..815b57469d --- /dev/null +++ b/IBPSA/Electrical/DC/Loads/Examples/package.order @@ -0,0 +1,3 @@ +LinearizedLoad +Resistor +VariableLoad diff --git a/IBPSA/Electrical/DC/Loads/Resistor.mo b/IBPSA/Electrical/DC/Loads/Resistor.mo new file mode 100644 index 0000000000..6d4cc2afa0 --- /dev/null +++ b/IBPSA/Electrical/DC/Loads/Resistor.mo @@ -0,0 +1,97 @@ +within IBPSA.Electrical.DC.Loads; +model Resistor "Ideal linear electrical resistor" + extends IBPSA.Electrical.Interfaces.ResistiveLoad( + redeclare package PhaseSystem = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_n terminal, + final mode=IBPSA.Electrical.Types.Load.FixedZ_steady_state, + final P_nominal=V_nominal^2/max(R, Modelica.Constants.small)); + extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref); + parameter Modelica.Units.SI.Resistance R(start=1) + "Resistance at temperature T_ref"; + parameter Modelica.Units.SI.Temperature T_ref=300.15 "Reference temperature"; + parameter Modelica.Units.SI.LinearTemperatureCoefficient alpha=0 + "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))"; + Modelica.Units.SI.Resistance R_actual + "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))"; +equation + assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside of scope of model"); + R_actual = R*(1 + alpha*(T_heatPort - T_ref)); + PhaseSystem.systemVoltage(v) = R_actual*PhaseSystem.systemCurrent(i); + LossPower = PhaseSystem.activePower(v,i); + sum(i) = 0; + annotation ( + Documentation(info=" ++Model of a linear DC resistor that can vary with respect to temperature. +
++The model implements the Ohm's law +
++V = R(T) i. +
++The resistance R(T) varies depending on the temperature T as +
++R(T) = R (1 + α (T - Tref)), +
+
+where the resistance R is the reference value of the resistance, α is the
+linear temperature coefficient, and Tref is the reference temperature.
+The temperature T is the temperature of the heat port if useHeatPort = true
.
+
P_nominal
to avoid an error when translating
+the model in Dymola's pedantic mode.
++This package contains models that represent different types of DC loads. +
+")); +end Loads; diff --git a/IBPSA/Electrical/DC/Loads/package.order b/IBPSA/Electrical/DC/Loads/package.order new file mode 100644 index 0000000000..7e5a266009 --- /dev/null +++ b/IBPSA/Electrical/DC/Loads/package.order @@ -0,0 +1,3 @@ +Conductor +Resistor +Examples diff --git a/IBPSA/Electrical/DC/Sensors/Examples/GeneralizedSensor.mo b/IBPSA/Electrical/DC/Sensors/Examples/GeneralizedSensor.mo new file mode 100644 index 0000000000..0e2200a7cc --- /dev/null +++ b/IBPSA/Electrical/DC/Sensors/Examples/GeneralizedSensor.mo @@ -0,0 +1,40 @@ +within IBPSA.Electrical.DC.Sensors.Examples; +model GeneralizedSensor "Example model for generalized sensor" + extends Modelica.Icons.Example; + IBPSA.Electrical.DC.Sensors.GeneralizedSensor sen "Power sensor" + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + IBPSA.Electrical.DC.Loads.Conductor loa(V_nominal=120, P_nominal=120) + "Constant load" + annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + IBPSA.Electrical.DC.Sources.ConstantVoltage sou(V=120) "Voltage source" + annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + Modelica.Electrical.Analog.Basic.Ground ground + annotation (Placement(transformation(extent={{-60,-32},{-40,-12}}))); +equation + connect(sen.terminal_p, loa.terminal) + annotation (Line(points={{10,0},{40,0}}, smooth=Smooth.None)); + connect(sen.terminal_n, sou.terminal) + annotation (Line(points={{-10,0},{-30,0}}, smooth=Smooth.None)); + connect(sou.n, ground.p) annotation (Line( + points={{-50,0},{-50,-12}}, + color={0,0,255}, + smooth=Smooth.None)); + annotation ( experiment(StopTime=1.0,Tolerance=1e-06), + Documentation( + info=" ++This example illustrates the use of the generalized sensor. +
+", +revisions=" ++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.DC.Sensors. +
+")); +end Examples; diff --git a/IBPSA/Electrical/DC/Sensors/Examples/package.order b/IBPSA/Electrical/DC/Sensors/Examples/package.order new file mode 100644 index 0000000000..b638efa963 --- /dev/null +++ b/IBPSA/Electrical/DC/Sensors/Examples/package.order @@ -0,0 +1 @@ +GeneralizedSensor diff --git a/IBPSA/Electrical/DC/Sensors/GeneralizedSensor.mo b/IBPSA/Electrical/DC/Sensors/GeneralizedSensor.mo new file mode 100644 index 0000000000..25efccc657 --- /dev/null +++ b/IBPSA/Electrical/DC/Sensors/GeneralizedSensor.mo @@ -0,0 +1,85 @@ +within IBPSA.Electrical.DC.Sensors; +model GeneralizedSensor "Sensor for power, voltage and current" + extends IBPSA.Electrical.Icons.GeneralizedSensor; + extends IBPSA.Electrical.Interfaces.PartialTwoPort( + redeclare package PhaseSystem_p = PhaseSystems.TwoConductor, + redeclare package PhaseSystem_n = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_n terminal_n, + redeclare Interfaces.Terminal_p terminal_p); + Modelica.Blocks.Interfaces.RealOutput V(final quantity="ElectricPotential", + final unit="V") "Voltage" + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-50}), iconTransformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,-90}))); + Modelica.Blocks.Interfaces.RealOutput I(final quantity="ElectricCurrent", + final unit="A") "Current" + annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={60,-50}), iconTransformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={60,-90}))); + Modelica.Blocks.Interfaces.RealOutput P( + final quantity="Power", + final unit="W") "Power" annotation (Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={-60,-50}), iconTransformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={-60,-90}))); +equation + Connections.branch(terminal_p.theta, terminal_n.theta); + terminal_p.theta = terminal_n.theta; + + V = IBPSA.Electrical.PhaseSystems.TwoConductor.systemVoltage(terminal_n.v); + I = IBPSA.Electrical.PhaseSystems.TwoConductor.systemCurrent(terminal_n.i); + P = IBPSA.Electrical.PhaseSystems.TwoConductor.activePower(v=terminal_n.v, i=terminal_n.i); + + connect(terminal_n, terminal_p) annotation (Line( + points={{-100,0},{100,0}}, + color={0,0,255}, + smooth=Smooth.None)); + + annotation (defaultComponentName="sen", + Documentation(info=" ++Ideal sensor that measures power, voltage and current. +The two components of the power S are the active and reactive power. +As this sensor is configured to measure DC power, the reactive power is always zero. +
+", revisions=" +each
.
+Terminal_n
and
+Terminal_p
as it is already declared to the be the same
+phase system, and it is not declared to be replaceable.
+This avoids a translation error in OpenModelica.
++This package contains models for sensors for DC circuits. +
+")); +end Sensors; diff --git a/IBPSA/Electrical/DC/Sensors/package.order b/IBPSA/Electrical/DC/Sensors/package.order new file mode 100644 index 0000000000..2923d15c82 --- /dev/null +++ b/IBPSA/Electrical/DC/Sensors/package.order @@ -0,0 +1,2 @@ +GeneralizedSensor +Examples diff --git a/IBPSA/Electrical/DC/Sources/BaseClasses/WindCorrection.mo b/IBPSA/Electrical/DC/Sources/BaseClasses/WindCorrection.mo new file mode 100644 index 0000000000..7e19eea416 --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/BaseClasses/WindCorrection.mo @@ -0,0 +1,75 @@ +within Buildings.Electrical.DC.Sources.BaseClasses; +block WindCorrection "Block for wind correction" + extends Modelica.Blocks.Icons.Block; + parameter Modelica.Units.SI.Height h "Height over ground"; + parameter Modelica.Units.SI.Height hRef + "Reference height for wind measurement"; + parameter Real n(min=0) = 0.4 "Height exponent for wind profile calculation"; + Modelica.Blocks.Interfaces.RealOutput vLoc( unit="m/s") + "Wind velocity at the location" + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); + Modelica.Blocks.Interfaces.RealInput vRef(unit="m/s") + "Wind velocity at the reference height" + annotation (Placement(transformation(extent={{-120,-10},{-100,10}}), + iconTransformation(extent={{-142,-20},{-102,20}}))); +equation + vLoc=vRef * (h / hRef)^n; + annotation ( + defaultComponentName = "cor", + Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Text( + extent={{-92,48},{-32,-50}}, + textColor={0,128,255}, + fillColor={85,170,255}, + fillPattern=FillPattern.Solid, + textString="vRef"), + Polygon( + points={{26,0},{6,20},{6,10},{-24,10},{-24,-10},{6,-10},{6,-20},{26,0}}, + lineColor={0,128,255}, + fillColor={85,170,255}, + fillPattern=FillPattern.Solid), + Text( + extent={{30,50},{90,-48}}, + textColor={0,128,0}, + fillColor={85,170,255}, + fillPattern=FillPattern.Solid, + textString="vLoc")}),Documentation(info=" ++This model calculates the wind velocity at the location as a function of the height over ground. +The equation is based on Gash (1991). + +The model computes the wind velocity vLoc as +
+ ++vLoc = vRef * (h / hRef)n +
+ ++where vRef is the wind velocity at the reference height, h is the height over ground, hRef +is the reference height, and n is the height exponent for wind calculation. +
++Gasch, R. 1991. Windkraftanlagen. Grundlagen und Entwurf (German). Teubner, Stuttgart. +
+", +revisions=" +final
keyword for parameters to allow users to adjust them,
+and removed default value for h
.
++This package contains base classes that are used to construct the models in +Buildings.Electrical.DC.Sources. +
+")); +end BaseClasses; diff --git a/IBPSA/Electrical/DC/Sources/BaseClasses/package.order b/IBPSA/Electrical/DC/Sources/BaseClasses/package.order new file mode 100644 index 0000000000..b7efbc807b --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/BaseClasses/package.order @@ -0,0 +1 @@ +WindCorrection diff --git a/IBPSA/Electrical/DC/Sources/ConstantVoltage.mo b/IBPSA/Electrical/DC/Sources/ConstantVoltage.mo new file mode 100644 index 0000000000..380fc626a4 --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/ConstantVoltage.mo @@ -0,0 +1,59 @@ +within IBPSA.Electrical.DC.Sources; +model ConstantVoltage "Model of a constant DC voltage source" + extends IBPSA.Electrical.Interfaces.Source( + redeclare package PhaseSystem = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_p terminal, + final potentialReference=true, + final definiteReference=false); + parameter Modelica.Units.SI.Voltage V(start=1) "Value of constant voltage"; + Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative pin" + annotation (Placement(transformation(extent={{-110,-10},{-90,10}}))); +equation + terminal.v[1] = V; + terminal.v[2] = n.v; + sum(terminal.i) + n.i = 0; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={ + Line(points={{-40,0},{40,0}}, color={0,0,0}, + origin={10,0}, + rotation=90), + Line(points={{0,26},{0,-54}}, color={0,0,0}, + origin={36,0}, + rotation=90), + Line(points={{0,46},{0,-34}}, color={0,0,0}, + origin={-44,0}, + rotation=90), + Line(points={{-20,0},{20,0}}, + color={0,0,0}, + origin={-10,0}, + rotation=90), + Text( + extent={{50,70},{150,20}}, + textColor={0,0,0}, + textString="+"), + Text( + extent={{50,-12},{150,-62}}, + textColor={0,0,0}, + textString="-"), + Text( + extent={{-150,60},{150,100}}, + textColor={0,0,0}, + textString="V=%V")}), Documentation(info=" ++This model represents a simple DC voltage source with constant voltage. +
+", revisions=" +final potentialReference=true
and
+final definiteReference=false
as this
+model is for a DC voltage.
++This model illustrates the use of the variable voltage source model. +
+", + revisions=" ++This package contains examples for the use of models that can be found in + +IBPSA.Electrical.DC.Sources. +
+")); +end Examples; diff --git a/IBPSA/Electrical/DC/Sources/Examples/package.order b/IBPSA/Electrical/DC/Sources/Examples/package.order new file mode 100644 index 0000000000..800d45b3d3 --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/Examples/package.order @@ -0,0 +1 @@ +VoltageSource diff --git a/IBPSA/Electrical/DC/Sources/VoltageSource.mo b/IBPSA/Electrical/DC/Sources/VoltageSource.mo new file mode 100644 index 0000000000..7994282b25 --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/VoltageSource.mo @@ -0,0 +1,53 @@ +within IBPSA.Electrical.DC.Sources; +model VoltageSource "Model of a generoic DC voltage source" + extends IBPSA.Electrical.Interfaces.VariableVoltageSource( + V(start = 1), + redeclare package PhaseSystem = PhaseSystems.TwoConductor, + redeclare Interfaces.Terminal_p terminal, + final potentialReference=true, + final definiteReference=false); + Modelica.Electrical.Analog.Interfaces.NegativePin n "Negative pin" + annotation (Placement(transformation(extent={{-110,-10},{-90,10}}))); +equation + terminal.v[1] = V_in_internal; + terminal.v[2] = n.v; + sum(terminal.i) + n.i = 0; + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={ + Line(points={{-40,0},{40,0}}, color={0,0,0}, + origin={10,0}, + rotation=90), + Line(points={{0,26},{0,-54}}, color={0,0,0}, + origin={36,0}, + rotation=90), + Line(points={{0,46},{0,-34}}, color={0,0,0}, + origin={-44,0}, + rotation=90), + Line(points={{-20,0},{20,0}}, + color={0,0,0}, + origin={-10,0}, + rotation=90), + Text( + extent={{50,70},{150,20}}, + textColor={0,0,0}, + textString="+"), + Text( + extent={{50,-12},{150,-62}}, + textColor={0,0,0}, + textString="-"), + Text(visible = not use_V_in, + extent={{-150,60},{150,100}}, + textColor={0,0,0}, + textString="V=%V")}), Documentation(info=" ++This model represents a simple DC voltage source with variable voltage. +
+", revisions=" ++This package contains models that represent different types of DC sources. +
+")); +end Sources; diff --git a/IBPSA/Electrical/DC/Sources/package.order b/IBPSA/Electrical/DC/Sources/package.order new file mode 100644 index 0000000000..44097be245 --- /dev/null +++ b/IBPSA/Electrical/DC/Sources/package.order @@ -0,0 +1,4 @@ +ConstantVoltage +VoltageSource +Examples +BaseClasses diff --git a/IBPSA/Electrical/DC/package.mo b/IBPSA/Electrical/DC/package.mo new file mode 100644 index 0000000000..7954dfbb21 --- /dev/null +++ b/IBPSA/Electrical/DC/package.mo @@ -0,0 +1,36 @@ +within IBPSA.Electrical; +package DC "Package for analog direct current (DC) electrical circuits" + extends Modelica.Icons.Package; + + + annotation (Documentation(info=" +
+Package with models for direct current (DC) systems.
+The models contained in this package use the phase system IBPSA.Electrical.PhaseSystems.TwoConductor.
+
+This is the icon for a probe that measure voltage magnitude and phase. +
+", revisions=" ++This is the icon for ideal sensors that measure power, voltage and current. +
+", revisions=" ++This is the icon that conditionally draws the angle symbol for a +conversion model (e.g., a transformer). +
+", revisions=" ++Package that contains icons. +
+")); +end Icons; diff --git a/IBPSA/Electrical/Icons/package.order b/IBPSA/Electrical/Icons/package.order new file mode 100644 index 0000000000..b8b8852717 --- /dev/null +++ b/IBPSA/Electrical/Icons/package.order @@ -0,0 +1,3 @@ +GeneralizedProbe +GeneralizedSensor +RefAngleConversion diff --git a/IBPSA/Electrical/Interfaces/BaseTerminal.mo b/IBPSA/Electrical/Interfaces/BaseTerminal.mo new file mode 100644 index 0000000000..cfc4238d6a --- /dev/null +++ b/IBPSA/Electrical/Interfaces/BaseTerminal.mo @@ -0,0 +1,15 @@ +within IBPSA.Electrical.Interfaces; +connector BaseTerminal "Empty connector used by partial models" + + annotation (Documentation(info=" +This empty connector represents the base class extended by every electric connector of type +IBPSA.Electrical.Interfaces.Terminal. +", revisions=" +pf_in
and updated documentation.
++This is a model of a generic capacitive load. This model is an extension of the base load model +IBPSA.Electrical.Interfaces.Load. +
+
+This model assumes a fixed power factor pf
when the flag use_pf_in = false
+otherwise it uses the power factor specified by the input pf_in
.
+
The power factor (either the input or the parameter) is used to compute the reactive power
+Q
given the active power P
+
+Q = - P * tan(arccos(pf)) +
+")); +end CapacitiveLoad; diff --git a/IBPSA/Electrical/Interfaces/Ground.mo b/IBPSA/Electrical/Interfaces/Ground.mo new file mode 100644 index 0000000000..4aabbba875 --- /dev/null +++ b/IBPSA/Electrical/Interfaces/Ground.mo @@ -0,0 +1,35 @@ +within IBPSA.Electrical.Interfaces; +model Ground "Generalized model of a ground connection." + replaceable package PhaseSystem = + IBPSA.Electrical.PhaseSystems.PartialPhaseSystem constrainedby + IBPSA.Electrical.PhaseSystems.PartialPhaseSystem "Phase system" + annotation (choicesAllMatching=true); + + replaceable IBPSA.Electrical.Interfaces.Terminal terminal(redeclare + package PhaseSystem = PhaseSystem) "Generalized terminal" + annotation (Placement(transformation(extent={{-8,92},{8,108}}), + iconTransformation(extent={{-8,92},{8,108}}))); +equation + terminal.v = zeros(PhaseSystem.n); + annotation (Documentation(info=" +
+Given a generic electric connector
+
+IBPSA.Electrical.Interfaces.Terminal this
+model imposes the following condition on the voltage V[PhaseSystem.n]
+
+V = 0, +
+
+where 0 is a null vector of length PhaseSystem.n
.
+
+This model represents a generalized interface for an impedance. +
++The model has a single generalized electric terminal of type + +IBPSA.Electrical.Interfaces.Terminal +that can be redeclared. +The impedance can be of different types: +
+
+The values of the resistance R
, capacitance C
and
+inductance L
can be
+specified as parameters of the model.
+
+The values of the resistance R
, capacitance C
+and inductance L
can also be
+specified by using the input variables y_R
, y_C
,
+and y_L
that are Real values between [0,1].
+These input values are enabled by the boolean flags use_R_in
,
+use_L_in
, and
+use_C_in
.
+
+If the flag use_R_in = true
, the value of R
is computed as
+
+R = Rmin + yR (Rmax - Rmin) +
+", revisions=" +pf_in
and updated documentation.
++This is a model of a generic inductive load. This model is an extension of the base load model + +IBPSA.Electrical.Interfaces.Load. +
+
+This model assumes a fixed power factor pf
when the flag use_pf_in = false
+otherwise it uses the power factor specified by the input pf_in
.
+
The power factor (either the input or the parameter) is used to compute the reactive power
+Q
given the active power P
+
+Q = P tan(arccos(pf)) +
+")); +end InductiveLoad; diff --git a/IBPSA/Electrical/Interfaces/Load.mo b/IBPSA/Electrical/Interfaces/Load.mo new file mode 100644 index 0000000000..54edb9226d --- /dev/null +++ b/IBPSA/Electrical/Interfaces/Load.mo @@ -0,0 +1,256 @@ +within IBPSA.Electrical.Interfaces; +model Load "Partial model for a generic load" + replaceable package PhaseSystem = + IBPSA.Electrical.PhaseSystems.PartialPhaseSystem constrainedby + IBPSA.Electrical.PhaseSystems.PartialPhaseSystem "Phase system" + annotation (choicesAllMatching=true); + parameter Boolean linearized = false "If true, the load model is linearized" + annotation(Evaluate=true,Dialog(group="Modeling assumption")); + parameter IBPSA.Electrical.Types.Load mode( + min=IBPSA.Electrical.Types.Load.FixedZ_steady_state, + max=IBPSA.Electrical.Types.Load.VariableZ_y_input) = IBPSA.Electrical.Types.Load.FixedZ_steady_state + "Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.)" + annotation (Evaluate=true, Dialog(group="Modeling assumption")); + + parameter Modelica.Units.SI.Power P_nominal=0 + "Nominal power (negative if consumed, positive if generated). Used if mode <> IBPSA.Electrical.Types.Load.VariableZ_P_input" + annotation (Dialog(group="Nominal conditions", enable=mode <> IBPSA.Electrical.Types.Load.VariableZ_P_input)); + + parameter Modelica.Units.SI.Voltage V_nominal(min=0, start=110) + "Nominal voltage (V_nominal >= 0)" annotation (Evaluate=true, Dialog(group= + "Nominal conditions", enable=(mode == IBPSA.Electrical.Types.Load.FixedZ_dynamic + or linearized))); + parameter IBPSA.Electrical.Types.InitMode initMode( + min=IBPSA.Electrical.Types.InitMode.zero_current, + max=IBPSA.Electrical.Types.InitMode.linearized) = IBPSA.Electrical.Types.InitMode.zero_current + "Initialization mode for homotopy operator" annotation(Dialog(tab = "Initialization")); + + Modelica.Units.SI.Voltage v[:](start=PhaseSystem.phaseVoltages(V_nominal)) = + terminal.v "Voltage vector"; + Modelica.Units.SI.Current i[:](each start=0) = terminal.i "Current vector"; + Modelica.Units.SI.Power S[PhaseSystem.n]=PhaseSystem.phasePowers_vi(v, -i) + "Phase powers"; + Modelica.Units.SI.Power P(start=0) + "Power of the load (negative if consumed, positive if fed into the electrical grid)"; + + Modelica.Blocks.Interfaces.RealInput y(min=0, max=1, unit="1") + if (mode == IBPSA.Electrical.Types.Load.VariableZ_y_input) + "Fraction of the nominal power consumed" annotation (Placement(transformation( + extent={{-20,-20},{20,20}}, + rotation=180, + origin={100,0}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=180, + origin={100,0}))); + Modelica.Blocks.Interfaces.RealInput Pow(unit="W") + if (mode == IBPSA.Electrical.Types.Load.VariableZ_P_input) + "Power consumed" annotation (Placement(transformation( + extent={{-20,-20},{20,20}}, + rotation=180, + origin={100,0}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=180, + origin={100,0}))); + replaceable IBPSA.Electrical.Interfaces.Terminal terminal( + redeclare replaceable package PhaseSystem = PhaseSystem) + "Generalized electric terminal" + annotation (Placement(transformation(extent={{-108,-8},{-92,8}}), + iconTransformation(extent={{-108,-8},{-92,8}}))); + +protected + Modelica.Blocks.Interfaces.RealInput y_internal + "Hidden value of the input load for the conditional connector"; + Modelica.Blocks.Interfaces.RealInput P_internal + "Hidden value of the input power for the conditional connector"; + Real load(min=eps, max=1) + "Internal representation of control signal, used to avoid singularity"; + constant Real eps = 1E-10 + "Small number used to avoid a singularity if the power is zero"; + constant Real oneEps = 1-eps + "Small number used to avoid a singularity if the power is zero"; + +initial equation + if mode == IBPSA.Electrical.Types.Load.VariableZ_P_input then + assert(abs(P_nominal) < 1E-10, "*** Warning: P_nominal = " + String(P_nominal) + ", but this value will be ignored.", + AssertionLevel.warning); + end if; + +equation + assert(y_internal>=0 and y_internal<=1+eps, "The power load fraction P (input of the model) must be within [0,1]"); + + // Connection between the conditional and inner connector + connect(y,y_internal); + connect(Pow,P_internal); + + // If the power is fixed, inner connector value is equal to 1 + if mode==IBPSA.Electrical.Types.Load.FixedZ_steady_state or + mode==IBPSA.Electrical.Types.Load.FixedZ_dynamic then + y_internal = 1; + P_internal = 0; + elseif mode==IBPSA.Electrical.Types.Load.VariableZ_y_input then + P_internal = 0; + elseif mode==IBPSA.Electrical.Types.Load.VariableZ_P_input then + y_internal = 1; + end if; + + // Value of the load, depending on the type: fixed or variable + if mode==IBPSA.Electrical.Types.Load.VariableZ_y_input then + load = eps + oneEps*y_internal; + else + load = 1; + end if; + + // Power consumption + if mode==IBPSA.Electrical.Types.Load.FixedZ_steady_state or + mode==IBPSA.Electrical.Types.Load.FixedZ_dynamic then + P = P_nominal; + elseif mode==IBPSA.Electrical.Types.Load.VariableZ_P_input then + P = P_internal; + else + P = P_nominal*load; + end if; + + annotation ( Documentation(revisions=" +P
.
+P_nominal
+and removed assertion warning.
+This is required for pedantic model check in Dymola.
+This is for
+#426.
+P_nominal
if
+mode <> IBPSA.Electrical.Types.Load.VariableZ_P_input
.
+This avoids a warning during translation of
+
+IBPSA.Examples.ChillerPlant.DataCenterRenewables.
+linear
to linearized
+because IBPSA.Fluid
also uses linearized
.
+This change has been done to use a consistent naming across the library.
+initMode
that can be used to
+select the assumption to be used during initialization phase
+by the homotopy operator.
++This model represents a generic load that can be extended to represent +either a DC or an AC load. +
+
+The model has a single generalized electric terminal of type
+
+IBPSA.Electrical.Interfaces.Terminal
+that can be redeclared.
+The generalized load is modeled as an impedance whose value can change. The value of the impedance
+can change depending on the value of the parameter mode
, which is of type
+IBPSA.Electrical.Types.Load:
+
Mode | +Description | +Explanation | +
---|---|---|
IBPSA.Electrical.Types.Load.FixedZ_steady_state | +fixed Z steady state | +The load consumes exactly the power
+specified by the parameter P_nominal .
+ |
+
IBPSA.Electrical.Types.Load.FixedZ_dynamic | +fixed Z dynamic | +
+The load consumes exactly the power
+specified by the parameter P_nominal at steady state.
+Depending on the type
+of load (e.g., inductive or capacitive)
+different dynamics are represented.
+ |
+
IBPSA.Electrical.Types.Load.VariableZ_P_input | +variable Z P input | +
+The load consumes exactly the power specified
+by the input variable Pow .
+ |
+
IBPSA.Electrical.Types.Load.VariableZ_y_input | +variable Z y input | +
+The load consumes exactly the a fraction of the nominal power
+P_nominal specified by the input variable y .
+ |
+
+It is assumed that the power P
of the load is positive when produced
+(e.g., the load acts like a source) and negative when consumed (e.g., the
+source acts like a utilizer).
+
+The model has a Boolean parameter linearized
that by default is equal to false
.
+When the power consumption of the load is imposed, this introduces
+a nonlinear equation between the voltage and the current of the load. This flag is used to
+select between a linearized version
+of the equations or the original nonlinear ones.
+When the linearized version of the model is used, the parameter V_nominal
has to
+be specified. The nominal voltage is needed to linearize the nonlinear equations.
+
+Note: +A linearized model will not consume the nominal power if the voltage +at the terminal differs from the nominal voltage. +
+ +")); +end Load; diff --git a/IBPSA/Electrical/Interfaces/PartialAcDcParameters.mo b/IBPSA/Electrical/Interfaces/PartialAcDcParameters.mo new file mode 100644 index 0000000000..511f2606f5 --- /dev/null +++ b/IBPSA/Electrical/Interfaces/PartialAcDcParameters.mo @@ -0,0 +1,21 @@ +within IBPSA.Electrical.Interfaces; +record PartialAcDcParameters + "Partial model that contains basic parameters for a DC/AC conversion system" + parameter Real pf(min=0, max=1) = 0.9 "Power factor" + annotation (Dialog(group="AC-Conversion")); + parameter Real eta_DCAC(min=0, max=1) = 0.9 "Efficiency of DC/AC conversion" + annotation (Dialog(group="AC-Conversion")); + annotation (Documentation(info=" ++This model contains the minimum set of parameters necessary to describe +an AC/DC converter. +
+", revisions=" ++This model declares connectors for electrical components with two terminals. +
+")); +end PartialBaseTwoPort; diff --git a/IBPSA/Electrical/Interfaces/PartialConversion.mo b/IBPSA/Electrical/Interfaces/PartialConversion.mo new file mode 100644 index 0000000000..926e91841b --- /dev/null +++ b/IBPSA/Electrical/Interfaces/PartialConversion.mo @@ -0,0 +1,40 @@ +within IBPSA.Electrical.Interfaces; +model PartialConversion + "Model representing a generic two port system for conversion" + extends IBPSA.Electrical.Interfaces.PartialTwoPort; + Modelica.Units.SI.Voltage v_p "Voltage drop between the two positive pins"; + Modelica.Units.SI.Voltage v_n "Voltage drop between the two negative pins"; + Modelica.Units.SI.Current i_p "Current flowing through the positive pins"; + Modelica.Units.SI.Current i_n "Current flowing through the negative pins"; +equation + i_p = PhaseSystem_p.systemCurrent(terminal_p.i); + i_n = PhaseSystem_n.systemCurrent(terminal_n.i); + + v_p = PhaseSystem_p.systemVoltage(terminal_p.v); + v_n = PhaseSystem_n.systemVoltage(terminal_n.v); + + annotation (Documentation(revisions=" +
+This model extends the base class
+
+IBPSA.Electrical.Interfaces.PartialTwoPort
+model and declares the variables
+v_p
and i_p
that represents the voltage and the
+current at the terminal_p
, and the variables
+v_n
and i_n
that represents the voltage and the
+current at the terminal_n
.
+These variables are used in conversion models such as transformers and AC/DC converters.
+
+This is a model of a component with two electric terminals. +It represents a common interface that is extended by other models. +
+")); +end PartialTwoPort; diff --git a/IBPSA/Electrical/Interfaces/ResistiveLoad.mo b/IBPSA/Electrical/Interfaces/ResistiveLoad.mo new file mode 100644 index 0000000000..0619d44cbc --- /dev/null +++ b/IBPSA/Electrical/Interfaces/ResistiveLoad.mo @@ -0,0 +1,35 @@ +within IBPSA.Electrical.Interfaces; +partial model ResistiveLoad "Partial model of a resistive load" + extends Load; + + annotation (Documentation(revisions=" +PhaseSystem.n
when models like
+
+IBPSA.Electrical.AC.OnePhase.Loads.Resistive
+inherit directly from
+
+IBPSA.Electrical.Interfaces.LoadIBPSA.Electrical.Interfaces.Load.+This is a model of a generic resistive load. This model is an extension of the base load model + +IBPSA.Electrical.Interfaces.Load. +
+")); +end ResistiveLoad; diff --git a/IBPSA/Electrical/Interfaces/Source.mo b/IBPSA/Electrical/Interfaces/Source.mo new file mode 100644 index 0000000000..a7f6e4f839 --- /dev/null +++ b/IBPSA/Electrical/Interfaces/Source.mo @@ -0,0 +1,71 @@ +within IBPSA.Electrical.Interfaces; +model Source "Partial model of a generic source." + replaceable package PhaseSystem = + IBPSA.Electrical.PhaseSystems.OnePhase constrainedby + IBPSA.Electrical.PhaseSystems.PartialPhaseSystem "Phase system" + annotation (choicesAllMatching=true); + parameter Boolean potentialReference = true + "Serve as potential root for the reference angle theta" + annotation (Evaluate=true, Dialog(group="Reference Parameters")); + parameter Boolean definiteReference = false + "Serve as definite root for the reference angle theta" + annotation (Evaluate=true, Dialog(group="Reference Parameters")); + Modelica.Units.SI.Power S[PhaseSystem.n]=PhaseSystem.phasePowers_vi(terminal.v, + terminal.i) "Complex power S[1] = P, S[2]= Q"; + Modelica.Units.SI.Angle phi=PhaseSystem.phase(terminal.v) - PhaseSystem.phase( + -terminal.i) "Phase shift with respect to reference angle"; + replaceable IBPSA.Electrical.Interfaces.Terminal terminal( + redeclare final replaceable package PhaseSystem = PhaseSystem) + "Generalized terminal" + annotation (Placement(transformation(extent={{92,-8},{108,8}}))); +protected + function j = PhaseSystem.j; +equation + if potentialReference then + if definiteReference then + Connections.root(terminal.theta); + else + Connections.potentialRoot(terminal.theta); + end if; + end if; + annotation ( Documentation(revisions=" ++This model represents a generic source. +
+
+In case the phase system has PhaseSystem.m > 0
and
+thus the connectors are over determined,
+the source can be selected to serve as reference point.
+The parameters potentialReference
and definiteReference
+are used to define if the source model should be selected as source for
+the reference angles theta
or not.
+More information about overdetermined connectors can be found
+in Olsson Et Al. (2008).
+
+
+Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
+
+Balanced Models in Modelica 3.0 for Increased Model Quality.
+Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.
+
+This connector represents a generalized electric terminal. The generalization is made possible by the
+replaceable package
+IBPSA.Electrical.Interfaces.Terminal.PhaseSystem.
+The package PhaseSystem
can be one of the packages contained in
+
+IBPSA.Electrical.PhaseSystems.
+Using this approach allows to represent DC, single phase AC and
+multi phases balanced and unbalanced AC systems with the same connector.
+
+This connector is compatible with the following Modelica libraries: +
+
+The connector is overdetermined since the number of effort variables
+is higher than the number of flow variables.
+This happens when the phase system has a number of reference angles
+PhaseSystem.m > 0
.
+The over-determined connectors are defined and used in such a way
+that a Modelica tool is able
+to remove the superfluous but consistent equations arriving
+at a balanced set of equations, based on a
+graph analysis of the connection structure.
+The models have to use ad-hoc constructs specified by the Modelica language to handle this situation.
+More information can be found in Olsson Et Al. (2008).
+
+More details about the generalized electrical terminal +can be found in Franke and Wiesmann (2014). +
+
+
+Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
+
+Balanced Models in Modelica 3.0 for Increased Model Quality.
+Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.
+
+
+Ruediger Franke and Hansjurg Wiesmann.
+
+Flexible modeling of electrical power systems - the Modelica PowerSystems library.
+Proc. of the 10th Modelica Conference, Lund, Sweden, March 2014.
+
+This model represents a generic variable voltage source. The model has a boolean
+flag use_V_in
, when this flag is equal to true
+the voltage of the source is imposed by the input variable V_in
.
+When the flag is equal to false
the voltage source is equal to the parameter V
.
+
+In case the phase system adopted has PhaseSystem.m > 0
and
+thus the connectors are over determined,
+the source can be selected to serve as reference point.
+The parameters potentialReference
and definiteReference
are used to define if the
+source model should be selected as source for the reference angles or not.
+More information about overdetermined connectors can be found
+in Olsson Et Al. (2008).
+
+
+Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
+
+Balanced Models in Modelica 3.0 for Increased Model Quality.
+Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.
+
+This package contains basic classes that are used to build +component models for electrical systems. +The classes are not directly usable, but can +be extended when building a new model. +
+", +revisions=" ++This package declares the functions that are used to implement +the DC models. +
+")); +end DirectCurrent; diff --git a/IBPSA/Electrical/PhaseSystems/OnePhase.mo b/IBPSA/Electrical/PhaseSystems/OnePhase.mo new file mode 100644 index 0000000000..d769b95785 --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/OnePhase.mo @@ -0,0 +1,125 @@ +within IBPSA.Electrical.PhaseSystems; +package OnePhase "Single phase two connectors AC system" + extends PartialPhaseSystem(phaseSystemName="OnePhase", n=2, m=1); + + + redeclare function extends j "Return vector rotated by 90 degrees" + algorithm + y := {-x[2], x[1]}; + annotation(Inline=true); + end j; + + + redeclare function extends rotate + "Rotate a vector of an angle theta (anti-counterclock)" + algorithm + y[1] := cos(theta)*x[1] - sin(theta)*x[2]; + y[2] := sin(theta)*x[1] + cos(theta)*x[2]; + annotation(Inline=true); + end rotate; + + + redeclare function extends product + "Multiply two complex numbers represented by vectors x[2] and y[2]" + algorithm + z := {x[1]*y[1] - x[2]*y[2], x[1]*y[2] + x[2]*y[1]}; + annotation(Inline=true); + end product; + + + redeclare function extends divide + "Divide two complex numbers represented by vectors x[2] and y[2]" + algorithm + z := {x[1]*y[1] + x[2]*y[2], x[2]*y[1] - x[1]*y[2]}/(y[1]^2 + y[2]^2); + annotation(Inline=true); + end divide; + + + redeclare function extends thetaRel + "Return absolute angle of rotating system as offset to thetaRef" + algorithm + thetaRel := 0; + annotation(Inline=true); + end thetaRel; + + + redeclare function extends thetaRef + "Return absolute angle of rotating reference system" + algorithm + thetaRef := theta[1]; + annotation(Inline=true); + end thetaRef; + + + redeclare function extends phase "Return phase" + algorithm + phase := atan2(x[2], x[1]); + annotation(Inline=true); + end phase; + + + redeclare function extends phaseVoltages "Return phase to neutral voltages" + algorithm + v := {V*cos(phi), V*sin(phi)}; + annotation(Inline=true); + end phaseVoltages; + + + redeclare function extends phaseCurrents "Return phase currents" + algorithm + i := {I*cos(phi), I*sin(phi)}; + annotation(Inline=true); + end phaseCurrents; + + + redeclare function extends phasePowers "Return phase powers" + algorithm + p := {P, P*tan(phi)}; + annotation(Inline=true); + end phasePowers; + + + redeclare function extends phasePowers_vi "Return phase powers" + algorithm + p := {v[1]*i[1] + v[2]*i[2], v[2]*i[1] - v[1]*i[2]}; + annotation(Inline=true); + end phasePowers_vi; + + + redeclare function extends systemVoltage + "Return system voltage as function of phase voltages" + algorithm + V := Modelica.Fluid.Utilities.regRoot(v*v, delta = 1e-5); + annotation(Inline=true); + end systemVoltage; + + + redeclare function extends systemCurrent + "Return system current as function of phase currents" + algorithm + I := Modelica.Fluid.Utilities.regRoot(i*i, delta = 1e-5); + annotation(Inline=true); + end systemCurrent; + + + redeclare function extends activePower + "Return total power as function of phase powers" + algorithm + // P = v[1]*i[1] + v[2]*i[2] + P := v*i; + annotation(Inline=true); + end activePower; + + + annotation (Icon(graphics={ + Line( + points={{-70,-10},{-58,10},{-38,30},{-22,10},{-10,-10},{2,-30},{22,-50}, + {40,-30},{50,-10}}, + color={95,95,95}, + smooth=Smooth.Bezier)}), Documentation(info=" ++This package declares the functions that are used to implement +the AC single phase models. +
+")); +end OnePhase; diff --git a/IBPSA/Electrical/PhaseSystems/PartialPhaseSystem.mo b/IBPSA/Electrical/PhaseSystems/PartialPhaseSystem.mo new file mode 100644 index 0000000000..bb566679ce --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/PartialPhaseSystem.mo @@ -0,0 +1,160 @@ +within IBPSA.Electrical.PhaseSystems; +package PartialPhaseSystem "Base package of all phase systems" + extends Modelica.Icons.Package; + constant String phaseSystemName = "UnspecifiedPhaseSystem" + "Name of the phase system represented by the package"; + constant Integer n "Number of independent voltage and current components"; + constant Integer m "Number of reference angles"; + + type Current = Real(unit = "A", quantity = "Current." + phaseSystemName) + "Current for connector" annotation (Documentation(info=" +This type defines the current for a specific connector that extends + +IBPSA.Electrical.PhaseSystems.PartialPhaseSystem. +")); + + type Voltage = Real(unit = "V", quantity = "Voltage." + phaseSystemName) + "Voltage for connector" annotation (Documentation(info=" +This type defines the voltage for a specific connector that extends + +IBPSA.Electrical.PhaseSystems.PartialPhaseSystem. +")); + + type ReferenceAngle "Reference angle for connector" + extends Modelica.Units.SI.Angle; + + function equalityConstraint "Assert that angles are equal" + extends Modelica.Icons.Function; + input ReferenceAngle theta1[:]; + input ReferenceAngle theta2[:]; + output Real residue[0]; + algorithm + for i in 1:size(theta1, 1) loop + assert(abs(theta1[i] - theta2[i]) < Modelica.Constants.eps, + "Angles theta1 and theta2 are not equal over the connection."); + end for; + end equalityConstraint; + annotation (Documentation(info=" +This type defines the voltage angle (used by the phasorial approach) for a specific connector that extends + +IBPSA.Electrical.PhaseSystems.PartialPhaseSystem. +")); + end ReferenceAngle; + + replaceable partial function j "Return vector rotated by 90 degrees" + extends Modelica.Icons.Function; + input Real x[n]; + output Real y[n]; + end j; + + replaceable partial function jj "Vectorized version of j" + extends Modelica.Icons.Function; + input Real[:,:] xx "array of voltage or current vectors"; + output Real[size(xx,1),size(xx,2)] yy "array of rotated vectors"; + algorithm + //yy := {j(xx[:,k]) for k in 1:size(xx,2)}; + // Note: Dymola 2013 fails to expand + for k in 1:size(xx,2) loop + yy[:,k] := j(xx[:,k]); + end for; + end jj; + + replaceable partial function rotate + "Rotate a vector of an angle theta (anti-counterclock)" + extends Modelica.Icons.Function; + input Real x[n]; + input Modelica.Units.SI.Angle theta; + output Real y[n]; + end rotate; + + replaceable partial function product "Multiply two vectors" + extends Modelica.Icons.Function; + input Real x[n]; + input Real y[n]; + output Real z[n]; + end product; + + replaceable partial function divide "Divide two vectors" + extends Modelica.Icons.Function; + input Real x[n]; + input Real y[n]; + output Real z[n]; + end divide; + + replaceable partial function thetaRel + "Return absolute angle of rotating system as offset to thetaRef" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Angle theta[m]; + output Modelica.Units.SI.Angle thetaRel; + end thetaRel; + + replaceable partial function thetaRef + "Return absolute angle of rotating reference system" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Angle theta[m]; + output Modelica.Units.SI.Angle thetaRef; + end thetaRef; + + replaceable partial function phase "Return phase" + extends Modelica.Icons.Function; + input Real x[n]; + output Modelica.Units.SI.Angle phase; + end phase; + + replaceable partial function phaseVoltages "Return phase to neutral voltages" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Voltage V "system voltage"; + input Modelica.Units.SI.Angle phi=0 "phase angle"; + output Modelica.Units.SI.Voltage v[n] "phase to neutral voltages"; + end phaseVoltages; + + replaceable partial function phaseCurrents "Return phase currents" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Current I "system current"; + input Modelica.Units.SI.Angle phi=0 "phase angle"; + output Modelica.Units.SI.Current i[n] "phase currents"; + end phaseCurrents; + + replaceable partial function phasePowers "Return phase powers" + extends Modelica.Icons.Function; + input Modelica.Units.SI.ActivePower P "active system power"; + input Modelica.Units.SI.Angle phi=0 "phase angle"; + output Modelica.Units.SI.Power p[n] "phase powers"; + end phasePowers; + + replaceable partial function phasePowers_vi "Return phase powers" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Voltage v[n] "phase voltages"; + input Modelica.Units.SI.Current i[n] "phase currents"; + output Modelica.Units.SI.Power p[n] "phase powers"; + end phasePowers_vi; + + replaceable partial function systemVoltage + "Return system voltage as function of phase voltages" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Voltage v[n]; + output Modelica.Units.SI.Voltage V; + end systemVoltage; + + replaceable partial function systemCurrent + "Return system current as function of phase currents" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Current i[n]; + output Modelica.Units.SI.Current I; + end systemCurrent; + + replaceable partial function activePower + "Return total power as function of phase powers" + extends Modelica.Icons.Function; + input Modelica.Units.SI.Voltage v[n] "phase voltages"; + input Modelica.Units.SI.Current i[n] "phase currents"; + output Modelica.Units.SI.ActivePower P "active system power"; + end activePower; + +annotation (Documentation(info=" ++This package declares the functions that are used to implement +the different phase systems. +
+")); +end PartialPhaseSystem; diff --git a/IBPSA/Electrical/PhaseSystems/ThreePhase_d.mo b/IBPSA/Electrical/PhaseSystems/ThreePhase_d.mo new file mode 100644 index 0000000000..a39764423e --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/ThreePhase_d.mo @@ -0,0 +1,37 @@ +within IBPSA.Electrical.PhaseSystems; +package ThreePhase_d "AC system covering only resistive loads with three symmetric phases" + extends DirectCurrent(phaseSystemName="ThreePhase_d"); + + + redeclare function phaseVoltages "Return phase to neutral voltages" + extends Modelica.Icons.Function; + input SI.Voltage V "system voltage"; + input SI.Angle phi = 0 "phase angle"; + output SI.Voltage v[n] "phase to neutral voltages"; + algorithm + v := {V}/sqrt(3); + end phaseVoltages; + + + redeclare function systemVoltage + "Return system voltage as function of phase voltages" + extends Modelica.Icons.Function; + input SI.Voltage v[n]; + output SI.Voltage V; + algorithm + V := sqrt(3)*v[1]; + end systemVoltage; + + + annotation (Icon(graphics={ + Line( + points={{-70,-10},{-58,10},{-38,30},{-22,10},{-10,-10},{2,-30},{22, + -50},{40,-30},{50,-10}}, + color={95,95,95}, + smooth=Smooth.Bezier)}), Documentation(info=" ++This package declares the functions that are used to implement +the AC three-phase balanced and purely resistive models. +
+")); +end ThreePhase_d; diff --git a/IBPSA/Electrical/PhaseSystems/ThreePhase_dq.mo b/IBPSA/Electrical/PhaseSystems/ThreePhase_dq.mo new file mode 100644 index 0000000000..45d31b770f --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/ThreePhase_dq.mo @@ -0,0 +1,107 @@ +within IBPSA.Electrical.PhaseSystems; +package ThreePhase_dq "AC system, symmetrically loaded three-phase" + extends PartialPhaseSystem(phaseSystemName="ThreePhase_dq", n=2, m=1); + + + redeclare function extends j "Return vector rotated by 90 degrees" + algorithm + y := {-x[2], x[1]}; + annotation(Inline=true); + end j; + + + redeclare function extends thetaRel + "Return absolute angle of rotating system as offset to thetaRef" + algorithm + thetaRel := 0; + annotation(Inline=true); + end thetaRel; + + + redeclare function extends thetaRef + "Return absolute angle of rotating reference system" + algorithm + thetaRef := theta[1]; + annotation(Inline=true); + end thetaRef; + + + redeclare function extends phase "Return phase" + algorithm + phase := atan2(x[2], x[1]); + annotation(Inline=true); + end phase; + + + redeclare function extends phaseVoltages "Return phase to neutral voltages" + algorithm + v := {V*cos(phi), V*sin(phi)}/sqrt(3); + annotation(Inline=true); + end phaseVoltages; + + + redeclare function extends phaseCurrents "Return phase currents" + algorithm + i := {I*cos(phi), I*sin(phi)}; + annotation(Inline=true); + end phaseCurrents; + + + redeclare function extends phasePowers "Return phase powers" + algorithm + p := {P, P*tan(phi)}; + annotation(Inline=true); + end phasePowers; + + + redeclare function extends phasePowers_vi "Return phase powers" + algorithm + p := {v*i, -j(v)*i}; + annotation(Inline=true); + end phasePowers_vi; + + + redeclare function extends systemVoltage + "Return system voltage as function of phase voltages" + algorithm + V := Modelica.Fluid.Utilities.regRoot(3*v*v, delta = 1e-5); + annotation(Inline=true); + end systemVoltage; + + + redeclare function extends systemCurrent + "Return system current as function of phase currents" + algorithm + I := Modelica.Fluid.Utilities.regRoot(i*i, delta = 1e-5); + annotation(Inline=true); + end systemCurrent; + + + redeclare function extends activePower + "Return total power as function of phase powers" + algorithm + P := v[1]*i[1]; + annotation(Inline=true); + end activePower; + + + annotation (Icon(graphics={ + Line( + points={{-70,12},{-58,32},{-38,52},{-22,32},{-10,12},{2,-8},{22,-28}, + {40,-8},{50,12}}, + color={95,95,95}, + smooth=Smooth.Bezier), + Line( + points={{-70,-70},{50,-70}}, + color={95,95,95}, + smooth=Smooth.None), + Line( + points={{-70,-46},{50,-46}}, + color={95,95,95}, + smooth=Smooth.None)}), Documentation(info=" ++This package declares the functions that are used to implement +the AC three-phase balanced models using the DQ representation. +
+")); +end ThreePhase_dq; diff --git a/IBPSA/Electrical/PhaseSystems/ThreePhase_dq0.mo b/IBPSA/Electrical/PhaseSystems/ThreePhase_dq0.mo new file mode 100644 index 0000000000..bde728c3ce --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/ThreePhase_dq0.mo @@ -0,0 +1,134 @@ +within IBPSA.Electrical.PhaseSystems; +package ThreePhase_dq0 "AC system in dqo representation" + extends PartialPhaseSystem(phaseSystemName="ThreePhase_dqo", n=3, m=2); + + + redeclare function extends j + "Rotation(pi/2) of vector around {0,0,1} and projection on North plane" + algorithm + y := cat(1, {-x[2], x[1]}, zeros(size(x,1)-2)); + annotation(Inline=true); + end j; + + + redeclare function extends rotate + "Rotate a vector of an angle theta (anti-counterclock)" + algorithm + y[1] := cos(theta)*x[1] - sin(theta)*x[2]; + y[2] := sin(theta)*x[1] + cos(theta)*x[2]; + y[3] := x[3]; + annotation(Inline=true); + end rotate; + + + redeclare function jj "Vectorized version of j" + extends Modelica.Icons.Function; + input Real[:,:] xx "array of voltage or current vectors"; + output Real[size(xx,1),size(xx,2)] yy "array of rotated vectors"; + algorithm + yy := cat(1, {-xx[2,:], xx[1,:]}, zeros(size(xx,1)-2, size(xx,2))); + annotation(Inline=true); + end jj; + + + redeclare function extends thetaRel + "Return absolute angle of rotating system as offset to thetaRef" + algorithm + thetaRel := theta[1]; + annotation(Inline=true); + end thetaRel; + + + redeclare function extends thetaRef + "Return absolute angle of rotating reference system" + algorithm + thetaRef := theta[2]; + annotation(Inline=true); + end thetaRef; + + + redeclare function extends phase "Return phase" + algorithm + phase := atan2(x[2], x[1]); + annotation(Inline=true); + end phase; + + + redeclare function extends phaseVoltages "Return phase to neutral voltages" + protected + Voltage neutral_v = 0; + algorithm + v := {V*cos(phi), V*sin(phi), sqrt(3)*neutral_v}/sqrt(3); + annotation(Inline=true); + end phaseVoltages; + + + redeclare function extends phaseCurrents "Return phase currents" + algorithm + i := {I*cos(phi), I*sin(phi), 0}; + annotation(Inline=true); + end phaseCurrents; + + + redeclare function extends phasePowers "Return phase powers" + algorithm + p := {P, P*tan(phi), 0}; + annotation(Inline=true); + end phasePowers; + + + redeclare function extends phasePowers_vi "Return phase powers" + algorithm + p := {v[1:2]*i[1:2], -j(v[1:2])*i[1:2], v[3]*i[3]}; + annotation(Inline=true); + end phasePowers_vi; + + + redeclare function extends systemVoltage + "Return system voltage as function of phase voltages" + algorithm + V := Modelica.Fluid.Utilities.regRoot(v*v, delta = 1e-5); + annotation(Inline=true); + end systemVoltage; + + + redeclare function extends systemCurrent + "Return system current as function of phase currents" + algorithm + I := Modelica.Fluid.Utilities.regRoot(i*i, delta = 1e-5); + annotation(Inline=true); + end systemCurrent; + + + redeclare function extends activePower + "Return total power as function of phase powers" + algorithm + P := v[1]*i[1]; + annotation(Inline=true); + end activePower; + + + annotation (Icon(graphics={ + Line( + points={{-70,28},{-58,48},{-38,68},{-22,48},{-10,28},{2,8},{22,-12}, + {40,8},{50,28}}, + color={95,95,95}, + smooth=Smooth.Bezier), + Line( + points={{-70,-54},{50,-54}}, + color={95,95,95}, + smooth=Smooth.None), + Line( + points={{-70,-78},{50,-78}}, + color={95,95,95}, + smooth=Smooth.None), + Line( + points={{-70,-28},{50,-28}}, + color={95,95,95}, + smooth=Smooth.None)}), Documentation(info=" ++This package declares the functions that are used to implement +the AC three-phase balanced models using the DQ0 representation. +
+")); +end ThreePhase_dq0; diff --git a/IBPSA/Electrical/PhaseSystems/TwoConductor.mo b/IBPSA/Electrical/PhaseSystems/TwoConductor.mo new file mode 100644 index 0000000000..526d119663 --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/TwoConductor.mo @@ -0,0 +1,110 @@ +within IBPSA.Electrical.PhaseSystems; +package TwoConductor "Two conductors for DC components" + extends PartialPhaseSystem(phaseSystemName="TwoConductor", n=2, m=0); + + + redeclare function extends j "Direct current has no complex component" + algorithm + y := zeros(n); + annotation(Inline=true); + end j; + + + redeclare function extends rotate + "Rotate a vector of an angle theta (anti-counterclock)" + algorithm + y[n] := x[n]; + annotation(Inline=true); + end rotate; + + + redeclare function extends thetaRel + "Return absolute angle of rotating system as offset to thetaRef" + algorithm + thetaRel := 0; + annotation(Inline=true); + end thetaRel; + + + redeclare function extends thetaRef + "Return absolute angle of rotating reference system" + algorithm + thetaRef := 0; + annotation(Inline=true); + end thetaRef; + + + redeclare function extends phase "Return phase" + algorithm + phase := 0; + annotation(Inline=true); + end phase; + + + redeclare replaceable function extends phaseVoltages + "Return phase to neutral voltages" + algorithm + v := 0.5*{V, -V}; + annotation(Inline=true); + end phaseVoltages; + + + redeclare function extends phaseCurrents "Return phase currents" + algorithm + i := {I, -I}; + annotation(Inline=true); + end phaseCurrents; + + + redeclare function extends phasePowers "Return phase powers" + algorithm + p := {P, 0}; + annotation(Inline=true); + end phasePowers; + + + redeclare function extends phasePowers_vi "Return phase powers" + algorithm + p := v.*i; + annotation(Inline=true); + end phasePowers_vi; + + + redeclare replaceable function extends systemVoltage + "Return system voltage as function of phase voltages" + algorithm + V := v[1] - v[2]; + annotation(Inline=true); + end systemVoltage; + + + redeclare function extends systemCurrent + "Return system current as function of phase currents" + algorithm + I := (i[1] - i[2])/2; + annotation(Inline=true); + end systemCurrent; + + + redeclare function extends activePower + "Return total power as function of phase powers" + algorithm + P := v*i; + annotation(Inline=true); + end activePower; + + + annotation (Icon(graphics={Line( + points={{-70,-28},{50,-28}}, + color={95,95,95}, + smooth=Smooth.None), + Line( + points={{-70,6},{50,6}}, + color={95,95,95}, + smooth=Smooth.None)}), Documentation(info=" ++This package declares the functions that are used to implement +the DC models with double conductors. +
+")); +end TwoConductor; diff --git a/IBPSA/Electrical/PhaseSystems/package.mo b/IBPSA/Electrical/PhaseSystems/package.mo new file mode 100644 index 0000000000..c7e2603264 --- /dev/null +++ b/IBPSA/Electrical/PhaseSystems/package.mo @@ -0,0 +1,72 @@ +within IBPSA.Electrical; +package PhaseSystems "Phase systems used in power connectors" + extends Modelica.Icons.Package; + import Modelica.Units.SI; + import Modelica.Constants.pi; + + + annotation (Icon(graphics={Line( + points={{-70,-52},{50,-52}}, + color={95,95,95}, + smooth=Smooth.None), Line( + points={{-70,8},{-58,28},{-38,48},{-22,28},{-10,8},{2,-12},{22,-32},{ + 40,-12},{50,8}}, + color={95,95,95}, + smooth=Smooth.Bezier)}), +preferredView="info", +Documentation(info=" ++This package contains a list of packages that represent different type of electric systems. +Each package inherits from +Buildings.Electrical.PhaseSystems.PartialPhaseSystem. +
++The packages represent various types of electrical systems. The basic idea behind this +approach is to use the same connector for different electrical domains. +Each connector has a replaceable package that inherits from + +Buildings.Electrical.PhaseSystems.PartialPhaseSystem +depending on the type of electrical system. +The electrical systems represented are: +
+ ++This approach has been used by the following Modelica libraries: +
+ ++More details about the phase system packages can be found in Franke and Wiesmann (2014). +
+
+
+Ruediger Franke and Hansjurg Wiesmann.
+
+Flexible modeling of electrical power systems - the Modelica PowerSystems library.
+Proc. of the 10th Modelica Conference, Lund, Sweden, March 2014.
+
M
+is directly specified in the record.
++This record contains the basic properties to describe a commercial +cable. +
++The low voltage and medium voltage cables extends this base records and add +other specific parameters like the geometrical properties. +
++The record contains four partial replaceable functions used to compute +the properties of the cable such its resistance, inductance or capacitance. +
+")); +end BaseCable; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/PartialBaseLine.mo b/IBPSA/Electrical/Transmission/BaseClasses/PartialBaseLine.mo new file mode 100644 index 0000000000..0c0f87e1c5 --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/PartialBaseLine.mo @@ -0,0 +1,171 @@ +within IBPSA.Electrical.Transmission.BaseClasses; +partial model PartialBaseLine "Partial cable line dispersion model" + parameter Modelica.Units.SI.Length l(min=0) "Length of the line"; + parameter Modelica.Units.SI.Power P_nominal(min=0) + "Nominal power of the line"; + parameter Modelica.Units.SI.Voltage V_nominal(min=0, start=220) + "Nominal voltage of the line"; + final parameter Modelica.Units.SI.Frequency f_n=50 + "Frequency considered in the definition of cables properties"; + + parameter Boolean use_C = false + "Set to true to add a capacitance in the center of the line" + annotation(Evaluate=true, Dialog(tab="Model", group="Assumptions")); + parameter IBPSA.Electrical.Types.Load modelMode=IBPSA.Electrical.Types.Load.FixedZ_steady_state + "Select between steady state and dynamic model" + annotation(Evaluate=true, Dialog(tab="Model", group="Assumptions", enable = use_C), choices(choice=IBPSA.Electrical.Types.Load.FixedZ_steady_state + "Steady state", choice=IBPSA.Electrical.Types.Load.FixedZ_dynamic "Dynamic")); + parameter Boolean use_T = false + "If true, enables the input for the temperature of the cable" annotation(Evaluate = true, Dialog(tab="Model", group="Thermal")); + parameter Modelica.Units.SI.Temperature TCable=T_ref + "Fixed temperature of the cable" annotation (Dialog( + tab="Model", + group="Thermal", + enable=not use_T)); + + parameter IBPSA.Electrical.Types.CableMode mode=IBPSA.Electrical.Types.CableMode.automatic + "Select if choosing the cable automatically or between a list of commercial options" + annotation(Evaluate=true, Dialog(tab="Tech. specification", group="Auto/Manual mode"), choicesAllMatching=true); + + replaceable parameter + IBPSA.Electrical.Transmission.LowVoltageCables.Generic + commercialCable constrainedby + IBPSA.Electrical.Transmission.BaseClasses.BaseCable + "Commercial cables options" + annotation(Evaluate=true, Dialog(tab="Tech. specification", group="Manual mode", + enable = mode == IBPSA.Electrical.Types.CableMode.commercial), + choicesAllMatching = true); + + final parameter Modelica.Units.SI.Temperature T_ref=commercialCable.T_ref + "Reference temperature of the line" annotation (Evaluate=True); + final parameter Modelica.Units.SI.Temperature M=commercialCable.M + "Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref))"; + final parameter Modelica.Units.SI.Resistance R=commercialCable.lineResistance( + l, + f_n, + commercialCable) "Resistance of the cable" annotation (Evaluate=True); + final parameter Modelica.Units.SI.Inductance L=commercialCable.lineInductance( + l, + f_n, + commercialCable) + "Inductance of the cable due to mutual and self inductance" + annotation (Evaluate=True); + final parameter Modelica.Units.SI.Capacitance C= + commercialCable.lineCapacitance( + l, + f_n, + commercialCable) "Capacitance of the cable" annotation (Evaluate=True); + Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature cableTemp + "Temperature of the cable" + annotation (Placement(transformation(extent={{-60,12},{-40,32}}))); + Modelica.Blocks.Interfaces.RealInput T if use_T "Temperature of the cable" + annotation ( + Placement(transformation(extent={{-42,28},{-2,68}}), iconTransformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={0,30}))); + Modelica.Blocks.Sources.RealExpression cableTemperature(y=T_in) + "Temperature of the cable" + annotation (Placement(transformation(extent={{-92,12},{-72,32}}))); +protected + Modelica.Blocks.Interfaces.RealInput T_in + "Internal variable for conditional temperature"; +equation + assert(L>=0 and R>=0 and C>=0, "The parameters R,L,C must be positive. Check cable properties and size."); + connect(T_in, T); + + if not use_T then + T_in = TCable; + end if; + + connect(cableTemperature.y, cableTemp.T) annotation (Line( + points={{-71,22},{-62,22}}, + color={0,0,127}, + smooth=Smooth.None)); + annotation ( Icon(coordinateSystem( + preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={ + Text( + extent={{-150,-19},{150,-59}}, + textColor={0,0,0}, + textString="%name")}), + Documentation(info=" ++This partial model contains parameters and variables needed to parametrize a +generic cable. The resistance, inductance and capacitance +are computed by the functions associated to the type of cable selected. +The type of cable is specified using a record that inherits from + +IBPSA.Electrical.Transmission.BaseClasses.BaseCable such as ( + +IBPSA.Electrical.Transmission.LowVoltageCables.Generic or + +IBPSA.Electrical.Transmission.MediumVoltageCables.Generic). +The record contains functions that depending on the properties of cable compute its +resistance, inductance or capacitance. +
+
+The model has two parameters use_C
and modelMode
that
+change the behaviour of the model. It is possible to include the effects
+of a capacity or select the model to be dynamic or steady state. More information
+are available in the line models that extends this partial model.
+
+If mode = commercial
, the user can select the type of cable from a list
+of commercial cables. The cables are divided in three different categories:
+
+The details and type of cables can be found in + +IBPSA.Electrical.Transmission.LowVoltageCables and + +IBPSA.Electrical.Transmission.MediumVoltageCables. +
+ +
+If mode = automatic
, the type of cable is automatically selected
+depending on the value of the parameters V_nominal
and
+P_nominal
.
+
+More details about the functions that compute the type of cable and its +properties can be found in +IBPSA.Electrical.Transmission.Functions. +
+
+The parameter commercialCable
is assumed to be
+
+IBPSA.Electrical.Transmission.LowVoltageCables.Generic.
+The parameter is replaceable so it can be redeclared using a different type, for example
+
+IBPSA.Electrical.Transmission.MediumVoltageCables.Generic.
+The example models
+
+IBPSA.Electrical.AC.ThreePhasesBalanced.Lines.Examples.ACLineMedium and
+
+IBPSA.Electrical.AC.ThreePhasesBalanced.Lines.Examples.ACSimpleGridMedium
+show how this can be done.
+
+This partial model extends the model +IBPSA.Electrical.Transmission.BaseClasses.PartialBaseLine. +It adds two generalized electric connectors. +
++See +IBPSA.Electrical.Transmission.BaseClasses.PartialBaseLine for more information. +
+")); +end PartialLine; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/PartialNetwork.mo b/IBPSA/Electrical/Transmission/BaseClasses/PartialNetwork.mo new file mode 100644 index 0000000000..c5e2758b95 --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/PartialNetwork.mo @@ -0,0 +1,131 @@ +within IBPSA.Electrical.Transmission.BaseClasses; +partial model PartialNetwork "Partial model that represent an electric network" + parameter Modelica.Units.SI.Voltage V_nominal(min=0, start=110) + "Nominal voltage of the lines in the network"; + replaceable parameter IBPSA.Electrical.Transmission.Grids.PartialGrid grid + "Record that describe the grid with the number of nodes, links, connections, etc." + annotation (choicesAllMatching=true, + Placement(transformation(extent={{40,60},{60,80}}))); + replaceable IBPSA.Electrical.Interfaces.BaseTerminal terminal[grid.nNodes] + "Electric terminals for each node of the network" + annotation (Placement(transformation(extent={{90,-10},{110,10}}))); + replaceable IBPSA.Electrical.Transmission.BaseClasses.PartialBaseLine lines[grid.nLinks]( + each mode=IBPSA.Electrical.Types.CableMode.commercial, + l={grid.l[i, 1] for i in 1:grid.nLinks}, + each P_nominal=1000, + each V_nominal=V_nominal) + "Array of line models, each line connecting two nodes of the grid"; + + annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={ + Rectangle( + extent={{-100,100},{100,-100}}, + lineColor={0,0,0}, + fillPattern=FillPattern.Solid, + fillColor={255,255,255}), + Ellipse( + extent={{-6,86},{6,74}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-86,46},{-74,34}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-36,-24},{-24,-36}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{74,46},{86,34}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{74,-54},{86,-66}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-6,-74},{6,-86}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-66,6},{-54,-6}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{54,6},{66,-6}}, + lineColor={0,0,0}, + fillColor={0,0,0}, + fillPattern=FillPattern.Solid), + Line( + points={{-80,40},{0,80}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-60,0},{0,80}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{0,-80},{60,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{-32,-28},{-60,0}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{80,40},{0,80}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{0,-80},{0,80}}, + color={0,0,0}, + smooth=Smooth.None), + Line( + points={{80,-62},{80,40}}, + color={0,0,0}, + smooth=Smooth.None), + Text( + extent={{-140,140},{140,100}}, + textColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + textString="%name")}), Documentation(revisions=" ++This partial model represents a generalized electrical network. +
+
+The model has three main components. The parameter grid
declares the type
+
+IBPSA.Electrical.Transmission.Grids.PartialGrid
+that contains the information about the topology of the network, such as
+the number of nodes,
+how they are connected, and the length of each connection.
+The parameter terminal[...]
declares
+an array of generalized electric connectors that are associated to each node of the grid.
+The parameter lines[...]
is an array of type
+
+IBPSA.Electrical.Transmission.BaseClasses.PartialBaseLine that represent the cables
+in the grid.
+
+This is a partial model that once extended can represent either DC or AC networks. +This model is based on the assumption that the topology of the network does not depend on +the type of cables that connect the nodes. +
+")); +end PartialNetwork; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortInductance.mo b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortInductance.mo new file mode 100644 index 0000000000..87751372ef --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortInductance.mo @@ -0,0 +1,72 @@ +within IBPSA.Electrical.Transmission.BaseClasses; +partial model PartialTwoPortInductance + "Partial model of an inductive element that links two electrical connectors" + extends Interfaces.PartialTwoPort; + parameter Modelica.Units.SI.Inductance L "Inductance" + annotation (Evaluate=true); +equation + Connections.branch(terminal_p.theta, terminal_n.theta); + terminal_p.theta = terminal_n.theta; + + terminal_p.i = - terminal_n.i; + + annotation (Diagram(graphics={ + Rectangle(extent={{-70,30},{70,-30}}, lineColor={0,0,255}), + Line(points={{-90,0},{-70,0}}, color={0,0,255}), + Line(points={{70,0},{90,0}}, color={0,0,255})}), Icon( + coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Text( + extent={{-142,-30},{144,-62}}, + textColor={0,0,0}, + textString="L=%L"), + Line(points={{-90,0},{-70,0}}, color={0,0,0}), + Line(points={{70,0},{90,0}}, color={0,0,0}), + Rectangle( + extent={{-70,30},{70,-30}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-42,14},{-14,-14}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-14,14},{14,-14}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{14,14},{42,-14}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-44,0},{44,-16}}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None), + Line( + points={{0,0},{12,1.46953e-15}}, + color={0,0,0}, + origin={-42,0}, + rotation=180), + Line( + points={{-6.85214e-44,-8.39117e-60},{10,1.22461e-15}}, + color={0,0,0}, + origin={52,0}, + rotation=180)}), + Documentation(revisions=" ++Partial model of an inductance that links two generalized electrical connectors. +
+")); +end PartialTwoPortInductance; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortRLC.mo b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortRLC.mo new file mode 100644 index 0000000000..37e7751f88 --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortRLC.mo @@ -0,0 +1,131 @@ +within IBPSA.Electrical.Transmission.BaseClasses; +partial model PartialTwoPortRLC + "Partial model of an RLC element that links two electrical connectors" + extends IBPSA.Electrical.Interfaces.PartialTwoPort; + extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref); + parameter Modelica.Units.SI.Resistance R "Resistance at temperature T_ref" + annotation (Evaluate=true); + parameter Modelica.Units.SI.Temperature T_ref=298.15 "Reference temperature"; + parameter Modelica.Units.SI.Temperature M=507.65 + "Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref))"; + parameter Modelica.Units.SI.Capacitance C "Capacity"; + parameter Modelica.Units.SI.Inductance L "Inductance"; + parameter Modelica.Units.SI.Voltage V_nominal(min=0, start=110) + "Nominal voltage (V_nominal >= 0)" + annotation (Dialog(group="Nominal conditions")); + Modelica.Units.SI.Resistance R_actual + "Actual resistance = R*(M + T_heatPort)/(M + T_ref) "; +equation + Connections.branch(terminal_p.theta, terminal_n.theta); + terminal_p.theta = terminal_n.theta; + + assert(R_actual>=0, + "The value of R_actual must be positive, check reference and actual temperatures"); + + R_actual =R*(M + Modelica.Units.Conversions.to_degC(T_heatPort))/(M + + Modelica.Units.Conversions.to_degC(T_ref)); + + annotation (Diagram(graphics={ + Rectangle(extent={{-70,30},{70,-30}}, lineColor={0,0,255}), + Line(points={{-90,0},{-70,0}}, color={0,0,255}), + Line(points={{70,0},{90,0}}, color={0,0,255})}), Icon( + coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Text( + extent={{-148,-28},{138,-60}}, + textColor={0,0,0}, + textString="R=%R, L=%L"), + Line(points={{-90,0},{-70,0}}, color={0,0,0}), + Line(points={{70,0},{90,0}}, color={0,0,0}), + Rectangle( + extent={{-70,32},{70,-28}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Line( + points={{-6.85214e-44,-8.39117e-60},{96,1.22003e-14}}, + color={0,0,0}, + origin={64,16}, + rotation=180), + Line( + visible = C > 0, + points={{-6.85214e-44,-8.39117e-60},{-4.17982e-15,16}}, + color={0,0,0}, + origin={22,16}, + rotation=180), + Line( + visible = C > 0, + points={{-6.85214e-44,-8.39117e-60},{16,1.95937e-15}}, + color={0,0,0}, + origin={30,0}, + rotation=180), + Line( + visible = C > 0, + points={{-6.85214e-44,-8.39117e-60},{16,1.95937e-15}}, + color={0,0,0}, + origin={30,-4}, + rotation=180), + Line( + visible = C > 0, + points={{-6.85214e-44,-8.39117e-60},{-2.40346e-15,16}}, + color={0,0,0}, + origin={22,-4}, + rotation=180), + Line( + points={{-66,16},{-60,16},{-58,20},{-54,12},{-50,20},{-46,12},{-42,20}, + {-38,12},{-36,16},{-32,16}}, + color={0,0,0}, + smooth=Smooth.None), + Ellipse( + extent={{-24,22},{-12,10}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-12,22},{0,10}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{0,22},{12,10}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-24,16},{12,4}}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None), + Text( + extent={{-142,-56},{144,-88}}, + textColor={0,0,0}, + textString="C=%C")}), + Documentation(revisions=" ++Partial model of a resistance that links two generalized electrical connectors. +
++The model computes a resistance R(T) that varies depending on the temperature T as +
++R(T) = Rref (M + T)/(M + Tref), +
+
+where the resistance Rref is the reference value of the resistance,
+M is the temperature coefficient of the cable material, and
+Tref is the reference temperature.
+The temperature T is the temperature of the heat port if useHeatPort = true
.
+
+The impedance L and the capacity C do not vary with respect to the temperature +and are specified by the user. +
+")); +end PartialTwoPortRLC; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortResistance.mo b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortResistance.mo new file mode 100644 index 0000000000..d202cbccde --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/PartialTwoPortResistance.mo @@ -0,0 +1,66 @@ +within IBPSA.Electrical.Transmission.BaseClasses; +partial model PartialTwoPortResistance + "Partial model of a resistive element that links two electrical connectors" + extends Interfaces.PartialTwoPort; + extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(T = T_ref); + parameter Modelica.Units.SI.Resistance R "Resistance at temperature T_ref"; + parameter Modelica.Units.SI.Temperature T_ref=298.15 "Reference temperature"; + parameter Modelica.Units.SI.Temperature M=507.65 + "Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref))"; + Modelica.Units.SI.Resistance R_actual + "Actual resistance = R*(M + T_heatPort)/(M + T_ref) "; +equation + Connections.branch(terminal_p.theta, terminal_n.theta); + terminal_p.theta = terminal_n.theta; + + assert(R_actual>=0, + "The value of R_actual must be positive, check reference and actual temperatures."); + + R_actual =R*(M + Modelica.Units.Conversions.to_degC(T_heatPort))/(M + + Modelica.Units.Conversions.to_degC(T_ref)); + + terminal_p.i = - terminal_n.i; + + annotation (Diagram(graphics={ + Rectangle(extent={{-70,30},{70,-30}}, lineColor={0,0,255}), + Line(points={{-90,0},{-70,0}}, color={0,0,255}), + Line(points={{70,0},{90,0}}, color={0,0,255})}), Icon( + coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), + graphics={ + Text( + extent={{-142,-30},{144,-62}}, + textColor={0,0,0}, + textString="R=%R"), + Line(points={{-90,0},{-70,0}}, color={0,0,0}), + Line(points={{70,0},{90,0}}, color={0,0,0}), + Rectangle( + extent={{-70,30},{70,-30}}, + lineColor={0,0,0}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid)}), + Documentation(revisions=" ++Partial model of a resistance that links two generalized electrical connectors. +
++The model computes a resistance R(T) that varies depending on the temperature T as +
++R(T) = Rref (M + T)/(M + Tref), +
+
+where the resistance Rref is the reference value of the resistance,
+M is the temperature coefficient of the cable material,
+and Tref is the reference temperature.
+The temperature T is the temperature of the heat port
+if useHeatPort = true
.
+
+This package contains partial models that describe electric +lines and cables. +
+")); +end BaseClasses; diff --git a/IBPSA/Electrical/Transmission/BaseClasses/package.order b/IBPSA/Electrical/Transmission/BaseClasses/package.order new file mode 100644 index 0000000000..70fcbed17b --- /dev/null +++ b/IBPSA/Electrical/Transmission/BaseClasses/package.order @@ -0,0 +1,7 @@ +PartialBaseLine +PartialLine +PartialNetwork +PartialTwoPortInductance +PartialTwoPortRLC +PartialTwoPortResistance +BaseCable diff --git a/IBPSA/Electrical/Transmission/Functions/R_AC_correction.mo b/IBPSA/Electrical/Transmission/Functions/R_AC_correction.mo new file mode 100644 index 0000000000..a92c50f41a --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/R_AC_correction.mo @@ -0,0 +1,293 @@ +within IBPSA.Electrical.Transmission.Functions; +function R_AC_correction + "This function computes the correction factor of the DC resistance for AC systems at 60 Hz" + input String size "Size of the commercial cable (AWG or kcmil)"; + input IBPSA.Electrical.Transmission.Types.Material material + "Material of the cable"; + output Real correction "Correction factor"; +algorithm + if material == IBPSA.Electrical.Transmission.Types.Material.Al then + if size == "1/0" then + correction := 1.0; + elseif size == "2/0" then + correction := 1.001; + elseif size == "3/0" then + correction := 1.001; + elseif size == "4/0" then + correction := 1.001; + elseif size == "250" then + correction := 1.002; + elseif size == "300" then + correction := 1.003; + elseif size == "350" then + correction := 1.004; + elseif size == "400" then + correction := 1.005; + elseif size == "500" then + correction := 1.007; + elseif size == "600" then + correction := 1.01; + elseif size == "700" then + correction := 1.013; + elseif size == "750" then + correction := 1.015; + elseif size == "800" then + correction := 1.017; + elseif size == "1000" then + correction := 1.026; + elseif size == "1250" then + correction := 1.04; + elseif size == "1500" then + correction := 1.058; + elseif size == "1750" then + correction := 1.079; + elseif size == "2000" then + correction := 1.1; + elseif size == "2500" then + correction := 1.142; + else + correction := 1.0; + end if; + + elseif material == IBPSA.Electrical.Transmission.Types.Material.Cu then + if size == "1/0" then + correction := 1.0; + elseif size == "2/0" then + correction := 1.001; + elseif size == "3/0" then + correction := 1.002; + elseif size == "4/0" then + correction := 1.004; + elseif size == "250" then + correction := 1.005; + elseif size == "300" then + correction := 1.006; + elseif size == "350" then + correction := 1.009; + elseif size == "400" then + correction := 1.011; + elseif size == "500" then + correction := 1.018; + elseif size == "600" then + correction := 1.025; + elseif size == "700" then + correction := 1.034; + elseif size == "750" then + correction := 1.039; + elseif size == "800" then + correction := 1.044; + elseif size == "1000" then + correction := 1.067; + elseif size == "1250" then + correction := 1.102; + elseif size == "1500" then + correction := 1.142; + elseif size == "1750" then + correction := 1.185; + elseif size == "2000" then + correction := 1.233; + elseif size == "2500" then + correction := 1.326; + else + correction := 1.0; + end if; + else + assert(material <> IBPSA.Electrical.Transmission.Types.Material.Al and + material <> IBPSA.Electrical.Transmission.Types.Material.Cu, + "In function IBPSA.Electrical.Transmission.Functions.R_AC_Correction, + does not support material " + String(material) + ". + The selected cable has the R_AC_Correction of the Copper.", + level = AssertionLevel.warning); + + correction := 1.0; + end if; +annotation(Inline = true, Documentation(revisions=" ++This function computes a correction factor for adapting the DC resistance +when working with AC voltages. The correction factor assumes f = 60 Hz. +
++The correction is based on the type of cabel (AWG or kcmil) and the material. +
+ +Type (AWG or kcmil) | +Material | +Correction factor | +
---|---|---|
1/0 | Aluminium | 1.0 | +
2/0 | Aluminium | 1.001 | +
3/0 | Aluminium | 1.001 | +
4/0 | Aluminium | 1.001 | +
250 | Aluminium | 1.002 | +
300 | Aluminium | 1.003 | +
350 | Aluminium | 1.004 | +
400 | Aluminium | 1.005 | +
500 | Aluminium | 1.007 | +
600 | Aluminium | 1.010 | +
700 | Aluminium | 1.013 | +
750 | Aluminium | 1.015 | +
800 | Aluminium | 1.017 | +
1000 | Aluminium | 1.026 | +
1250 | Aluminium | 1.040 | +
1500 | Aluminium | 1.058 | +
1750 | Aluminium | 1.079 | +
2000 | Aluminium | 1.100 | +
2500 | Aluminium | 1.142 | +
Type (AWG or kcmil) | +Material | +Correction factor | +
---|---|---|
1/0 | Copper | 1.0 | +
2/0 | Copper | 1.001 | +
3/0 | Copper | 1.002 | +
4/0 | Copper | 1.004 | +
250 | Copper | 1.005 | +
300 | Copper | 1.006 | +
350 | Copper | 1.009 | +
400 | Copper | 1.011 | +
500 | Copper | 1.018 | +
600 | Copper | 1.025 | +
700 | Copper | 1.034 | +
750 | Copper | 1.039 | +
800 | Copper | 1.044 | +
1000 | Copper | 1.067 | +
1250 | Copper | 1.102 | +
1500 | Copper | 1.142 | +
1750 | Copper | 1.185 | +
2000 | Copper | 1.233 | +
2500 | Copper | 1.326 | +
+This model validates + +IBPSA.Electrical.Transmission.Functions.selectCable_low +for a different range of currents. +
+", revisions=" ++This model validates + +IBPSA.Electrical.Transmission.Functions.selectCable_med +for a different range of currents. +
+", revisions=" ++This package contains validation models for the classes in + +IBPSA.Electrical.Transmission.Functions. +
++Note that most validation models contain simple input data which may not be realistic, +but for which the correct output can be obtained through an analytic solution. +The examples plot various outputs, which have been verified against these solutions. +These model outputs are stored as reference data and used for continuous validation +whenever models in the library change. +")); +end Validation; diff --git a/IBPSA/Electrical/Transmission/Functions/Validation/package.order b/IBPSA/Electrical/Transmission/Functions/Validation/package.order new file mode 100644 index 0000000000..17fc38e447 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/Validation/package.order @@ -0,0 +1,2 @@ +SelectCable_low +SelectCable_med diff --git a/IBPSA/Electrical/Transmission/Functions/computeGMD.mo b/IBPSA/Electrical/Transmission/Functions/computeGMD.mo new file mode 100644 index 0000000000..83f1f430ac --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/computeGMD.mo @@ -0,0 +1,32 @@ +within IBPSA.Electrical.Transmission.Functions; +function computeGMD + "This function computes the geometric mean distance of a three-phase transmission line" + input Modelica.Units.SI.Length d1 "Distance between conductors"; + input Modelica.Units.SI.Length d2=d1 "Distance between conductors"; + input Modelica.Units.SI.Length d3=2*d1 "Distance between conductors"; + output Modelica.Units.SI.Length GMD "Geometric Mean Distance"; +algorithm + GMD := (d1*d2*d3)^(1.0/3.0); +annotation(Inline = true, Documentation(revisions=" +
+This function computes the Geometric Mean Distance of a cable. +
++The GMD is computed as +
++GMD = (d1 d2 d3)1/3, +
++where d1, d2, and d3 are + the distances between the conductors. +
+")); +end computeGMD; diff --git a/IBPSA/Electrical/Transmission/Functions/computeGMR.mo b/IBPSA/Electrical/Transmission/Functions/computeGMR.mo new file mode 100644 index 0000000000..0681782133 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/computeGMR.mo @@ -0,0 +1,60 @@ +within IBPSA.Electrical.Transmission.Functions; +function computeGMR + "This function computes the geometric mean radius of a cable with 1 to 4 conductors" + input Modelica.Units.SI.Length d "Diameter of the conductor"; + input Integer N = 1 "Number of conductors"; + output Modelica.Units.SI.Length GMR "Geometric Mean Radius"; +algorithm + assert(N > 0 and N < 5, + "The number of conductors N must be between 1 and 4, received N=" + String(N) + "."); + if N==1 then + GMR := 0.5*d*0.7788; + elseif N==2 then + GMR := sqrt(d); + elseif N==3 then + GMR := (d^2)^(1/3); + else // N == 4 + GMR := 1.09*(d^3)^(1/4); + end if; +annotation(Inline = true, Documentation(revisions=" ++This function computes the Geometric Mean Radius (GMR) of a cable. +
++The GMR is computed as follow, depending on the number of conductors N +that are part of the cable, and the diamater of the conductor d. +
+ +Equation | Condition |
---|---|
0.7788 (d/2) | +N = 1 | +
d1/2 | +N = 2 | +
d2/3 | +N = 3 | +
d2/3 | +N = 4 | +
+This package contains various functions that are used to compute +cable properties and select the default cable during +automatic parametrization. +
+")); +end Functions; diff --git a/IBPSA/Electrical/Transmission/Functions/package.order b/IBPSA/Electrical/Transmission/Functions/package.order new file mode 100644 index 0000000000..d62457d0b8 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/package.order @@ -0,0 +1,7 @@ +R_AC_correction +computeGMD +computeGMR +selectCable_low +selectCable_med +selectVoltageLevel +Validation diff --git a/IBPSA/Electrical/Transmission/Functions/selectCable_low.mo b/IBPSA/Electrical/Transmission/Functions/selectCable_low.mo new file mode 100644 index 0000000000..42405e0fba --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/selectCable_low.mo @@ -0,0 +1,90 @@ +within IBPSA.Electrical.Transmission.Functions; +function selectCable_low "This function is used to automatically select the + type of cable for low voltages" + input Modelica.Units.SI.Power P_nominal=0 "Rated power"; + input Modelica.Units.SI.Voltage V_nominal=0 "Rated voltage"; + output IBPSA.Electrical.Transmission.LowVoltageCables.Generic cable "Cable"; +protected + parameter Real safety_factor = 1.2; + Modelica.Units.SI.Current I_nominal + "Nominal current flowing through the line"; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu10 cu10; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu20 cu20; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu25 cu25; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu35 cu35; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu50 cu50; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu95 cu95; + IBPSA.Electrical.Transmission.LowVoltageCables.Cu100 cu100; +algorithm + + assert(Transmission.Functions.selectVoltageLevel(V_nominal) == IBPSA.Electrical.Types.VoltageLevel.Low, + "In function IBPSA.Electrical.Transmission.Functions.selectCable_low, + cable autosizing has a nominal Voltage " + String(V_nominal) + " [V]. + The low voltage cables do not support such a voltage level.", + level=AssertionLevel.error); + + // Check if it's possible to compute the current + if V_nominal > 0 then + I_nominal :=safety_factor*P_nominal/V_nominal; + else + I_nominal :=0; + end if; + + // Assumed the material is Copper + if I_nominal < cu10.Amp then + cable := cu10; + elseif I_nominal >= cu10.Amp and I_nominal < cu20.Amp then + cable := cu20; + elseif I_nominal >= cu20.Amp and I_nominal < cu25.Amp then + cable := cu25; + elseif I_nominal >= cu25.Amp and I_nominal < cu35.Amp then + cable := cu35; + elseif I_nominal >= cu35.Amp and I_nominal < cu50.Amp then + cable := cu50; + elseif I_nominal >= cu50.Amp and I_nominal < cu95.Amp then + cable := cu95; + elseif I_nominal >= cu95.Amp and I_nominal < cu100.Amp then + cable := cu100; + else + assert(I_nominal < cu100.Amp, +"In function IBPSA.Electrical.Transmission.Functions.selectCable_low, + cable autosizing does not support a current of " + String(I_nominal) + " [A]. + The selected cable will be undersized.", + level=AssertionLevel.warning); + cable := cu100; + end if; +annotation(Inline = true, Documentation(revisions=" ++This function selects the default cable for a low voltage +transmission line. +
++The function takes as inputs the nominal voltage Vnominal and the +nominal power Pnominal. It computes the maximum current current that +can flow through the cable as +
++IMAX = SF Pnominal / Vnominal, +
++where SF is the safety factor. By default the safety factor is equal to 1.2. +
++Using IMAX, the function selects the smallest cable that has an ampacity +higher than IMAX. The cables are selected from + +IBPSA.Electrical.Transmission.LowVoltageCables. +
+")); +end selectCable_low; diff --git a/IBPSA/Electrical/Transmission/Functions/selectCable_med.mo b/IBPSA/Electrical/Transmission/Functions/selectCable_med.mo new file mode 100644 index 0000000000..b91d52a5d4 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/selectCable_med.mo @@ -0,0 +1,91 @@ +within IBPSA.Electrical.Transmission.Functions; +function selectCable_med "This function is used to automatically select the + type of cable for medium voltages" + input Modelica.Units.SI.Power P_nominal=0 "Rated power"; + input Modelica.Units.SI.Voltage V_nominal=0 "Rated voltage"; + output IBPSA.Electrical.Transmission.MediumVoltageCables.Generic cable "Cable"; +protected + parameter Real safety_factor = 1.2; + Modelica.Units.SI.Current I_nominal + "Nominal current flowing through the line"; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_10 Al10; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_30 Al30; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_40 Al40; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_350 Al350; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_500 Al500; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_1000 Al1000; + IBPSA.Electrical.Transmission.MediumVoltageCables.Annealed_Al_1500 Al1500; +algorithm + + assert(Transmission.Functions.selectVoltageLevel(V_nominal) == IBPSA.Electrical.Types.VoltageLevel.Medium, + "In function IBPSA.Electrical.Transmission.Functions.selectCable_med, + cable autosizing has a nominal Voltage " + String(V_nominal) + " [V]. + The medium voltage cables do not support such a voltage level.", + level=AssertionLevel.error); + + // Check if it's possible to compute the current + if V_nominal > 0 then + I_nominal :=safety_factor*P_nominal/V_nominal; + else + I_nominal :=0; + end if; + + // Assumed the material is Copper + if I_nominal < Al10.Amp then + cable := Al10; + elseif I_nominal >= Al10.Amp and I_nominal < Al30.Amp then + cable := Al30; + elseif I_nominal >= Al30.Amp and I_nominal < Al40.Amp then + cable := Al40; + elseif I_nominal >= Al40.Amp and I_nominal < Al350.Amp then + cable := Al350; + elseif I_nominal >= Al350.Amp and I_nominal < Al500.Amp then + cable := Al500; + elseif I_nominal >= Al500.Amp and I_nominal < Al1000.Amp then + cable := Al1000; + elseif I_nominal >= Al1000.Amp and I_nominal < Al1500.Amp then + cable := Al1500; + else + assert(I_nominal < Al1500.Amp, +"Warning: In function IBPSA.Electrical.Transmission.Functions.selectCable_med, + cable autosizing does not support a current of " + String(I_nominal) + " [A]. + The selected cable will be undersized.", + level=AssertionLevel.warning); + + cable := Al10; + end if; +annotation(Inline = true, Documentation(revisions=" ++This function selects the default cable for a medium voltage +transmission line. +
++The function takes as inputs the nominal voltage Vnominal and the +nominal power Pnominal. It computes the maximum current current that +can flow through the cable as +
++IMAX = SF Pnominal / Vnominal, +
++where SF is the safety factor. By default the safety factor is equal to 1.2. +
++Using IMAX, the function selects the smallest cable that has an ampacity +higher than IMAX. The cables are selected from + +IBPSA.Electrical.Transmission.MediumVoltageCables. +
+")); +end selectCable_med; diff --git a/IBPSA/Electrical/Transmission/Functions/selectVoltageLevel.mo b/IBPSA/Electrical/Transmission/Functions/selectVoltageLevel.mo new file mode 100644 index 0000000000..8c2b463f75 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Functions/selectVoltageLevel.mo @@ -0,0 +1,61 @@ +within IBPSA.Electrical.Transmission.Functions; +function selectVoltageLevel + "This function computes the voltage level (low, medium or high) given the nominal voltage" + input Modelica.Units.SI.Voltage V "Nominal voltage"; + output IBPSA.Electrical.Types.VoltageLevel level "Type of voltage level"; +algorithm + if V <= 0 then + assert(V > 0, + "In function IBPSA.Electrical.Transmission.Functions.selectVoltageLevel, + does not support a voltage of " + String(V) + " [V]. + The selected voltage level will be assumed to be low.", + level = AssertionLevel.warning); + level := IBPSA.Electrical.Types.VoltageLevel.Low; + elseif V <= 1000 then + level := IBPSA.Electrical.Types.VoltageLevel.Low; + elseif V > 1000 and V <= 50000 then + level := IBPSA.Electrical.Types.VoltageLevel.Medium; + else + level := IBPSA.Electrical.Types.VoltageLevel.High; + end if; +annotation(Inline = true, Documentation(revisions=" ++This function computes the voltage level for a given voltage. +The computation is as follows: +
+ +Condition | +Voltage Level | +
---|---|
0 ≤ V < 1 kV | +Low voltage | +
1 kV ≤ V < 50 kV | +Medium voltage | +
V ≥ 50 kV | +HIgh voltage | +
This model represents a grid inspired by the IEEE 34 node test feeder. +In this example, the cable types and lengths have been modified in order to +represent a typical distribution feeder.
+The following three type of cables are in the grid: AL120, AL70, and Al35. +
+ +", revisions=" ++This abstract grid model specifies the topology of the network by +
++The picture below describes the meaning of the +values contained in the matrices. +
+ ++ +
+", revisions=" ++This model represents a simple grid with two nodes and a single link between them. +
++The picture below describes the grid topology. +
++ +
+", revisions=" ++This model represents a simple grid with two nodes and a single link between them. +This model differs from + +IBPSA.Electrical.Transmission.Grids.TestGrid2Nodes because it defines a medium voltage +cable instead of a low voltage cable. +
++The picture below describes the grid topology. +
++ +
+", revisions=" ++This package contains different types of grids that can be used to represent +electrical networks. The topology of the network is specified by +
++Copper cable with a cross-sectional area of 10mm^2. +This type of cable has the following properties +
++RCha = 1.810-003 // Characteristic resistance [Ohm/m] +XCha = 0.076e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 100mm^2. +This type of cable has the following properties +
++RCha = 0.181e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 20mm^2. +This type of cable has the following properties +
++RCha = 0.905e-003 // Characteristic resistance [Ohm/m] +XCha = 0.075e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 25mm^2. +This type of cable has the following properties +
++RCha = 0.727e-003 // Characteristic resistance [Ohm/m] +XCha = 0.075e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 35mm^2. +This type of cable has the following properties +
++RCha = 0.517e-003 // Characteristic resistance [Ohm/m] +XCha = 0.074e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 50mm^2. +This type of cable has the following properties +
++RCha = 0.362e-003 // Characteristic resistance [Ohm/m] +XCha = 0.073e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Copper cable with a cross-sectional area of 95mm^2. +This type of cable has the following properties +
++RCha = 0.191e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++This function computes the overall resistance of a cable. +
+ ++The low voltage cable is described by a characteristic resistance per unit +length, given this value the overall resistance is computed as +
++R = RCHA lCABLE, +
++where RCHA is the characteristic resistance per unit length, and +lCABLE is the length of the cable. +
+")); + end lineResistance; + + redeclare function extends lineInductance + "Function that computes the resistance of a cable" + input IBPSA.Electrical.Transmission.LowVoltageCables.Generic cable + "Record that contains cable properties"; + algorithm + L := l*(cable.XCha/omega); + annotation(Inline=true, Documentation(revisions=" ++This function computes the overall inductance of a cable. +
++When the voltage level is low, the cables have a characteristic reactance per unit +length, which is specified at f = 50 Hz. +The overall inductance is computed as +
++L = (XCHA/ω) lCABLE, +
++where XCHA is the characteristic reactance per unit length, +ω = 2 π f is the angular velocity, and lCABLE is +the length of the cable. +
+")); + end lineInductance; + + redeclare function extends lineCapacitance + "Function that computes the capacitance of a cable" + input IBPSA.Electrical.Transmission.LowVoltageCables.Generic cable + "Record that contains cable properties"; + algorithm + C := 0.0; + annotation(Inline=true, Documentation(revisions=" ++This function computes the overall capacity of a cable. +
++When the voltage level is low, the cables do not consider the capacitive effect. Hence, +
++C = 0. +
+")); + end lineCapacitance; + + annotation (Documentation(info=" ++This is a base record for specifying physical properties for low +voltage commercial cables. New cables can be added by extending the +it. +
++For low voltage cables, only the characteristic resistance and reactance are +specified. +
+", revisions=" ++Aluminium cable with a cross-sectional area of 120mm^2. +This type of cable has the following properties +
++RCha = 0.269e-003 // Characteristic resistance [Ohm/m] +XCha = 0.071e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 120mm^2, ECM type. +This type of cable has the following properties +
++RCha = 0.278e-003 // Characteristic resistance [Ohm/m] +XCha = 0.071e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 150mm^2. +This type of cable has the following properties +
++RCha = 0.206e-003 // Characteristic resistance [Ohm/m] +XCha = 0.070e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 16mm^2, ECM type. +This type of cable has the following properties +
++RCha = 2.105e-003 // Characteristic resistance [Ohm/m] +XCha = 0.076e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 16mm^2, ECM type. +This type of cable has the following properties +
++RCha = 2.105e-003 // Characteristic resistance [Ohm/m] +XCha = 0.076e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 25mm^2, ECM type. +This type of cable has the following properties +
++RCha = 1.292e-003 // Characteristic resistance [Ohm/m] +XCha = 0.075e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 25mm^2, ECM type. +This type of cable has the following properties +
++RCha = 1.320e-003 // Characteristic resistance [Ohm/m] +XCha = 0.075e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 35mm^2, ECM type. +This type of cable has the following properties +
++RCha = 0.923e-003 // Characteristic resistance [Ohm/m] +XCha = 0.074e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 35mm^2, ECM type. +This type of cable has the following properties +
++RCha = 0.956e-003 // Characteristic resistance [Ohm/m] +XCha = 0.074e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 50mm^2. +This type of cable has the following properties +
++RCha = 0.641e-003 // Characteristic resistance [Ohm/m] +XCha = 0.073e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 70mm^2. +This type of cable has the following properties +
++RCha = 0.5071e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 70mm^2, ECM type. +This type of cable has the following properties +
++RCha = 0.488e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 75mm^2. +This type of cable has the following properties +
++RCha = 0.431e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++Aluminium cable with a cross-sectional area of 95mm^2. +This type of cable has the following properties +
++RCha = 0.320e-003 // Characteristic resistance [Ohm/m] +XCha = 0.072e-003 // Characteristic reactance [Ohm/m] ++", revisions=" +
M
+is directly specified in the record.
++This package contains records of physical properties for low +voltage commercial cables. New cables can be added by extending the +base record + +IBPSA.Electrical.Transmission.LowVoltageCables.Generic. +
++For low voltage cables, only the characteristic resistance and reactance are +specified. See +IBPSA.Electrical.Transmission.Base.BaseCable for a comprehensive list of +parameters that can be specified for a cable. +
+", revisions=" ++Annealed aluminium cable with a cross-sectional AWG 1/0 +(American Wire Gauge). +This type of cable has the following properties +
++Rdc = 0.551181e-3 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 9.195e-3 // Inner diameter [m] +D = 26.543e-3 // Outer diameter [m] +Amp = 195 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional kcmil 1000 +(thousand of Circular Mils). +This type of cable has the following properties +
++Rdc = 5.80709e-5 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 28.372e-3 // Inner diameter [m] +D = 46.101e-3 // Outer diameter [m] +Amp = 640 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional kcmil 1500 +(thousand of Circular Mils). +This type of cable has the following properties +
++Rdc = 3.87139e-5 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 34.798e-3 // Inner diameter [m] +D = 53.34e-3 // Outer diameter [m] +Amp = 800 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional AWG 2/0 +(American Wire Gauge). +This type of cable has the following properties +
++Rdc = 0.344488e-3 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 11.582e-3 // Inner diameter [m] +D = 28.956e-3 // Outer diameter [m] +Amp = 250 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional kcmil 350 +(thousand of Circular Mils). +This type of cable has the following properties +
++Rdc = 0.165682e-3 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 16.789e-3 // Inner diameter [m] +D = 34.417e-3 // Outer diameter [m] +Amp = 375 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional AWG 4/0 +(American Wire Gauge). +This type of cable has the following properties +
++Rdc = 0.274278e-3 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 13.005e-3 // Inner diameter [m] +D = 30.353e-3 // Outer diameter [m] +Amp = 285 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++Annealed aluminium cable with a cross-sectional kcmil 500 +(thousand of Circular Mils). +This type of cable has the following properties +
++Rdc = 0.116142e-3 // Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref= 298.15 // Reference temperature of the material [K] +d = 20.066e-3 // Inner diameter [m] +D = 37.592e-3 // Outer diameter [m] +Amp = 450 // Ampacity [A] ++", revisions=" +
M
+is directly specified in the record.
++This function computes the overall resistance of a cable. +
++When the voltage level is medium or high, the cables have a DC resistance that needs +to be corrected to account for the effects cause by the AC voltage. +The correction is +
++R = lCABLE RDC fCORR(s, m), +
++where RDC is the characteristic DC resistance per unit length, +lCABLE is the length of the cable, and +fCORR(s, m) is a function that corrects the DC value and depends on the +size of the cable s and its material m. See + +IBPSA.Electrical.Transmission.Functions.R_AC_correction for more details. +
+ +")); + end lineResistance; + + redeclare function extends lineInductance + "Function that computes the resistance of a cable" + input IBPSA.Electrical.Transmission.MediumVoltageCables.Generic cable + "Record that contains cable properties"; + algorithm + L := l*2e-7*log(cable.GMD/cable.GMR); + annotation(Inline=true, Documentation(revisions=" ++This function computes the overall inductance of a cable. +
++When the voltage level is medium or high, the cables have geometric parameters that can +be used to compute the inductance as +
++R = lCABLE 2 10-7 log(GMD/GMR), +
++where lCABLE is the length of the cable, and +GMD and GMR are the geometric mean distance and the geometric mean radius +of the cable. +
+")); + end lineInductance; + + redeclare function extends lineCapacitance + "Function that computes the capacitance of a cable" + input IBPSA.Electrical.Transmission.MediumVoltageCables.Generic cable + "Record that contains cable properties"; + protected + Modelica.Units.SI.Length r "Radius"; + algorithm + r := cable.d/2.0; + C := l*2*Modelica.Constants.pi*Modelica.Constants.epsilon_0/log(cable.GMD/r); + annotation(Inline=true, Documentation(revisions=" ++This function computes the overall capacity of a cable. +
++When the voltage level is medium or high, the cables have geometric parameters that can +be used to compute the capacity as +
++C = lCABLE 2 π ε0/log(GMD/r), +
++where lCABLE is the length of the cable, +ε0 is the dielectric constant of the air, GMD +is the geometric mean distance, and r = d/2 where d is the inner +diameter of the cable. +
+")); + end lineCapacitance; + + annotation (Documentation(info=" ++This is a base record for specifying physical properties for medium +voltage commercial cables. New cables can be added by extending +it. +
++For medium voltage cables, the geometric properties of the cable and the material are +specified. For example some of the properties that are specified are: +
++Rdc : Characteristic DC resistance at T = T_ref[Ohm/m] +T_ref : Reference temperature of the material [K] +d : Inner diameter [m] +D : Outer diameter [m] +Amp : Ampacity [A] ++
+other properties such as the geometric mean diameter GMD and the +geometric mean radius GMR are by default computed using functions, +but this can be overriden. +
+", revisions=" ++This package contains records of physical properties of medium +voltage commercial cables. New cables can be added by extending the +base record + +IBPSA.Electrical.Transmission.MediumVoltageCables.Generic. +
+", revisions=" ++Enumeration for materials that can be used +for cables. +
+")); diff --git a/IBPSA/Electrical/Transmission/Types/package.mo b/IBPSA/Electrical/Transmission/Types/package.mo new file mode 100644 index 0000000000..27fa5a8d27 --- /dev/null +++ b/IBPSA/Electrical/Transmission/Types/package.mo @@ -0,0 +1,19 @@ +within IBPSA.Electrical.Transmission; +package Types "Package that contains cables materials" + extends Modelica.Icons.TypesPackage; + + +annotation (preferredView="info", +Documentation(info=" ++This package contains an enumeration for materials. +
+", revisions=" ++This package contains cables that can be used +to represent a line in a electric grid. The package contains +several functions and records to parametrize cables either using +default values or values from commercial cables. +
++The package + +IBPSA.Electrical.Transmission.Grids +contains models of +electrical networks. +
++The package contains several low voltage and medium voltage cable with +pre-defined physical and geometrical properties like characteristic resistances and +diameters. There are different conventions to measure the cables. +
+ ++A measure of cross-sectional area in square mm. E.g. 50 mm2 +wire has a nominal circula area of 50 mm2 and a diameter of +7.98 mm. +
+ ++A measure of wire thickness (which also dictates cross-sectional area, and +for a given material, ampacity). E.g. 24 AWG wire has a nominal diameter of +0.0201 in or 0.511 mm. +
+ ++kcmil is an abbreviation for thousands of circular mils, an old measurement of +wire gauge. 1 kcmil = 0.5067 square millimeters. A mil is 1/1000 inch. +A wire 200 mils in diameter is 40 kcmil. kcmil is generally used for very +large-diameter wire. Most wires use AWG. +
+ +", revisions=" +InitMode
to represent different types
+of initialization assumptions for the load model.
+LoadConnection
to represent different types
+of unbalanced connection.
++The IBPSA.Electrical package extends the +capabilities of the IBPSA library with models for electrical systems, allowing +to study building-to-grid integration such as the effect of large scale PV on the +voltage of the electrical distribution grid. +The package contains models for different types of sources, loads, storage equipment, +and transmission lines for electric power. The package contains models that can be used to +represent DC, AC one-phase, and AC three-phase balanced and unbalanced systems. +The models can be used to scale from the building level up to the distribution level. +The models have been successfully validated against the IEEE four nodes test feeder. +
+ ++The IBPSA.Electrical package uses a +new type of generalized connector that has been introduced by R. Franke and Wiesman (2014) +and is used by the Power Systems Library +and the +Electric Power Library. +
++The Modelica Standard Library (MSL) version 3.2.1 has different connectors depending on the +type of electric system being modeled. For example, DC and AC continuous time systems have +a connector (Modelica.Electrical.Analog.Interfaces.Pin) +that differs from the one used by AC models, which use the +quasi-stationary assumption ( +Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces.Pin). +
+
+The generalized electrical connector overcomes this limitation. It uses a paradigm
+that is similar to the one used by the Modelica.Fluid
connectors.
+The generalized connector is as follows:
+
+connector + Terminal +"Generalized electric terminal" +
++extends +IBPSA.Electrical.Interfaces.BaseTerminal +; +
++replaceable package + PhaseSystem = +IBPSA.Electrical.PhaseSystems.PartialPhaseSystem +"Phase system" +; +
++PhaseSystem.Voltage + v[PhaseSystem.n] +"Voltage vector" +; +
+flow +PhaseSystem.Current + i[PhaseSystem.n] +"Current vector" +; +
++PhaseSystem.ReferenceAngle + theta[PhaseSystem.m] +"Optional vector of phase angles" +; +
++end +Terminal; +
+ +
+The connector has a package called PhaseSystem
that contains constants, functions,
+and equations of the specific electric domain. This allows to represent different electrical domains using the
+same connector, reusing the same standardized interfaces.
+
+As the electrical connectors of the Modelica Standard Library, the Terminal
has a vector of voltages as effort variables and
+a vector of currents as flow variables. The connector has an additional vector that represents the
+reference angle theta[PhaseSystem.m]
. If PhaseSystem.m > 0
the connector is overdetermined
+because the number of effort variables is higher than the number of flow variables.
+The over-determined connectors are defined and used in such a way that a Modelica tool is able
+to remove the superfluous but consistent equations, arriving at a balanced set of equations based on a
+graph analysis of the connection structure. The models in the library uses constructs specified
+by the Modelica language to handle this situation Olsson Et Al. (2008).
+
+The connector has a package called PhaseSystem
that allows to represent different
+electrical domains using the same connector, reusing the same standardized interfaces.
+The available PhaseSystems
are contained in the package
+
+IBPSA.Electrical.PhaseSystems.
+
+Each of the available packages represent a different type of electrical systems. +The electrical systems represented are: +
++ +
++Consider the simple DC circuit shown above, where VS is a +constant voltage source and R is a line resistance. The load has a voltage V across +its electrical pins and a current i. If the power consumed +by the load is PLOAD, the equation that describes the circuit is nonlinear. +
+ ++ +
+ +
+If the number of loads increases, as typically happens in grid simulations, the size of the system of
+nonlinear equations to be solved increases too, causing the numerical solver to slow the simulation.
+A linearized load model can solve such a problem. All the load models in the
+IBPSA.Electrical package have a linearized version.
+The linearized version of the model can be selected by setting the boolean flag linearized = true
.
+Details about the implementation of the linearized models can be found in
+IBPSA.Electrical.DC.Loads.Conductor
+or
+IBPSA.Electrical.AC.OnePhase.Loads.Resistive.
+
+When multiple loads are connected in a grid through cables that cause voltage drops,
+the dimension of the system of nonlinear equations increases linearly with the number of loads.
+This nonlinear system of equations introduces challenges during the initialization, as Newton solvers
+may diverge if initialized far from a solution.
+The initialization problem can be simplified using the homotopy
+operator. The homotopy operator uses two different types of equations to compute the value of a
+variable: the actual one and a simplified one. The actual equation is the one used during the normal
+operation. During initialization, the simplified equation is first solved and then slowly replaced with the
+actual equation to compute the initial values for the nonlinear systems of equations.
+The load model uses the homotopy operator, with the linearized model being used
+as the simplified equation. This numerical expedient has proven useful
+when simulating models with more than ten connected loads.
+All the load models of the IBPSA.Electrical package use the
+the homotopy operator during the initialization. The parameter initMode
is used to select which
+simplified equation should be used by the homotopy operator:
+
IBPSA.Electrical.Types.InitMode.zeroCurrent
IBPSA.Electrical.Types.InitMode.linearized
+Most components have a parameters for the nominal operating conditions.
+These parameters have names that end in _nominal
and
+they should be set to the values that the component typically
+have if they are run at design conditions. Depending on the model, these
+parameters are used differently, and the respective model documentation or code
+should be consulted for details. However, the table below shows the typical use of
+the parameters in various models to help the user understand how they are used.
+
Parameter | +Model | +Functionality | +
---|---|---|
V_nominal + P_nominal |
+ Load models | +
+ V_nominal is the RMS (Root Mean Square) voltage at which the load consumes the
+ nominal real power (measured in [W]) P_nominal .
+ When the load model are linearized, the linearization is done for V = V_nominal .
+ |
+
V_nominal + P_nominal |
+ Transmission line models + | +
+ V_nominal is the RMS (Root Mean Square) voltage at which the line operates
+ while P_nominal is the power flowing through it. These values are used in some
+ cases to automatically select the right cable properties.
+ |
+
V_nominal | +Storage + PVs + Wind turbine + |
+
+ V_nominal is the RMS (Root Mean Square) voltage at which these components
+ typically operate. Since these model contain load models, V_nominal can be used
+ for linearization purposes.
+ |
+
V_nominal | +Sensors | +
+ V_nominal is the RMS (Root Mean Square) voltage of the system
+ that is currently measured, it can be used to measure quantities in per unit [pu].
+ |
+
+Other information about the models and the packages can be found in the +info section of each model or sub-packages. +
+ ++The paper titled +A Modelica package for building-to-electrical grid integration won the best paper +award at the BauSIM 2014 conference. +
+ +
+
+Marco Bonvini, Michael Wetter, and Thierry Stephane Nouidui.
+
+A Modelica package for building-to-electrical grid integration
+BauSIM 2014 Conference, Aachen, Germany, September 2014.
+
+
+Rudiger Franke and Hansjorg Wiesmann.
+
+Flexible modeling of electrical power systems - the Modelica PowerSystems library.
+Proc. of the 10th Modelica Conference, Lund, Sweden, March 2014.
+
+
+Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
+
+Balanced Models in Modelica 3.0 for Increased Model Quality.
+Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.
+
+This package contains models for both DC and AC electrical systems. +
+"), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, + {100,100}}), graphics={Line( + points={{32,80},{-36,12},{24,12},{-58,-74},{-58,-74}}, + color={0,0,0}, + smooth=Smooth.None), Polygon( + points={{-58,-74},{-42,-24},{-8,-56},{-58,-74}}, + lineColor={0,0,0}, + smooth=Smooth.None, + fillPattern=FillPattern.Solid, + fillColor={0,0,0})})); end Electrical; diff --git a/IBPSA/Electrical/package.order b/IBPSA/Electrical/package.order index 31f903d8b0..e287da516a 100644 --- a/IBPSA/Electrical/package.order +++ b/IBPSA/Electrical/package.order @@ -1,5 +1,13 @@ DataBase PVSystem BaseClasses +UsersGuide +AC +DC +Icons +PhaseSystems +Transmission +Types +Interfaces Examples -Validation +Validation \ No newline at end of file