Skip to content

Commit 5fc602e

Browse files
committed
Comments added, namespace TimeProviders removed
1 parent c2edda9 commit 5fc602e

19 files changed

Lines changed: 76 additions & 15 deletions

src/Controllers/IDynamicController.st

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
NAMESPACE Simatic.Ax.Dynamics
22
INTERFACE IDynamicController
33

4+
/// Pass process value and input
5+
/// Get next output
46
METHOD Next : LREAL
57
VAR_INPUT
68
value : LREAL;

src/Dynamics/Amplifier.st

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
NAMESPACE Simatic.Ax.Dynamics
22
CLASS Amplifier IMPLEMENTS IDynamic
33

4+
/// Amplification
45
VAR PUBLIC
56
k : LREAL := 1.0;
67
END_VAR
78

8-
// Get K
9+
/// Get amplification
910
METHOD PUBLIC GetK : LREAL
1011
GetK := k;
1112
END_METHOD
12-
// Set K
13+
/// Set ampflification
1314
METHOD PUBLIC SetK
1415
VAR_INPUT
1516
newK : LREAL;

src/Dynamics/Differentiator.st

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,27 @@ NAMESPACE Simatic.Ax.Dynamics
22
CLASS Differentiator EXTENDS FirstOrderDynamic
33

44
VAR PUBLIC
5+
/// Lead time in seconds
56
tDSeconds : LREAL;
67
END_VAR
78

89
VAR PRIVATE
910
_value : LREAL;
1011
END_VAR
1112

13+
/// Get lead time in seconds
1214
METHOD PUBLIC GetTDSeconds : LREAL
1315
GetTDSeconds := tDSeconds;
1416
END_METHOD
17+
/// Set lead time in seconds
1518
METHOD PUBLIC SetTDSeconds
1619
VAR_INPUT
1720
newTDSeconds : LREAL;
1821
END_VAR
1922
tDSeconds := newTDSeconds;
2023
END_METHOD
24+
/// Set lead time in seconds and amplification
25+
/// SetTDSeconds(newTDSeconds, k) is equivalent to SetTDSeconds(newTDSeconds * k)
2126
METHOD PUBLIC SetTDSeconds
2227
VAR_INPUT
2328
newTDSeconds : LREAL;
@@ -26,6 +31,7 @@ NAMESPACE Simatic.Ax.Dynamics
2631
THIS.SetTDSeconds(newTDSeconds * k);
2732
END_METHOD
2833

34+
/// Get last process value
2935
METHOD INTERNAL GetValue : LREAL
3036
GetValue := _value;
3137
END_METHOD

src/Dynamics/FirstOrderDynamic.st

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
USING TimeProviders;
21
NAMESPACE Simatic.Ax.Dynamics
2+
/// Dynamic exploiting the elapsed time since last call
3+
/// `elapsedTimeProvider` must be given!
34
CLASS INTERNAL ABSTRACT FirstOrderDynamic IMPLEMENTS IDynamic
45

56
VAR PUBLIC
7+
/// Provides elapsed time since last call to `Next()`
8+
/// `elapsedTimeProvider.Start()` will be called automatically on `Next()`
9+
/// User should never call `elapsedTimeProvider.Start()`!
10+
/// Unexpected behaviour could be the result.
611
elapsedTimeProvider : IElapsedSecondsProvider;
712
END_VAR
813

14+
/// Maps the process value and the elapsed time in seconds to the next output value
915
METHOD PROTECTED ABSTRACT _Next : LREAL
1016
VAR_INPUT
1117
value : LREAL;

src/Dynamics/FirstOrderOutputDynamic.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
NAMESPACE Simatic.Ax.Dynamics
2+
/// Dynamic exploiting the elapsed time since last call and last output value
3+
/// `elapsedTimeProvider` must be given!
24
CLASS INTERNAL ABSTRACT FirstOrderOutputDynamic EXTENDS FirstOrderDynamic IMPLEMENTS IOutputDynamic
35

46
VAR PRIVATE
@@ -16,6 +18,7 @@ NAMESPACE Simatic.Ax.Dynamics
1618
SetOutput := _output;
1719
END_METHOD
1820

21+
/// Maps process value, elapsed time since last call and last output value to next output value
1922
METHOD PROTECTED ABSTRACT _Next : LREAL
2023
VAR_INPUT
2124
value : LREAL;

src/Dynamics/IDynamic.st

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
NAMESPACE Simatic.Ax.Dynamics
2+
3+
/// `Next(value)`
24
INTERFACE IDynamic
35

6+
/// Pass process value
7+
/// Get next output
48
METHOD Next : LREAL
59
VAR_INPUT
610
value : LREAL;

src/Dynamics/IOutputDynamic.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
NAMESPACE Simatic.Ax.Dynamics
2+
/// `SetOutput`, extends `IDynamic, IOutputProvider`
23
INTERFACE IOutputDynamic EXTENDS IDynamic, IOutputProvider
4+
/// Set output value
5+
/// New value should be used as base for next output
36
METHOD SetOutput : LREAL
47
VAR_INPUT
58
output : LREAL;

src/Dynamics/ParallelFirstOrderDynamic.st

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
USING TimeProviders;
2-
USING TimeProviders;
31
NAMESPACE Simatic.Ax.Dynamics
2+
/// The process value is passed to two first order dynamics.
3+
/// The output values are summed up and multiplied by the factor K.
44
CLASS INTERNAL ABSTRACT ParallelFirstOrderDynamic EXTENDS FirstOrderDynamic
55

66
VAR PUBLIC
7+
/// The factor K
78
k : LREAL := 1.0;
89
END_VAR
910

1011
VAR PROTECTED
12+
/// Provides the time of the real time provider in the moment of the call to next.
13+
/// The use of a pseudo time provider ensures the same elapsed time is used by both dynamics.
14+
/// Moreover, time is saved by not calling the measuring function twice.
1115
_pseudoTimeProvider : ConstantTimeProvider;
1216
END_VAR
1317

18+
/// Get the factor K
1419
METHOD PUBLIC GetK : LREAL
1520
GetK := k;
1621
END_METHOD
22+
/// Set the factor K
1723
METHOD PUBLIC SetK
1824
VAR_INPUT
1925
newK : LREAL;
2026
END_VAR
2127
k := newK;
2228
END_METHOD
2329

30+
/// The method `Next` of one dynamic
2431
METHOD PROTECTED ABSTRACT _Next0 : LREAL
2532
VAR_INPUT
2633
value : LREAL;
2734
END_VAR
2835
END_METHOD
36+
/// The method `Next` of the other dynamic
2937
METHOD PROTECTED ABSTRACT _Next1 : LREAL
3038
VAR_INPUT
3139
value : LREAL;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
NAMESPACE Simatic.Ax.Dynamics
2+
/// `GetOutput`
23
INTERFACE IOutputProvider
4+
/// Get current output value
35
METHOD GetOutput : LREAL END_METHOD
46
END_INTERFACE
57
END_NAMESPACE

src/Signals/ConstantSignal.st

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
NAMESPACE Simatic.Ax.Dynamics
2+
/// Constantly provides `output`
23
CLASS ConstantSignal IMPLEMENTS IOutputSignal
34

45
VAR PUBLIC
6+
/// The output value
57
output : LREAL;
68
END_VAR
79

810
METHOD PUBLIC GetOutput : LREAL
911
GetOutput := output;
1012
END_METHOD
13+
14+
/// Set the output value
1115
METHOD PUBLIC SetOutput : LREAL
1216
VAR_INPUT
1317
newOutput : LREAL;

0 commit comments

Comments
 (0)