Skip to content
Snippets Groups Projects
as_model_lin.m 1.96 KiB
Newer Older
function [A, B, C, D] = as_model_lin(ks, ku, r, bs, bu, gf, Ts)
    % AS_MODEL_LIN(...) Generate linear model matrices for greybox identification
    %
    % This function is intended to be given to greyest(). Please see
    % the source code of as_model_lin() 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
    % - gf = relative strength of the actuator between lower and upper masses
    % !! no static friction here, as it is nonlinear

    % 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)
    
    A = [
             0,      1,           0,      0;
        -ks/ms, -bs/ms,      +ks/ms,      0;
             0,      0,           0,      1;
        +ks/mu,      0, (-ks-ku)/mu, -bu/mu;
    ];
    B = [
             0,      0;
             0, +gf/ms;
             0,      0;
        +ku/mu, -gf/mu;
    ];
    C = [
        1, 0, 0, 0;
        0, 0, 1, 0;
    ];
    D = [
        0, 0;
        0, 0;
    ];
end