Newer
Older
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
function [dx, y] = as_model_nl(t, x, u, ks, ku, r, bs, bu, fs, fu, gf, FileArgument)
% AS_MODEL_NL(t, x, u, ...) Simulate a system step for nonlinear greybox identification
%
% This function is intended to be given to nlgreyest(). Please see
% the source code of as_model_nl() for explanation of what
% its parameters mean.
ms = 2.5;
mu = ms / r;
% explanation of parameters:
% - ks = stiffness of the spring between the upper and lower masses
% - ku = stiffness of the spring between the lower mass and the road platform
% - ms = mass of the upper mass
% - mu = mass of the lower mass
% - r = ratio of ms/mu. This is what is actually optimized - it seems
% that this removes an unconstrained degree of freedom in the
% parameters.
% - bs = coefficient of viscous friction between the upper mass and the guiding rail connected to the base
% - bu = coefficient of viscous friction between the lower mass and the guiding rail connected to the base
% - fs = coefficient of static friction between the upper mass and the guiding rail connected to the base
% - fu = coefficient of static friction between the lower mass and the guiding rail connected to the base
% - gf = relative strength of the actuator between lower and upper masses
% explanation of states/inputs/outputs:
% - x(1) = height of the upper mass above the base, minus its idle position
% - x(2) = speed of the upper mass wrt. the base
% - x(3) = height of the lower mass above the base, minus its idle position
% - x(4) = speed of the lower mass wrt. the base
% - u(1) = road height above the base, minus its idle position
% - u(2) = actuator control signal
% - y(1) = x(1)
% - y(2) = x(3)
zs = x(1);
dzs = x(2);
zus = x(3);
dzus = x(4);
zr = u(1);
act = u(2);
sprung_Fext = +gf*act -(zs-zus)*ks;
unsprung_Fext = -gf*act +(zs-zus)*ks + (zr-zus)*ku;
sprung_Ffri = -dzs *bs - sign(dzs) *fs;
unsprung_Ffri = -dzus*bu - sign(dzus)*fu;
dx = [
dzs;
(sprung_Fext + sprung_Ffri) / ms;
dzus;
(unsprung_Fext + unsprung_Ffri) / mu
];
y = [zs; zus];
end