/
EMBrake.jl
135 lines (108 loc) · 3.59 KB
/
EMBrake.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# # Electromechanical brake
#md # !!! note "Overview"
#md # System type: Linear clocked hybrid system\
#md # State dimension: 4\
#md # Application domain: Mechanical engineering
# ## Model description
# This system models an electromechanical brake, which works as in the following
# image.
#
# ![](embrake_scheme.png)
#
# The system is described by linear differential equations:
#
# ```math
# \begin{aligned}
# \dot{x}(t) &= Ax(t) + Bu(t),\qquad u(t) ∈ \mathcal{U} \\
# y(t) &= Cx(t)
# \end{aligned}
# ```
#
# A hybrid-automaton model is depicted below.
#
# ![](embrake_automaton.png)
#
# There are two versions of this benchmark:
#
# - **Time-varying inputs**: The inputs can change arbitrarily over time:
# ``\forall t: u(t) ∈ \mathcal{U}``.
#
# - **Constant inputs**: The inputs are only uncertain in the initial value, and
# constant over time: ``u(0) ∈ \mathcal{U}``, ``\dot{u}(t) = 0.``
using ReachabilityAnalysis, SparseArrays
# ## Common functionality between model variants
# The following code is shared between all model variants.
function embrake_common(; A, Tsample, ζ, x0)
## continuous system
EMbrake = @system(x' = A * x)
## initial condition
X₀ = Singleton([0.0, 0, 0, 0])
## reset map
Ar = sparse([1, 2, 3, 4, 4], [1, 2, 2, 2, 4], [1.0, 1.0, -1.0, -Tsample, 1.0], 4, 4)
br = sparsevec([3, 4], [x0, Tsample * x0], 4)
reset_map(X) = Ar * X + br
## hybrid system with clocked affine dynamics
ha = HACLD1(EMbrake, reset_map, Tsample, ζ)
return IVP(ha, X₀)
end;
# ## Fixed parameters
# The model without parameter variation is defined below.
function embrake_no_pv(; Tsample=1.E-4, ζ=1e-6, x0=0.05)
## model's constants
L = 1.e-3
KP = 10000.0
KI = 1000.0
R = 0.5
K = 0.02
drot = 0.1
i = 113.1167
## state variables: [I, x, xe, xc]
A = Matrix([-(R + K^2 / drot)/L 0 KP/L KI/L;
K / i/drot 0 0 0;
0 0 0 0;
0 0 0 0])
return embrake_common(; A=A, Tsample=Tsample, ζ=ζ, x0=x0)
end;
# ## Parameter variation
# The model with parameter variation described below consists of changing only
# one coefficient, which corresponds to the Flow\* settings in [^SO15].
function embrake_pv_1(; Tsample=1.E-4, ζ=1e-6, Δ=3.0, x0=0.05)
## model's constants
L = 1.e-3
KP = 10000.0
KI = 1000.0
R = 0.5
K = 0.02
drot = 0.1
i = 113.1167
p = 504.0 + (-Δ .. Δ)
## state variables: [I, x, xe, xc]
A = IntervalMatrix([-p 0 KP/L KI/L;
K / i/drot 0 0 0;
0 0 0 0;
0 0 0 0])
return embrake_common(; A=A, Tsample=Tsample, ζ=ζ, x0=x0)
end;
# ## Extended parameter variation
# In the following model, considered in [^SO15], we vary all constants by χ%
# with respect to their nominal values. The variation percentage defaults to 5%.
function embrake_pv_2(; Tsample=1.E-4, ζ=1e-6, x0=0.05, χ=5.0)
## model's constants
Δ = -χ / 100 .. χ / 100
L = 1.e-3 * (1 + Δ)
KP = 10000.0 * (1 + Δ)
KI = 1000.0 * (1 + Δ)
R = 0.5 * (1 + Δ)
K = 0.02 * (1 + Δ)
drot = 0.1 * (1 + Δ)
i = 113.1167 * (1 + Δ)
## state variables: [I, x, xe, xc]
A = IntervalMatrix([-(R + K^2 / drot)/L 0 KP/L KI/L;
K / i/drot 0 0 0;
0 0 0 0;
0 0 0 0])
return embrake_common(; A=A, Tsample=Tsample, ζ=ζ, x0=x0)
end;
# ## References
# [^SO15]: Strathmann, Thomas, and Jens Oehlerking. *Verifying Properties of an
# Electro-Mechanical Braking System*. ARCH. 2015.