Change the way simulation is initialized.
Add script to define input vectors. Add script to plot curves.
This commit is contained in:
parent
5587309cfa
commit
84bc428a18
13
Analysis/analyze_setpoint.m
Normal file
13
Analysis/analyze_setpoint.m
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
%%
|
||||||
|
Dmeas.Data = Dmeas.Data - Dmeas.Data(1, :);
|
||||||
|
|
||||||
|
%%
|
||||||
|
figure;
|
||||||
|
hold on;
|
||||||
|
plot(r_setpoint.Time, r_setpoint.Data(:, 2));
|
||||||
|
plot(Dmeas.Time, Dmeas.Data(:, 2));
|
||||||
|
legend({'Setpoint', 'Ty'})
|
||||||
|
hold off;
|
||||||
|
xlabel('Time [s]'); ylabel('Displacement [m]');
|
||||||
|
|
||||||
|
exportFig('set_time_translations', 'normal-normal')
|
BIN
Assemblage.slx
BIN
Assemblage.slx
Binary file not shown.
Binary file not shown.
14
init_data.m
14
init_data.m
@ -1,13 +1,6 @@
|
|||||||
%%
|
%%
|
||||||
run init_solidworks_data.m
|
run init_solidworks_data.m
|
||||||
|
|
||||||
%% Solver Configuration
|
|
||||||
Ts = 1e-4; % Sampling time [s]
|
|
||||||
Tsim = 5; % Simulation time [s]
|
|
||||||
|
|
||||||
%% Gravity
|
|
||||||
g = 0 ; % Gravity along the z axis [m/s^2]
|
|
||||||
|
|
||||||
%% Ground
|
%% Ground
|
||||||
ground = struct();
|
ground = struct();
|
||||||
|
|
||||||
@ -98,13 +91,6 @@ sample.mass = 50; % Sample mass [kg]
|
|||||||
sample.offset = 0; % Decentralization offset [mm]
|
sample.offset = 0; % Decentralization offset [mm]
|
||||||
sample.color = [0.9 0.1 0.1]; % Sample color
|
sample.color = [0.9 0.1 0.1]; % Sample color
|
||||||
|
|
||||||
%% Signals Applied to the system
|
|
||||||
% load('./mat/inputs_ground_motion.mat');
|
|
||||||
load('./mat/inputs_spindle.mat');
|
|
||||||
|
|
||||||
%%
|
|
||||||
load('./mat/controller.mat', 'K');
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
function element = updateDamping(element)
|
function element = updateDamping(element)
|
||||||
field = fieldnames(element.k);
|
field = fieldnames(element.k);
|
||||||
|
@ -1,8 +1,19 @@
|
|||||||
|
%%
|
||||||
|
run init_sim_configuration.m
|
||||||
|
run init_data.m
|
||||||
|
|
||||||
%%
|
%%
|
||||||
time_vector = 0:Ts:Tsim;
|
time_vector = 0:Ts:Tsim;
|
||||||
|
|
||||||
|
%% Set point [m, rad]
|
||||||
|
setpoint = zeros(length(time_vector), 6);
|
||||||
|
|
||||||
|
setpoint(ceil(1/Ts):end, 2) = 1e-6;
|
||||||
|
|
||||||
|
r_setpoint = timeseries(setpoint, time_vector);
|
||||||
|
|
||||||
%% Ground motion
|
%% Ground motion
|
||||||
r_Gm = timeseries(zeros(length(time_vector), 3), time_vector);
|
xg = zeros(length(time_vector), 3);
|
||||||
|
|
||||||
% Wxg = 1e-5*(s/(2e2)^(1/3) + 2*pi*0.1)^3/(s + 2*pi*0.1)^3;
|
% Wxg = 1e-5*(s/(2e2)^(1/3) + 2*pi*0.1)^3/(s + 2*pi*0.1)^3;
|
||||||
% Wxg = Wxg*(s/(0.5e6)^(1/3) + 2*pi*10)^3/(s + 2*pi*10)^3;
|
% Wxg = Wxg*(s/(0.5e6)^(1/3) + 2*pi*10)^3/(s + 2*pi*10)^3;
|
||||||
@ -12,9 +23,9 @@ r_Gm = timeseries(zeros(length(time_vector), 3), time_vector);
|
|||||||
% xg(:, 1) = lsim(Wxg, xg(:, 1), time_vector);
|
% xg(:, 1) = lsim(Wxg, xg(:, 1), time_vector);
|
||||||
% xg(:, 2) = lsim(Wxg, xg(:, 2), time_vector);
|
% xg(:, 2) = lsim(Wxg, xg(:, 2), time_vector);
|
||||||
% xg(:, 3) = lsim(Wxg, xg(:, 3), time_vector);
|
% xg(:, 3) = lsim(Wxg, xg(:, 3), time_vector);
|
||||||
%
|
|
||||||
% r_Gm = timeseries(xg, time_vector);
|
r_Gm = timeseries(xg, time_vector);
|
||||||
%
|
|
||||||
% figure;
|
% figure;
|
||||||
% plot(r_Gm)
|
% plot(r_Gm)
|
||||||
|
|
||||||
@ -25,9 +36,9 @@ r_Ty = timeseries(zeros(length(time_vector), 1), time_vector);
|
|||||||
r_My = timeseries(zeros(length(time_vector), 1), time_vector);
|
r_My = timeseries(zeros(length(time_vector), 1), time_vector);
|
||||||
|
|
||||||
%% Spindle
|
%% Spindle
|
||||||
% r_Mz = timeseries(zeros(length(time_vector), 1), time_vector);
|
r_Mz = timeseries(zeros(length(time_vector), 1), time_vector);
|
||||||
|
|
||||||
r_Mz = timeseries(360*time_vector*rz.k.rot', time_vector);
|
% r_Mz = timeseries(360*time_vector*rz.k.rot', time_vector);
|
||||||
|
|
||||||
%% Micro Hexapod
|
%% Micro Hexapod
|
||||||
r_u_hexa = timeseries(zeros(length(time_vector), 6), time_vector);
|
r_u_hexa = timeseries(zeros(length(time_vector), 6), time_vector);
|
||||||
@ -39,4 +50,4 @@ r_mass = timeseries(zeros(length(time_vector), 2), time_vector);
|
|||||||
r_n_hexa = timeseries(zeros(length(time_vector), 6), time_vector);
|
r_n_hexa = timeseries(zeros(length(time_vector), 6), time_vector);
|
||||||
|
|
||||||
%%
|
%%
|
||||||
save('./mat/inputs_spindle.mat', 'r_Gm', 'r_Ty', 'r_My', 'r_u_hexa', 'r_mass', 'r_n_hexa');
|
save('./mat/inputs_setpoint.mat', 'r_setpoint', 'r_Gm', 'r_Ty', 'r_My', 'r_u_hexa', 'r_mass', 'r_n_hexa');
|
6
init_sim_configuration.m
Normal file
6
init_sim_configuration.m
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
%% Solver Configuration
|
||||||
|
Ts = 1e-4; % Sampling time [s]
|
||||||
|
Tsim = 5; % Simulation time [s]
|
||||||
|
|
||||||
|
%% Gravity
|
||||||
|
g = 0 ; % Gravity along the z axis [m/s^2]
|
11
init_simulation.m
Normal file
11
init_simulation.m
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
%%
|
||||||
|
run init_sim_configuration.m
|
||||||
|
run init_data.m
|
||||||
|
|
||||||
|
%% Signals Applied to the system
|
||||||
|
% load('./mat/inputs_ground_motion.mat');
|
||||||
|
% load('./mat/inputs_spindle.mat');
|
||||||
|
load('./mat/inputs_setpoint.mat');
|
||||||
|
|
||||||
|
%%
|
||||||
|
load('./mat/controller.mat', 'K');
|
Binary file not shown.
BIN
mat/inputs_setpoint.mat
Normal file
BIN
mat/inputs_setpoint.mat
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user