From a524d7a7d50cbbabcf19e3d1347a5aabdee01df5 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Oct 2022 11:40:14 +0200 Subject: [PATCH 1/4] remove not needed 2nd port --- .../Examples/BookTrading/BookBuyerAgent.mo | 51 ++++++++++--------- .../Examples/BookTrading/BookTrading.mo | 40 +++++---------- .../BuildingHeatingSystems/BuildingHeating.mo | 3 +- .../Controls/HVACAgentBasedControl/package.mo | 2 +- 4 files changed, 40 insertions(+), 56 deletions(-) diff --git a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookBuyerAgent.mo b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookBuyerAgent.mo index ffbf901500..cb7b624303 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookBuyerAgent.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookBuyerAgent.mo @@ -52,7 +52,7 @@ model BookBuyerAgent Modelica.StateGraph.TransitionWithSignal confirmation(enableTimer=true, waitTime=0.1) annotation (Placement(transformation(extent={{0,-140},{20,-120}}))); - Modelica.StateGraph.Step setDone(nOut=2, nIn=1) + Modelica.StateGraph.Step setDone(nOut=1, nIn=1) annotation (Placement(transformation(extent={{40,-140},{60,-120}}))); Modelica.StateGraph.Transition transition1(enableTimer=true, waitTime=0.1) annotation (Placement(transformation(extent={{22,-66},{42,-46}}))); @@ -207,7 +207,7 @@ equation smooth=Smooth.None)); connect(transitionWithSignal.outPort, composeRequest.inPort[1]) annotation ( Line( - points={{-132.5,-8},{-104,-8},{-104,126.667},{-85,126.667}}, + points={{-132.5,-8},{-104,-8},{-104,125.667},{-85,125.667}}, color={0,0,0}, smooth=Smooth.None)); connect(transition.inPort, composeRequest.outPort[1]) annotation (Line( @@ -219,7 +219,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(check.outPort[1], offer.inPort) annotation (Line( - points={{-59.5,60.25},{-60,60.25},{-60,60},{-30,60}}, + points={{-59.5,59.875},{-60,59.875},{-60,60},{-30,60}}, color={0,0,0}, smooth=Smooth.None)); connect(offer.outPort, collectProposal.inPort[1]) annotation (Line( @@ -227,7 +227,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(refuse.inPort, check.outPort[2]) annotation (Line( - points={{-30,18},{-44,18},{-44,59.75},{-59.5,59.75}}, + points={{-30,18},{-44,18},{-44,60.125},{-59.5,60.125}}, color={0,0,0}, smooth=Smooth.None)); connect(refuse.outPort, composeRequest.inPort[2]) annotation (Line( @@ -235,20 +235,20 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(collectProposal.outPort[1], notDone.inPort) annotation (Line( - points={{30.5,60.25},{40,60.25},{40,60},{48,60},{48,16},{64,16}}, + points={{30.5,59.875},{40,59.875},{40,60},{48,60},{48,16},{64,16}}, color={0,0,0}, smooth=Smooth.None)); connect(done.inPort, collectProposal.outPort[2]) annotation (Line( - points={{64,60},{80,60},{80,59.75},{30.5,59.75}}, + points={{64,60},{80,60},{80,60.125},{30.5,60.125}}, color={0,0,0}, smooth=Smooth.None)); connect(notDone.outPort, composeRequest.inPort[3]) annotation (Line( - points={{69.5,16},{120,16},{120,-8},{-104,-8},{-104,125.333},{-85,125.333}}, + points={{69.5,16},{120,16},{120,-8},{-104,-8},{-104,126.333},{-85,126.333}}, color={0,0,0}, smooth=Smooth.None)); connect(sendRequest.outPort[1], newMessage.inPort) annotation (Line( - points={{18.5,126.25},{78,126.25},{78,126},{96,126}}, + points={{18.5,125.875},{78,125.875},{78,126},{96,126}}, color={0,0,0}, smooth=Smooth.None)); connect(sendRequest.inPort[1], transition.outPort) annotation (Line( @@ -264,7 +264,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(confirmation.inPort, check1.outPort[1]) annotation (Line( - points={{6,-130},{-48,-130},{-48,-129.75},{-51.5,-129.75}}, + points={{6,-130},{-48,-130},{-48,-130.125},{-51.5,-130.125}}, color={0,0,0}, smooth=Smooth.None)); connect(setDone.inPort[1], confirmation.outPort) annotation (Line( @@ -272,16 +272,16 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition3.inPort, setDone.outPort[1]) annotation (Line( - points={{96,-130},{62,-130},{62,-129.75},{60.5,-129.75}}, + points={{96,-130},{62,-130},{62,-130},{60.5,-130}}, color={0,0,0}, smooth=Smooth.None)); connect(transition3.outPort, waiting.inPort[1]) annotation (Line( - points={{101.5,-130},{134,-130},{134,-192},{-180,-192},{-180,-127.25},{-167, - -127.25}}, + points={{101.5,-130},{134,-130},{134,-192},{-180,-192},{-180,-128.375},{-167, + -128.375}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage1.inPort, sendBuy.outPort[1]) annotation (Line( - points={{96,-70},{86,-70},{86,-55.75},{74.5,-55.75}}, + points={{96,-70},{86,-70},{86,-56.125},{74.5,-56.125}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage1.outPort, check1.inPort[1]) annotation (Line( @@ -326,12 +326,12 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(abort.inPort, check1.outPort[2]) annotation (Line( - points={{-28,-176},{-42,-176},{-42,-130.25},{-51.5,-130.25}}, + points={{-28,-176},{-42,-176},{-42,-129.875},{-51.5,-129.875}}, color={0,0,0}, smooth=Smooth.None)); connect(abort.outPort, waiting.inPort[2]) annotation (Line( - points={{-22.5,-176},{40,-176},{40,-192},{-180,-192},{-180,-127.75},{-167, - -127.75}}, + points={{-22.5,-176},{40,-176},{40,-192},{-180,-192},{-180,-128.125},{-167, + -128.125}}, color={0,0,0}, smooth=Smooth.None)); @@ -345,7 +345,7 @@ equation smooth=Smooth.None)); connect(transitionWithSignal1.inPort, stateOfOffers.outPort[1]) annotation ( Line( - points={{-34,-56},{-40,-56},{-40,-55.75},{-47.5,-55.75}}, + points={{-34,-56},{-40,-56},{-40,-56.125},{-47.5,-56.125}}, color={0,0,0}, smooth=Smooth.None)); connect(stateOfOffers.inPort[1], done.outPort) annotation (Line( @@ -358,29 +358,30 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(noOffers.inPort, stateOfOffers.outPort[2]) annotation (Line( - points={{-156,-162},{-124,-162},{-124,-86},{-42,-86},{-42,-56.25},{-47.5,-56.25}}, + points={{-156,-162},{-124,-162},{-124,-86},{-42,-86},{-42,-55.875},{-47.5, + -55.875}}, color={0,0,0}, smooth=Smooth.None)); connect(noOffers.outPort, waiting.inPort[3]) annotation (Line( - points={{-161.5,-162},{-180,-162},{-180,-128.25},{-167,-128.25}}, + points={{-161.5,-162},{-180,-162},{-180,-127.875},{-167,-127.875}}, color={0,0,0}, smooth=Smooth.None)); connect(abortAction.inPort, sendRequest.outPort[2]) annotation (Line( - points={{96,164},{74,164},{74,125.75},{18.5,125.75}}, + points={{96,164},{74,164},{74,126.125},{18.5,126.125}}, color={0,0,0}, smooth=Smooth.None)); connect(abortAction1.inPort, sendBuy.outPort[2]) annotation (Line( - points={{96,-38},{82,-38},{82,-56.25},{74.5,-56.25}}, + points={{96,-38},{82,-38},{82,-55.875},{74.5,-55.875}}, color={0,0,0}, smooth=Smooth.None)); connect(abortAction.outPort, notServed.inPort[1]) annotation (Line( - points={{101.5,164},{156,164},{156,-134},{182.5,-134},{182.5,-147}}, + points={{101.5,164},{156,164},{156,-134},{181.75,-134},{181.75,-147}}, color={0,0,0}, smooth=Smooth.None)); connect(abortAction1.outPort, notServed.inPort[2]) annotation (Line( - points={{101.5,-38},{144,-38},{144,-140},{156,-140},{156,-140},{181.5,-140}, - {181.5,-147}}, + points={{101.5,-38},{144,-38},{144,-140},{156,-140},{156,-140},{182.25,-140}, + {182.25,-147}}, color={0,0,0}, smooth=Smooth.None)); connect(notServed.outPort[1], transition2.inPort) annotation (Line( @@ -388,7 +389,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition2.outPort, waiting.inPort[4]) annotation (Line( - points={{182,-185.5},{182,-192},{-180,-192},{-180,-128.75},{-167,-128.75}}, + points={{182,-185.5},{182,-192},{-180,-192},{-180,-127.625},{-167,-127.625}}, color={0,0,0}, smooth=Smooth.None)); diff --git a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo index 82ceae9fb5..132237d394 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo @@ -1,36 +1,20 @@ within AixLib.Controls.HVACAgentBasedControl.Examples.BookTrading; model BookTrading extends Modelica.Icons.Example; - - BookBuyerAgent bookBuyerAgent(name=10001, ISBN=0618640150, - sampleRate=1) - annotation (Placement(transformation(extent={{-60,-40},{-40,-20}}))); - BookSellerAgent bookSellerAgent(name=30001, bookList(start=[3551555559.0,30; - 3551555577.0,20; 3551555588.0,20]), - sampleRate=1) - annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); - BookSellerAgent bookSellerAgent1(name=30002, bookList(start=[3551555589.0, - 30; 3551555559.0,40; 3551555556.0,20]), - sampleRate=1) - annotation (Placement(transformation(extent={{-20,40},{0,60}}))); - BookSellerAgent bookSellerAgent2(name=30003, bookList(start=[3551555555.0, - 30; 3551555554.0,20; 3551555553.0,20; 3551555580.0,15]), - sampleRate=1) - annotation (Placement(transformation(extent={{20,40},{40,60}}))); - BookBuyerAgent bookBuyerAgent1( - name=10002, - ISBN=3551555559.0, - sampleRate=1, - sampleTime=40) - annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); - BookBuyerAgent bookBuyerAgent2( - ISBN=3551555559.0, - name=10003, - sampleRate=1, - sampleTime=55) - annotation (Placement(transformation(extent={{20,-40},{40,-20}}))); inner Agents.MessageNotification messageNotification annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + BookSellerAgent bookSellerAgent(bookList(start = [3551555559.0, 30; 3551555577.0, 20; 3551555588.0, 20]), name = 30001, sampleRate = 1) annotation( + Placement(visible = true, transformation(extent = {{-60, 40}, {-40, 60}}, rotation = 0))); + BookSellerAgent bookSellerAgent2(bookList(start = [3551555555.0, 30; 3551555554.0, 20; 3551555553.0, 20; 3551555580.0, 15]), name = 30003, sampleRate = 1) annotation( + Placement(visible = true, transformation(extent = {{20, 40}, {40, 60}}, rotation = 0))); + BookSellerAgent bookSellerAgent1(bookList(start = [3551555589.0, 30; 3551555559.0, 40; 3551555556.0, 20]), name = 30002, sampleRate = 1) annotation( + Placement(visible = true, transformation(extent = {{-20, 40}, {0, 60}}, rotation = 0))); + BookBuyerAgent bookBuyerAgent(ISBN = 618640150, name = 10001, sampleRate = 1) annotation( + Placement(visible = true, transformation(extent = {{-60, -40}, {-40, -20}}, rotation = 0))); + BookBuyerAgent bookBuyerAgent2(ISBN = 3551555559.0, name = 10003, sampleRate = 1, sampleTime = 55) annotation( + Placement(visible = true, transformation(extent = {{20, -40}, {40, -20}}, rotation = 0))); + BookBuyerAgent bookBuyerAgent1(ISBN = 3551555559.0, name = 10002, sampleRate = 1, sampleTime = 40) annotation( + Placement(visible = true, transformation(extent = {{-20, -40}, {0, -20}}, rotation = 0))); annotation (Documentation(info="

Overview

diff --git a/AixLib/Controls/HVACAgentBasedControl/Examples/BuildingHeatingSystems/BuildingHeating.mo b/AixLib/Controls/HVACAgentBasedControl/Examples/BuildingHeatingSystems/BuildingHeating.mo index 4f706e5fe5..dc9516b6ed 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Examples/BuildingHeatingSystems/BuildingHeating.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Examples/BuildingHeatingSystems/BuildingHeating.mo @@ -7,8 +7,7 @@ model BuildingHeating thermalZone(zoneParam= DataBase.ThermalZones.OfficePassiveHouse.OPH_1_OfficeNoHeaterCooler(), redeclare - package Medium = - Modelica.Media.Air.SimpleAir) annotation(Placement(transformation(extent={{-60,58}, + package Medium = Modelica.Media.Air.SimpleAir) annotation(Placement(transformation(extent={{-60,58}, {-34,84}}))); ThermalZones.ReducedOrder.ThermalZone.ThermalZone thermalZone1(redeclare package Medium = diff --git a/AixLib/Controls/HVACAgentBasedControl/package.mo b/AixLib/Controls/HVACAgentBasedControl/package.mo index 1cfa4527d5..93cd7fd7d5 100644 --- a/AixLib/Controls/HVACAgentBasedControl/package.mo +++ b/AixLib/Controls/HVACAgentBasedControl/package.mo @@ -1,6 +1,6 @@ within AixLib.Controls; package HVACAgentBasedControl "This package contains a library for agent-based control of HVAC systems" - +extends Modelica.Icons.VariantsPackage; annotation (); end HVACAgentBasedControl; From 40eb2a4bfe4bcc3662ae5c64aee9ba399b93fd39 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Oct 2022 12:05:26 +0200 Subject: [PATCH 2/4] add each to unit definition [skip ci] --- AixLib/Controls/Interfaces/ModularSensorControlBus.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AixLib/Controls/Interfaces/ModularSensorControlBus.mo b/AixLib/Controls/Interfaces/ModularSensorControlBus.mo index 4f0ab1217e..7fe86318c0 100644 --- a/AixLib/Controls/Interfaces/ModularSensorControlBus.mo +++ b/AixLib/Controls/Interfaces/ModularSensorControlBus.mo @@ -33,7 +33,7 @@ expandable connector ModularSensorControlBus Modelica.Units.SI.MassFlowRate meaMasFloVal[nValSen] "Array of measured mass flow rates at expansion valves' outlets" annotation (Dialog(tab="Measurements", group="Expansion Valves")); - Real meaPhaVal[nValSen](unit="1") + Real meaPhaVal[nValSen](each unit="1") "Array of measured phases at expansion valves' outlets" annotation(Dialog(tab="Measurements",group="Expansion Valves")); @@ -48,7 +48,7 @@ expandable connector ModularSensorControlBus Modelica.Units.SI.MassFlowRate meaMasFloEva[nEvaSen] "Array of measured mass flow rates at evaporators' outlets" annotation (Dialog(tab="Measurements", group="Evaporators")); - Real meaPhaEva[nEvaSen](unit="1") + Real meaPhaEva[nEvaSen](each unit="1") "Array of measured phases at evaporators' outlets" annotation(Dialog(tab="Measurements",group="Evaporators")); @@ -63,7 +63,7 @@ expandable connector ModularSensorControlBus Modelica.Units.SI.MassFlowRate meaMasFloCom[nComSen] "Array of measured mass flow rates at compressors' outlets" annotation (Dialog(tab="Measurements", group="Compressors")); - Real meaPhaCom[nComSen](unit="1") + Real meaPhaCom[nComSen](each unit="1") "Array of measured phases at compressors' outlets" annotation(Dialog(tab="Measurements",group="Compressors")); @@ -78,7 +78,7 @@ expandable connector ModularSensorControlBus Modelica.Units.SI.MassFlowRate meaMasFloCon[nConSen] "Array of measured mass flow rates at expansion valves' outlets" annotation (Dialog(tab="Measurements", group="Condensers")); - Real meaPhaCon[nConSen](unit="1") + Real meaPhaCon[nConSen](each unit="1") "Array of measured phases at expansion valves' outlets" annotation(Dialog(tab="Measurements",group="Condensers")); From dd79f12f4a5ca9bebd5f4368dc831b6e9d7c06d9 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Oct 2022 12:29:04 +0200 Subject: [PATCH 3/4] fix connection errors in controls [skip ci] --- .../Agents/ColdProducerAgent.mo | 41 +++++++---------- .../Agents/HeatProducerAgent.mo | 37 ++++++++------- .../Agents/IntermediateAgent.mo | 45 +++++++++---------- 3 files changed, 56 insertions(+), 67 deletions(-) diff --git a/AixLib/Controls/HVACAgentBasedControl/Agents/ColdProducerAgent.mo b/AixLib/Controls/HVACAgentBasedControl/Agents/ColdProducerAgent.mo index c5ee265842..7ae87741f8 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Agents/ColdProducerAgent.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Agents/ColdProducerAgent.mo @@ -146,7 +146,7 @@ public rotation=0, origin={-82,-154}))); Modelica.StateGraph.Step shutDown( - nOut=2, nIn=1) + nOut=1, nIn=1) annotation (Placement(transformation(extent={{-56,-164},{-36,-144}}))); Modelica.StateGraph.Transition transition7( waitTime=0.1, enableTimer=true) @@ -196,7 +196,7 @@ equation end if; connect(newMessage.inPort, waiting.outPort[1]) annotation (Line( - points={{-96,-108},{-108,-108},{-108,-107.75},{-119.5,-107.75}}, + points={{-96,-108},{-108,-108},{-108,-108.125},{-119.5,-108.125}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage.outPort, message.inPort[1]) annotation (Line( @@ -249,7 +249,7 @@ equation smooth=Smooth.None)); connect(sendProposal.outPort[1], transitionWithSignal1.inPort) annotation ( Line( - points={{96.5,96.3333},{104,96.3333},{104,68},{-114,68},{-114,30},{-80,30}}, + points={{96.5,95.8333},{104,95.8333},{104,68},{-114,68},{-114,30},{-80,30}}, color={0,0,0}, smooth=Smooth.None)); connect(transitionWithSignal2.condition, booleanExpression2.y) annotation ( @@ -264,7 +264,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(message.outPort[1], transitionWithSignal.inPort) annotation (Line( - points={{-51.5,-107.75},{-48,-107.75},{-48,-86},{-132,-86},{-132,96},{-94, + points={{-51.5,-108.125},{-48,-108.125},{-48,-86},{-132,-86},{-132,96},{-94, 96}}, color={0,0,0}, smooth=Smooth.None)); @@ -278,7 +278,7 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(transitionWithSignal3.inPort, message.outPort[2]) annotation (Line( - points={{-80,-46},{-132,-46},{-132,-86},{-48,-86},{-48,-108.25},{-51.5,-108.25}}, + points={{-80,-46},{-132,-46},{-132,-86},{-48,-86},{-48,-107.875},{-51.5,-107.875}}, color={0,0,0}, smooth=Smooth.None)); @@ -446,7 +446,7 @@ algorithm equation connect(transition2.outPort, sendConfirmation.inPort[1]) annotation (Line( - points={{3.5,30},{14,30},{14,30.5},{25,30.5}}, + points={{3.5,30},{14,30},{14,29.75},{25,29.75}}, color={0,0,0}, smooth=Smooth.None)); connect(sendConfirmation.outPort[1], transition5.inPort) annotation (Line( @@ -454,8 +454,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition5.outPort, waiting.inPort[2]) annotation (Line( - points={{83.5,30},{104,30},{104,-172},{-148,-172},{-148,-107.75},{ - -141,-107.75}}, + points={{83.5,30},{104,30},{104,-172},{-148,-172},{-148,-108.125},{-141,-108.125}}, color={0,0,0}, smooth=Smooth.None)); @@ -490,32 +489,26 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition6.outPort, sendConfirmation.inPort[2]) annotation (Line( - points={{3.5,-16},{18,-16},{18,29.5},{25,29.5}}, + points={{3.5,-16},{18,-16},{18,30.25},{25,30.25}}, color={0,0,0}, smooth=Smooth.None)); connect(transition4.outPort, waiting.inPort[1]) annotation (Line( - points={{93.5,-46},{104,-46},{104,-172},{-148,-172},{-148,-107.25},{ - -141,-107.25}}, + points={{93.5,-46},{104,-46},{104,-172},{-148,-172},{-148,-108.375},{-141, + -108.375}}, color={0,0,0}, smooth=Smooth.None)); - - connect(calcCapacity, calcCapacity) annotation (Line( - points={{-90,198},{-90,198},{-90,198}}, - color={0,0,127}, - smooth=Smooth.None)); connect(not2.u, OnOff_external) annotation (Line(points={{-185,-189},{ -188,-189},{-188,-190},{-192,-190},{-192,-110},{-200,-110}}, color={255,0,255})); - connect(Off.inPort, waiting.outPort[2]) annotation (Line(points={{-86, - -154},{-112,-154},{-112,-154},{-112,-108.25},{-119.5,-108.25}}, + connect(Off.inPort, waiting.outPort[2]) annotation (Line(points={{-86,-154},{-112, + -154},{-112,-154},{-112,-107.875},{-119.5,-107.875}}, color={0,0,0})); connect(Off.outPort, shutDown.inPort[1]) annotation (Line(points={{-80.5,-154}, {-57,-154}}, color={0,0,0})); connect(shutDown.outPort[1], transition7.inPort) annotation (Line(points={{-35.5, - -153.75},{-28.75,-153.75},{-28.75,-154},{-20,-154}}, color={0,0,0})); + -154},{-28.75,-154},{-28.75,-154},{-20,-154}}, color={0,0,0})); connect(transition7.outPort, waiting.inPort[3]) annotation (Line(points={{-14.5, - -154},{18,-154},{18,-172},{-148,-172},{-148,-108.25},{-141, - -108.25}}, + -154},{18,-154},{18,-172},{-148,-172},{-148,-107.875},{-141,-107.875}}, color={0,0,0})); connect(not2.y, and1.u1) annotation (Line(points={{-173.5,-189},{-124, -189},{-124,-186},{-120,-186},{-120,-188},{-116,-188}}, @@ -527,12 +520,12 @@ equation -196},{-124,-196},{-116,-196}}, color={255,0,255})); connect(reset.inPort, sendProposal.outPort[3]) annotation (Line( - points={{14,-106},{120,-106},{120,95.6667},{96.5,95.6667}}, + points={{14,-106},{120,-106},{120,96.1667},{96.5,96.1667}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(reset.outPort, waiting.inPort[4]) annotation (Line( - points={{8.5,-106},{-14,-106},{-14,-126},{-142,-126},{-142,-114},{ - -142,-108.75},{-141,-108.75}}, + points={{8.5,-106},{-14,-106},{-14,-126},{-142,-126},{-142,-114},{-142,-107.625}, + {-141,-107.625}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(minCapacityInput, zeroOrderHold.u) diff --git a/AixLib/Controls/HVACAgentBasedControl/Agents/HeatProducerAgent.mo b/AixLib/Controls/HVACAgentBasedControl/Agents/HeatProducerAgent.mo index 78106a9275..2750940c4b 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Agents/HeatProducerAgent.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Agents/HeatProducerAgent.mo @@ -139,7 +139,7 @@ public annotation (Placement(transformation(extent={{-100,-54},{-60,-14}}), iconTransformation(extent={{-100,-54},{-60,-14}}))); Modelica.StateGraph.Step shutDown( - nOut=2, nIn=1) + nOut=1, nIn=1) annotation (Placement(transformation(extent={{-42,-160},{-22,-140}}))); Modelica.StateGraph.TransitionWithSignal Off annotation (Placement( transformation( @@ -183,7 +183,7 @@ equation end if; connect(newMessage.inPort, waiting.outPort[1]) annotation (Line( - points={{-96,-108},{-108,-108},{-108,-107.75},{-119.5,-107.75}}, + points={{-96,-108},{-108,-108},{-108,-108.125},{-119.5,-108.125}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage.outPort, message.inPort[1]) annotation (Line( @@ -232,7 +232,7 @@ equation smooth=Smooth.None)); connect(sendProposal.outPort[1], transitionWithSignal1.inPort) annotation ( Line( - points={{96.5,96.3333},{104,96.3333},{104,68},{-114,68},{-114,30},{-80,30}}, + points={{96.5,95.8333},{104,95.8333},{104,68},{-114,68},{-114,30},{-80,30}}, color={0,0,0}, smooth=Smooth.None)); connect(transitionWithSignal2.condition, booleanExpression2.y) annotation ( @@ -247,7 +247,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(message.outPort[1], transitionWithSignal.inPort) annotation (Line( - points={{-51.5,-107.75},{-48,-107.75},{-48,-86},{-132,-86},{-132,96},{-94, + points={{-51.5,-108.125},{-48,-108.125},{-48,-86},{-132,-86},{-132,96},{-94, 96}}, color={0,0,0}, smooth=Smooth.None)); @@ -261,7 +261,7 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(transitionWithSignal3.inPort, message.outPort[2]) annotation (Line( - points={{-80,-46},{-132,-46},{-132,-86},{-48,-86},{-48,-108.25},{-51.5,-108.25}}, + points={{-80,-46},{-132,-46},{-132,-86},{-48,-86},{-48,-107.875},{-51.5,-107.875}}, color={0,0,0}, smooth=Smooth.None)); @@ -424,7 +424,7 @@ algorithm equation connect(transition2.outPort, sendConfirmation.inPort[1]) annotation (Line( - points={{3.5,30},{14,30},{14,30.5},{25,30.5}}, + points={{3.5,30},{14,30},{14,29.75},{25,29.75}}, color={0,0,0}, smooth=Smooth.None)); connect(sendConfirmation.outPort[1], transition5.inPort) annotation (Line( @@ -432,8 +432,7 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition5.outPort, waiting.inPort[2]) annotation (Line( - points={{83.5,30},{104,30},{104,-170},{-150,-170},{-150,-107.75},{ - -141,-107.75}}, + points={{83.5,30},{104,30},{104,-170},{-150,-170},{-150,-108.125},{-141,-108.125}}, color={0,0,0}, smooth=Smooth.None)); @@ -460,12 +459,12 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition6.outPort, sendConfirmation.inPort[2]) annotation (Line( - points={{3.5,-16},{18,-16},{18,29.5},{25,29.5}}, + points={{3.5,-16},{18,-16},{18,30.25},{25,30.25}}, color={0,0,0}, smooth=Smooth.None)); connect(transition4.outPort, waiting.inPort[1]) annotation (Line( - points={{93.5,-46},{104,-46},{104,-170},{-150,-170},{-150,-107.25},{ - -141,-107.25}}, + points={{93.5,-46},{104,-46},{104,-170},{-150,-170},{-150,-108.375},{-141, + -108.375}}, color={0,0,0}, smooth=Smooth.None)); @@ -477,14 +476,14 @@ equation -34},{-172,-177},{-169,-177}}, color={255,0,255})); connect(Off.inPort, waiting.outPort[2]) annotation (Line(points={{-72,-150},{-82, - -150},{-110,-150},{-110,-108.25},{-119.5,-108.25}}, color={0,0,0})); + -150},{-110,-150},{-110,-107.875},{-119.5,-107.875}}, + color={0,0,0})); connect(shutDown.inPort[1], Off.outPort) annotation (Line(points={{-43, -150},{-66.5,-150}}, color={0,0,0})); - connect(transition7.inPort, shutDown.outPort[1]) annotation (Line(points={{-6, - -150},{-21.5,-150},{-21.5,-149.75}}, color={0,0,0})); + connect(transition7.inPort, shutDown.outPort[1]) annotation (Line(points={{-6,-150}, + {-21.5,-150},{-21.5,-150}}, color={0,0,0})); connect(transition7.outPort, waiting.inPort[3]) annotation (Line(points={{-0.5, - -150},{24,-150},{24,-170},{-150,-170},{-150,-108.25},{-141, - -108.25}}, + -150},{24,-150},{24,-170},{-150,-170},{-150,-107.875},{-141,-107.875}}, color={0,0,0})); connect(and1.u2, booleanExpression4.y) annotation (Line(points={{-136, -196},{-142,-196},{-142,-194},{-149,-194}}, @@ -496,13 +495,13 @@ equation -190},{-104,-190},{-104,-174},{-104,-162},{-68,-162}}, color={255,0,255})); connect(reset.inPort, sendProposal.outPort[3]) annotation (Line( - points={{54,-100},{90,-100},{120,-100},{120,95.6667},{96.5,95.6667}}, + points={{54,-100},{90,-100},{120,-100},{120,96.1667},{96.5,96.1667}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(reset.outPort, waiting.inPort[4]) annotation (Line( - points={{48.5,-100},{38,-100},{38,-100},{20,-100},{20,-130},{-146, - -130},{-146,-108.75},{-141,-108.75}}, + points={{48.5,-100},{38,-100},{38,-100},{20,-100},{20,-130},{-146,-130},{-146, + -107.625},{-141,-107.625}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(or1.y, or2.u2) annotation (Line(points={{125,-184},{125,-192},{132,-192}}, diff --git a/AixLib/Controls/HVACAgentBasedControl/Agents/IntermediateAgent.mo b/AixLib/Controls/HVACAgentBasedControl/Agents/IntermediateAgent.mo index bc8d546534..816df4018b 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Agents/IntermediateAgent.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Agents/IntermediateAgent.mo @@ -176,7 +176,7 @@ model IntermediateAgent Modelica.Blocks.Logical.And and1 annotation (Placement(transformation(extent={{-150,-300},{-130,-280}}))); Modelica.StateGraph.Step shutDown( - nOut=2, nIn=1) + nOut=1, nIn=1) annotation (Placement(transformation(extent={{-80,-274},{-60,-254}}))); Modelica.StateGraph.Transition transition9( waitTime=0.1, enableTimer=true) @@ -191,7 +191,7 @@ model IntermediateAgent equation connect(newMessage.inPort, waiting.outPort[1]) annotation (Line( - points={{-156,-136},{-140,-136},{-140,-243.75},{-167.5,-243.75}}, + points={{-156,-136},{-140,-136},{-140,-244.125},{-167.5,-244.125}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage.outPort, message.inPort[1]) annotation (Line( @@ -225,8 +225,8 @@ equation smooth=Smooth.None)); connect(message.outPort[1], transitionWithSignal.inPort) annotation (Line( - points={{-157.5,-87.75},{-152,-87.75},{-152,-86},{-144,-86},{-144,-86}, - {-132,-86},{-132,96},{-82,96}}, + points={{-157.5,-88.125},{-152,-88.125},{-152,-86},{-144,-86},{-144,-86},{ + -132,-86},{-132,96},{-82,96}}, color={0,0,0}, smooth=Smooth.None)); @@ -239,8 +239,8 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(transitionWithSignal3.inPort, message.outPort[2]) annotation (Line( - points={{-78,-228},{-132,-228},{-132,-86},{-152,-86},{-152,-88.25},{-157.5, - -88.25}}, + points={{-78,-228},{-132,-228},{-132,-86},{-152,-86},{-152,-87.875},{-157.5, + -87.875}}, color={0,0,0}, smooth=Smooth.None)); @@ -358,14 +358,13 @@ algorithm equation connect(transition4.outPort, waiting.inPort[1]) annotation (Line( - points={{95.5,-228},{130,-228},{130,-280},{-192,-280},{-192,-243.2},{ - -189,-243.2}}, + points={{95.5,-228},{130,-228},{130,-280},{-192,-280},{-192,-244.4},{-189, + -244.4}}, color={0,0,0}, smooth=Smooth.None)); connect(sendCall.outPort[1], newMessage1.inPort) annotation (Line( - points={{94.5,96.25},{110,96.25},{110,60},{-122,60},{-122,40},{-112, - 40}}, + points={{94.5,95.875},{110,95.875},{110,60},{-122,60},{-122,40},{-112,40}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage1.outPort, check.inPort[1]) annotation (Line( @@ -389,8 +388,8 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(sendInformation.outPort[1], newMessage2.inPort) annotation (Line( - points={{104.5,40.25},{110,40.25},{110,-16},{-124,-16},{-124,-40},{ - -114,-40}}, + points={{104.5,39.875},{110,39.875},{110,-16},{-124,-16},{-124,-40},{-114, + -40}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage2.outPort, check1.inPort[1]) annotation (Line( @@ -445,8 +444,8 @@ equation color={0,0,0}, smooth=Smooth.None)); connect(transition6.outPort, waiting.inPort[2]) annotation (Line( - points={{93.5,-108},{130,-108},{130,-280},{-192,-280},{-192,-243.6},{ - -189,-243.6}}, + points={{93.5,-108},{130,-108},{130,-280},{-192,-280},{-192,-244.2},{-189, + -244.2}}, color={0,0,0}, smooth=Smooth.None)); connect(newMessage1.condition, integerChange.y) annotation (Line( @@ -498,12 +497,11 @@ equation color={255,0,255}, smooth=Smooth.None)); connect(reset.inPort, sendCall.outPort[2]) annotation (Line( - points={{-32,-160},{36,-160},{124,-160},{124,94},{124,95.75},{94.5, - 95.75}}, + points={{-32,-160},{36,-160},{124,-160},{124,94},{124,96.125},{94.5,96.125}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(sendInformation.outPort[2], reset1.inPort) annotation (Line( - points={{104.5,39.75},{124,39.75},{124,-180},{8,-180}}, + points={{104.5,40.125},{124,40.125},{124,-180},{8,-180}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(reset.outPort, waiting.inPort[3]) annotation (Line( @@ -511,26 +509,25 @@ equation color={255,0,0}, pattern=LinePattern.Dot)); connect(reset1.outPort, waiting.inPort[4]) annotation (Line( - points={{2.5,-180},{-80,-180},{-192,-180},{-192,-244.4},{-189,-244.4}}, + points={{2.5,-180},{-80,-180},{-192,-180},{-192,-243.8},{-189,-243.8}}, color={255,0,0}, pattern=LinePattern.Dot)); connect(and1.u2, booleanExpression2.y) annotation (Line(points={{-152, -298},{-158,-298},{-158,-296},{-179,-296}}, color={255,0,255})); - connect(Off.inPort, waiting.outPort[2]) annotation (Line(points={{-120, - -264},{-164,-264},{-164,-244.25},{-167.5,-244.25}}, + connect(Off.inPort, waiting.outPort[2]) annotation (Line(points={{-120,-264},{ + -164,-264},{-164,-243.875},{-167.5,-243.875}}, color={0,0,0})); connect(Off.outPort, shutDown.inPort[1]) annotation (Line(points={{-114.5, -264},{-128,-264},{-81,-264}}, color={0,0,0})); connect(shutDown.outPort[1], transition9.inPort) annotation (Line(points={{-59.5, - -263.75},{-52,-263.75},{-52,-264},{-46,-264}}, color={0,0,0})); + -264},{-52,-264},{-52,-264},{-46,-264}}, color={0,0,0})); connect(and1.y, Off.condition) annotation (Line(points={{-129,-290},{-118, -290},{-118,-276},{-116,-276}}, color={255,0,255})); connect(transition9.outPort, waiting.inPort[5]) annotation (Line(points={{-40.5, - -264},{-26,-264},{-26,-280},{-192,-280},{-192,-244},{-190,-244},{ - -190,-244.8},{-189,-244.8}}, - color={0,0,0})); + -264},{-26,-264},{-26,-280},{-192,-280},{-192,-244},{-190,-244},{-190, + -243.6},{-189,-243.6}}, color={0,0,0})); connect(OnOff_external, not2.u) annotation (Line(points={{-132,-144},{ -132,-190},{-196,-190},{-196,-287},{-173,-287}}, color={255,0,255})); connect(not2.y, and1.u1) annotation (Line(points={{-161.5,-287},{-160, From 00550bb9429dd2c911040d8f06029c6bec0ac1ba Mon Sep 17 00:00:00 2001 From: David Date: Thu, 13 Oct 2022 15:27:28 +0200 Subject: [PATCH 4/4] fix line length [skip ci] --- .../Examples/BookTrading/BookTrading.mo | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo index 132237d394..82ceae9fb5 100644 --- a/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo +++ b/AixLib/Controls/HVACAgentBasedControl/Examples/BookTrading/BookTrading.mo @@ -1,20 +1,36 @@ within AixLib.Controls.HVACAgentBasedControl.Examples.BookTrading; model BookTrading extends Modelica.Icons.Example; + + BookBuyerAgent bookBuyerAgent(name=10001, ISBN=0618640150, + sampleRate=1) + annotation (Placement(transformation(extent={{-60,-40},{-40,-20}}))); + BookSellerAgent bookSellerAgent(name=30001, bookList(start=[3551555559.0,30; + 3551555577.0,20; 3551555588.0,20]), + sampleRate=1) + annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); + BookSellerAgent bookSellerAgent1(name=30002, bookList(start=[3551555589.0, + 30; 3551555559.0,40; 3551555556.0,20]), + sampleRate=1) + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + BookSellerAgent bookSellerAgent2(name=30003, bookList(start=[3551555555.0, + 30; 3551555554.0,20; 3551555553.0,20; 3551555580.0,15]), + sampleRate=1) + annotation (Placement(transformation(extent={{20,40},{40,60}}))); + BookBuyerAgent bookBuyerAgent1( + name=10002, + ISBN=3551555559.0, + sampleRate=1, + sampleTime=40) + annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); + BookBuyerAgent bookBuyerAgent2( + ISBN=3551555559.0, + name=10003, + sampleRate=1, + sampleTime=55) + annotation (Placement(transformation(extent={{20,-40},{40,-20}}))); inner Agents.MessageNotification messageNotification annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); - BookSellerAgent bookSellerAgent(bookList(start = [3551555559.0, 30; 3551555577.0, 20; 3551555588.0, 20]), name = 30001, sampleRate = 1) annotation( - Placement(visible = true, transformation(extent = {{-60, 40}, {-40, 60}}, rotation = 0))); - BookSellerAgent bookSellerAgent2(bookList(start = [3551555555.0, 30; 3551555554.0, 20; 3551555553.0, 20; 3551555580.0, 15]), name = 30003, sampleRate = 1) annotation( - Placement(visible = true, transformation(extent = {{20, 40}, {40, 60}}, rotation = 0))); - BookSellerAgent bookSellerAgent1(bookList(start = [3551555589.0, 30; 3551555559.0, 40; 3551555556.0, 20]), name = 30002, sampleRate = 1) annotation( - Placement(visible = true, transformation(extent = {{-20, 40}, {0, 60}}, rotation = 0))); - BookBuyerAgent bookBuyerAgent(ISBN = 618640150, name = 10001, sampleRate = 1) annotation( - Placement(visible = true, transformation(extent = {{-60, -40}, {-40, -20}}, rotation = 0))); - BookBuyerAgent bookBuyerAgent2(ISBN = 3551555559.0, name = 10003, sampleRate = 1, sampleTime = 55) annotation( - Placement(visible = true, transformation(extent = {{20, -40}, {40, -20}}, rotation = 0))); - BookBuyerAgent bookBuyerAgent1(ISBN = 3551555559.0, name = 10002, sampleRate = 1, sampleTime = 40) annotation( - Placement(visible = true, transformation(extent = {{-20, -40}, {0, -20}}, rotation = 0))); annotation (Documentation(info="

Overview