Skip to content

Commit

Permalink
Make PNlib pretty (#58)
Browse files Browse the repository at this point in the history
- Added UsersGuide package
- Added components package 
- Changed nIn and nOut Annotations 
- Added some icons for packages 

== 0 out of 93 tests failed [Testing/OpenModelica, time: 1636]

Thanks at 
Georg Ferdinand Schneider
  • Loading branch information
tlask committed Nov 20, 2017
1 parent 87fcef3 commit fb0bb36
Show file tree
Hide file tree
Showing 223 changed files with 1,040 additions and 837 deletions.
4 changes: 2 additions & 2 deletions PNlib/IA.mo → PNlib/Components/IA.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within PNlib;
within PNlib.Components;
model IA "Inhibitor Arc"
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Real testValue=1 "marking that has to be deceeded to enable firing" annotation(Dialog(enable = true, group = "Inhibitor Arc"));
Expand Down Expand Up @@ -39,7 +39,7 @@ model IA "Inhibitor Arc"
{48, 36}}), iconTransformation(extent={{28, 16},
{48, 36}})));
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Integer testValueInt "integer test value (for generating events!)";
equation
if outTransition.disPlace then
Expand Down
8 changes: 4 additions & 4 deletions PNlib/PC.mo → PNlib/Components/PC.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within PNlib;
within PNlib.Components;
model PC "Continuous Place"
Real t "marking";
parameter Integer nIn=0 "number of input transitions" annotation(Dialog(connectorSizing=true));
parameter Integer nOut=0 "number of output transitions" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input transitions" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output transitions" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Real startMarks = 0 "start marks" annotation(Dialog(enable = true, group = "Marks"));
parameter Real minMarks = 0 "minimum capacity" annotation(Dialog(enable = true, group = "Marks"));
Expand Down Expand Up @@ -35,7 +35,7 @@ model PC "Continuous Place"
parameter Integer localSeedIn = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for input conflicts" annotation(Dialog(enable = true, group = "Random Number Generator"));
parameter Integer localSeedOut = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for output conflicts" annotation(Dialog(enable = true, group = "Random Number Generator"));
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Real disMarkChange "discrete mark change";
Real conMarkChange "continuous mark change";
Real arcWeightIn[nIn] "weights of input arcs";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/PD.mo → PNlib/Components/PD.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within PNlib;
within PNlib.Components;
model PD "Discrete Place"
discrete Integer t(start = startTokens, fixed=true) "marking";
parameter Integer nIn=0 "number of input transitions" annotation(Dialog(connectorSizing=true));
parameter Integer nOut=0 "number of output transitions" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input transitions" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output transitions" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Integer startTokens = 0 "start tokens" annotation(Dialog(enable = true, group = "Tokens"));
parameter Integer minTokens = 0 "minimum capacity" annotation(Dialog(enable = true, group = "Tokens"));
Expand Down Expand Up @@ -37,7 +37,7 @@ model PD "Discrete Place"
parameter Integer localSeedIn = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for input conflicts" annotation(Dialog(enable = true, group = "Random Number Generator"));
parameter Integer localSeedOut = PNlib.Functions.Random.counter() "Local seed to initialize random number generator for output conflicts" annotation(Dialog(enable = true, group = "Random Number Generator"));
protected
outer PNlib.Settings settings "global settings for animation and display";
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";
Expand Down
2 changes: 1 addition & 1 deletion PNlib/Settings.mo → PNlib/Components/Settings.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within PNlib;
within PNlib.Components;
model Settings "Global Settings for Animation and Display"
parameter Boolean showPlaceName=true "show names of places" annotation(Dialog(enable = true, group = "Display"));
parameter Boolean showTransitionName=true "show names of transitions" annotation(Dialog(enable = true, group = "Display"));
Expand Down
10 changes: 5 additions & 5 deletions PNlib/T.mo → PNlib/Components/T.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
within PNlib;
model T "Discrete Transition with delay "
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
within PNlib.Components;
model T "immediate Transition"
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(Dialog(enable = true, group = "Arc Weights"));
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(Dialog(enable = true, group = "Arc Weights"));
Boolean firingCon=true "additional firing condition" annotation(Dialog(enable = true, group = "Firing Condition"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Boolean showTransitionName=settings.showTransitionName "only for transition animation and display (Do not change!)";
Boolean showDelay=settings.showTime "only for transition animation and display (Do not change!)";
Real color[3] "only for transition animation and display (Do not change!)";
Expand Down
4 changes: 2 additions & 2 deletions PNlib/TA.mo → PNlib/Components/TA.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within PNlib;
within PNlib.Components;
model TA "Test Arc"
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Real testValue=1 "marking that has to be exceeded to enable firing" annotation(Dialog(enable = true, group = "Test Arc"));
Expand Down Expand Up @@ -32,7 +32,7 @@ model TA "Test Arc"
normalArc=normalArc,
speedSum=inPlace.speedSum) "connector for transition" annotation(Placement(transformation(extent={{28, 16}, {48, 36}}), iconTransformation(extent={{28, 16}, {48, 36}})));
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Integer testValueInt "integer test value (for generating events!)";
equation
if outTransition.disPlace then
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TC.mo → PNlib/Components/TC.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within PNlib;
within PNlib.Components;
model TC "Continuous Transition"
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real maximumSpeed=1 "maximum speed" annotation(Dialog(enable = true, group = "Maximum Speed"));
Real arcWeightIn[nIn]=fill(1, nIn) "arc weights of input places" annotation(Dialog(enable = true, group = "Arc Weights"));
Expand All @@ -15,7 +15,7 @@ model TC "Continuous Transition"
Boolean animateSpeed=settings.animateSpeed "only for transition animation and display (Do not change!)";
Real color[3] "only for transition animation and display (Do not change!)";
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Real prelimSpeed "preliminary speed";
Real tIn[nIn] "tokens of input places";
Real tOut[nOut] "tokens of output places";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TD.mo → PNlib/Components/TD.mo
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
within PNlib;
within PNlib.Components;
model TD "Discrete Transition with delay "
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real delay = 1 "delay of timed transition" annotation(Dialog(enable = true, group = "Delay"));
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(Dialog(enable = true, group = "Arc Weights"));
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(Dialog(enable = true, group = "Arc Weights"));
Boolean firingCon=true "additional firing condition" annotation(Dialog(enable = true, group = "Firing Condition"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Boolean showTransitionName=settings.showTransitionName "only for transition animation and display (Do not change!)";
Boolean showDelay=settings.showTime "only for transition animation and display (Do not change!)";
Real color[3] "only for transition animation and display (Do not change!)";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TDS.mo → PNlib/Components/TDS.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within PNlib;
within PNlib.Components;
model TDS "Stochastic Transition with delay"
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter PNlib.Types.DistributionType distributionType=PNlib.Types.DistributionType.Exponential
"distribution type of delay" annotation(Dialog(enable = true, group = "Distribution"));
Real h=1
Expand Down Expand Up @@ -40,7 +40,7 @@ model TDS "Stochastic Transition with delay"
protected
discrete Integer state128[4] "state of random number generator";
Real r128 "random number";
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
discrete Real fireTime "for transition animation";
Real tIn[nIn] "tokens of input places";
Real tOut[nOut] "tokens of output places";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TE.mo → PNlib/Components/TE.mo
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
within PNlib;
within PNlib.Components;
model TE "Discrete Transition with event"
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real event[:] = {1,2,3} "Event time of timed transition" annotation(Dialog(enable = true, group = "Event"));
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(Dialog(enable = true, group = "Arc Weights"));
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(Dialog(enable = true, group = "Arc Weights"));
Boolean firingCon=true "additional firing condition" annotation(Dialog(enable = true, group = "Firing Condition"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Boolean showTransitionName=settings.showTransitionName "only for transition animation and display (Do not change!)";
Boolean showevent=settings.showTime "only for transition animation and display (Do not change!)";
Real color[3] "only for transition animation and display (Do not change!)";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TES.mo → PNlib/Components/TES.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within PNlib;
within PNlib.Components;
model TES "Stochastic Transition with event"
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter PNlib.Types.DistributionType distributionType=PNlib.Types.DistributionType.Exponential
"distribution type of event" annotation(Dialog(enable = true, group = "Distribution"));
Real h=1
Expand Down Expand Up @@ -40,7 +40,7 @@ model TES "Stochastic Transition with event"
protected
discrete Integer state128[4] "state of random number generator";
Real r128 "random number";
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
discrete Real fireTime "for transition animation";
Real tIn[nIn] "tokens of input places";
Real tOut[nOut] "tokens of output places";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TFD.mo → PNlib/Components/TFD.mo
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
within PNlib;
within PNlib.Components;
model TFD "Discrete Transition with fire duration"
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
Real duration = 1 "duration of timed transition" annotation(Dialog(enable = true, group = "Duration"));
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(Dialog(enable = true, group = "Arc Weights"));
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(Dialog(enable = true, group = "Arc Weights"));
Boolean firingCon=true "additional firing condition" annotation(Dialog(enable = true, group = "Firing Condition"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Boolean showTransitionName=settings.showTransitionName "only for transition animation and display (Do not change!)";
Boolean showDuration=settings.showTime "only for transition animation and display (Do not change!)";
Real color[3] "only for transition animation and display (Do not change!)";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TFDS.mo → PNlib/Components/TFDS.mo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
within PNlib;
within PNlib.Components;
model TFDS "Stochastic Transition with fire duration"
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter PNlib.Types.DistributionType distributionType= PNlib.Types.DistributionType.Exponential
"distribution type of duration" annotation(Dialog(enable = true, group = "Distribution"));
Real h=1
Expand Down Expand Up @@ -36,7 +36,7 @@ model TFDS "Stochastic Transition with fire duration"
protected
discrete Integer state128[4] "state of random number generator";
Real r128 "random number";
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Real firingTimeIn "next putative firing time";
Real firingTimeOut "next putative firing time";
discrete Real fireTime "for transition animation";
Expand Down
8 changes: 4 additions & 4 deletions PNlib/TT.mo → PNlib/Components/TT.mo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within PNlib;
within PNlib.Components;
model TT "Discrete Transition"
parameter Integer nIn = 0 "number of input places" annotation(Dialog(connectorSizing=true));
parameter Integer nOut = 0 "number of output places" annotation(Dialog(connectorSizing=true));
parameter Integer nIn(min=0)= 0 "number of input places" annotation(Dialog(enable=true,group="Connector sizing"));
parameter Integer nOut(min=0)= 0 "number of output places" annotation(Dialog(enable=true,group="Connector sizing"));
//****MODIFIABLE PARAMETERS AND VARIABLES BEGIN****//
parameter Real tactIntervall = 1 "tact intervall of timed transition" annotation(Dialog(enable = true, group = "Takt"));
parameter Real tactStart = 1 "tact start of timed transition" annotation(Dialog(enable = true, group = "Takt"));
Expand All @@ -12,7 +12,7 @@ model TT "Discrete Transition"
Boolean firingCon=true "additional firing condition" annotation(Dialog(enable = true, group = "Firing Condition"));
//****MODIFIABLE PARAMETERS AND VARIABLES END****//
protected
outer PNlib.Settings settings "global settings for animation and display";
outer PNlib.Components.Settings settings "global settings for animation and display";
Boolean showTransitionName=settings.showTransitionName
"only for transition animation and display (Do not change!)";
Boolean showTakt=settings.showTime
Expand Down
5 changes: 5 additions & 0 deletions PNlib/Components/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
within PNlib;
package Components "Contains component models to compose models of petri nets."
extends Modelica.Icons.Package;

end Components;
14 changes: 14 additions & 0 deletions PNlib/Components/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PD
PC
T
TD
TDS
TE
TES
TFD
TFDS
TT
TC
TA
IA
Settings
14 changes: 7 additions & 7 deletions PNlib/Examples/ConTest/Conflict.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ within PNlib.Examples.ConTest;
model Conflict
extends Modelica.Icons.Example;

PNlib.TC T1(nOut = 1) annotation(Placement(transformation(extent={{-40, -10}, {
PNlib.Components.TC T1(nOut = 1) annotation(Placement(transformation(extent={{-40, -10}, {
-20, 10}})));
PNlib.TC T2(maximumSpeed = 2, nIn = 1, nOut = 1) annotation(Placement(transformation(extent={{20, 10},
PNlib.Components.TC T2(maximumSpeed = 2, nIn = 1, nOut = 1) annotation(Placement(transformation(extent={{20, 10},
{40, 30}})));
PNlib.TC T3(nIn = 1, nOut = 1) annotation(Placement(transformation(extent={{20, -30},
PNlib.Components.TC T3(nIn = 1, nOut = 1) annotation(Placement(transformation(extent={{20, -30},
{40, -10}})));
PNlib.PC P1(nIn = 1, nOut = 2) annotation(Placement(transformation(extent={{-10, -10},
PNlib.Components.PC P1(nIn = 1, nOut = 2) annotation(Placement(transformation(extent={{-10, -10},
{10, 10}})));
PNlib.PC P2(nIn = 1) annotation(Placement(transformation(extent={{50, 10}, {70,
PNlib.Components.PC P2(nIn = 1) annotation(Placement(transformation(extent={{50, 10}, {70,
30}})));
PNlib.PC P3(nIn = 1) annotation(Placement(transformation(extent={{50, -30}, {70,
PNlib.Components.PC P3(nIn = 1) annotation(Placement(transformation(extent={{50, -30}, {70,
-10}})));
inner PNlib.Settings settings annotation(Placement(transformation(extent={{-40, 20},
inner PNlib.Components.Settings settings annotation(Placement(transformation(extent={{-40, 20},
{-20, 40}})));
equation
connect(T1.outPlaces[1], P1.inTransition[1]) annotation(Line(points={{-25.2, 0},
Expand Down

0 comments on commit fb0bb36

Please sign in to comment.