diff --git a/matlab/iff_measure.slx b/matlab/iff_measure.slx index 823a102..63e0923 100644 Binary files a/matlab/iff_measure.slx and b/matlab/iff_measure.slx differ diff --git a/matlab/run_batch_identification.m b/matlab/run_batch_identification.m new file mode 100644 index 0000000..d0c253a --- /dev/null +++ b/matlab/run_batch_identification.m @@ -0,0 +1,51 @@ +%% First make sure the model is open, and we are connected to the +% Speedgoat Machine. + +%% Run Multiple Simulations +my_model = 'iff_measure'; +tg = slrt; + +%% For each strut +for i_leg = 1:6 + %% Get excitation strut + p = Simulink.Mask.get([my_model, '/Subsystem7']); + p.Parameters.Value = sprintf('%i', i_leg); + + %% Connect + set_param(my_model,'SimulationCommand','connect') + + %% Run the simulation + sprintf('Start excitation for strut %i', i_leg) + set_param(my_model,'SimulationCommand','start') + + %% Wait for the simulation to finish + pause(1) + while strcmp(get_param(my_model,'SimulationStatus'), 'external') + pause(1) + end + sprintf('Finished excitation for strut %i', i_leg) + + %% Disconnect + set_param(my_model,'SimulationCommand','disconnect') + + %% Save the data + f = SimulinkRealTime.openFTP(tg); + mget(f, 'data/data.dat'); + close(f); + data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data; + + de = data(:, 1:6); % Measurment displacement (encoder) [m] + Vs = data(:, 7:12); % Force Sensor [V] + u = data(:, 13:18); % Control Output [V] + Va = data(:, 19); % Excitation Signal [V] +% Rx = data(:, 20:25); % Reference Signal [m/rad] + t = data(:, end); % Time [s] + + load('sim_data/data_sim.mat', 'Ts'); % To save Sampling Period + save('sim_data/Kiff.mat', 'Kiff'); % To save Controller + + save(sprintf('mat/frf_data_exc_strut_%i_iff_vib_table_0m.mat', i_leg), ... + 't', 'Ts', 'de', 'Vs', 'u', 'Va', 'Kiff'); + + sprintf('Saved Data for strut %i', i_leg) +end