within PNlib.Examples.ExtTest;

model ArcswithPCtoTC2
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(maxMarks = 1, nIn = 1, nOut = 1)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(maxMarks = 1, nIn = 1, nOut = 1)
  PNlib.Components.PC P4(nIn = 1)
  PNlib.Components.PC P5(maxMarks = 1, nIn = 1, nOut = 1)
  PNlib.Components.PC P6(nIn = 1)
  PNlib.Components.PC P7(maxMarks = 1, nIn = 1, nOut = 1)
  PNlib.Components.PC P8(nIn = 1)
  PNlib.Components.TC T1(nIn = 1, nOut = 1)
  PNlib.Components.TC T2(nIn = 1, nOut = 1)
  PNlib.Components.TC T3(nIn = 1, nOut = 1)
  PNlib.Components.TC T4(nIn = 1, nOut = 1)
  PNlib.Components.TA TA1
  PNlib.Components.TA TA2(realTestArc = false)
  PNlib.Components.IA IA1
  PNlib.Components.IA IA2(realInhibitorArc = false)
  PNlib.Components.TC T5(nOut = 4)
equation
  connect(T5.outPlaces[4], P7.inTransition[1])
  connect(T5.outPlaces[3], P5.inTransition[1])
  connect(T5.outPlaces[2], P3.inTransition[1])
  connect(T5.outPlaces[1], P1.inTransition[1])
  connect(T4.outPlaces[1], P8.inTransition[1])
  connect(T3.outPlaces[1], P6.inTransition[1])
  connect(T2.outPlaces[1], P4.inTransition[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(IA2.outTransition, T4.inPlaces[1])
  connect(P7.outTransition[1], IA2.inPlace)
  connect(IA1.outTransition, T3.inPlaces[1])
  connect(P5.outTransition[1], IA1.inPlace)
  connect(TA2.outTransition, T2.inPlaces[1])
  connect(P3.outTransition[1], TA2.inPlace)
  connect(TA1.outTransition, T1.inPlaces[1])
  connect(P1.outTransition[1], TA1.inPlace)
end ArcswithPCtoTC2;


within PNlib.Examples.ExtTest;

model ArcswithPCtoTC3
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(minMarks = 1, nOut = 2, startMarks = 2)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(minMarks = 1, nOut = 2, startMarks = 2)
  PNlib.Components.PC P4(nIn = 1)
  PNlib.Components.PC P5(minMarks = 1, nOut = 2, startMarks = 2)
  PNlib.Components.PC P6(nIn = 1)
  PNlib.Components.PC P7(minMarks = 1, nOut = 2, startMarks = 2)
  PNlib.Components.PC P8(nIn = 1)
  PNlib.Components.TC T1(nIn = 1, nOut = 1)
  PNlib.Components.TC T2(nIn = 1, nOut = 1)
  PNlib.Components.TC T3(nIn = 1, nOut = 1)
  PNlib.Components.TC T4(nIn = 1, nOut = 1)
  PNlib.Components.TA TA1
  PNlib.Components.TA TA2(realTestArc = false)
  PNlib.Components.IA IA1
  PNlib.Components.IA IA2(realInhibitorArc = false)
  PNlib.Components.TC T5(nIn = 4, nOut = 0)
equation
  connect(T5.inPlaces[4], P7.outTransition[2])
  connect(T5.inPlaces[3], P5.outTransition[2])
  connect(T5.inPlaces[2], P3.outTransition[2])
  connect(T5.inPlaces[1], P1.outTransition[2])
  connect(T4.outPlaces[1], P8.inTransition[1])
  connect(T3.outPlaces[1], P6.inTransition[1])
  connect(T2.outPlaces[1], P4.inTransition[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(IA2.outTransition, T4.inPlaces[1])
  connect(P7.outTransition[1], IA2.inPlace)
  connect(IA1.outTransition, T3.inPlaces[1])
  connect(P5.outTransition[1], IA1.inPlace)
  connect(TA2.outTransition, T2.inPlaces[1])
  connect(P3.outTransition[1], TA2.inPlace)
  connect(TA1.outTransition, T1.inPlaces[1])
  connect(P1.outTransition[1], TA1.inPlace)
end ArcswithPCtoTC3;


within PNlib.Examples.ExtTest;

model DoubleArcwithPCtoTC
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA IA1(testValue = 3, normalArc = false)
  PNlib.Components.PC P1(nOut = 2, startMarks = 5)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(nIn = 1)
  PNlib.Components.TA TA1(testValue = 2, normalArc = false)
  PNlib.Components.TC T1(nOut = 1, nIn = 1)
  PNlib.Components.TC T2(nIn = 1, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
  connect(IA1.outTransition, T1.inPlaces[1])
  connect(IA1.inPlace, P1.outTransition[2])
end DoubleArcwithPCtoTC;


within PNlib.Examples.ExtTest;

model DoubleArcwithPTtoTD
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA IA1(testValue = 3, normalArc = false)
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TA TA1(normalArc = false, testValue = 2)
  PNlib.Components.TD T1(nOut = 1, nIn = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
  connect(IA1.inPlace, P1.outTransition[2])
  connect(IA1.outTransition, T1.inPlaces[1])
end DoubleArcwithPTtoTD;


within PNlib.Examples.ExtTest;

model DoubleArcwithPTtoTD2
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA IA1(normalArc = false, realInhibitorArc = false, testValue = 3)
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TA TA1(normalArc = false, realTestArc = false, testValue = 2)
  PNlib.Components.TD T1(nOut = 1, nIn = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
  connect(IA1.inPlace, P1.outTransition[2])
  connect(IA1.outTransition, T1.inPlaces[1])
end DoubleArcwithPTtoTD2;


within PNlib.Examples.ExtTest;

model IATest
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA IA1(normalArc = false, testValue = 1)
  PNlib.Components.IA IA2(testValue = 2)
  PNlib.Components.PC P1(nOut = 2, nIn = 1, startMarks = 2)
  PNlib.Components.PC P2(nIn = 1, nOut = 1, startMarks = 1)
  PNlib.Components.PC P3(nIn = 1)
  PNlib.Components.TC T1(nOut = 1, nIn = 1)
  PNlib.Components.TC T2(nOut = 1, maximumSpeed = 1.5)
  PNlib.Components.TC T3(nIn = 2, arcWeightIn = {1, 2}, maximumSpeed = 2, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], IA1.inPlace)
  connect(IA1.outTransition, T1.inPlaces[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
  connect(P2.outTransition[1], IA2.inPlace)
  connect(IA2.outTransition, T3.inPlaces[1])
  connect(P1.outTransition[2], T3.inPlaces[2])
  connect(T3.outPlaces[1], P3.inTransition[1])
end IATest;


within PNlib.Examples.ExtTest;

model IAwithPCtoTC
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA TA1(testValue = 3)
  PNlib.Components.PC P1(nOut = 2, startMarks = 5)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(nIn = 1)
  PNlib.Components.TC T1(nIn = 1, nOut = 1)
  PNlib.Components.TC T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end IAwithPCtoTC;


within PNlib.Examples.ExtTest;

model IAwithPDtoTD
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA TA1(testValue = 3)
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end IAwithPDtoTD;


within PNlib.Examples.ExtTest;

model IAwithPDtoTD2
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.IA TA1(realInhibitorArc = false, testValue = 3)
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end IAwithPDtoTD2;


within PNlib.Examples.ExtTest;

model NoTokens
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 1, startMarks = 5)
  PNlib.Components.PC P3(nOut = 1, startMarks = 5)
  PNlib.Components.PC P2(nOut = 2, startMarks = 5)
  PNlib.Components.TC T1(nIn = 2, nOut = 1)
  PNlib.Components.TC T2(nIn = 2, nOut = 1)
  PNlib.Components.PC P4(nIn = 2)
  PNlib.Components.IA IA1
equation
  connect(T2.outPlaces[1], P4.inTransition[2])
  connect(T1.outPlaces[1], P4.inTransition[1])
  connect(P3.outTransition[1], T2.inPlaces[2])
  connect(P2.outTransition[2], IA1.inPlace)
  connect(P2.outTransition[1], T1.inPlaces[2])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(IA1.outTransition, T2.inPlaces[1])
end NoTokens;


within PNlib.Examples.ExtTest;

model TATest
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 2, nIn = 1)
  PNlib.Components.PC P2(nIn = 1, nOut = 1)
  PNlib.Components.TA TA1(normalArc = false, testValue = 1)
  PNlib.Components.TA TA2(testValue = 2)
  PNlib.Components.TC T1(nOut = 1, nIn = 1)
  PNlib.Components.TC T2(nOut = 1, maximumSpeed = 1.5)
  PNlib.Components.TC T3(nIn = 2, arcWeightIn = {1, 2})
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], TA1.inPlace)
  connect(TA1.outTransition, T1.inPlaces[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
  connect(P2.outTransition[1], TA2.inPlace)
  connect(TA2.outTransition, T3.inPlaces[1])
  connect(P1.outTransition[2], T3.inPlaces[2])
end TATest;


within PNlib.Examples.ExtTest;

model TAwithPCtoTC
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 2, startMarks = 5)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(nIn = 1)
  PNlib.Components.TA TA1(testValue = 3)
  PNlib.Components.TC T1(nIn = 1, nOut = 1)
  PNlib.Components.TC T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end TAwithPCtoTC;


within PNlib.Examples.ExtTest;

model TAwithPDtoTD
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TA TA1(testValue = 3)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end TAwithPDtoTD;


within PNlib.Examples.ExtTest;

model TAwithPDtoTD2
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 2, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TA TA1(realTestArc = false, testValue = 3)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[2], TA1.inPlace)
  connect(TA1.outTransition, T2.inPlaces[1])
  connect(T2.outPlaces[1], P3.inTransition[1])
end TAwithPDtoTD2;


within PNlib.Examples.ExtTest;

model TAwithWeaklyActivation
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nIn = 1, nOut = 2, startMarks = 4)
  PNlib.Components.PC P2(nIn = 1, maxMarks = 3)
  PNlib.Components.TA TA1(normalArc = false, testValue = 5)
  PNlib.Components.TC T1(nOut = 1, maximumSpeed = if time > 2 then 2 else 1)
  PNlib.Components.TC T2(nOut = 1, nIn = 1)
  PNlib.Components.TC T3(nIn = 1, maximumSpeed = if time > 3 then 2 else 0)
equation
  connect(P1.outTransition[1], TA1.inPlace)
  connect(T1.outPlaces[1], P1.inTransition[1])
  connect(T2.outPlaces[1], P2.inTransition[1])
  connect(T3.inPlaces[1], P1.outTransition[2])
  connect(TA1.outTransition, T2.inPlaces[1])
end TAwithWeaklyActivation;


within PNlib.Examples.ExtTest;

model TDSdiscrete
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 1, startTokens = 18)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(distributionType = PNlib.Types.DistributionType.Discrete, localSeed = 1, nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
end TDSdiscrete;


within PNlib.Examples.ExtTest;

model TDSTest
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 1, startTokens = 8)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(localSeed = 1, nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
end TDSTest;


within PNlib.Examples.ExtTest;

model TDSTestinterrupt
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nIn = 1, nOut = 2, startTokens = 1)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(a = 0.5, b = 1.5, c = 1, distributionType = PNlib.Types.DistributionType.Triangular, localSeed = 1, nIn = 1, nOut = 1)
  PNlib.Components.TE T2(event = {0.4}, nIn = 1)
  PNlib.Components.TE T3(event = {2, 4}, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(P1.outTransition[2], T2.inPlaces[1])
  connect(T3.outPlaces[1], P1.inTransition[1])
end TDSTestinterrupt;


within PNlib.Examples.ExtTest;

model TDStriangular
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 1, startTokens = 8)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(distributionType = PNlib.Types.DistributionType.Triangular, localSeed = 1, nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
end TDStriangular;


within PNlib.Examples.ExtTest;

model TDStruncatednormal
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 1, startTokens = 8)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(distributionType = PNlib.Types.DistributionType.TruncatedNormal, localSeed = 1, nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
end TDStruncatednormal;


within PNlib.Examples.ExtTest;

model TDSuniform
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nOut = 1, startTokens = 8)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TDS T1(a = 2, b = 4, distributionType = PNlib.Types.DistributionType.Uniform, localSeed = 1, nIn = 1, nOut = 1)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
end TDSuniform;


within PNlib.Examples.ExtTest;

model TESTest
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nIn = 1, nOut = 1, startTokens = 1)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TE T2(event = {3, 4, 5, 9}, nOut = 1)
  PNlib.Components.TES T1(distributionType = PNlib.Types.DistributionType.Triangular, nIn = 1, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T1.inPlaces[1], P1.outTransition[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
end TESTest;


within PNlib.Examples.ExtTest;

model TFDStest
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PD P1(nIn = 0, nOut = 1, startTokens = 5)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.TFDS T1(b = 2, c = 1, distributionType = PNlib.Types.DistributionType.Triangular, localSeed = 5, nIn = 1, nOut = 1)
equation
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
end TFDStest;


within PNlib.Examples.HybTest;

model ConflictPrio
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, startMarks = 2)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TD T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end ConflictPrio;


within PNlib.Examples.HybTest;

model ConflictProb
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, enablingType = PNlib.Types.EnablingType.Probability, startMarks = 2, localSeedIn = 1, localSeedOut = 2)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(nIn = 1, localSeedIn = 3, localSeedOut = 4)
  PNlib.Components.PD P3(nIn = 1, localSeedIn = 5, localSeedOut = 6)
  PNlib.Components.TD T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end ConflictProb;


within PNlib.Examples.HybTest;

model ConflictType3
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, startMarks = 2)
  PNlib.Components.TC T1(nIn = 1, nOut = 1, maximumSpeed = 2)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TC T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end ConflictType3;


