diff --git a/Analysis/analyze_setpoint.m b/Analysis/analyze_setpoint.m new file mode 100644 index 0000000..fbc4748 --- /dev/null +++ b/Analysis/analyze_setpoint.m @@ -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') diff --git a/Assemblage.slx b/Assemblage.slx index 3e565a3..e2c58eb 100644 Binary files a/Assemblage.slx and b/Assemblage.slx differ diff --git a/Control/control_y.m b/Control/control_y.m index ae348d6..729a3d1 100644 Binary files a/Control/control_y.m and b/Control/control_y.m differ diff --git a/init_data.m b/init_data.m index bd3a330..8ec00dc 100644 --- a/init_data.m +++ b/init_data.m @@ -1,13 +1,6 @@ %% 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 = struct(); @@ -98,13 +91,6 @@ sample.mass = 50; % Sample mass [kg] sample.offset = 0; % Decentralization offset [mm] 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) field = fieldnames(element.k); diff --git a/init_inputs.m b/init_inputs.m index ade1ab7..264bfec 100644 --- a/init_inputs.m +++ b/init_inputs.m @@ -1,8 +1,19 @@ +%% +run init_sim_configuration.m +run init_data.m + %% 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 -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 = 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(:, 2) = lsim(Wxg, xg(:, 2), time_vector); % xg(:, 3) = lsim(Wxg, xg(:, 3), time_vector); -% -% r_Gm = timeseries(xg, time_vector); -% + +r_Gm = timeseries(xg, time_vector); + % figure; % 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); %% 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 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); %% -save('./mat/inputs_spindle.mat', 'r_Gm', 'r_Ty', 'r_My', 'r_u_hexa', 'r_mass', 'r_n_hexa'); \ No newline at end of file +save('./mat/inputs_setpoint.mat', 'r_setpoint', 'r_Gm', 'r_Ty', 'r_My', 'r_u_hexa', 'r_mass', 'r_n_hexa'); \ No newline at end of file diff --git a/init_sim_configuration.m b/init_sim_configuration.m new file mode 100644 index 0000000..f7ed2ad --- /dev/null +++ b/init_sim_configuration.m @@ -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] diff --git a/init_simulation.m b/init_simulation.m new file mode 100644 index 0000000..39fde47 --- /dev/null +++ b/init_simulation.m @@ -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'); diff --git a/mat/controller.mat b/mat/controller.mat index 2f69e6f..0dee083 100644 Binary files a/mat/controller.mat and b/mat/controller.mat differ diff --git a/mat/inputs_setpoint.mat b/mat/inputs_setpoint.mat new file mode 100644 index 0000000..3a5efec Binary files /dev/null and b/mat/inputs_setpoint.mat differ diff --git a/mat/inputs_spindle.mat b/mat/inputs_spindle.mat index da8bbbb..08658a5 100644 Binary files a/mat/inputs_spindle.mat and b/mat/inputs_spindle.mat differ