Skip to content
Snippets Groups Projects
Commit 1bdb3956 authored by Christian Gutsche's avatar Christian Gutsche
Browse files

Energy Park components basic working implementation

parent 6c562339
No related branches found
No related tags found
No related merge requests found
Showing
with 374 additions and 100 deletions
......@@ -26,6 +26,8 @@ model EnergeticFlowPlace
parameter Real enablingProbIn[nIn] = fill(1/nIn, nIn) "enabling probabilities of input transitions" annotation(
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then false else true, group = "Enabling"));
Real power "Power (sum of arcWeightIn)";
Real actualPower "Power (sum of arcWeightIn weighted with speed)";
Real actualPowers[nIn] "Power (sum of arcWeightIn weighted with speed)";
parameter Real enablingProbOut[nOut] = fill(1/nOut, nOut) "enabling probabilities of output transitions" annotation(
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then false else true, group = "Enabling"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
......@@ -44,7 +46,7 @@ model EnergeticFlowPlace
protected
outer PNlib.Components.Settings settings "global settings for animation and display";
Real minMarks = 0 "minimum capacity";
Real maxMarks = 0 "maximum capacity";
Real maxMarks = 10e-15 "maximum capacity";
Real reStartMarks = 0 "number of marks at restart";
Real disMarkChange "discrete mark change";
Real conMarkChange "continuous mark change";
......@@ -84,7 +86,7 @@ protected
PNlib.Blocks.anyTrue emptying(vec = preFireOut and not disTransitionOut);
//firing sum calculation
PNlib.Blocks.firingSumCon firingSumIn(fire = preFireIn, arcWeight = arcWeightIn, instSpeed = instSpeedIn, disTransition = disTransitionIn);
PNlib.Blocks.firingSumCon firingSumOut(fire = preFireOut, arcWeight = arcWeightOut, instSpeed = instSpeedOut, disTransition = disTransitionOut);
PNlib.Blocks.firingSumCon firingSumOut(fire = preFireOut, arcWeight = arcWeightOut, instSpeed = maxSpeedOut, disTransition = disTransitionOut);
//****BLOCKS END****//
Real decFactorIn[nIn] "decreasing factors for input transitions";
Real decFactorOut[nOut] "decreasing factors for output transitions";
......@@ -140,9 +142,13 @@ public
equation
for i in 1:nOut loop
arcWeightOut[i] = arcWeightOutSplit[i] * power;
arcWeightOut[i] = arcWeightOutSplit[i] * actualPower;
end for;
for i in 1:nIn loop
actualPowers[i] = if fireIn[i] then arcWeightIn[i] * instSpeedIn[i] / maxSpeedIn[i] else 0;
end for;
power = sum(arcWeightIn);
actualPower = sum(actualPowers);
//decreasing factor calculation
(decFactorIn, decFactorOut) = PNlib.Functions.decreasingFactor(nIn = nIn, nOut = nOut, t = t_, minMarks = minMarks, maxMarks = maxMarks, speedIn = firingSumIn.conFiringSum, speedOut = firingSumOut.conFiringSum, maxSpeedIn = maxSpeedIn, maxSpeedOut = maxSpeedOut, prelimSpeedIn = prelimSpeedIn, prelimSpeedOut = prelimSpeedOut, arcWeightIn = arcWeightIn, arcWeightOut = arcWeightOut, firingIn = fireIn and not disTransitionIn, firingOut = fireOut and not disTransitionOut);
//calculation of continuous mark change
......
......@@ -9,6 +9,7 @@ model EnergeticTransitionWithoutActivator
Dialog(enable = true, group = "Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real power;
Real powers[nIn];
Real maximumSpeed = 1 "maximum speed" annotation(
Dialog(enable = true, group = "Maximum Speed"));
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(
......@@ -56,14 +57,14 @@ protected
Boolean enableIn[nIn] "Is the transition enabled by all its discrete input transitions?";
//****BLOCKS BEGIN****// since no events are generated within functions!!!
//activation process
PNlib.Blocks.activationCon activation(testValue = testValue, testValueInt = testValueInt, normalArc = normalArc, nIn = nIn, nOut = nOut, tIn = tIn, tOut = tOut, tIntIn = tIntIn, tIntOut = tIntOut, arcType = arcType, arcWeightIn = arcWeightIn, arcWeightOut = arcWeightOut, arcWeightIntIn = arcWeightIntIn, arcWeightIntOut = arcWeightIntOut, minTokens = minTokens, maxTokens = maxTokens, minTokensInt = minTokensInt, maxTokensInt = maxTokensInt, firingCon = firingCon, fed = fed, emptied = emptied, disPlaceIn = disPlaceIn, disPlaceOut = disPlaceOut);
PNlib.Blocks.activationCon activation(testValue = testValue, testValueInt = testValueInt, normalArc = normalArc, nIn = nIn, nOut = nOut, tIn = tIn, tOut = tOut, tIntIn = tIntIn, tIntOut = tIntOut, arcType = arcType, arcWeightIn = arcWeightIn[1:nIn], arcWeightOut = arcWeightOut, arcWeightIntIn = arcWeightIntIn, arcWeightIntOut = arcWeightIntOut, minTokens = minTokens, maxTokens = maxTokens, minTokensInt = minTokensInt, maxTokensInt = maxTokensInt, firingCon = firingCon, fed = fed, emptied = emptied, disPlaceIn = disPlaceIn, disPlaceOut = disPlaceOut);
Boolean fire_ = PNlib.Functions.OddsAndEnds.allTrue(/* hack for Dymola 2017 */PNlib.Functions.OddsAndEnds.boolOr(enableIn, not disPlaceIn));
//****BLOCKS END****//
equation
//****MAIN BEGIN****//
//preliminary speed calculation
prelimSpeed = PNlib.Functions.preliminarySpeed(nIn = nIn, nOut = nOut, arcWeightIn = arcWeightIn, arcWeightOut = arcWeightOut, speedSumIn = speedSumIn, speedSumOut = speedSumOut, maximumSpeed = maximumSpeed, weaklyInputActiveVec = activation.weaklyInputActiveVec, weaklyOutputActiveVec = activation.weaklyOutputActiveVec);
prelimSpeed = PNlib.Functions.preliminarySpeed(nIn = nIn, nOut = nOut, arcWeightIn = arcWeightIn[1:nIn], arcWeightOut = arcWeightOut, speedSumIn = speedSumIn, speedSumOut = speedSumOut, maximumSpeed = maximumSpeed, weaklyInputActiveVec = activation.weaklyInputActiveVec, weaklyOutputActiveVec = activation.weaklyOutputActiveVec);
//firing process
fire = fire_ and activation.active and not maximumSpeed <= 0;
//instantaneous speed calculation
......@@ -74,6 +75,7 @@ equation
//****ANIMATION END****//
//****ERROR MESSENGES BEGIN****// hier noch Message gleiches Kantengewicht und auch Kante dis Place!!
power = sum(arcWeightIn[1:nIn]);
powers = arcWeightIn[1:nIn];
for i in 1:nIn loop
if disPlaceIn[i] then
arcWeightIntIn[i] = integer(arcWeightIn[i]);
......
......@@ -16,12 +16,12 @@ model BaseTransmissionLine
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.ElectricalOutput electricalOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, nIn = NIn, nOut = 1) annotation(
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticFlowPlace p1(nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {58, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power;
powerInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(electricalOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
......
within PNRG.Distribution;
model CO2Pipe
parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer NOut "Number of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
Real massInput(unit = "kg");
Real totalLoad(unit = "kg");
PNRG.Interfaces.CO2Input co2Input[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.CO2Output co2Output[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {massInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
massInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(co2Output.arcWeight);
for i in 1:NIn loop
connect(co2Input[i], t1.inPlaces[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
for i in 1:NOut loop
connect(co2Output[i], p1.outTransition[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
connect(t1.outPlaces[1], p1.inTransition[1]) annotation(
Line(points = {{-32, 0}, {36, 0}}, thickness = 0.5));
annotation(
Icon(graphics = {Rectangle(origin = {0, 80}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 20}, {100, -20}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name"), Ellipse(origin = {-82, 79}, fillColor = {54, 54, 54}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Rectangle(origin = {-2, 79}, fillColor = {54, 54, 54}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-80, 15}, {80, -15}}), Ellipse(origin = {78, 79}, fillColor = {54, 54, 54}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Ellipse(origin = {78, 79}, fillColor = {15, 15, 15}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-8, 13}, {8, -13}}), Line(origin = {-2, 94}, points = {{-80, 0}, {80, 0}, {80, 0}}), Line(origin = {-2, 64}, points = {{80, 0}, {-80, 0}})}, coordinateSystem(extent = {{-120, 40}, {120, -40}})));
end CO2Pipe;
......@@ -14,9 +14,9 @@ model ConditionalConnection
Placement(visible = true, transformation(origin = {0, -110}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {0, -110}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
PNRG.Logics.SplitLogicalInput splitLogicalInput annotation(
Placement(visible = true, transformation(origin = {0, -80}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
PNlib.Components.TC t1(arcWeightIn = {currentPower}, arcWeightOut = {currentPower}, firingCon = logicalInput.t == 1, nIn = 1, nOut = 1) annotation(
PNlib.Components.TC t1(arcWeightIn = {currentPower}, arcWeightOut = {currentPower}, firingCon = logicalInput.t == 1, maximumSpeed = 1/3600, nIn = 1, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.TC t11(arcWeightIn = {2, 2}, firingCon = false, nIn = 2) annotation(
PNlib.Components.TC t11(arcWeightIn = {2, 2}, firingCon = false, maximumSpeed = 1/3600, nIn = 2) annotation(
Placement(visible = true, transformation(origin = {26, -56}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
currentPower = power*logicalInput.t;
......
within PNRG.Distribution;
model DistributionPowerGrid
parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer NOut "Number of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Real Voltage(unit = "V") = 1 "Voltage of grid" annotation(
Dialog(enable = true, group = "Grid properties"));
Real Voltage(unit = "V") = 1 "Voltage of grid";
Real powerDifference(unit = "kW") "Difference between power suply and consumption";
Real powerInput(unit = "kW");
Real totalLoad(unit = "kW");
Real powerInputs[NIn];
Real powerInputsRaw[NIn];
Real powerRatio[NIn];
PNRG.Interfaces.ElectricalInput electricalInput[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.ElectricalOutput electricalOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, nIn = NIn, nOut = 1) annotation(
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power;
powerInput = sum(powerInputs);//*t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(electricalOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
powerInputs[i] = electricalInput[i].arcWeight*electricalInput[i].instSpeed/electricalInput[i].maxSpeed;
powerInputsRaw[i] = electricalInput[i].arcWeight;
powerRatio[i] = electricalInput[i].instSpeed/electricalInput[i].maxSpeed;
connect(electricalInput[i], t1.inPlaces[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
......
within PNRG.Distribution;
model HeatPipe
parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer NOut "Number of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
Real powerDifference(unit = "kW") "Difference between power suply and consumption";
Real powerInput(unit = "kW");
Real totalLoad(unit = "kW");
PNRG.Interfaces.HeatInput heatInput[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.HeatOutput heatOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(heatOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
connect(heatInput[i], t1.inPlaces[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
for i in 1:NOut loop
connect(heatOutput[i], p1.outTransition[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
connect(t1.outPlaces[1], p1.inTransition[1]) annotation(
Line(points = {{-32, 0}, {36, 0}}, thickness = 0.5));
annotation(
Icon(graphics = {Rectangle(origin = {0, 80}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 20}, {100, -20}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name"), Ellipse(origin = {-82, 79}, fillColor = {255, 80, 50}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Rectangle(origin = {-2, 79}, fillColor = {255, 80, 50}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-80, 15}, {80, -15}}), Ellipse(origin = {78, 79}, fillColor = {255, 80, 50}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Ellipse(origin = {78, 79}, fillColor = {195, 59, 38}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-8, 13}, {8, -13}}), Line(origin = {-2, 94}, points = {{-80, 0}, {80, 0}, {80, 0}}), Line(origin = {-2, 64}, points = {{80, 0}, {-80, 0}})}, coordinateSystem(extent = {{-120, 40}, {120, -40}})));
end HeatPipe;
......@@ -8,8 +8,6 @@ parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Real Voltage(unit = "V") = 1 "Voltage of grid" annotation(
Dialog(enable = true, group = "Grid properties"));
Real powerDifference(unit = "kW") "Difference between power suply and consumption";
Real powerInput(unit = "kW");
Real totalLoad(unit = "kW");
......@@ -17,12 +15,12 @@ parameter Integer NIn "Number of Inputs" annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.HydrogenOutput hydrogenOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, nIn = NIn, nOut = 1) annotation(
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power;
powerInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(hydrogenOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
......
within PNRG.Distribution;
model NaturalGasPipe
parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer NOut "Number of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
Real massInput(unit = "kg");
Real totalLoad(unit = "kg");
PNRG.Interfaces.NaturalGasInput naturalGasInput[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.NaturalGasOutput naturalGasOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {massInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
massInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(naturalGasOutput.arcWeight);
for i in 1:NIn loop
connect(naturalGasInput[i], t1.inPlaces[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
for i in 1:NOut loop
connect(naturalGasOutput[i], p1.outTransition[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
end for;
connect(t1.outPlaces[1], p1.inTransition[1]) annotation(
Line(points = {{-32, 0}, {36, 0}}, thickness = 0.5));
annotation(
Icon(graphics = {Rectangle(origin = {0, 80}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 20}, {100, -20}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name"), Ellipse(origin = {-82, 79}, lineColor = {126, 58, 0}, fillColor = {126, 58, 0}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Rectangle(origin = {-2, 79}, lineColor = {126, 58, 0}, fillColor = {126, 58, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-80, 15}, {80, -15}}), Ellipse(origin = {78, 79}, fillColor = {126, 58, 0}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Ellipse(origin = {78, 79}, fillColor = {81, 36, 0}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-8, 13}, {8, -13}}), Line(origin = {-2, 94}, points = {{-80, 0}, {80, 0}, {80, 0}}), Line(origin = {-2, 64}, points = {{80, 0}, {-80, 0}})}, coordinateSystem(extent = {{-120, 40}, {120, -40}})));
end NaturalGasPipe;
......@@ -7,23 +7,19 @@ parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Real Voltage(unit = "V") = 1 "Voltage of grid" annotation(
Dialog(enable = true, group = "Grid properties"));
Real powerDifference(unit = "kW") "Difference between power suply and consumption";
Real powerInput(unit = "kW");
Real totalLoad(unit = "kW");
Real massInput(unit = "kg");
Real totalLoad(unit = "kg");
PNRG.Interfaces.OxygenInput oxygenInput[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.OxygenOutput oxygenOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, nIn = NIn, nOut = 1) annotation(
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {massInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power;
massInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(oxygenOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
connect(oxygenInput[i], t1.inPlaces[i]) annotation(
Line(points = {{-31.2, 0}, {34.8, 0}}, thickness = 0.5));
......
......@@ -3,6 +3,7 @@ within PNRG.Distribution;
model Transformer
Real inputPower(unit = "kW");
Real outputPower(unit = "kW");
parameter Real efficiency "Energy conversion effiency" annotation(
Dialog(enable = true, group = "General properties"));
Interfaces.ElectricalInput electricalInput annotation(
......@@ -11,7 +12,7 @@ model Transformer
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Backend.EnergeticFlowPlace p1(nIn = 1, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {60, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Backend.EnergeticTransitionWithoutActivator t11(arcWeightOut = {outputPower}, nIn = 1, nOut = 1) annotation(
Backend.EnergeticTransitionWithoutActivator t11(arcWeightOut = {outputPower}, maximumSpeed = 1/3600, nIn = 1, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {2, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
inputPower = t11.power;
......@@ -23,5 +24,6 @@ equation
connect(t11.inPlaces[1], electricalInput) annotation(
Line(points = {{-2, 0}, {-110, 0}}));
annotation(
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Ellipse(origin = {-40, -1}, lineColor = {255, 200, 0}, lineThickness = 5, extent = {{-56, 55}, {56, -55}}), Ellipse(origin = {40, -3}, lineColor = {255, 200, 0}, lineThickness = 5, extent = {{-56, 55}, {56, -55}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name")}));
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Ellipse(origin = {-40, -1}, lineColor = {255, 200, 0}, lineThickness = 5, extent = {{-56, 55}, {56, -55}}), Ellipse(origin = {40, -3}, lineColor = {255, 200, 0}, lineThickness = 5, extent = {{-56, 55}, {56, -55}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name")}),
Diagram(coordinateSystem(extent = {{-120, 100}, {120, -160}})));
end Transformer;
......@@ -8,21 +8,19 @@ parameter Integer NIn "Number of Inputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Integer prioOut[NOut] "Priority of Outputs" annotation(
Dialog(enable = true, group = "General properties"));
parameter Real Voltage(unit = "V") = 1 "Voltage of grid" annotation(
Dialog(enable = true, group = "Grid properties"));
Real powerDifference(unit = "kW") "Difference between power suply and consumption";
Real powerInput(unit = "kW");
Real totalLoad(unit = "kW");
Real powerDifference(unit = "kg") "Difference between power suply and consumption";
Real powerInput(unit = "kg");
Real totalLoad(unit = "kg");
PNRG.Interfaces.WaterInput waterInput[NIn] annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.WaterOutput waterOutput[NOut] annotation(
Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, nIn = NIn, nOut = 1) annotation(
PNRG.Backend.EnergeticTransitionWithoutActivator t1(arcWeightOut = {powerInput}, maximumSpeed = 1/3600, nIn = NIn, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {-36, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(enablingPrioOut = prioOut, nIn = 1, nOut = NOut) annotation(
Placement(visible = true, transformation(origin = {46, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerInput = t1.power;
powerInput = t1.power*t1.actualSpeed./t1.maximumSpeed;
totalLoad = sum(waterOutput.arcWeight);
powerDifference = powerInput - totalLoad;
for i in 1:NIn loop
......@@ -38,5 +36,4 @@ equation
annotation(
Icon(graphics = {Rectangle(origin = {0, 80}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 20}, {100, -20}}), Text(origin = {-45, 119}, extent = {{-53, 23}, {53, -23}}, textString = "%name"), Ellipse(origin = {-82, 79}, fillColor = {61, 133, 198}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Rectangle(origin = {-2, 79}, fillColor = {61, 133, 198}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-80, 15}, {80, -15}}), Ellipse(origin = {78, 79}, fillColor = {61, 133, 198}, fillPattern = FillPattern.Solid, extent = {{-10, 15}, {10, -15}}), Ellipse(origin = {78, 79}, fillColor = {42, 92, 136}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-8, 13}, {8, -13}}), Line(origin = {-2, 94}, points = {{-80, 0}, {80, 0}, {80, 0}}), Line(origin = {-2, 64}, points = {{80, 0}, {-80, 0}})}, coordinateSystem(extent = {{-120, 40}, {120, -40}})));
end WaterPipe;
......@@ -5,3 +5,6 @@ ConditionalConnection
WaterPipe
HydrogenPipe
OxygenPipe
HeatPipe
CO2Pipe
NaturalGasPipe
......@@ -3,7 +3,7 @@ within PNRG.EnergyConsumer;
model ElectricityConsumer
Real powerConsumption(unit = "kW") "Consumption of electrical energy";
Real cumulativeEnergyConsumption(unit = "kWh") "Cumulative consumption of electrical energy";
PNlib.Components.TC t1(arcWeightIn = {powerConsumption}, arcWeightOut = {powerConsumption}, nIn = 1, nOut = 1) annotation(
PNlib.Components.TC t1(arcWeightIn = {powerConsumption}, arcWeightOut = {powerConsumption}, maximumSpeed = 1/3600, nIn = 1, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Interfaces.ElectricalInput electricalInput annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
......@@ -11,7 +11,7 @@ model ElectricityConsumer
Placement(visible = true, transformation(origin = {-110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(nIn = 1) annotation(
Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Backend.EnergeticTransitionWithoutActivator t11(nIn = 1) annotation(
Backend.EnergeticTransitionWithoutActivator t11(maximumSpeed = 1/3600, nIn = 1) annotation(
Placement(visible = true, transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerConsumption = t11.power;
......
......@@ -3,22 +3,22 @@ within PNRG.EnergyConsumer;
model HeatConsumer
Real powerConsumption(unit = "kW") "Consumption of electrical energy";
Real cumulativeEnergyConsumption(unit = "kWh") "Cumulative consumption of electrical energy";
PNlib.Components.TC t1(arcWeightIn = {powerConsumption}, arcWeightOut = {powerConsumption}, nIn = 1, nOut = 1) annotation(
PNlib.Components.TC t1(arcWeightIn = {powerConsumption}, arcWeightOut = {powerConsumption}, maximumSpeed = 1/3600, nIn = 1, nOut = 1) annotation(
Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Interfaces.ElectricalInput electricalInput annotation(
Interfaces.HeatInput heatInput annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Interfaces.FileInput fileInput annotation(
Placement(visible = true, transformation(origin = {-110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-110, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNlib.Components.PC p1(nIn = 1) annotation(
Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Backend.EnergeticTransitionWithoutActivator t11(nIn = 1) annotation(
Backend.EnergeticTransitionWithoutActivator t11(maximumSpeed = 1/3600, nIn = 1) annotation(
Placement(visible = true, transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
powerConsumption = t11.power;
cumulativeEnergyConsumption = p1.t;
connect(t1.outPlaces[1], p1.inTransition[1]) annotation(
Line(points = {{4, 0}, {40, 0}}, thickness = 0.5));
connect(electricalInput, t1.inPlaces[1]) annotation(
connect(heatInput, t1.inPlaces[1]) annotation(
Line(points = {{-110, 0}, {-4, 0}}));
connect(fileInput, t11.inPlaces[1]) annotation(
Line(points = {{-110, 60}, {-4, 60}}));
......
This diff is collapsed.
ElectricityConsumer
HeatConsumer
HydrogenConsumer
This diff is collapsed.
EnergyPark
simpleExample
Microgrids
test
......@@ -11,7 +11,7 @@ model simpleExample
Placement(visible = true, transformation(origin = {-54, -20}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
PNRG.Distribution.Transformer transformer1(efficiency = 0.999) annotation(
Placement(visible = true, transformation(origin = {-54, -44}, extent = {{-6, -6}, {6, 6}}, rotation = 0)));
PNRG.PowerPlants.PVPowerPlant pVPowerPlant(areaPV = 1) annotation(
PNRG.PowerPlants.PVPowerPlant pVPowerPlant(areaPV = 100, efficiency_PV = 0.2) annotation(
Placement(visible = true, transformation(origin = {-80, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.EnergyConsumer.ElectricityConsumer electricityConsumer annotation(
Placement(visible = true, transformation(origin = {150, -14}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
......@@ -23,7 +23,7 @@ model simpleExample
Placement(visible = true, transformation(origin = {10, 98}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Logics.LogicalExpression logicalExpression1(NOut = 2, expression = windPowerPlant.currentPower + pVPowerPlant.currentPower <= electricityConsumer.powerConsumption + electricityConsumer1.powerConsumption+ battery.currentInputPower) annotation(
Placement(visible = true, transformation(origin = {-10, 52}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
PNRG.Logics.IntegerController testController(NChange = 1, NMax = 10, NStart = 10, delay = 0.1) annotation(
PNRG.Logics.IntegerController testController(NChange = 1, NMax = 10, NStart = 10, delay = 300) annotation(
Placement(visible = true, transformation(origin = {-46, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
PNRG.Logics.LogicalExpression logicalExpression11(NOut = 1, expression = windPowerPlant.currentPower + pVPowerPlant.currentPower - windPowerPlant.singlePower > electricityConsumer.powerConsumption + electricityConsumer1.powerConsumption + battery.power) annotation(
Placement(visible = true, transformation(origin = {-80, 78}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment