Skip to content

Commit 369dff2

Browse files
committed
Some progress
1 parent b6bbdac commit 369dff2

File tree

6 files changed

+78
-17
lines changed

6 files changed

+78
-17
lines changed

docs/src/components.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ CurrentModule = WinchControllers
55
```@docs
66
Integrator
77
Integrator(dt, i=1.0, x0=0.0)
8-
reset
9-
calc_output
10-
on_timer
8+
reset(int::Integrator, x0=0.0)
9+
calc_output(int::Integrator, input)
10+
on_timer(int::Integrator)
11+
```
12+
13+
## UnitDelay
14+
```@docs
15+
UnitDelay
16+
reset(ud::UnitDelay)
17+
calc_output(ud::UnitDelay, input)
18+
on_timer(ud::UnitDelay)
19+
```
20+
21+
## CalcVSetIn
22+
```@docs
23+
set_vset_pc(cvi::CalcVSetIn, v_set_pc, force)
24+
calc_output(cvi::CalcVSetIn)
1125
```

docs/src/functions.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
```@meta
22
CurrentModule = WinchControllers
33
```
4-
## Input functions
5-
```@docs
6-
set_vset_pc
7-
```
84

95
## Output functions
106
```@docs

docs/src/types.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CurrentModule = WinchControllers
66

77
## Control components
88
```@docs
9-
UnitDelay
109
RateLimiter
1110
Mixer_2CH
1211
Mixer_3CH

src/components.jl

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@ $(TYPEDFIELDS)
2727
end
2828

2929
"""
30-
Integrator(dt, i=1.0, x0=0.0)
30+
function Integrator(dt, i=1.0, x0=0.0)
3131
3232
Constructor for discrete integrator with external reset.
3333
3434
# Parameters
35-
3635
- dt: timestep [s]
3736
- i: integration constant
3837
- x0: initial and last output
38+
39+
# Returns
40+
- a new struct of type `Integrator`
3941
"""
4042
function Integrator(dt, i=1.0, x0=0.0)
4143
Integrator(dt, i, x0, x0)
@@ -47,9 +49,11 @@ end
4749
Reset the integrator `int` to the value `x0`.
4850
4951
# Parameters
50-
5152
- int::Integrator: An integrator struct
5253
- x0: default value =0.0; initial and last output
54+
55+
# Returns
56+
- nothing
5357
"""
5458
function reset(int::Integrator, x0=0.0)
5559
int.output = x0
@@ -66,6 +70,9 @@ Calculate and return the output without updating `last_output`.
6670
6771
- int::Integrator: An integrator struct
6872
- input: The input value
73+
74+
# Returns
75+
- the output value
6976
"""
7077
function calc_output(int::Integrator, input)
7178
int.output = int.last_output + input * int.i * int.dt
@@ -79,6 +86,9 @@ Update the field `last_output`. Must be called once per time-step.
7986
# Parameters
8087
8188
- int::Integrator: An integrator struct
89+
90+
# Returns
91+
- nothing
8292
"""
8393
function on_timer(int::Integrator)
8494
int.last_output = int.output
@@ -99,18 +109,55 @@ $(TYPEDFIELDS)
99109
last_input = 0
100110
end
101111

112+
"""
113+
calc_output(ud::UnitDelay, input)
114+
115+
Calculate and return the output and update the `last_input`, but not the `last_output`.
116+
117+
# Parameters
118+
- int::UnitDelay: A `UnitDelay` struct
119+
- input: The input value
120+
121+
# Returns
122+
- the last output
123+
"""
102124
function calc_output(ud::UnitDelay, input)
103125
ud.last_input = input
104126
ud.last_output
105127
end
106128

129+
"""
130+
on_timer(ud::UnitDelay)
131+
132+
Update the field `last_output`. Must be called once per time-step.
133+
134+
# Parameters
135+
136+
- ud::UnitDelay: A UnitDelay struct
137+
138+
# Returns
139+
- nothing
140+
"""
107141
function on_timer(ud::UnitDelay)
108142
ud.last_output = ud.last_input
143+
nothing
109144
end
110145

146+
"""
147+
reset(ud::UnitDelay)
148+
149+
Reset the `last_input` and `last_output` of the struct ud to zero.
150+
151+
# Parameters
152+
- ud::UnitDelay: A `UnitDelay` struct
153+
154+
# Returns
155+
- nothing
156+
"""
111157
function reset(ud::UnitDelay)
112158
ud.last_input = 0.0
113159
ud.last_output = 0.0
160+
nothing
114161
end
115162

116163
"""

src/wc_components.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ end
4444
set_vset_pc(cvi::CalcVSetIn, v_set_pc, force)
4545
4646
Parameters:
47-
- force: measured tether force [N]
48-
- v_set_pc: only used during manual operation or park-at-length. If it is `nothing`,
49-
v_set_in is calculated as function of the force.
47+
- force: measured tether force [N]
48+
- `v_set_pc`: only used during manual operation or park-at-length. If it is `nothing`,
49+
`v_set_in` is calculated as function of the force.
50+
51+
Returns:
52+
- nothing
5053
"""
5154
function set_vset_pc(cvi::CalcVSetIn, v_set_pc, force=nothing)
5255
if isnothing(v_set_pc)
@@ -62,7 +65,11 @@ end
6265
"""
6366
calc_output(cvi::CalcVSetIn)
6467
65-
Returns v_set_in: Either v_set, or a value, proportional to the sqare root of the force.
68+
## Parameters
69+
- cvi::CalcVSetIn: A struct of type CalcVSetIn
70+
71+
## Returns
72+
- `v_set_in`: Either `v_set`, or a value, proportional to the square root of the force.
6673
"""
6774
function calc_output(cvi::CalcVSetIn)
6875
calc_output(cvi.mixer2, cvi.input_a, cvi.input_b)

src/winchcontroller.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Winch winch controller component, implemented as described in the PhD thesis of Uwe Fechner.
22
@enum WinchControllerState wcsLowerForceLimit wcsSpeedControl wcsUpperForceLimit
33

4-
5-
64
"""
75
mutable struct WinchController
86

0 commit comments

Comments
 (0)