within PNlib.Examples.HybTest;

model ConflictType4
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 1, startMarks = 10)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PC P3(nOut = 1, startMarks = 10)
  PNlib.Components.PC P4(nIn = 1)
  PNlib.Components.TC T1(nIn = 2, nOut = 2)
  PNlib.Components.TC T2(nIn = 2, nOut = 2)
  PNlib.Components.PD P5(nOut = 2, nIn = 2, startTokens = 1)
equation
  connect(P1.outTransition[1], T2.inPlaces[1])
  connect(T2.outPlaces[1], P2.inTransition[1])
  connect(P5.outTransition[1], T2.inPlaces[2])
  connect(T2.outPlaces[2], P5.inTransition[1])
  connect(P3.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P4.inTransition[1])
  connect(P5.outTransition[2], T1.inPlaces[2])
  connect(P5.inTransition[2], T1.outPlaces[2])
end ConflictType4;


within PNlib.Examples.HybTest;

model EightConflictProb
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(enablingType = PNlib.Types.EnablingType.Probability, nOut = 8, startMarks = 1, localSeedIn = 1, localSeedOut = 2)
  PNlib.Components.TD T1(nIn = 1)
  PNlib.Components.TD T2(nIn = 1)
  PNlib.Components.TD T3(nIn = 1)
  PNlib.Components.TD T4(nIn = 1)
  PNlib.Components.TD T5(nIn = 1)
  PNlib.Components.TD T6(nIn = 1)
  PNlib.Components.TD T7(nIn = 1)
  PNlib.Components.TD T8(nIn = 1)
  inner PNlib.Components.Settings settings
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T3.inPlaces[1], P1.outTransition[3])
  connect(T4.inPlaces[1], P1.outTransition[4])
  connect(T5.inPlaces[1], P1.outTransition[5])
  connect(T6.inPlaces[1], P1.outTransition[6])
  connect(T7.inPlaces[1], P1.outTransition[7])
  connect(T8.inPlaces[1], P1.outTransition[8])
end EightConflictProb;


within PNlib.Examples.HybTest;

model HybLoopAndArcweight
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nOut = 1, nIn = 1, startMarks = 2)
  PNlib.Components.TD T1(nIn = 1, nOut = 1, arcWeightIn = {1.5}, arcWeightOut = {2.5})
  inner PNlib.Components.Settings settings
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P1.inTransition[1])
end HybLoopAndArcweight;


within PNlib.Examples.HybTest;

model InputConflictPrio
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 2, nOut = 1, maxMarks = 2)
  PNlib.Components.TD T1(nIn = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.TD T3(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(startTokens = 5, nOut = 1)
  PNlib.Components.PD P3(startTokens = 5, nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(P2.outTransition[1], T2.inPlaces[1])
  connect(P3.outTransition[1], T3.inPlaces[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
  connect(T3.outPlaces[1], P1.inTransition[2])
  connect(T1.inPlaces[1], P1.outTransition[1])
end InputConflictPrio;


within PNlib.Examples.HybTest;

model InputConflictProb
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 2, nOut = 1, enablingType = PNlib.Types.EnablingType.Probability, maxMarks = 2, localSeedIn = 1, localSeedOut = 2)
  PNlib.Components.TD T1(nIn = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.TD T3(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(startTokens = 5, nOut = 1, localSeedIn = 3, localSeedOut = 4)
  PNlib.Components.PD P3(startTokens = 5, nOut = 1, localSeedIn = 5, localSeedOut = 6)
  inner PNlib.Components.Settings settings
equation
  connect(P2.outTransition[1], T2.inPlaces[1])
  connect(P3.outTransition[1], T3.inPlaces[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
  connect(T3.outPlaces[1], P1.inTransition[2])
  connect(T1.inPlaces[1], P1.outTransition[1])
end InputConflictProb;


within PNlib.Examples.HybTest;

model InputConflictType3
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 2, nOut = 1, maxMarks = 2)
  PNlib.Components.TC T1(nIn = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.TC T3(nIn = 1, nOut = 1, maximumSpeed = 2)
  PNlib.Components.PD P2(startTokens = 5, nOut = 1)
  PNlib.Components.PC P3(nOut = 1, startMarks = 5)
  inner PNlib.Components.Settings settings
equation
  connect(P2.outTransition[1], T2.inPlaces[1])
  connect(P3.outTransition[1], T3.inPlaces[1])
  connect(T2.outPlaces[1], P1.inTransition[1])
  connect(T3.outPlaces[1], P1.inTransition[2])
  connect(T1.inPlaces[1], P1.outTransition[1])
end InputConflictType3;


within PNlib.Examples.HybTest;

model OutputConflictPrio
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, minMarks = 2, startMarks = 4)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TD T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end OutputConflictPrio;


within PNlib.Examples.HybTest;

model OutputConflictProb
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, enablingType = PNlib.Types.EnablingType.Probability, minMarks = 2, startMarks = 4, localSeedIn = 1, localSeedOut = 2)
  PNlib.Components.TD T1(nIn = 1, nOut = 1)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PD P2(nIn = 1, localSeedIn = 3, localSeedOut = 4)
  PNlib.Components.PD P3(nIn = 1, localSeedIn = 5, localSeedOut = 6)
  PNlib.Components.TD T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end OutputConflictProb;


within PNlib.Examples.HybTest;

model OutputConflictType3
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, nOut = 2, startMarks = 2)
  PNlib.Components.TC T1(nIn = 1, nOut = 1, maximumSpeed = 2)
  PNlib.Components.TD T2(nIn = 1, nOut = 1)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.PD P3(nIn = 1)
  PNlib.Components.TC T3(nOut = 1)
  inner PNlib.Components.Settings settings
equation
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T2.outPlaces[1], P3.inTransition[1])
end OutputConflictType3;


within PNlib.Examples.HybTest;

model PCtoTD
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 1, startMarks = 8)
  PNlib.Components.TD T1(nIn = 1, delay = 1, arcWeightIn = {1})
equation
  connect(T1.inPlaces[1], P1.outTransition[1])
end PCtoTD;


within PNlib.Examples.HybTest;

model PCtoTDfunction
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 1, startMarks = 5)
  PNlib.Components.TD T1(nIn = 1, arcWeightIn = {P1.t})
equation
  connect(T1.inPlaces[1], P1.outTransition[1])
end PCtoTDfunction;


within PNlib.Examples.HybTest;

model SixConflictProb
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(enablingType = PNlib.Types.EnablingType.Probability, nOut = 6, startMarks = 1, localSeedIn = 1, localSeedOut = 2)
  PNlib.Components.TD T1(nIn = 1)
  PNlib.Components.TD T2(nIn = 1)
  PNlib.Components.TD T3(nIn = 1)
  PNlib.Components.TD T4(nIn = 1)
  PNlib.Components.TD T5(nIn = 1)
  PNlib.Components.TD T6(nIn = 1)
  inner PNlib.Components.Settings settings
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T2.inPlaces[1], P1.outTransition[2])
  connect(T3.inPlaces[1], P1.outTransition[3])
  connect(T4.inPlaces[1], P1.outTransition[4])
  connect(T5.inPlaces[1], P1.outTransition[5])
  connect(T6.inPlaces[1], P1.outTransition[6])
end SixConflictProb;


within PNlib.Examples.HybTest;

model TCwithPD
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Components.PC P1(nOut = 1, startMarks = 10)
  PNlib.Components.PC P2(nIn = 1)
  PNlib.Components.TC T1(nIn = 2, nOut = 2, arcWeightIn = {2, 1}, firingCon = true)
  PNlib.Components.PD P3(nOut = 1, nIn = 1, startTokens = 10)
equation
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(T1.outPlaces[1], P2.inTransition[1])
  connect(P3.outTransition[1], T1.inPlaces[2])
  connect(T1.outPlaces[2], P3.inTransition[1])
end TCwithPD;


within PNlib.Examples.HybTest;

model TDtoPC
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nOut = 0, nIn = 1)
  PNlib.Components.TD T1(nOut = 1, arcWeightOut = {1})
  inner PNlib.Components.Settings settings
equation
  connect(P1.inTransition[1], T1.outPlaces[1])
end TDtoPC;


within PNlib.Examples.HybTest;

model TDtoPCfunction
  extends Modelica.Icons.Example;
  PNlib.Components.PC P1(nIn = 1, startMarks = 5)
  PNlib.Components.TD T1(nOut = 1, arcWeightOut = {P1.t})
  inner PNlib.Components.Settings settings
equation
  connect(P1.inTransition[1], T1.outPlaces[1])
end TDtoPCfunction;


Model of a flush toilet.

within PNlib.Examples.Models;

model FlushToilet "Model of a flush toilet"
  import PNlib.Components.*;
  extends Modelica.Icons.Example;
  PD Lever(nIn = 1, maxTokens = 1, nOut = 1) "Lever of the toilet"
  TD pushing(nOut = 1, arcWeightIn = {1}, nIn = 1, delay = 3) "visitor pushes the lever"
  TD lifting(nOut = 1, nIn = 1, delay = 0.02) "Lift the flush valve flapper"
  PD FlushValveFlapper(nIn = 1, nOut = 3, maxTokens = 1)
  TC flowing(nOut = 1, nIn = 3, arcWeightIn = {0, 1, 2.5}, maximumSpeed = 5) "Water flows in the bowl"
  PC WaterInBowl(nIn = 1, nOut = 1) "Water in the toilet bowl"
  TA TA1(testValue = 0)
  PC WaterInTank(nOut = 1, nIn = 1, maxMarks = 12, startMarks = 12) "Water in the toilet tank"
  PC LevelOfFloat(nOut = 3, nIn = 1, maxMarks = 30, startMarks = 30) "Level of the float"
  TD opening(nOut = 1, nIn = 1, arcWeightIn = {6}, delay = 0.1) "Open the tank fill valve"
  PD TankFillValve(nIn = 1, nOut = 2, maxTokens = 1)
  TC filling(nIn = 1, nOut = 2, arcWeightOut = {2.5, 1}, arcWeightIn = {0}, maximumSpeed = 6) "Water flows to the toilet tank"
  TA TA3(testValue = 0)
  IA IA1(testValue = 6)
  TA TA2(testValue = 29.9)
  TD closing(nIn = 2, arcWeightIn = {1, 29.999}, delay = 0.1) "Close the tank fill valve"
  TD sinking(nIn = 1, delay = 2) "Sink the flush valve flapper"
  TC Sewer(nIn = 1, maximumSpeed = 4) "Sewer"
  inner Settings settings(scale = 5, timeFire = 0.1)
  PD Visitor(nOut = 1, nIn = 1, startTokens = 1, maxTokens = 1) "Visitor of the toilet"
  TDS entering(nOut = 1, nIn = 1, h = 1/10) "Visitor enters the toilet"
  IA IA2
equation
  connect(pushing.outPlaces[1], Lever.inTransition[1])
  connect(lifting.outPlaces[1], FlushValveFlapper.inTransition[1])
  connect(flowing.outPlaces[1], WaterInBowl.inTransition[1])
  connect(FlushValveFlapper.outTransition[1], TA1.inPlace)
  connect(TA1.outTransition, flowing.inPlaces[1])
  connect(WaterInTank.outTransition[1], flowing.inPlaces[2])
  connect(LevelOfFloat.outTransition[1], flowing.inPlaces[3])
  connect(opening.outPlaces[1], TankFillValve.inTransition[1])
  connect(TankFillValve.outTransition[1], TA3.inPlace)
  connect(TA3.outTransition, filling.inPlaces[1])
  connect(filling.outPlaces[1], LevelOfFloat.inTransition[1])
  connect(IA1.outTransition, opening.inPlaces[1])
  connect(LevelOfFloat.outTransition[2], IA1.inPlace)
  connect(filling.outPlaces[2], WaterInTank.inTransition[1])
  connect(LevelOfFloat.outTransition[3], TA2.inPlace)
  connect(TankFillValve.outTransition[2], closing.inPlaces[1])
  connect(TA2.outTransition, closing.inPlaces[2])
  connect(WaterInBowl.outTransition[1], Sewer.inPlaces[1])
  connect(Lever.outTransition[1], lifting.inPlaces[1])
  connect(FlushValveFlapper.outTransition[2], sinking.inPlaces[1])
  connect(Visitor.outTransition[1], pushing.inPlaces[1])
  connect(entering.outPlaces[1], Visitor.inTransition[1])
  connect(FlushValveFlapper.outTransition[3], IA2.inPlace)
  connect(IA2.outTransition, entering.inPlaces[1])
