Skip to content
Snippets Groups Projects
Verified Commit fcdfb841 authored by Jakub Vaněk's avatar Jakub Vaněk
Browse files

Added identification data and scripts from students

parent cbbb3dfd
No related branches found
No related tags found
1 merge request!1Improvements derived from semestral work
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
% Run nonlinear model identification
clear variables;
load_ident_data;
idd_to_use = merge(idd_longsweep, idd_sweep2, idd_forcesweep, idd_forcesweep2, idd_forcestep, idd_faststep);
% see the as_model_nl.m file for explanation of parameters
i_ks = 990.38;
i_ku = 2259.4;
i_r = 1.8947;
i_bs = 1.4388;
i_bu = 2.7914;
i_fs = 0.52346;
i_fu = 0.45989;
i_gf = 0.7386;
i_vars = [i_ks, i_ku, i_r, i_bs, i_bu, i_fs, i_fu, i_gf];
model = idnlgrey('as_model_nl', [2 2 4], i_vars);
model.SimulationOptions.Solver = 'ode4';
model.SimulationOptions.FixedStep = idd_to_use.Ts{1};
model.InputName = {'road', 'actuator'};
model.InputUnit = {'m', 'N'};
model.OutputName = {'zs', 'zus'};
model.OutputUnit = {'m', 'm'};
opts = nlgreyestOptions('Display', 'on');
opts.SearchOptions.MaxIterations = 50;
model_est = nlgreyest(idd_to_use, model, opts);
% see model_est.Parameters.Value
% Load identification experiments into iddata objects
% road sweeps
idd_sweep = load_road_experiment("../data/road_sweep_normal.mat");
idd_sweep2 = load_road_experiment("../data/road_sweep_normal_2.mat");
idd_lfsweep = load_road_experiment("../data/road_sweep_lf.mat");
idd_longsweep = load_road_experiment("../data/road_sweep_long.mat");
idd_hurak = load_road_experiment("../../measured_and_simulated_open_loop_responses.mat");
% road steps
idd_slowstep = load_road_experiment("../data/road_step_slow.mat");
idd_faststep = load_road_experiment("../data/road_step_fast.mat");
% actuator sweeps
idd_forcesweep = load_actuator_experiment("../data/actuator_sweep.mat");
idd_forcesweep2 = load_actuator_experiment("../data/actuator_sweep_lf_longer_v2.mat");
% actuator steps
idd_forcestep = load_actuator_experiment("../data/actuator_step.mat");
function idd = load_road_experiment(filename)
mat_file = load(filename);
Ts = mat_file.measured_pos_ol_response.time(2) - mat_file.measured_pos_ol_response.time(1);
padding = 1000;
zr = mat_file.measured_pos_ol_response.signals.values(:,1);
zus = mat_file.measured_pos_ol_response.signals.values(:,2);
zs = mat_file.measured_pos_ol_response.signals.values(:,3);
full_y = [
zeros(padding, 2);
[zs, zus]
];
full_u = [
zeros(padding, 2);
[zr, zeros(length(zr), 1)]
];
idd = create_idd(full_y, full_u, Ts);
end
function idd = load_actuator_experiment(filename)
mat_file = load(filename);
Ts = mat_file.measured_pos_ol_response.time(2) - mat_file.measured_pos_ol_response.time(1);
padding = 1000;
zus = mat_file.measured_pos_ol_response.signals.values(:,2);
zs = mat_file.measured_pos_ol_response.signals.values(:,3);
full_y = [
zeros(padding, 2);
[zs, zus]
];
full_u = [
zeros(padding, 2);
mat_file.control_signal.signals.values
];
idd = create_idd(full_y, full_u, Ts);
end
function idd = create_idd(full_y, full_u, Ts)
idd = iddata(full_y, full_u, Ts);
idd.InputName = {'road', 'actuator'};
idd.InputUnit = {'m', 'N'};
idd.OutputName = {'zs', 'zus'};
idd.OutputUnit = {'m', 'm'};
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment