Skip to content

Commit 49d2ad4

Browse files
authored
[janitor] Simplify and remove unused code (#79)
* Simplify code * Remove unused functions
1 parent 23d0a09 commit 49d2ad4

File tree

18 files changed

+45
-278
lines changed

18 files changed

+45
-278
lines changed

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Vim buffer files
2+
[._]*.sw?
3+
*~
4+
15
# Windows image file caches
26
Thumbs.db
37
ehthumbs.db

Diff for: PNlib/Components/PD.mo

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ model PD "Discrete Place"
2020
parameter PNlib.Types.EnablingType enablingType = PNlib.Types.EnablingType.Priority "resolution type of actual conflict (type-1-conflict)" annotation(
2121
Dialog(enable = true, group = "Enabling"));
2222
parameter Integer enablingPrioIn[nIn] = 1:nIn "enabling priorities of input transitions" annotation(
23-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then true else false, group = "Enabling"));
23+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Priority, group = "Enabling"));
2424
parameter Integer enablingPrioOut[nOut] = 1:nOut "enabling priorities of output transitions" annotation(
25-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then true else false, group = "Enabling"));
25+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Priority, group = "Enabling"));
2626
parameter Real enablingProbIn[nIn] = fill(1/nIn, nIn) "enabling probabilities of input transitions" annotation(
27-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Probability then true else false, group = "Enabling"));
27+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Probability, group = "Enabling"));
2828
parameter Real enablingProbOut[nOut] = fill(1/nOut, nOut) "enabling probabilities of output transitions" annotation(
29-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Probability then true else false, group = "Enabling"));
29+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Probability, group = "Enabling"));
3030
parameter Real enablingBeneIn[nIn] = 1:nIn "enabling benefit of input transitions" annotation(
31-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
31+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3232
parameter Real enablingBeneOut[nOut] = 1:nOut "enabling benefit of output transitions" annotation(
33-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
33+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3434
parameter PNlib.Types.BenefitType benefitType = PNlib.Types.BenefitType.Greedy "enabling strategy for benefit" annotation(
35-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
35+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3636
parameter Integer N = settings.N "N+1=amount of levels" annotation(
3737
Dialog(enable = true, group = "Level Concentrations"));
3838
//****MODIFIABLE PARAMETERS AND VARIABLES END****//

Diff for: PNlib/Components/Settings.mo

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ model Settings "Global Settings for Animation and Display"
1414
parameter Boolean animatePlace = true "animation of places" annotation(
1515
Dialog(enable = true, group = "Animation"));
1616
parameter Real scale = 1 "scale factor for place animation 0-100" annotation(
17-
Dialog(enable = if animatePlace then true else false, group = "Animation"));
17+
Dialog(enable = animatePlace, group = "Animation"));
1818
parameter Boolean animateTransition = true "animation of transitions" annotation(
1919
Dialog(enable = true, group = "Animation"));
2020
parameter Real timeFire = 0.3 "time of transition animation" annotation(
21-
Dialog(enable = if animateTransition then true else false, group = "Animation"));
21+
Dialog(enable = animateTransition, group = "Animation"));
2222
parameter Boolean animatePutFireTime = true "animation of putative fire time of stochastic transitions" annotation(
2323
Dialog(enable = true, group = "Animation"));
2424
parameter Boolean animateHazardFunc = true "animation of hazard functions of stochastic transitions" annotation(

Diff for: PNlib/Components/TDS.mo

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ model TDS "Stochastic Transition with delay"
99
parameter PNlib.Types.DistributionType distributionType = PNlib.Types.DistributionType.Exponential "distribution type of delay" annotation(
1010
Dialog(enable = true, group = "Distribution"));
1111
parameter Real h = 1 "probability density" annotation(
12-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Exponential then true else false, group = "Exponential distribution"));
12+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Exponential, group = "Exponential distribution"));
1313
parameter Real a = 0 "Lower Limit" annotation(
14-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
14+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1515
parameter Real b = 1 "Upper Limit" annotation(
16-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
16+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1717
parameter Real c = 0.5 "Most likely value" annotation(
18-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular then true else false, group = "Triangular distribution"));
18+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular, group = "Triangular distribution"));
1919
parameter Real mu = 0.5 "Expected value" annotation(
20-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
20+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2121
parameter Real sigma = 1/6 "Standard deviation" annotation(
22-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
22+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2323
parameter Real E[:] = {1, 2, 3, 4, 5, 6} "Events of Discrete Distribution" annotation(
24-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
24+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2525
parameter Real P[:] = {1/6, 1/6, 1/6, 1/6, 1/6, 1/6} "Probability of Discrete Distribution" annotation(
26-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
26+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2727
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(
2828
Dialog(enable = true, group = "Arc Weights"));
2929
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(

Diff for: PNlib/Components/TES.mo

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ model TES "Stochastic Transition with event"
99
parameter PNlib.Types.DistributionType distributionType = PNlib.Types.DistributionType.Exponential "distribution type of event" annotation(
1010
Dialog(enable = true, group = "Distribution"));
1111
parameter Real h = 1 "probability density" annotation(
12-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Exponential then true else false, group = "Exponential distribution"));
12+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Exponential, group = "Exponential distribution"));
1313
parameter Real a = 0 "Lower Limit" annotation(
14-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
14+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1515
parameter Real b = 1 "Upper Limit" annotation(
16-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
16+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1717
parameter Real c = 0.5 "Most likely value" annotation(
18-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular then true else false, group = "Triangular distribution"));
18+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular, group = "Triangular distribution"));
1919
parameter Real mu = 0.5 "Expected value" annotation(
20-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
20+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2121
parameter Real sigma = 1/6 "Standard deviation" annotation(
22-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
22+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2323
parameter Real E[:] = {1, 2, 3, 4, 5, 6} "Events of Discrete Distribution" annotation(
24-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
24+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2525
parameter Real P[:] = {1/6, 1/6, 1/6, 1/6, 1/6, 1/6} "Probability of Discrete Distribution" annotation(
26-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
26+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2727
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(
2828
Dialog(enable = true, group = "Arc Weights"));
2929
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(

Diff for: PNlib/Components/TFDS.mo

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ model TFDS "Stochastic Transition with fire duration"
99
parameter PNlib.Types.DistributionType distributionType = PNlib.Types.DistributionType.Exponential "distribution type of duration" annotation(
1010
Dialog(enable = true, group = "Distribution"));
1111
parameter Real h = 1 "probability density" annotation(
12-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Exponential then true else false, group = "Exponential distribution"));
12+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Exponential, group = "Exponential distribution"));
1313
parameter Real a = 0 "Lower Limit" annotation(
14-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
14+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1515
parameter Real b = 1 "Upper Limit" annotation(
16-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Triangular, Uniform or Truncated normal distribution"));
16+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular or distributionType == PNlib.Types.DistributionType.Uniform or distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Triangular, Uniform or Truncated normal distribution"));
1717
parameter Real c = 0.5 "Most likely value" annotation(
18-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Triangular then true else false, group = "Triangular distribution"));
18+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Triangular, group = "Triangular distribution"));
1919
parameter Real mu = 0.5 "Expected value" annotation(
20-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
20+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2121
parameter Real sigma = 1/6 "Standard deviation" annotation(
22-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.TruncatedNormal then true else false, group = "Truncated normal distribution"));
22+
Dialog(enable = distributionType == PNlib.Types.DistributionType.TruncatedNormal, group = "Truncated normal distribution"));
2323
parameter Real E[:] = {1, 2, 3, 4, 5, 6} "Events of Discrete Distribution" annotation(
24-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
24+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2525
parameter Real P[:] = {1/6, 1/6, 1/6, 1/6, 1/6, 1/6} "Probability of Discrete Distribution" annotation(
26-
Dialog(enable = if distributionType == PNlib.Types.DistributionType.Discrete then true else false, group = "Discrete Probability Distribution"));
26+
Dialog(enable = distributionType == PNlib.Types.DistributionType.Discrete, group = "Discrete Probability Distribution"));
2727
Real arcWeightIn[nIn] = fill(1, nIn) "arc weights of input places" annotation(
2828
Dialog(enable = true, group = "Arc Weights"));
2929
Real arcWeightOut[nOut] = fill(1, nOut) "arc weights of output places" annotation(

Diff for: PNlib/Examples/Models/FiliP/PNerweiterungen/PDwkeit.mo

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ model PDwkeit "Discrete Place"
2020
parameter PNlib.Types.EnablingType enablingType = PNlib.Types.EnablingType.Priority "resolution type of actual conflict (type-1-conflict)" annotation(
2121
Dialog(enable = true, group = "Enabling"));
2222
parameter Integer enablingPrioIn[nIn] = 1:nIn "enabling priorities of input transitions" annotation(
23-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then true else false, group = "Enabling"));
23+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Priority, group = "Enabling"));
2424
parameter Integer enablingPrioOut[nOut] = 1:nOut "enabling priorities of output transitions" annotation(
25-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Priority then true else false, group = "Enabling"));
25+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Priority, group = "Enabling"));
2626
Real enablingProbIn[nIn] = fill(1/nIn, nIn) "enabling probabilities of input transitions" annotation(
27-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Probability then true else false, group = "Enabling"));
27+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Probability, group = "Enabling"));
2828
Real enablingProbOut[nOut] = fill(1/nOut, nOut) "enabling probabilities of output transitions" annotation(
29-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Probability then true else false, group = "Enabling"));
29+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Probability, group = "Enabling"));
3030
parameter Real enablingBeneIn[nIn] = 1:nIn "enabling benefit of input transitions" annotation(
31-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
31+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3232
parameter Real enablingBeneOut[nOut] = 1:nOut "enabling benefit of output transitions" annotation(
33-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
33+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3434
parameter PNlib.Types.BenefitType benefitType = PNlib.Types.BenefitType.Greedy "enabling strategy for benefit" annotation(
35-
Dialog(enable = if enablingType == PNlib.Types.EnablingType.Benefit then true else false, group = "Enabling"));
35+
Dialog(enable = enablingType == PNlib.Types.EnablingType.Benefit, group = "Enabling"));
3636
parameter Integer N = settings.N "N+1=amount of levels" annotation(
3737
Dialog(enable = true, group = "Level Concentrations"));
3838
//****MODIFIABLE PARAMETERS AND VARIABLES END****//

Diff for: PNlib/Examples/Models/Printing/Start_Stop.mo

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ model Start_Stop "starting and stop the printing machine"
4040
Modelica.Blocks.Math.IntegerToReal integerToReal annotation(
4141
Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-38, 28})));
4242
equation
43-
reStart = if Stop2.t > 0 then true else false;
43+
reStart = Stop2.t > 0;
4444
when Stop.t > 0 then
4545
stopTime = time;
4646
end when;

Diff for: PNlib/Functions/OddsAndEnds/boolToInt.mo

-12
This file was deleted.

Diff for: PNlib/Functions/OddsAndEnds/compare.mo

-35
This file was deleted.

Diff for: PNlib/Functions/OddsAndEnds/compareReal.mo

-11
This file was deleted.

Diff for: PNlib/Functions/OddsAndEnds/countTrue.mo

-16
This file was deleted.

0 commit comments

Comments
 (0)