end FlushToilet;


within PNlib.Examples;

package Models "contains several examples and offers the possibility to structure further Petri net models"
  extends Modelica.Icons.ExamplesPackage;
end Models;


within PNlib.Examples.Models.BicoloredPlaces;

model Aquarium
  extends Modelica.Icons.Example;
  inner PNlib.Components.Settings settings
  PNlib.Examples.Models.BicoloredPlaces.CPC P1(nIn = 1, nOut = 1, startMarks = {50, 0})
  PNlib.Examples.Models.BicoloredPlaces.CPC P2(nIn = 1, startMarks = {0, 0})
  PNlib.Examples.Models.BicoloredPlaces.CTC t1(nOut = 1, arcWeightOut = {{0, 1}})
  PNlib.Examples.Models.BicoloredPlaces.CTC t2(nIn = 1, nOut = 1, arcWeightIn = {{P1.color[1]/(P1.color[1] + P1.color[2]), P1.color[2]/(P1.color[1] + P1.color[2])}}, arcWeightOut = {{P1.color[1]/(P1.color[1] + P1.color[2]), P1.color[2]/(P1.color[1] + P1.color[2])}})
  Real ratio = P1.color[2]/(P1.color[1] + P1.color[2]);
equation
  connect(t1.outPlaces[1], P1.inTransition[1])
  connect(P1.outTransition[1], t2.inPlaces[1])
  connect(t2.outPlaces[1], P2.inTransition[1])
end Aquarium;


marking.

within PNlib.Examples.Models.BicoloredPlaces;

model CPC
  Real color[numColors] "marking";
  Real t = sum(color) "total marking";
  parameter Integer nIn = 0 "number of input transitions"
  parameter Integer nOut = 0 "number of output transitions"
  parameter Real startMarks[numColors] = fill(0, numColors) "start marks"
  parameter Real minMarks[numColors] = fill(0, numColors) "minimum capacity"
  parameter Real maxMarks[numColors] = fill(PNlib.Constants.inf, numColors) "maximum capacity"
  PNlib.Interfaces.PlaceIn[nIn, numColors] inTransition
  PNlib.Interfaces.PlaceOut[nOut, numColors] outTransition
  Boolean animateMarking = settings.animateMarking "only for place animation and display (Do not change!)";
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  PNlib.Components.PC place1(nIn = nIn, nOut = nOut, startMarks = startMarks[1], minMarks = minMarks[1], maxMarks = maxMarks[1]);
  PNlib.Components.PC place2(nIn = nIn, nOut = nOut, startMarks = startMarks[2], minMarks = minMarks[2], maxMarks = maxMarks[2]);
equation
  color = {place1.t, place2.t};
  for i in 1:nIn loop
    connect(inTransition[i, 1], place1.inTransition[i]);
    connect(inTransition[i, 2], place2.inTransition[i]);
  end for;
  for i in 1:nOut loop
    connect(outTransition[i, 1], place1.outTransition[i]);
    connect(outTransition[i, 2], place2.outTransition[i]);
  end for;
end CPC;


number of input transitions.

within PNlib.Examples.Models.BicoloredPlaces;

model CTC
  parameter Integer nIn = 0 "number of input transitions"
  parameter Integer nOut = 0 "number of output transitions"
  Real maximumSpeed = 1 "maximum speed"
  Boolean fire = transition_.fire "Does the transition fire?";
  Real instantaneousSpeed = transition_.instantaneousSpeed "instantaneous speed";
  Real actualSpeed = transition_.actualSpeed;
  Real arcWeightIn[nIn, numColors] = fill(1, nIn, numColors) "arc weights of input places"
  Real arcWeightOut[nOut, numColors] = fill(1, nOut, numColors) "arc weights of output places"
  PNlib.Interfaces.TransitionIn[nIn, numColors] inPlaces
  PNlib.Interfaces.TransitionOut[nOut, numColors] outPlaces
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  PNlib.Components.TC transition_(nIn = numColors*nIn, nOut = numColors*nOut, maximumSpeed = maximumSpeed, arcWeightIn = arcWeightIn_flat, arcWeightOut = arcWeightOut_flat);
  Real arcWeightIn_flat[nIn*numColors];
  Real arcWeightOut_flat[nOut*numColors];
equation
  for i in 1:nIn loop
    for j in 1:numColors loop
      connect(inPlaces[i, j], transition_.inPlaces[j + (i - 1)*numColors]);
      arcWeightIn_flat[j + (i - 1)*numColors] = arcWeightIn[i, j];
    end for;
  end for;
  for i in 1:nOut loop
    for j in 1:numColors loop
      connect(outPlaces[i, j], transition_.outPlaces[j + (i - 1)*numColors]);
      arcWeightOut_flat[j + (i - 1)*numColors] = arcWeightOut[i, j];
    end for;
  end for;
end CTC;


Stunde.

within PNlib.Examples.Models.FiliP;

model AllgemeineParameter
  Real Stunde(displayUnit = "Stunde") = time/24;
  Real Tag(displayUnit = "Tag") = time;
  parameter Real BeginFruehschicht = 6;
  parameter Real BeginSpaetschicht = 12.3;
  parameter Real BeginNachtschicht = 20.25;
  parameter Real DauerFruehschicht = 8.2;
  parameter Real DauerSpaetschicht = 8.2;
  parameter Real DauerNachtschicht = 10;
end AllgemeineParameter;


Begin Urlaub.

within PNlib.Examples.Models.FiliP;

model KrankUrlaub
  parameter Real UrlaubStartTermine[:] = {10, 20, 30} "Begin Urlaub";
  parameter Real UrlaubEndTermine[:] = {15, 25, 35} "Ende Urlaub";
  PNlib.Components.TD Gesund1(nIn = 1, delay = 0, nOut = 1)
  PNlib.Examples.Models.FiliP.PNerweiterungen.PDwkeit Krankpruefer1(enablingProbOut = {WK, 1 - WK}, enablingType = PNlib.Types.EnablingType.Probability, nIn = 1, nOut = 2)
  PNlib.Components.TD Arbeitet1(nIn = 1, nOut = 1, delay = 0)
  PNlib.Components.TD T12(nIn = 1, nOut = 1, delay = 0)
  PNlib.Components.PD KannArbeiteten(nIn = 3, nOut = 1)
  PNlib.Interfaces.TransitionOut transitionOut
  PNlib.Interfaces.PlaceIn placeIn[3]
  Real WK;
  //Real WU;
  PNlib.Components.TFDS Krank(E = 1:31, P = {75/237, 41/237, 24/237, 19/237, 22/237, 10/237, 13/237, 4/237, 2/237, 3/237, 2/237, 1/237, 3/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237, 1/237}, distributionType = PNlib.Types.DistributionType.Discrete, nIn = 1, nOut = 1)
  PNlib.Components.TE TUrlaubEnde(event = UrlaubEndTermine, nIn = 1, nOut = 1)
  PNlib.Components.TE TUrlaubStart(event = UrlaubStartTermine, nOut = 1)
  PNlib.Components.PD ImUrlaub(nIn = 1, nOut = 1)
  PNlib.Components.TD Urlaubgeber(delay = 0, nIn = 2, nOut = 1)
  PNlib.Components.PD P1(nIn = 1, nOut = 2)
  PNlib.Components.TE T1(event = UrlaubEndTermine, nIn = 1)
  PNlib.Components.PD Urlaubpruefer(nIn = 3, nOut = 2)
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
equation
  connect(Urlaubpruefer.outTransition[2], Arbeitet1.inPlaces[1])
  connect(Urlaubpruefer.outTransition[1], Urlaubgeber.inPlaces[1])
  connect(Urlaubpruefer.inTransition[3], placeIn[3])
  connect(Urlaubpruefer.inTransition[2], placeIn[2])
  connect(Urlaubpruefer.inTransition[1], placeIn[1])
  connect(P1.outTransition[2], Urlaubgeber.inPlaces[2])
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(TUrlaubStart.outPlaces[1], P1.inTransition[1])
  connect(ImUrlaub.inTransition[1], Urlaubgeber.outPlaces[1])
  connect(Arbeitet1.outPlaces[1], Krankpruefer1.inTransition[1])
  connect(Krank.inPlaces[1], Krankpruefer1.outTransition[1])
  connect(Krankpruefer1.outTransition[2], Gesund1.inPlaces[1])
  connect(ImUrlaub.outTransition[1], TUrlaubEnde.inPlaces[1])
  connect(KannArbeiteten.inTransition[1], Gesund1.outPlaces[1])
  connect(KannArbeiteten.inTransition[2], Krank.outPlaces[1])
  connect(KannArbeiteten.inTransition[3], TUrlaubEnde.outPlaces[1])
  connect(KannArbeiteten.outTransition[1], T12.inPlaces[1])
  connect(T12.outPlaces[1], transitionOut)
  WK = if time <= 744 then 0.0117 else if time <= 1464 then 0.008 else if time <= 2208 then 0.0196 else if time <= 2928 then 0.0325 else if time <= 3672 then 0.0276 else if time <= 4416 then 0.031 else if time <= 5088 then 0.0344 else if time <= 5832 then 0.0458 else if time <= 6552 then 0.0084 else if time <= 7296 then 0.0118 else if time <= 8016 then 0.0315 else 0.0188;
  //WU = if time <= 744 then 0.0212 else if time <= 1464 then 0.0531 else if time <= 2208 then 0.0310 else if time <= 2928 then 0.0458 else if time <= 3672 then 0.0671 else if time <= 4416 then 0.046 else if time <= 5088 then 0.0135 else if time <= 5832 then 0.0304 else if time <= 6552 then 0.03 else if time <= 7296 then 0.0446 else if time <= 8016 then 0.0372 else 0.0618;
end KrankUrlaub;


Was fuer eine Stelle.

within PNlib.Examples.Models.FiliP;

model Pflegekraft
  parameter Real Stelle = 1 "Was fuer eine Stelle"
  //parameter Integer UrlaubsTage = 36 "Anzahl der Urlaubstage"
  parameter Integer WEF = 1 "Welches Wochenende frei"
  parameter Real UrlaubStartTermine[:] = {10, 20, 30} "number of input places"
  parameter Real UrlaubEndTermine[:] = {15, 25, 35} "number of input places"
  Real HatFruehDienst = IstImFruehDienst.t;
  Real HatSpaetDienst = IstImSpaetDienst.t;
  Real HatNachtDienst = IstImNachtDienst.t;
  Boolean IstKrank = krankurlaub.Krank.fire;
  Real HatUrlaubt = krankurlaub.ImUrlaub.t;
  Real HatWochenende = ImWochenEnde.t;
  Real HatRuhezeit = Ruhe.t;
  Real Dienstfaehig = Dienstbereit.t;
  Real ArbeitszeitKontingentPlanungsPeriode = ArbeitszeitKontingent.t;
  Real GeleisteteArbeistzeitGesammt = GeleisteteArbeistzeit.t;
protected
  extends PNlib.Examples.Models.FiliP.AllgemeineParameter;
  PNlib.Components.PD IstImFruehDienst(nIn = 1, nOut = 1)
  PNlib.Components.PD IstImSpaetDienst(nIn = 1, nOut = 1)
  PNlib.Components.PD IstImNachtDienst(nIn = 1, nOut = 1)
  PNlib.Components.TT FSB(nOut = 2, nIn = 2, tactIntervall = 1, tactStart = BeginFruehschicht/24, arcWeightIn = {1, DauerFruehschicht - 0.5})
  PNlib.Components.TT SSB(nOut = 2, nIn = 2, tactIntervall = 1, tactStart = BeginSpaetschicht/24, arcWeightIn = {1, DauerSpaetschicht - 0.5})
  PNlib.Components.TT NSB(nOut = 2, nIn = 2, tactIntervall = 1, tactStart = BeginNachtschicht/24, arcWeightIn = {1, DauerNachtschicht - 0.75})
  PNlib.Components.TD FSE(nIn = 2, nOut = 2, delay = DauerFruehschicht/24, arcWeightOut = {1, DauerFruehschicht - 0.5})
  PNlib.Components.TD SSE(nIn = 2, nOut = 2, delay = DauerSpaetschicht/24, arcWeightOut = {1, DauerSpaetschicht - 0.5})
  PNlib.Components.TD NSE(nIn = 2, nOut = 2, delay = DauerNachtschicht/24, arcWeightOut = {1, DauerNachtschicht - 0.75})
  PNlib.Components.PC GeleisteteArbeistzeit(nIn = 3)
  PNlib.Components.PD Ruhe(nOut = 2, nIn = 3)
  PNlib.Components.PD Dienstbereit(nIn = 1, nOut = 5, startTokens = 1)
  PNlib.Components.TD RuheZeitEnde(nIn = 1, delay = 11/24, nOut = 1)
  PNlib.Components.PC ArbeitszeitKontingent(nIn = 1, nOut = 4, startMarks = if WEF == 2 then 57.75*Stelle else 11*Stelle)
  PNlib.Interfaces.TransitionOut transitionOut[3]
  PNlib.Interfaces.TransitionIn transitionIn[3]
  PNlib.Components.TT ArbeitszeitGeber(nOut = 1, tactIntervall = 14, tactStart = if WEF == 2 then 9 else 2, arcWeightOut = {2*38.5*Stelle}, nIn = 1, arcWeightIn = {ArbeitszeitKontingent.t})
  PNlib.Components.TT WochenEndSignal(nOut = 1, tactIntervall = if WEF == 3 then 7 else 14, tactStart = if WEF == 2 then 9 else 2)
  PNlib.Components.TD WochenEndGeber2(nIn = 2, nOut = 1, delay = 0)
  PNlib.Components.TD WochenEndGeber1(nIn = 2, nOut = 1, delay = 0)
  PNlib.Components.PD SollInsWochenEnde(nOut = 3, nIn = 1, maxTokens = 1)
  PNlib.Components.PD ImWochenEnde(nOut = 1, nIn = 2)
  PNlib.Components.TT WochenEndEnde(nIn = 1, tactIntervall = if WEF == 3 then 7 else 14, tactStart = if WEF == 2 then 11 else 4, nOut = 1)
  PNlib.Components.TD EinTagWiederholer(nOut = 1, nIn = 1, delay = 1)
  PNlib.Components.TD WEenderbeiKrank(nIn = 1, delay = 2)
  PNlib.Examples.Models.FiliP.KrankUrlaub krankurlaub(UrlaubEndTermine = UrlaubEndTermine, UrlaubStartTermine = UrlaubStartTermine)
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
equation
  connect(WochenEndEnde.outPlaces[1], krankurlaub.placeIn[3])
  connect(EinTagWiederholer.outPlaces[1], krankurlaub.placeIn[2])
  connect(RuheZeitEnde.outPlaces[1], krankurlaub.placeIn[1])
  connect(krankurlaub.transitionOut, Dienstbereit.inTransition[1])
  connect(FSB.outPlaces[1], IstImFruehDienst.inTransition[1])
  connect(IstImFruehDienst.outTransition[1], FSE.inPlaces[1])
  connect(SSB.outPlaces[1], IstImSpaetDienst.inTransition[1])
  connect(SSE.inPlaces[1], IstImSpaetDienst.outTransition[1])
  connect(NSB.outPlaces[1], IstImNachtDienst.inTransition[1])
  connect(IstImNachtDienst.outTransition[1], NSE.inPlaces[1])
  connect(FSB.outPlaces[2], transitionOut[1])
  connect(SSB.outPlaces[2], transitionOut[2])
  connect(NSB.outPlaces[2], transitionOut[3])
  connect(FSE.inPlaces[2], transitionIn[1])
  connect(SSE.inPlaces[2], transitionIn[2])
  connect(NSE.inPlaces[2], transitionIn[3])
  connect(Ruhe.outTransition[1], RuheZeitEnde.inPlaces[1])
  connect(Ruhe.inTransition[1], NSE.outPlaces[1])
  connect(SSE.outPlaces[1], Ruhe.inTransition[2])
  connect(FSE.outPlaces[1], Ruhe.inTransition[3])
  connect(Dienstbereit.outTransition[1], NSB.inPlaces[1])
  connect(SSB.inPlaces[1], Dienstbereit.outTransition[2])
  connect(FSB.inPlaces[1], Dienstbereit.outTransition[3])
  connect(ArbeitszeitKontingent.outTransition[1], FSB.inPlaces[2])
  connect(ArbeitszeitKontingent.outTransition[2], SSB.inPlaces[2])
  connect(ArbeitszeitKontingent.outTransition[3], NSB.inPlaces[2])
  connect(ArbeitszeitGeber.outPlaces[1], ArbeitszeitKontingent.inTransition[1])
  connect(WochenEndEnde.inPlaces[1], ImWochenEnde.outTransition[1])
  connect(WochenEndGeber1.inPlaces[1], Dienstbereit.outTransition[4])
  connect(WochenEndGeber2.inPlaces[1], Ruhe.outTransition[2])
  connect(SollInsWochenEnde.outTransition[1], WochenEndGeber1.inPlaces[2])
  connect(SollInsWochenEnde.outTransition[2], WochenEndGeber2.inPlaces[2])
  connect(WochenEndGeber1.outPlaces[1], ImWochenEnde.inTransition[1])
  connect(WochenEndGeber2.outPlaces[1], ImWochenEnde.inTransition[2])
  connect(WochenEndSignal.outPlaces[1], SollInsWochenEnde.inTransition[1])
  connect(GeleisteteArbeistzeit.inTransition[1], FSE.outPlaces[2])
  connect(GeleisteteArbeistzeit.inTransition[2], SSE.outPlaces[2])
  connect(GeleisteteArbeistzeit.inTransition[3], NSE.outPlaces[2])
  connect(EinTagWiederholer.inPlaces[1], Dienstbereit.outTransition[5])
  connect(WEenderbeiKrank.inPlaces[1], SollInsWochenEnde.outTransition[3])
  connect(ArbeitszeitGeber.inPlaces[1], ArbeitszeitKontingent.outTransition[4])
end Pflegekraft;


Anzahl der Pflegekraefte.

within PNlib.Examples.Models.FiliP;

model Station
  parameter Integer nP = 1 "Anzahl der Pflegekraefte"
  parameter Integer APFD = 3 "Min. Anzahl Personal im Fruehedienst"
  parameter Integer APSD = 2 "Min. Anzahl Personal im Spaetdienst"
  parameter Integer APND = 2 "Min. Anzahl Personal im Nachtdienst"
  Real BesetzungFruehDienst = PersonalImFruedienst.t;
  Real BesetzungSpaetDienst = PersonalImSpaetdienst.t;
  Real BesetzungNachtDienst = PersonalImNachtdienst.t;
  Real BesetzungsDefizitFrueh = DefizitFruehschicht.t;
  Real BesetzungsDefizitSpaet = DefizitSpaetSchicht.t;
  Real BesetzungsDefizitNacht = DefizizNachtSchicht.t;
protected
  extends PNlib.Examples.Models.FiliP.AllgemeineParameter;
  PNlib.Components.PD DefizitFruehschicht(nIn = 1)
  PNlib.Components.PD DefizitSpaetSchicht(nIn = 1)
  PNlib.Components.PD DefizizNachtSchicht(nIn = 1)
  PNlib.Components.PD PersonalImFruedienst(enablingProbIn = fill(1/nP, nP), enablingProbOut = fill(1/nP, nP), enablingType = PNlib.Types.EnablingType.Probability, maxTokens = APFD, nIn = nP, nOut = nP)
  PNlib.Components.PD PersonalImSpaetdienst(enablingProbIn = fill(1/nP, nP), enablingProbOut = fill(1/nP, nP), enablingType = PNlib.Types.EnablingType.Probability, maxTokens = APSD, nIn = nP, nOut = nP)
  PNlib.Components.PD PersonalImNachtdienst(enablingProbIn = fill(1/nP, nP), enablingProbOut = fill(1/nP, nP), enablingType = PNlib.Types.EnablingType.Probability, maxTokens = APND, nIn = nP, nOut = nP)
  PNlib.Interfaces.PlaceOut placeOut[3*nP]
  PNlib.Interfaces.PlaceIn placeIn[3*nP]
  PNlib.Components.TT BeginnFrueh(nOut = 1, tactIntervall = 1, tactStart = (BeginFruehschicht + 1)/24, arcWeightOut = {APFD - PersonalImFruedienst.t})
  PNlib.Components.TT BeginnSpaet(nOut = 1, tactIntervall = 1, tactStart = (BeginSpaetschicht + 1)/24, arcWeightOut = {APSD - PersonalImSpaetdienst.t})
  PNlib.Components.TT BeginnNacht(nOut = 1, tactIntervall = 1, tactStart = (BeginNachtschicht + 1)/24, arcWeightOut = {APND - PersonalImNachtdienst.t})
  outer PNlib.Components.Settings settings "global settings for animation and display";
equation
  connect(BeginnNacht.outPlaces[1], DefizizNachtSchicht.inTransition[1])
  connect(BeginnSpaet.outPlaces[1], DefizitSpaetSchicht.inTransition[1])
  connect(BeginnFrueh.outPlaces[1], DefizitFruehschicht.inTransition[1])
  for i in 1:nP loop
    connect(PersonalImFruedienst.inTransition[i], placeIn[1 + 3*(i - 1)])
    connect(PersonalImFruedienst.outTransition[i], placeOut[1 + 3*(i - 1)])
    connect(PersonalImSpaetdienst.outTransition[i], placeOut[2 + 3*(i - 1)])
    connect(PersonalImSpaetdienst.inTransition[i], placeIn[2 + 3*(i - 1)])
    connect(PersonalImNachtdienst.outTransition[i], placeOut[3 + 3*(i - 1)])
    connect(PersonalImNachtdienst.inTransition[i], placeIn[3 + 3*(i - 1)])
  end for;
end Station;


within PNlib.Examples.Models.FiliP.ModellStationen;

model Station1
  extends Modelica.Icons.Example;
  extends PNlib.Examples.Models.FiliP.AllgemeineParameter;
  PNlib.Examples.Models.FiliP.Station station(APND = 1, nP = 1, APFD = 1, APSD = 1)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft(Dienstbereit(maxTokens = 1), WEF = 1)
  inner PNlib.Components.Settings settings
equation
  connect(station.placeOut[1], pflegekraft.transitionIn[1]);
  connect(station.placeOut[2], pflegekraft.transitionIn[2]);
  connect(station.placeOut[3], pflegekraft.transitionIn[3]);
  connect(station.placeIn[1], pflegekraft.transitionOut[1]);
  connect(station.placeIn[2], pflegekraft.transitionOut[2]);
  connect(station.placeIn[3], pflegekraft.transitionOut[3]);
end Station1;


within PNlib.Examples.Models.FiliP.ModellStationen;

