diff --git a/identification/id_nano_station.m b/identification/id_nano_station.m index fa4cc01..ac5d3ed 100644 --- a/identification/id_nano_station.m +++ b/identification/id_nano_station.m @@ -6,6 +6,8 @@ K = tf(zeros(6)); K_iff = tf(zeros(6)); save('./mat/controllers.mat', 'K', 'K_iff', '-append'); +initializeInputs(); + %% Light Sample initializeSample(struct('mass', 1)); diff --git a/identification/id_plant_variation.m b/identification/id_plant_variation.m new file mode 100644 index 0000000..de06306 --- /dev/null +++ b/identification/id_plant_variation.m @@ -0,0 +1,28 @@ +%% +clear; close all; clc; + +%% +K = tf(zeros(6)); +K_iff = tf(zeros(6)); +save('./mat/controllers.mat', 'K', 'K_iff', '-append'); + +%% Light Sample +initializeSample(struct('mass', 50)); +initializeNanoHexapod(struct('actuator', 'piezo')); + +%% Vertical Configuration +initializeInputs(); +G_vert_init = identifyPlant(); + +initializeInputs(struct('Rz', 90)); +G_vert_turn = identifyPlant(); + +%% Tilted configuration +initializeInputs(struct('Ry', 3)); +G_tilt_init = identifyPlant(); + +initializeInputs(struct('Ry', 3, 'Rz', 90)); +G_tilt_turn = identifyPlant(); + +%% Save +save('./mat/id_plant_variation.mat', 'G_vert_init', 'G_vert_turn', 'G_tilt_init', 'G_tilt_turn') diff --git a/identification/id_plant_variation_plots.m b/identification/id_plant_variation_plots.m new file mode 100644 index 0000000..7f8f360 --- /dev/null +++ b/identification/id_plant_variation_plots.m @@ -0,0 +1,24 @@ +%% +clear; close all; clc; + +%% Load +load('./mat/id_plant_variation.mat', 'G_vert_init', 'G_vert_turn', 'G_tilt_init', 'G_tilt_turn') + +%% +bodeFig({G_vert_init.G_dleg(1, 1), ... + G_vert_init.G_dleg(2, 2), ... + G_vert_init.G_dleg(3, 3), ... + G_vert_init.G_dleg(4, 4), ... + G_vert_init.G_dleg(5, 5), ... + G_vert_init.G_dleg(6, 6)}, struct('phase', true)); +xlim([1, 500]); + +%% +bodeFig({G_vert_init.G_dleg(1, 1), ... + G_vert_turn.G_dleg(1, 1),}, struct('phase', true)); +xlim([1, 500]); + +%% +bodeFig({G_vert_init.G_dleg(1, 1), ... + G_tilt_init.G_dleg(1, 1),}, struct('phase', true)); +xlim([1, 500]); diff --git a/identification/sim_nano_station_id.slx b/identification/sim_nano_station_id.slx index 24ac450..b3ba49b 100644 Binary files a/identification/sim_nano_station_id.slx and b/identification/sim_nano_station_id.slx differ diff --git a/init_simulation.m b/init_simulation.m index 8b6a0e7..75a6154 100644 --- a/init_simulation.m +++ b/init_simulation.m @@ -4,16 +4,5 @@ %% Load all the data used for the simulation load('./mat/sim_conf.mat'); -%% Load SolidWorks Data -% load('./mat/solids.mat'); - -%% Load data of each stage -% TODO - This is now loaded by mask of each stage -% load('./mat/stages.mat'); - -%% Load Signals Applied to the system -% TODO - This is now loaded by the input referenced system -% load('./mat/inputs.mat'); - %% Load Controller load('./mat/controllers.mat'); diff --git a/initialize/initializeInputs.m b/initialize/initializeInputs.m index 41908b0..3ac5d41 100644 --- a/initialize/initializeInputs.m +++ b/initialize/initializeInputs.m @@ -50,6 +50,8 @@ function [inputs] = initializeInputs(opts_param) Ry = 3*(2*pi/360)*sin(2*pi*0.2*t); elseif islogical(opts.Ry) && opts.Ry == false Ry = zeros(length(t), 1); + elseif isnumeric(opts.Ry) && length(opts.Ry) == 1 + Ry = opts.Ry*(2*pi/360)*ones(length(t), 1); else Ry = opts.Ry; end @@ -60,7 +62,7 @@ function [inputs] = initializeInputs(opts_param) elseif islogical(opts.Rz) && opts.Rz == false Rz = zeros(length(t), 1); elseif isnumeric(opts.Rz) && length(opts.Rz) == 1 - Rz = 2*pi*(opts.Rz/60)*t; + Rz = opts.Rz*(2*pi/360)*ones(length(t), 1); else Rz = opts.Rz; end diff --git a/mat/controllers.mat b/mat/controllers.mat index 45d3c6f..1b87372 100644 Binary files a/mat/controllers.mat and b/mat/controllers.mat differ diff --git a/mat/inputs.mat b/mat/inputs.mat index 8b72cd5..7ec6143 100644 Binary files a/mat/inputs.mat and b/mat/inputs.mat differ