From c32fe59fbdcc7ca67296757eb7f5ad36952e3085 Mon Sep 17 00:00:00 2001 From: Zizhe Wang <zizhe.wang@tu-dresden.de> Date: Tue, 30 Apr 2024 15:44:46 +0200 Subject: [PATCH] Upload New File --- CarSharing.mo | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 CarSharing.mo diff --git a/CarSharing.mo b/CarSharing.mo new file mode 100644 index 0000000..f56ade4 --- /dev/null +++ b/CarSharing.mo @@ -0,0 +1,61 @@ +model CarSharing + PNlib.Components.PD PSCii(nIn = 1, nOut = 1) annotation( + Placement(transformation(origin = {-72, 8}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); + PNlib.Components.TES TCRi(nIn = 1, nOut = 1) annotation( + Placement(transformation(origin = {-44, -28}, extent = {{-10, -10}, {10, 10}}))); + PNlib.Components.PD PSRi(nIn = 1, nOut = 1) annotation( + Placement(transformation(origin = {-8, 0}, extent = {{-10, -10}, {10, 10}}))); + PNlib.Components.PD PSCi(nIn = 1, nOut = 1, startTokens = 6) annotation( + Placement(transformation(origin = {-6, 34}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + PNlib.Components.T TUSi(nIn = 2, nOut = 2) annotation( + Placement(transformation(origin = {32, 0}, extent = {{-14, -14}, {14, 14}}))); + PNlib.Components.PD PCU(nIn = 1, nOut = 1, startTokens = 5) annotation( + Placement(transformation(origin = {86, 22}, extent = {{10, -10}, {-10, 10}}, rotation = -90))); + PNlib.Components.PD PSDi(nIn = 1, nOut = 2, startTokens = 1) annotation( + Placement(transformation(origin = {-36, -72}, extent = {{-10, -10}, {10, 10}}))); + PNlib.Components.TD TUNi(nIn = 1) annotation( + Placement(transformation(origin = {54, -72}, extent = {{-10, -10}, {10, 10}}))); + PNlib.Components.TES TUDi(nOut = 1) annotation( + Placement(transformation(origin = {-80, -72}, extent = {{-10, -10}, {10, 10}}))); + inner PNlib.Components.Settings settings(showTokenFlow = true) annotation( + Placement(transformation(origin = {-168, 98}, extent = {{-10, -10}, {10, 10}}))); + PNlib.Components.TES TCCi(nIn = 2, nOut = 1) annotation( + Placement(transformation(origin = {-44, 62}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); +equation + connect(TUDi.outPlaces, PSDi.inTransition) annotation( + Line(points = {{-76, -72}, {-46, -72}}, thickness = 0.5)); + connect(TUSi.outPlaces[1], PCU.inTransition[1]) annotation( + Line(points = {{38, 0}, {86, 0}, {86, 12}}, thickness = 0.5)); + connect(TUSi.outPlaces[2], PSCi.inTransition[1]) annotation( + Line(points = {{38, 0}, {48, 0}, {48, 33}, {4, 33}, {4, 34}}, thickness = 0.5)); + connect(PSRi.outTransition[1], TUSi.inPlaces[1]) annotation( + Line(points = {{2, 0}, {26, 0}}, thickness = 0.5)); + connect(PSDi.outTransition[1], TUSi.inPlaces[2]) annotation( + Line(points = {{-26, -72}, {20, -72}, {20, 0}, {26, 0}}, thickness = 0.5)); + connect(PSDi.outTransition[2], TUNi.inPlaces[1]) annotation( + Line(points = {{-26, -72}, {50, -72}}, thickness = 0.5)); + connect(PSCi.outTransition[1], TCCi.inPlaces[1]) annotation( + Line(points = {{-16, 34}, {-40, 34}, {-40, 62}}, thickness = 0.5)); + connect(PCU.outTransition[1], TCCi.inPlaces[2]) annotation( + Line(points = {{86, 32}, {54.5, 32}, {54.5, 66}, {55, 66}, {55, 64}, {24, 64}, {24, 65}, {-40, 65}, {-40, 62}}, thickness = 0.5)); + connect(TCCi.outPlaces[1], PSCii.inTransition[1]) annotation( + Line(points = {{-48, 62}, {-72, 62}, {-72, 18}}, thickness = 0.5)); + connect(PSCii.outTransition[1], TCRi.inPlaces[1]) annotation( + Line(points = {{-72, -2}, {-48, -2}, {-48, -28}}, thickness = 0.5)); + connect(TCRi.outPlaces[1], PSRi.inTransition[1]) annotation( + Line(points = {{-40, -28}, {-18, -28}, {-18, 0}}, thickness = 0.5)); + annotation( + uses(PNlib(version = "3.0.0")), + Diagram(graphics = {Text(origin = {-166, -72}, extent = {{74, -9}, {0, 9}}, textString = "User demand arrival at station +(stochastic transition)"), Text(origin = {-103, -96}, extent = {{3, 0}, {-3, 0}}, textString = "text"), Text(origin = {-26, -106}, extent = {{68, -24}, {-68, 24}}, textString = "Users (demands) waiting -during a given random +delay- for available and ready cars in the station."), Text(origin = {90, -95}, extent = {{-54, 23}, {54, -23}}, textString = "User demand “not satisfied” at station. The +user leaves the station without having been +served. (Deterministic transition)"), Text(origin = {-109, -30}, extent = {{-45, 28}, {45, -28}}, textString = "Car is ready after its charging operation +(stochastic transition)"), Text(origin = {-133, 11}, extent = {{-43, 21}, {43, -21}}, textString = "Cars parked at the station but still +under charging, not yet available for users."), Text(origin = {-9, 88}, extent = {{-57, 14}, {57, -14}}, textString = "Cars return to station by user. +Then, the car is in a charging situation +(stochastic transition)"), Text(origin = {23, 51}, extent = {{-49, 9}, {49, -9}}, textString = "Cars parked at the station but still +under charging, not yet available for users."), Text(origin = {-6, 15}, extent = {{-24, 5}, {24, -5}}, textString = "Cars are ready"), Text(origin = {72, -21}, extent = {{-42, 17}, {42, -17}}, textString = "User demand \"satisfied\", +then \"user departure\" from station. +(immediate transition)"), Text(origin = {87, 38}, extent = {{-13, 4}, {13, -4}}, textString = "Cars in use")})); +end CarSharing; -- GitLab