model Station20
  extends Modelica.Icons.Example;
  extends PNlib.Examples.Models.FiliP.AllgemeineParameter;
  PNlib.Examples.Models.FiliP.Station station(nP = 20, APFD = 4, APSD = 3, APND = 1)
  inner PNlib.Components.Settings settings
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft1(Stelle = 0.75)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft2(Stelle = 0.9)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft3(Stelle = 0.51)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft4(Stelle = 0.5, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft5(Stelle = 1, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft6(Stelle = 0.41)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft7(Stelle = 0.35, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft8(Stelle = 0.5)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft9(Stelle = 0.5)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft10(Stelle = 1, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft11(Stelle = 0.8)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft12(Stelle = 0.75, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft13(Stelle = 1, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft14(Stelle = 0.5)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft15(Stelle = 0.35)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft16(Stelle = 0.75)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft17(Stelle = 1, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft18(Stelle = 1)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft19(Stelle = 1, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft20(Stelle = 1, WEF = 2)
equation
  connect(station.placeIn[60], pflegekraft20.transitionOut[3]);
  connect(station.placeIn[59], pflegekraft20.transitionOut[2]);
  connect(station.placeIn[58], pflegekraft20.transitionOut[1]);
  connect(station.placeIn[57], pflegekraft19.transitionOut[3]);
  connect(station.placeIn[56], pflegekraft19.transitionOut[2]);
  connect(station.placeIn[55], pflegekraft19.transitionOut[1]);
  connect(station.placeIn[54], pflegekraft18.transitionOut[3]);
  connect(station.placeIn[53], pflegekraft18.transitionOut[2]);
  connect(station.placeIn[52], pflegekraft18.transitionOut[1]);
  connect(station.placeIn[51], pflegekraft17.transitionOut[3]);
  connect(station.placeIn[50], pflegekraft17.transitionOut[2]);
  connect(station.placeIn[49], pflegekraft17.transitionOut[1]);
  connect(station.placeIn[48], pflegekraft16.transitionOut[3]);
  connect(station.placeIn[47], pflegekraft16.transitionOut[2]);
  connect(station.placeIn[46], pflegekraft16.transitionOut[1]);
  connect(station.placeIn[45], pflegekraft15.transitionOut[3]);
  connect(station.placeIn[44], pflegekraft15.transitionOut[2]);
  connect(station.placeIn[43], pflegekraft15.transitionOut[1]);
  connect(station.placeIn[42], pflegekraft14.transitionOut[3]);
  connect(station.placeIn[41], pflegekraft14.transitionOut[2]);
  connect(station.placeIn[40], pflegekraft14.transitionOut[1]);
  connect(station.placeIn[39], pflegekraft13.transitionOut[3]);
  connect(station.placeIn[38], pflegekraft13.transitionOut[2]);
  connect(station.placeIn[37], pflegekraft13.transitionOut[1]);
  connect(station.placeIn[36], pflegekraft12.transitionOut[3]);
  connect(station.placeIn[35], pflegekraft12.transitionOut[2]);
  connect(station.placeIn[34], pflegekraft12.transitionOut[1]);
  connect(station.placeIn[33], pflegekraft11.transitionOut[3]);
  connect(station.placeIn[32], pflegekraft11.transitionOut[2]);
  connect(station.placeIn[31], pflegekraft11.transitionOut[1]);
  connect(station.placeIn[30], pflegekraft10.transitionOut[3]);
  connect(station.placeIn[29], pflegekraft10.transitionOut[2]);
  connect(station.placeIn[28], pflegekraft10.transitionOut[1]);
  connect(station.placeIn[27], pflegekraft9.transitionOut[3]);
  connect(station.placeIn[26], pflegekraft9.transitionOut[2]);
  connect(station.placeIn[25], pflegekraft9.transitionOut[1]);
  connect(station.placeIn[24], pflegekraft8.transitionOut[3]);
  connect(station.placeIn[23], pflegekraft8.transitionOut[2]);
  connect(station.placeIn[22], pflegekraft8.transitionOut[1]);
  connect(station.placeIn[21], pflegekraft7.transitionOut[3]);
  connect(station.placeIn[20], pflegekraft7.transitionOut[2]);
  connect(station.placeIn[19], pflegekraft7.transitionOut[1]);
  connect(station.placeIn[18], pflegekraft6.transitionOut[3]);
  connect(station.placeIn[17], pflegekraft6.transitionOut[2]);
  connect(station.placeIn[16], pflegekraft6.transitionOut[1]);
  connect(station.placeIn[15], pflegekraft5.transitionOut[3]);
  connect(station.placeIn[14], pflegekraft5.transitionOut[2]);
  connect(station.placeIn[13], pflegekraft5.transitionOut[1]);
  connect(station.placeIn[12], pflegekraft4.transitionOut[3]);
  connect(station.placeIn[11], pflegekraft4.transitionOut[2]);
  connect(station.placeIn[10], pflegekraft4.transitionOut[1]);
  connect(station.placeIn[9], pflegekraft3.transitionOut[3]);
  connect(station.placeIn[8], pflegekraft3.transitionOut[2]);
  connect(station.placeIn[7], pflegekraft3.transitionOut[1]);
  connect(station.placeIn[6], pflegekraft2.transitionOut[3]);
  connect(station.placeIn[5], pflegekraft2.transitionOut[2]);
  connect(station.placeIn[4], pflegekraft2.transitionOut[1]);
  connect(station.placeIn[3], pflegekraft1.transitionOut[3]);
  connect(station.placeIn[2], pflegekraft1.transitionOut[2]);
  connect(station.placeIn[1], pflegekraft1.transitionOut[1]);
  connect(station.placeOut[60], pflegekraft20.transitionIn[3]);
  connect(station.placeOut[59], pflegekraft20.transitionIn[2]);
  connect(station.placeOut[58], pflegekraft20.transitionIn[1]);
  connect(station.placeOut[57], pflegekraft19.transitionIn[3]);
  connect(station.placeOut[56], pflegekraft19.transitionIn[2]);
  connect(station.placeOut[55], pflegekraft19.transitionIn[1]);
  connect(station.placeOut[54], pflegekraft18.transitionIn[3]);
  connect(station.placeOut[53], pflegekraft18.transitionIn[2]);
  connect(station.placeOut[52], pflegekraft18.transitionIn[1]);
  connect(station.placeOut[51], pflegekraft17.transitionIn[3]);
  connect(station.placeOut[50], pflegekraft17.transitionIn[2]);
  connect(station.placeOut[49], pflegekraft17.transitionIn[1]);
  connect(station.placeOut[48], pflegekraft16.transitionIn[3]);
  connect(station.placeOut[47], pflegekraft16.transitionIn[2]);
  connect(station.placeOut[46], pflegekraft16.transitionIn[1]);
  connect(station.placeOut[45], pflegekraft15.transitionIn[3]);
  connect(station.placeOut[44], pflegekraft15.transitionIn[2]);
  connect(station.placeOut[43], pflegekraft15.transitionIn[1]);
  connect(station.placeOut[42], pflegekraft14.transitionIn[3]);
  connect(station.placeOut[41], pflegekraft14.transitionIn[2]);
  connect(station.placeOut[40], pflegekraft14.transitionIn[1]);
  connect(station.placeOut[39], pflegekraft13.transitionIn[3]);
  connect(station.placeOut[38], pflegekraft13.transitionIn[2]);
  connect(station.placeOut[37], pflegekraft13.transitionIn[1]);
  connect(station.placeOut[36], pflegekraft12.transitionIn[3]);
  connect(station.placeOut[35], pflegekraft12.transitionIn[2]);
  connect(station.placeOut[34], pflegekraft12.transitionIn[1]);
  connect(station.placeOut[33], pflegekraft11.transitionIn[3]);
  connect(station.placeOut[32], pflegekraft11.transitionIn[2]);
  connect(station.placeOut[31], pflegekraft11.transitionIn[1]);
  connect(station.placeOut[30], pflegekraft10.transitionIn[3]);
  connect(station.placeOut[29], pflegekraft10.transitionIn[2]);
  connect(station.placeOut[28], pflegekraft10.transitionIn[1]);
  connect(station.placeOut[27], pflegekraft9.transitionIn[3]);
  connect(station.placeOut[26], pflegekraft9.transitionIn[2]);
  connect(station.placeOut[25], pflegekraft9.transitionIn[1]);
  connect(station.placeOut[24], pflegekraft8.transitionIn[3]);
  connect(station.placeOut[23], pflegekraft8.transitionIn[2]);
  connect(station.placeOut[22], pflegekraft8.transitionIn[1]);
  connect(station.placeOut[21], pflegekraft7.transitionIn[3]);
  connect(station.placeOut[20], pflegekraft7.transitionIn[2]);
  connect(station.placeOut[19], pflegekraft7.transitionIn[1]);
  connect(station.placeOut[18], pflegekraft6.transitionIn[3]);
  connect(station.placeOut[17], pflegekraft6.transitionIn[2]);
  connect(station.placeOut[16], pflegekraft6.transitionIn[1]);
  connect(station.placeOut[15], pflegekraft5.transitionIn[3]);
  connect(station.placeOut[14], pflegekraft5.transitionIn[2]);
  connect(station.placeOut[13], pflegekraft5.transitionIn[1]);
  connect(station.placeOut[12], pflegekraft4.transitionIn[3]);
  connect(station.placeOut[11], pflegekraft4.transitionIn[2]);
  connect(station.placeOut[10], pflegekraft4.transitionIn[1]);
  connect(station.placeOut[9], pflegekraft3.transitionIn[3]);
  connect(station.placeOut[8], pflegekraft3.transitionIn[2]);
  connect(station.placeOut[7], pflegekraft3.transitionIn[1]);
  connect(station.placeOut[6], pflegekraft2.transitionIn[3]);
  connect(station.placeOut[5], pflegekraft2.transitionIn[2]);
  connect(station.placeOut[4], pflegekraft2.transitionIn[1]);
  connect(station.placeOut[3], pflegekraft1.transitionIn[3]);
  connect(station.placeOut[2], pflegekraft1.transitionIn[2]);
  connect(station.placeOut[1], pflegekraft1.transitionIn[1]);
//////////////////////////////////////////////////////////////////////////////
end Station20;


within PNlib.Examples.Models.FiliP.ModellStationen;

model Station7
  extends Modelica.Icons.Example;
  extends PNlib.Examples.Models.FiliP.AllgemeineParameter;
  PNlib.Examples.Models.FiliP.Station station(APFD = 1, APND = 1, APSD = 1, nP = 7)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft1(Dienstbereit(maxTokens = 1), UrlaubEndTermine = {25, 53, 81}, UrlaubStartTermine = {11, 39, 67}, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft2(UrlaubEndTermine = {109, 137, 165}, UrlaubStartTermine = {95, 123, 151}, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft3(UrlaubEndTermine = {193, 221, 249}, UrlaubStartTermine = {179, 207, 235}, WEF = 2)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft4(UrlaubEndTermine = {263, 277, 291, 305, 319, 333}, UrlaubStartTermine = {256, 270, 284, 298, 312, 326}, WEF = 3)
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft5(UrlaubEndTermine = {19, 47, 75}, UrlaubStartTermine = {5, 33, 61})
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft6(UrlaubEndTermine = {103, 131, 159}, UrlaubStartTermine = {89, 117, 145})
  PNlib.Examples.Models.FiliP.Pflegekraft pflegekraft7(UrlaubEndTermine = {187, 215, 243}, UrlaubStartTermine = {173, 201, 229})
  inner PNlib.Components.Settings settings
equation
  connect(station.placeIn[21], pflegekraft7.transitionOut[3]);
  connect(station.placeIn[20], pflegekraft7.transitionOut[2]);
  connect(station.placeIn[19], pflegekraft7.transitionOut[1]);
  connect(station.placeIn[18], pflegekraft6.transitionOut[3]);
  connect(station.placeIn[17], pflegekraft6.transitionOut[2]);
  connect(station.placeIn[16], pflegekraft6.transitionOut[1]);
  connect(station.placeIn[15], pflegekraft5.transitionOut[3]);
  connect(station.placeIn[14], pflegekraft5.transitionOut[2]);
  connect(station.placeIn[13], pflegekraft5.transitionOut[1]);
  connect(station.placeIn[12], pflegekraft4.transitionOut[3]);
  connect(station.placeIn[11], pflegekraft4.transitionOut[2]);
  connect(station.placeIn[10], pflegekraft4.transitionOut[1]);
  connect(station.placeIn[9], pflegekraft3.transitionOut[3]);
  connect(station.placeIn[8], pflegekraft3.transitionOut[2]);
  connect(station.placeIn[7], pflegekraft3.transitionOut[1]);
  connect(station.placeIn[6], pflegekraft2.transitionOut[3]);
  connect(station.placeIn[5], pflegekraft2.transitionOut[2]);
  connect(station.placeIn[4], pflegekraft2.transitionOut[1]);
  connect(station.placeOut[1], pflegekraft1.transitionIn[1]);
  connect(station.placeOut[2], pflegekraft1.transitionIn[2]);
  connect(station.placeOut[3], pflegekraft1.transitionIn[3]);
  connect(station.placeOut[21], pflegekraft7.transitionIn[3]);
  connect(station.placeOut[20], pflegekraft7.transitionIn[2]);
  connect(station.placeOut[19], pflegekraft7.transitionIn[1]);
  connect(station.placeOut[18], pflegekraft6.transitionIn[3]);
  connect(station.placeOut[17], pflegekraft6.transitionIn[2]);
  connect(station.placeOut[16], pflegekraft6.transitionIn[1]);
  connect(station.placeOut[15], pflegekraft5.transitionIn[3]);
  connect(station.placeOut[14], pflegekraft5.transitionIn[2]);
  connect(station.placeOut[13], pflegekraft5.transitionIn[1]);
  connect(station.placeOut[12], pflegekraft4.transitionIn[3]);
  connect(station.placeOut[11], pflegekraft4.transitionIn[2]);
  connect(station.placeOut[10], pflegekraft4.transitionIn[1]);
  connect(station.placeOut[9], pflegekraft3.transitionIn[3]);
  connect(station.placeOut[8], pflegekraft3.transitionIn[2]);
  connect(station.placeOut[7], pflegekraft3.transitionIn[1]);
  connect(station.placeOut[6], pflegekraft2.transitionIn[3]);
  connect(station.placeOut[5], pflegekraft2.transitionIn[2]);
  connect(station.placeOut[4], pflegekraft2.transitionIn[1]);
  connect(station.placeIn[1], pflegekraft1.transitionOut[1]);
  connect(station.placeIn[2], pflegekraft1.transitionOut[2]);
  connect(station.placeIn[3], pflegekraft1.transitionOut[3]);
end Station7;


Discrete Place.

within PNlib.Examples.Models.FiliP.PNerweiterungen;

model PDwkeit "Discrete Place"
  discrete Integer t(start = startTokens, fixed = true) "marking";
  parameter Integer nIn = 0 "number of input transitions"
  parameter Integer nOut = 0 "number of output transitions"
  //****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
  parameter Integer startTokens = 0 "start tokens"
  parameter Integer minTokens = 0 "minimum capacity"
  parameter Integer maxTokens = PNlib.Constants.Integer_inf "maximum capacity"
  Boolean reStart(start = false, fixed = true) = false "restart condition"
  parameter Integer reStartTokens = startTokens "number of tokens at restart"
  parameter PNlib.Types.EnablingType enablingType = PNlib.Types.EnablingType.Priority "resolution type of actual conflict (type-1-conflict)"
  parameter Integer enablingPrioIn[nIn] = 1:nIn "enabling priorities of input transitions"
  parameter Integer enablingPrioOut[nOut] = 1:nOut "enabling priorities of output transitions"
  Real enablingProbIn[nIn] = fill(1/nIn, nIn) "enabling probabilities of input transitions"
  Real enablingProbOut[nOut] = fill(1/nOut, nOut) "enabling probabilities of output transitions"
  parameter Real enablingBeneIn[nIn] = 1:nIn "enabling benefit of input transitions"
  parameter Real enablingBeneOut[nOut] = 1:nOut "enabling benefit of output transitions"
  parameter PNlib.Types.BenefitType benefitType = PNlib.Types.BenefitType.Greedy "enabling strategy for benefit"
  parameter Integer N = settings.N "N+1=amount of levels"
  //****MODIFIABLE PARAMETERS AND VARIABLES END****//
  Real levelCon "conversion of tokens to level concentration according to M and N of the settings box";
  Boolean showCapacity = settings.showCapacity "only for place animation and display (Do not change!)";
  Boolean animateMarking = settings.animateMarking "only for place animation and display (Do not change!)";
  Real color[3] "only for place animation and display (Do not change!)";
  parameter Integer localSeedIn = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for input conflicts"
  parameter Integer localSeedOut = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for output conflicts"
  PNlib.Interfaces.PlaceIn inTransition[nIn](each t = pret, each tint = pret, each maxTokens = maxTokens, each maxTokensint = maxTokens, enable = enableIn.TEin_, each emptied = false, each decreasingFactor = 1, each disPlace = true, each speedSum = 0, fire = fireIn, disTransition = disTransitionIn, arcWeightint = arcWeightIn, active = activeIn, enabledByInPlaces = enabledByInPlaces) if nIn > 0 "connector for input transitions"
  PNlib.Interfaces.PlaceOut outTransition[nOut](each t = pret, each tint = pret, each minTokens = minTokens, each minTokensint = minTokens, enable = enableOut.TEout_, each fed = false, each decreasingFactor = 1, each disPlace = true, each arcType = PNlib.Types.ArcType.NormalArc, each speedSum = 0, each tokenInOut = pre(tokeninout), fire = fireOut, disTransition = disTransitionOut, arcWeightint = arcWeightOut, active = activeOut, each testValue = -1, each testValueint = -1, each normalArc = false) if nOut > 0 "connector for output transitions"
  Modelica.Blocks.Interfaces.IntegerOutput pd_t = t "connector for Simulink connection"
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  Real tokenscale "only for place animation and display";
  discrete Integer pret "pre marking";
  Integer arcWeightIn[nIn] "Integer weights of input arcs";
  Integer arcWeightOut[nOut] "Integer weights of output arcs";
  Boolean tokeninout(start = false, fixed = true) "change of tokens?";
  Boolean fireIn[nIn] "Do input transtions fire?";
  Boolean fireOut[nOut] "Do output transitions fire?";
  Boolean disTransitionIn[nIn] "Are the input transitions discrete?";
  Boolean disTransitionOut[nOut] "Are the output transtions discrete?";
  Boolean activeIn[nIn] "Are delays passed of input transitions?";
  Boolean activeOut[nOut](each start = false, each fixed = true) "Are delay passed of output transitions?";
  Boolean enabledByInPlaces[nIn] "Are input transitions are enabled by all their input places?";
  //****BLOCKS BEGIN****// since no events are generated within functions!!!
  //change of activation of output transitions
  PNlib.Blocks.anyChange activeConOut(vec = pre(activeOut) and not disTransitionOut);
  //Does any delay passed of a connected transition?
  PNlib.Blocks.anyTrue delayPassedOut(vec = activeOut and disTransitionOut);
  PNlib.Blocks.anyTrue delayPassedIn(vec = activeIn and disTransitionIn);
  //firing sum calculation
  PNlib.Blocks.firingSumDis firingSumIn(fire = fireIn and disTransitionIn, arcWeight = arcWeightIn);
  PNlib.Blocks.firingSumDis firingSumOut(fire = fireOut and disTransitionOut, arcWeight = arcWeightOut);
  //Enabling process
  PNlib.Blocks.enablingOutDis enableOut(delayPassed = delayPassedOut.anytrue, activeCon = activeConOut.anychange, nOut = nOut, arcWeight = arcWeightOut, t = pret, minTokens = minTokens, TAout = activeOut, enablingType = enablingType, enablingPrio = enablingPrioOut, enablingProb = enablingProbOut, enablingBene = enablingBeneOut, benefitType = benefitType, disTransition = disTransitionOut, localSeed = localSeedOut, globalSeed = settings.globalSeed);
  PNlib.Blocks.enablingInDis enableIn(delayPassed = delayPassedIn.anytrue, active = activeIn, nIn = nIn, arcWeight = arcWeightIn, t = pret, maxTokens = maxTokens, TAein = enabledByInPlaces and activeIn, enablingType = enablingType, enablingPrio = enablingPrioIn, enablingProb = enablingProbIn, enablingBene = enablingBeneIn, benefitType = benefitType, disTransition = disTransitionIn, localSeed = localSeedIn, globalSeed = settings.globalSeed);
  //****BLOCKS END****//
equation
  //****MAIN BEGIN****//
  //recalculation of tokens
  pret = pre(t);
  tokeninout = firingSumIn.firingSum > 0 or firingSumOut.firingSum > 0;
  when tokeninout or pre(reStart) then
    t = if tokeninout then pret + firingSumIn.firingSum - firingSumOut.firingSum else reStartTokens;
  end when;
  //Conversion of tokens to level concentrations
  levelCon = t*settings.M/N;
  //****MAIN END****//
  //****ANIMATION BEGIN****//
  tokenscale = t*settings.scale;
  color = if settings.animatePlace then if tokenscale < 100 then {255, 255 - 2.55*tokenscale, 255 - 2.55*tokenscale} else {255, 0, 0} else {255, 255, 255};
  //****ANIMATION END****//
  //****ERROR MESSENGES BEGIN****//
  assert(PNlib.Functions.OddsAndEnds.prioCheck(enablingPrioIn, nIn) or nIn == 0 or enablingType == PNlib.Types.EnablingType.Probability, "The priorities of the input priorities may be given only once and must be selected from 1 to nIn");
  assert(PNlib.Functions.OddsAndEnds.prioCheck(enablingPrioOut, nOut) or nOut == 0 or enablingType == PNlib.Types.EnablingType.Probability, "The priorities of the output priorities may be given only once and must be selected from 1 to nOut");
  assert(PNlib.Functions.OddsAndEnds.isEqual(sum(enablingProbIn), 1.0, 1e-6) or nIn == 0 or enablingType == PNlib.Types.EnablingType.Priority, "The sum of input enabling probabilities has to be equal to 1");
  assert(PNlib.Functions.OddsAndEnds.isEqual(sum(enablingProbOut), 1.0, 1e-6) or nOut == 0 or enablingType == PNlib.Types.EnablingType.Priority, "The sum of output enabling probabilities has to be equal to 1");
  assert(startTokens >= minTokens and startTokens <= maxTokens, "minTokens<=startTokens<=maxTokens");
  //****ERROR MESSENGES END****//
end PDwkeit;


Top Model.

within PNlib.Examples.Models.PNproBP;

model Model "Top Model"
  extends Modelica.Icons.Example;
  parameter Integer Nr_Consultant = 2 "Number of consultants";
  parameter Integer Nr_Advisor1 = 2 "Number of advisor type 1";
  parameter Integer Nr_Advisor2 = 1 "Number of advisor type 2";
  parameter Integer Nr_Controller = 1 "Number of Controllers";
  parameter Integer Nr_Installer = 2 "Number of installers";
  parameter Integer Nr_Accountant = 2 "Number of accountants";
  parameter Real time_between_requests = 1.5 "Expected time between two requests";
  parameter Real time_consulting = 1 "Time for consulting";
  parameter Real time_preparing = 3 "Time for offer preparing";
  parameter Real time_planning = 1.5 "Time for order planning";
  parameter Real time_controlling = 2 "Time for offer controlling";
  parameter Real time_installation = 4 "Time for installation";
  parameter Real time_accounting = 1 "Time for order accounting";
  PNlib.Components.TDS RaiseRequest(nOut = 1, h = 1/time_between_requests) "a request is raised from a customer"
  PNlib.Components.PD Request(nIn = 1, enablingType = PNlib.Types.EnablingType.Probability, nOut = 1) "Request of a custumer is available"
  PNlib.Components.PD Consultants(enablingType = PNlib.Types.EnablingType.Probability, nOut = 1, nIn = 1, startTokens = Nr_Consultant, maxTokens = Nr_Consultant)
  PNlib.Components.PD Solution(nOut = 1, nIn = 1) "A solution for the customer wish has been found"
  PNlib.Components.PD Complete(nIn = 1, nOut = 1) "Consulting is completed"
  PNlib.Components.PD Offer(nOut = 1, nIn = 1) "The offer is complete"
  PNlib.Components.PD No_Solution(nIn = 1) "No solution for the costumer wish has been found"
  PNlib.Components.PD Advisor1(nOut = 1, enablingType = PNlib.Types.EnablingType.Probability, nIn = 1, startTokens = Nr_Advisor1)
  PNlib.Components.TD Offer_to_Customer(nOut = 1, delay = 8, nIn = 1, arcWeightIn = {pre(Offer.t)}, arcWeightOut = {pre(Offer.t)}) "The offers of a day are sent to the customer"
  PNlib.Components.PD Offer_at_Customer(nIn = 1, nOut = 1) "The offer has arrived the customer"
  PNproBP.XOR Replying(upperProb = 0.8, lowerProb = 0.2) "Does the customer answer to the offer?"
  PNlib.Components.PD Answer(nOut = 1, nIn = 1) "Answer from the customer"
  PNlib.Components.PD Order(nIn = 2, nOut = 1) "The customer gives the order"
  PNlib.Components.PD No_Order(nIn = 2) "no order"
  PNlib.Components.PD Advisor2(enablingType = PNlib.Types.EnablingType.Probability, startTokens = Nr_Advisor2, nOut = 1, nIn = 1)
  PNlib.Components.PD planned_order(nIn = 1, nOut = 1) "The order is planned"
  PNlib.Components.PD material_order(nIn = 1, nOut = 1) "The planning is complete and the material can be ordered"
  PNlib.Components.PD Material_supplied(nIn = 1, nOut = 1) "The required material is supplied"
  PNlib.Components.PD Installation_possible(nIn = 1, nOut = 1) "the installation is possible"
  PNlib.Components.PD Installer(startTokens = Nr_Installer, nOut = 1, nIn = 1)
  PNlib.Components.PD Installation_complete(nIn = 1, nOut = 1) "The installtion is complete"
  PNlib.Components.PD Invoice(nIn = 1, nOut = 1) "the invoice is complete and is sent to the customer"
  PNlib.Components.PD Order_complete(nIn = 1) "the order is completed"
  inner PNlib.Components.Settings settings(scale = 10)
  PNproBP.Parallel Consulting(nIn = 2, nOut = 2, delay = time_consulting, noParallel = Nr_Consultant) "the customer is coundeled"
  PNproBP.XOR Resluting(upperProb = 0.9, lowerProb = 0.1) "Result of the Consulting"
  PNproBP.Parallel Preparation(nIn = 2, nOut = 2, delay = time_preparing, noParallel = Nr_Advisor1) "Preparation of an offer"
  PNproBP.XOR Resulting2(upperProb = 0.5, lowerProb = 0.5) "Result of the answer"
  PNproBP.Parallel Accounting(noParallel = Nr_Accountant, nIn = 2, nOut = 2, delay = time_accounting) "Accounting of the order"
  PNproBP.Parallel Planning(noParallel = Nr_Advisor2, nIn = 2, nOut = 3, delay = time_planning) "The order is planned"
  PNproBP.Parallel Controlling(noParallel = Nr_Controller, nIn = 3, nOut = 2, delay = time_controlling) "Control the order"
  PNproBP.Parallel Installation(arcWeightIn = {1, 2}, nIn = 2, nOut = 2, delay = time_installation, noParallel = 2, arcWeightOut = {2, 1})
  PNproBP.Workload w_Consultants
  PNproBP.Workload w_Advisor
  PNproBP.Workload w_Advisor2
  PNproBP.Workload w_Installer
  PNproBP.TotalNumber t_Auftraege
  PNproBP.TotalNumber t_Order
  PNproBP.TotalNumber t_solution
  PNproBP.TotalNumber t_Offer
  PNlib.Components.PD No_Answer(nOut = 1, nIn = 1) "Nor answer from the customer"
  PNproBP.XOR Calling(upperProb = 0.8, lowerProb = 0.2) "Call the customer to get the answer"
  PNlib.Components.PD WaitingTime_over(nOut = 1, nIn = 1) "The waiting time of the answer is over"
  PNproBP.Waiting Waiting(delay = 40) "Waiting of the answer from the customer"
  PNproBP.Waiting Supply(delay = 40) "Waitin on the required material"
  PNproBP.Waiting Payment(delay = 40) "Wait for payment"
  PNlib.Components.PD Accountant(startTokens = Nr_Accountant, nOut = 1, nIn = 1)
  PNproBP.Workload w_Accountant
  PNlib.Components.PD Controller(enablingType = PNlib.Types.EnablingType.Probability, nOut = 1, nIn = 1, startTokens = Nr_Controller)
  PNproBP.Workload w_Advisor1
equation
  connect(RaiseRequest.outPlaces[1], Request.inTransition[1])
  connect(Offer_to_Customer.outPlaces[1], Offer_at_Customer.inTransition[1])
  connect(Offer.outTransition[1], Offer_to_Customer.inPlaces[1])
  connect(Request.outTransition[1], Consulting.inPlaces1[1])
  connect(Consultants.outTransition[1], Consulting.inPlaces1[2])
  connect(Consulting.outPlaces1[1], Complete.inTransition[1])
  connect(Consulting.outPlaces1[2], Consultants.inTransition[1])
  connect(Complete.outTransition[1], Resluting.inPlaces1)
  connect(Solution.outTransition[1], Preparation.inPlaces1[1])
  connect(Advisor1.outTransition[1], Preparation.inPlaces1[2])
  connect(Preparation.outPlaces1[1], Offer.inTransition[1])
  connect(Answer.outTransition[1], Resulting2.inPlaces1)
  connect(Preparation.outPlaces1[2], Advisor1.inTransition[1])
  connect(Resulting2.outPlaces1, No_Order.inTransition[1])
  connect(Resulting2.outPlaces2, Order.inTransition[1])
  connect(Consultants.pd_t, w_Consultants.u)
  connect(No_Answer.outTransition[1], Calling.inPlaces1)
  connect(Calling.outPlaces1, No_Order.inTransition[2])
  connect(Calling.outPlaces2, Order.inTransition[2])
  connect(WaitingTime_over.outTransition[1], Replying.inPlaces1)
  connect(Replying.outPlaces1, Answer.inTransition[1])
  connect(Replying.outPlaces2, No_Answer.inTransition[1])
  connect(Offer_at_Customer.outTransition[1], Waiting.inPlaces1)
  connect(Waiting.outPlaces1, WaitingTime_over.inTransition[1])
  connect(Resluting.outPlaces1, Solution.inTransition[1])
  connect(Resluting.outPlaces2, No_Solution.inTransition[1])
  connect(Advisor2.pd_t, w_Advisor2.u)
  connect(w_Installer.u, Installer.pd_t)
  connect(t_Auftraege.u, Request.pd_t)
  connect(t_solution.u, Solution.pd_t)
  connect(w_Advisor.u, Advisor1.pd_t)
  connect(t_Offer.u, Offer.pd_t)
  connect(Accountant.pd_t, w_Accountant.u)
  connect(Order.outTransition[1], Planning.inPlaces1[1])
  connect(Advisor2.outTransition[1], Planning.inPlaces1[2])
  connect(Planning.outPlaces1[1], Advisor2.inTransition[1])
  connect(Planning.outPlaces1[2], material_order.inTransition[1])
  connect(material_order.outTransition[1], Supply.inPlaces1)
  connect(Supply.outPlaces1, Material_supplied.inTransition[1])
  connect(Planning.outPlaces1[3], planned_order.inTransition[1])
  connect(Material_supplied.outTransition[1], Controlling.inPlaces1[1])
  connect(Controlling.outPlaces1[1], Installation_possible.inTransition[1])
  connect(planned_order.outTransition[1], Controlling.inPlaces1[2])
  connect(Installation_possible.outTransition[1], Installation.inPlaces1[1])
  connect(Installer.outTransition[1], Installation.inPlaces1[2])
  connect(Installation.outPlaces1[1], Installer.inTransition[1])
  connect(Installation.outPlaces1[2], Installation_complete.inTransition[1])
  connect(Installation_complete.outTransition[1], Accounting.inPlaces1[1])
  connect(Accountant.outTransition[1], Accounting.inPlaces1[2])
  connect(Accounting.outPlaces1[1], Accountant.inTransition[1])
  connect(Accounting.outPlaces1[2], Invoice.inTransition[1])
  connect(Invoice.outTransition[1], Payment.inPlaces1)
  connect(Payment.outPlaces1, Order_complete.inTransition[1])
  connect(Controller.pd_t, w_Advisor1.u)
  connect(Controller.outTransition[1], Controlling.inPlaces1[3])
  connect(Controlling.outPlaces1[2], Controller.inTransition[1])
  connect(Order.pd_t, t_Order.u)
end Model;


within PNlib.Examples.Models;

package PNproBP "Petri Nets for Modeling Business Processes"
  extends Modelica.Icons.ExamplesPackage;
end PNproBP;


arc weights of input place.

within PNlib.Examples.Models.PNproBP;

model Parallel
  parameter Real delay = 1;
  parameter Real noParallel = 2;
  Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input place"
  Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output place"
  parameter Integer nIn = 0 "number of input places"
  parameter Integer nOut = 0 "number of output places"
  Boolean fire "firability of continuous transition";
  Integer fireColor[3] "for animation";
  PNlib.Components.TD T1(delay = delay, nIn = 1, nOut = 1)
  PNlib.Components.TD puffern(nOut = 1, nIn = nIn, arcWeightIn = arcWeightIn, delay = 0.001)
  PNlib.Components.PD Puffer(nIn = 1, nOut = 6)
  PNlib.Components.TD T2(delay = delay, nIn = 1, nOut = 1, firingCon = noParallel > 1)
  PNlib.Components.TD T3(delay = delay, nIn = 1, nOut = 1, firingCon = noParallel > 2)
  PNlib.Components.TD T4(delay = delay, nIn = 1, nOut = 1, firingCon = noParallel > 3)
  PNlib.Components.TD T5(delay = delay, nIn = 1, nOut = 1, firingCon = noParallel > 4)
  PNlib.Components.TD T6(delay = delay, nIn = 1, nOut = 1, firingCon = noParallel > 5)
  Interfaces.TransitionIn inPlaces1[nIn]
  PNlib.Components.PD P1(nIn = 6, nOut = 1)
  PNlib.Components.TD T7(nOut = nOut, nIn = 1, arcWeightOut = arcWeightOut, delay = 0.0001)
  Interfaces.TransitionOut outPlaces1[nOut]
  Boolean ani "for transition animation";
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  discrete Real fireTime;
equation
  fire = T1.fire or T2.fire or T3.fire or T4.fire or T5.fire or T6.fire;
  when fire then
    fireTime = time;
    ani = true;
  end when;
  fireColor = if (fireTime + settings.timeFire >= time and settings.animateTransition and ani) then {255, 255, 0} else {128, 255, 0};
  connect(puffern.outPlaces[1], Puffer.inTransition[1])
  connect(Puffer.outTransition[1], T1.inPlaces[1])
  connect(Puffer.outTransition[2], T2.inPlaces[1])
  connect(Puffer.outTransition[3], T3.inPlaces[1])
  connect(Puffer.outTransition[4], T4.inPlaces[1])
  connect(Puffer.outTransition[5], T5.inPlaces[1])
  connect(Puffer.outTransition[6], T6.inPlaces[1])
  for i in 1:nIn loop
    connect(puffern.inPlaces[i], inPlaces1[i])
  end for;
  connect(T1.outPlaces[1], P1.inTransition[1])
  connect(T2.outPlaces[1], P1.inTransition[2])
  connect(T3.outPlaces[1], P1.inTransition[3])
  connect(T4.outPlaces[1], P1.inTransition[4])
  connect(T5.outPlaces[1], P1.inTransition[5])
  connect(T6.outPlaces[1], P1.inTransition[6])
  for i in 1:nOut loop
    connect(T7.outPlaces[i], outPlaces1[i])
  end for;
  connect(P1.outTransition[1], T7.inPlaces[1])
end Parallel;


number of input places.

within PNlib.Examples.Models.PNproBP;

model Puffer
  parameter Real delay = 1;
  parameter Integer nIn = 0 "number of input places"
  parameter Integer nOut = 0 "number of output places"
  Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input place"
  Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output place"
  PNlib.Components.TD T1(nIn = 1, nOut = nOut, delay = delay, arcWeightOut = arcWeightOut)
  PNlib.Components.PD P1(nIn = 1, nOut = 1)
  PNlib.Components.TD T3(nOut = 1, nIn = nIn, arcWeightIn = arcWeightIn, delay = 0.0001)
  Interfaces.TransitionIn inPlaces1[nIn]
  Interfaces.TransitionOut outPlaces1[nOut]
  Boolean fire "firability of continuous transition";
  Integer fireColor[3] "for animation";
  Boolean ani "for transition animation";
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  discrete Real fireTime;
equation
  fire = T1.fire;
  when fire then
    fireTime = time;
    ani = true;
  end when;
  fireColor = if (fireTime + settings.timeFire >= time and settings.animateTransition and ani) then {255, 255, 0} else {255, 128, 8};
  connect(T3.outPlaces[1], P1.inTransition[1])
  for i in 1:nIn loop
    connect(T3.inPlaces[i], inPlaces1[i])
  end for;
  connect(P1.outTransition[1], T1.inPlaces[1])
  for i in 1:nOut loop
    connect(T1.outPlaces[i], outPlaces1[i])
  end for;
end Puffer;


within PNlib.Examples.Models.PNproBP;

model TotalNumber
  Integer total;
  Modelica.Blocks.Interfaces.IntegerInput u
algorithm
  when u > pre(u) then
    total := total + (u - pre(u));
  end when;
end TotalNumber;


firability of continuous transition.

within PNlib.Examples.Models.PNproBP;

model Waiting
  parameter Real delay = 1;
  Integer arcWeight = 1;
  Boolean fire "firability of continuous transition";
  Integer fireColor[3] "for animation";
  PNlib.Components.TD T1(nIn = 1, nOut = 1, delay = 0.001, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P1.t) == 0)
  PNlib.Components.PD Puffer(nOut = 24, nIn = 1)
  PNlib.Components.TD T2(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P2.t) == 0)
  PNlib.Components.TD T3(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P3.t) == 0)
  PNlib.Components.TD T4(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P4.t) == 0)
  PNlib.Components.TD T5(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P5.t) == 0)
  PNlib.Components.TD T6(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P6.t) == 0)
  PNlib.Components.PD P1(nOut = 1, nIn = 1)
  PNlib.Components.TD T7(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P1.t)}, arcWeightOut = {pre(P1.t)}, firingCon = pre(P1.t) > 0)
  Boolean ani "for transition animation";
  PNlib.Components.PD P2(nOut = 1, nIn = 1)
  PNlib.Components.PD P3(nOut = 1, nIn = 1)
  PNlib.Components.PD P4(nOut = 1, nIn = 1)
  PNlib.Components.PD P5(nOut = 1, nIn = 1)
  PNlib.Components.PD P6(nOut = 1, nIn = 1)
  PNlib.Components.TD T8(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P2.t)}, arcWeightOut = {pre(P2.t)}, firingCon = pre(P2.t) > 0)
  PNlib.Components.TD T9(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P3.t)}, arcWeightOut = {pre(P3.t)}, firingCon = pre(P3.t) > 0)
  PNlib.Components.TD T10(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P4.t)}, arcWeightOut = {pre(P4.t)}, firingCon = pre(P4.t) > 0)
  PNlib.Components.TD T11(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P5.t)}, arcWeightOut = {pre(P5.t)}, firingCon = pre(P5.t) > 0)
  PNlib.Components.TD T12(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P6.t)}, arcWeightOut = {pre(P6.t)}, firingCon = pre(P6.t) > 0)
  PNlib.Components.PD P7(nIn = 24, nOut = 1)
  PNlib.Components.TD T13(nOut = 1, nIn = 1, arcWeightIn = {arcWeight}, arcWeightOut = {arcWeight}, delay = 0.001, firingCon = pre(arcWeight) > 0)
  Interfaces.TransitionIn inPlaces1
  PNlib.Components.TD T14(nIn = 1, delay = 0.001, arcWeightIn = {pre(P7.t)}, nOut = 1, arcWeightOut = {pre(P7.t)}, firingCon = pre(P7.t) > 0)
  Interfaces.TransitionOut outPlaces1
  PNlib.Components.TD T15(nIn = 1, nOut = 1, delay = 0.001, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P8.t) == 0)
  PNlib.Components.PD P8(nOut = 1, nIn = 1)
  PNlib.Components.TD T16(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P8.t)}, arcWeightOut = {pre(P8.t)}, firingCon = pre(P8.t) > 0)
  PNlib.Components.TD T17(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P9.t) == 0)
  PNlib.Components.PD P9(nOut = 1, nIn = 1)
  PNlib.Components.TD T18(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P9.t)}, arcWeightOut = {pre(P9.t)}, firingCon = pre(P9.t) > 0)
  PNlib.Components.TD T19(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P10.t) == 0)
  PNlib.Components.TD T20(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P11.t) == 0)
  PNlib.Components.TD T21(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P12.t) == 0)
  PNlib.Components.TD T22(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P13.t) == 0)
  PNlib.Components.PD P10(nOut = 1, nIn = 1)
  PNlib.Components.PD P11(nOut = 1, nIn = 1)
  PNlib.Components.PD P12(nOut = 1, nIn = 1)
  PNlib.Components.PD P13(nOut = 1, nIn = 1)
  PNlib.Components.TD T23(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P10.t)}, arcWeightOut = {pre(P10.t)}, firingCon = pre(P10.t) > 0)
  PNlib.Components.TD T24(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P11.t)}, arcWeightOut = {pre(P11.t)}, firingCon = pre(P11.t) > 0)
  PNlib.Components.TD T25(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P12.t)}, arcWeightOut = {pre(P12.t)}, firingCon = pre(P12.t) > 0)
  PNlib.Components.TD T26(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P13.t)}, arcWeightOut = {pre(P13.t)}, firingCon = pre(P13.t) > 0)
  PNlib.Components.TD T27(nIn = 1, nOut = 1, delay = 0.001, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P14.t) == 0)
  PNlib.Components.TD T28(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P15.t) == 0)
  PNlib.Components.TD T29(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P16.t) == 0)
  PNlib.Components.TD T30(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P17.t) == 0)
  PNlib.Components.TD T31(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P18.t) == 0)
  PNlib.Components.TD T32(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P19.t) == 0)
  PNlib.Components.PD P14(nOut = 1, nIn = 1)
  PNlib.Components.TD T33(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P14.t)}, arcWeightOut = {pre(P14.t)}, firingCon = pre(P14.t) > 0)
  PNlib.Components.PD P15(nOut = 1, nIn = 1)
  PNlib.Components.PD P16(nOut = 1, nIn = 1)
  PNlib.Components.PD P17(nOut = 1, nIn = 1)
  PNlib.Components.PD P18(nOut = 1, nIn = 1)
  PNlib.Components.PD P19(nOut = 1, nIn = 1)
  PNlib.Components.TD T34(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P15.t)}, arcWeightOut = {pre(P15.t)}, firingCon = pre(P15.t) > 0)
  PNlib.Components.TD T35(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P16.t)}, arcWeightOut = {pre(P16.t)}, firingCon = pre(P16.t) > 0)
  PNlib.Components.TD T36(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P17.t)}, arcWeightOut = {pre(P17.t)}, firingCon = pre(P17.t) > 0)
  PNlib.Components.TD T37(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P18.t)}, arcWeightOut = {pre(P18.t)}, firingCon = pre(P18.t) > 0)
  PNlib.Components.TD T38(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P19.t)}, arcWeightOut = {pre(P19.t)}, firingCon = pre(P19.t) > 0)
  PNlib.Components.TD T39(nIn = 1, nOut = 1, delay = 0.001, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P20.t) == 0)
  PNlib.Components.PD P20(nOut = 1, nIn = 1)
  PNlib.Components.TD T40(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P20.t)}, arcWeightOut = {pre(P20.t)}, firingCon = pre(P20.t) > 0)
  PNlib.Components.TD T41(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P21.t) == 0)
  PNlib.Components.PD P21(nOut = 1, nIn = 1)
  PNlib.Components.TD T42(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P21.t)}, arcWeightOut = {pre(P21.t)}, firingCon = pre(P21.t) > 0)
  PNlib.Components.PD P22(nOut = 1, nIn = 1)
  PNlib.Components.PD P23(nOut = 1, nIn = 1)
  PNlib.Components.PD P24(nOut = 1, nIn = 1)
  PNlib.Components.PD P25(nOut = 1, nIn = 1)
  PNlib.Components.TD T43(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P22.t)}, arcWeightOut = {pre(P22.t)}, firingCon = pre(P22.t) > 0)
  PNlib.Components.TD T44(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P23.t)}, arcWeightOut = {pre(P23.t)}, firingCon = pre(P23.t) > 0)
  PNlib.Components.TD T45(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P24.t)}, arcWeightOut = {pre(P24.t)}, firingCon = pre(P24.t) > 0)
  PNlib.Components.TD T46(nOut = 1, nIn = 1, delay = delay, arcWeightIn = {pre(P25.t)}, arcWeightOut = {pre(P25.t)}, firingCon = pre(P25.t) > 0)
  PNlib.Components.TD T47(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P22.t) == 0)
  PNlib.Components.TD T48(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P23.t) == 0)
  PNlib.Components.TD T49(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P24.t) == 0)
  PNlib.Components.TD T50(nIn = 1, delay = 0.001, nOut = 1, arcWeightIn = {pre(Puffer.t)}, arcWeightOut = {pre(Puffer.t)}, firingCon = pre(Puffer.t) > 0 and pre(P25.t) == 0)
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  discrete Real fireTime;
equation
  fire = T1.fire or T2.fire or T3.fire or T4.fire or T5.fire or T6.fire;
  when fire then
    fireTime = time;
    ani = true;
  end when;
  fireColor = if (fireTime + settings.timeFire >= time and settings.animateTransition and ani) then {255, 255, 0} else {128, 255, 0};
  connect(Puffer.outTransition[1], T1.inPlaces[1])
  connect(Puffer.outTransition[2], T2.inPlaces[1])
  connect(Puffer.outTransition[3], T3.inPlaces[1])
  connect(Puffer.outTransition[4], T4.inPlaces[1])
  connect(Puffer.outTransition[5], T5.inPlaces[1])
  connect(Puffer.outTransition[6], T6.inPlaces[1])
  connect(P1.outTransition[1], T7.inPlaces[1])
  connect(T1.outPlaces[1], P1.inTransition[1])
  connect(T2.outPlaces[1], P2.inTransition[1])
  connect(T3.outPlaces[1], P3.inTransition[1])
  connect(T4.outPlaces[1], P4.inTransition[1])
  connect(T5.outPlaces[1], P5.inTransition[1])
  connect(T6.outPlaces[1], P6.inTransition[1])
  connect(P2.outTransition[1], T8.inPlaces[1])
  connect(P3.outTransition[1], T9.inPlaces[1])
  connect(P4.outTransition[1], T10.inPlaces[1])
  connect(P5.outTransition[1], T11.inPlaces[1])
  connect(P6.outTransition[1], T12.inPlaces[1])
  connect(T7.outPlaces[1], P7.inTransition[1])
  connect(T8.outPlaces[1], P7.inTransition[2])
  connect(T9.outPlaces[1], P7.inTransition[3])
  connect(T10.outPlaces[1], P7.inTransition[4])
  connect(T11.outPlaces[1], P7.inTransition[5])
  connect(T12.outPlaces[1], P7.inTransition[6])
  connect(T13.outPlaces[1], Puffer.inTransition[1])
  connect(T13.inPlaces[1], inPlaces1)
  connect(P7.outTransition[1], T14.inPlaces[1])
  connect(T14.outPlaces[1], outPlaces1)
  connect(T15.outPlaces[1], P8.inTransition[1])
  connect(P8.outTransition[1], T16.inPlaces[1])
  connect(T17.outPlaces[1], P9.inTransition[1])
  connect(P9.outTransition[1], T18.inPlaces[1])
  connect(T19.outPlaces[1], P10.inTransition[1])
  connect(T20.outPlaces[1], P11.inTransition[1])
  connect(T21.outPlaces[1], P12.inTransition[1])
  connect(T22.outPlaces[1], P13.inTransition[1])
  connect(P13.outTransition[1], T26.inPlaces[1])
  connect(P12.outTransition[1], T25.inPlaces[1])
  connect(P11.outTransition[1], T24.inPlaces[1])
  connect(P10.outTransition[1], T23.inPlaces[1])
  connect(Puffer.outTransition[7], T15.inPlaces[1])
  connect(Puffer.outTransition[8], T17.inPlaces[1])
  connect(Puffer.outTransition[9], T19.inPlaces[1])
  connect(Puffer.outTransition[10], T20.inPlaces[1])
  connect(Puffer.outTransition[11], T21.inPlaces[1])
  connect(Puffer.outTransition[12], T22.inPlaces[1])
  connect(T16.outPlaces[1], P7.inTransition[7])
  connect(T18.outPlaces[1], P7.inTransition[8])
  connect(T23.outPlaces[1], P7.inTransition[9])
  connect(T24.outPlaces[1], P7.inTransition[10])
  connect(T25.outPlaces[1], P7.inTransition[11])
  connect(T26.outPlaces[1], P7.inTransition[12])
  connect(P14.outTransition[1], T33.inPlaces[1])
  connect(T27.outPlaces[1], P14.inTransition[1])
  connect(T28.outPlaces[1], P15.inTransition[1])
  connect(T29.outPlaces[1], P16.inTransition[1])
  connect(T30.outPlaces[1], P17.inTransition[1])
  connect(T31.outPlaces[1], P18.inTransition[1])
  connect(T32.outPlaces[1], P19.inTransition[1])
  connect(P15.outTransition[1], T34.inPlaces[1])
  connect(P16.outTransition[1], T35.inPlaces[1])
  connect(P17.outTransition[1], T36.inPlaces[1])
  connect(P18.outTransition[1], T37.inPlaces[1])
  connect(P19.outTransition[1], T38.inPlaces[1])
  connect(T39.outPlaces[1], P20.inTransition[1])
  connect(P20.outTransition[1], T40.inPlaces[1])
  connect(T41.outPlaces[1], P21.inTransition[1])
  connect(P21.outTransition[1], T42.inPlaces[1])
  connect(T47.outPlaces[1], P22.inTransition[1])
  connect(T48.outPlaces[1], P23.inTransition[1])
  connect(T49.outPlaces[1], P24.inTransition[1])
  connect(T50.outPlaces[1], P25.inTransition[1])
  connect(P25.outTransition[1], T46.inPlaces[1])
  connect(P24.outTransition[1], T45.inPlaces[1])
  connect(P23.outTransition[1], T44.inPlaces[1])
  connect(P22.outTransition[1], T43.inPlaces[1])
  connect(Puffer.outTransition[13], T27.inPlaces[1])
  connect(Puffer.outTransition[14], T28.inPlaces[1])
  connect(Puffer.outTransition[15], T29.inPlaces[1])
  connect(Puffer.outTransition[16], T30.inPlaces[1])
  connect(Puffer.outTransition[17], T31.inPlaces[1])
  connect(Puffer.outTransition[18], T32.inPlaces[1])
  connect(Puffer.outTransition[19], T39.inPlaces[1])
  connect(Puffer.outTransition[20], T41.inPlaces[1])
  connect(Puffer.outTransition[21], T47.inPlaces[1])
  connect(Puffer.outTransition[22], T48.inPlaces[1])
  connect(Puffer.outTransition[23], T49.inPlaces[1])
  connect(Puffer.outTransition[24], T50.inPlaces[1])
  connect(T33.outPlaces[1], P7.inTransition[13])
  connect(T34.outPlaces[1], P7.inTransition[14])
  connect(T35.outPlaces[1], P7.inTransition[15])
  connect(T36.outPlaces[1], P7.inTransition[16])
  connect(T37.outPlaces[1], P7.inTransition[17])
  connect(T38.outPlaces[1], P7.inTransition[18])
  connect(T40.outPlaces[1], P7.inTransition[19])
  connect(T42.outPlaces[1], P7.inTransition[20])
  connect(T43.outPlaces[1], P7.inTransition[21])
  connect(T44.outPlaces[1], P7.inTransition[22])
  connect(T45.outPlaces[1], P7.inTransition[23])
  connect(T46.outPlaces[1], P7.inTransition[24])
end Waiting;


within PNlib.Examples.Models.PNproBP;

model Workload
  Real cap;
  Modelica.Blocks.Interfaces.IntegerInput u
  Integer[3] color;
protected
  Real help1;
algorithm
  when u == 0 then
    help1 := time;
    color := {255, 0, 0};
  elsewhen u > 0 then
    cap := cap + time - help1;
    color := {128, 255, 0};
  end when;
end Workload;


arc weights of output place.

within PNlib.Examples.Models.PNproBP;

model XOR
  parameter Real upperProb = 0.5;
  parameter Real lowerProb = 0.5;
  Real arcWeightOut1 = 1 "arc weights of output place"
  Real arcWeightOut2 = 1 "arc weights of output place"
  PNlib.Components.TD T1(nIn = 1, nOut = 1, arcWeightOut = {arcWeightOut1}, delay = 0.0001)
  PNlib.Components.TD T2(nIn = 1, nOut = 1, arcWeightOut = {arcWeightOut2}, delay = 0.0001)
  PNlib.Components.PD P1(nIn = 1, nOut = 2, enablingType = PNlib.Types.EnablingType.Probability, enablingProbOut = {upperProb, lowerProb}, maxTokens = 1)
  PNlib.Components.TD T3(nOut = 1, nIn = 1, delay = 0.0001)
  Interfaces.TransitionIn inPlaces1
  Interfaces.TransitionOut outPlaces1
  Interfaces.TransitionOut outPlaces2
  Boolean fire "firability of continuous transition";
  Integer fireColor[3] "for animation";
  Boolean ani "for transition animation";
protected
  outer PNlib.Components.Settings settings "global settings for animation and display";
  discrete Real fireTime;
equation
  fire = T1.fire or T2.fire;
  when fire then
    fireTime = time;
    ani = true;
  end when;
  fireColor = if (fireTime + settings.timeFire >= time and settings.animateTransition and ani) then {255, 255, 0} else {85, 170, 255};
  connect(T3.outPlaces[1], P1.inTransition[1])
  connect(T3.inPlaces[1], inPlaces1)
  connect(P1.outTransition[1], T1.inPlaces[1])
  connect(P1.outTransition[2], T2.inPlaces[1])
  connect(T1.outPlaces[1], outPlaces1)
  connect(T2.outPlaces[1], outPlaces2)
end XOR;


counter for paper, examples, maculations, ....

within PNlib.Examples.Models.Printing;

model Counter "counter for paper, examples, maculations, ..."
  parameter String text = "counter";
  parameter Real color[3] = {255, 0, 0};
  Modelica.Blocks.Interfaces.RealInput levelSensor
  Real count;
  parameter Integer hmax = 1000000;
  Real levelSensor_ = if levelSensor > 0 then levelSensor else 0;
equation
  count = levelSensor_/hmax;
end Counter;