Update all project: add folders with scripts
This commit is contained in:
		
							
								
								
									
										36
									
								
								active_damping/act_damp_iff_generate.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								active_damping/act_damp_iff_generate.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
%%
 | 
			
		||||
clear; close all; clc;
 | 
			
		||||
 | 
			
		||||
%% Load the transfer functions
 | 
			
		||||
load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz');
 | 
			
		||||
 | 
			
		||||
%% Load Configuration file
 | 
			
		||||
load('./mat/config.mat', 'save_fig', 'freqs');
 | 
			
		||||
 | 
			
		||||
%%
 | 
			
		||||
s = tf('s');
 | 
			
		||||
 | 
			
		||||
%% Light Voice Coil
 | 
			
		||||
%sisotool(-G_light_vc.G_iff('Fm1', 'F1')/s);
 | 
			
		||||
 | 
			
		||||
K_iff_light_vc = 105/s*tf(eye(6));
 | 
			
		||||
 | 
			
		||||
%% Light Piezo
 | 
			
		||||
%sisotool(-G_light_pz.G_iff('Fm1', 'F1')/s);
 | 
			
		||||
 | 
			
		||||
K_iff_light_pz = 3300/s*tf(eye(6));
 | 
			
		||||
 | 
			
		||||
%% Heavy Voice Coil
 | 
			
		||||
%sisotool(-G_heavy_vc.G_iff('Fm1', 'F1')/s);
 | 
			
		||||
 | 
			
		||||
K_iff_heavy_vc = 22.7/s*tf(eye(6));
 | 
			
		||||
 | 
			
		||||
%% Heavy Piezo
 | 
			
		||||
%sisotool(-G_heavy_pz.G_iff('Fm1', 'F1')/s);
 | 
			
		||||
 | 
			
		||||
K_iff_heavy_pz = 720/s*tf(eye(6));
 | 
			
		||||
 | 
			
		||||
%% Save Controllers
 | 
			
		||||
save('./mat/K_iff_sisotool.mat', ...
 | 
			
		||||
    'K_iff_light_vc', 'K_iff_light_pz', ...
 | 
			
		||||
    'K_iff_heavy_vc', 'K_iff_heavy_pz');
 | 
			
		||||
							
								
								
									
										45
									
								
								active_damping/act_damp_iff_id.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								active_damping/act_damp_iff_id.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
%%
 | 
			
		||||
clear; close all; clc;
 | 
			
		||||
 | 
			
		||||
%% Load Configuration file
 | 
			
		||||
load('./mat/config.mat', 'save_fig', 'freqs');
 | 
			
		||||
 | 
			
		||||
%% Load controllers
 | 
			
		||||
load('./mat/K_iff_sisotool.mat', ...
 | 
			
		||||
    'K_iff_light_vc', 'K_iff_light_pz', ...
 | 
			
		||||
    'K_iff_heavy_vc', 'K_iff_heavy_pz');
 | 
			
		||||
 | 
			
		||||
%%
 | 
			
		||||
initializeSample(struct('mass', 1));
 | 
			
		||||
 | 
			
		||||
initializeHexapod(struct('actuator', 'lorentz'));
 | 
			
		||||
K_iff = K_iff_light_vc; %#ok
 | 
			
		||||
save('./mat/controllers.mat', 'K_iff', '-append');
 | 
			
		||||
 | 
			
		||||
G_light_vc_iff = identifyPlant();
 | 
			
		||||
 | 
			
		||||
initializeHexapod(struct('actuator', 'piezo'));
 | 
			
		||||
K_iff = K_iff_light_pz; %#ok
 | 
			
		||||
save('./mat/controllers.mat', 'K_iff', '-append');
 | 
			
		||||
 | 
			
		||||
G_light_pz_iff = identifyPlant();
 | 
			
		||||
 | 
			
		||||
%%
 | 
			
		||||
initializeSample(struct('mass', 50));
 | 
			
		||||
 | 
			
		||||
initializeHexapod(struct('actuator', 'lorentz'));
 | 
			
		||||
K_iff = K_iff_heavy_vc; %#ok
 | 
			
		||||
save('./mat/controllers.mat', 'K_iff', '-append');
 | 
			
		||||
 | 
			
		||||
G_heavy_vc_iff = identifyPlant();
 | 
			
		||||
 | 
			
		||||
initializeHexapod(struct('actuator', 'piezo'));
 | 
			
		||||
K_iff = K_iff_heavy_pz;
 | 
			
		||||
save('./mat/controllers.mat', 'K_iff', '-append');
 | 
			
		||||
 | 
			
		||||
G_heavy_pz_iff = identifyPlant();
 | 
			
		||||
 | 
			
		||||
%% Save the obtained transfer functions
 | 
			
		||||
save('./mat/G_iff.mat', ...
 | 
			
		||||
    'G_light_vc_iff', 'G_light_pz_iff', ...
 | 
			
		||||
    'G_heavy_vc_iff', 'G_heavy_pz_iff');
 | 
			
		||||
							
								
								
									
										133
									
								
								active_damping/act_damp_iff_plots.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								active_damping/act_damp_iff_plots.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,133 @@
 | 
			
		||||
%%
 | 
			
		||||
clear; close all; clc;
 | 
			
		||||
 | 
			
		||||
%% Load Configuration file
 | 
			
		||||
load('./mat/config.mat', 'save_fig', 'freqs');
 | 
			
		||||
 | 
			
		||||
%% Load
 | 
			
		||||
load('./mat/G_iff.mat', 'G_light_vc_iff', 'G_light_pz_iff', 'G_heavy_vc_iff', 'G_heavy_pz_iff');
 | 
			
		||||
load('./mat/G.mat', 'G_light_vc', 'G_light_pz', 'G_heavy_vc', 'G_heavy_pz');
 | 
			
		||||
 | 
			
		||||
%% New Damped Plant - Horizontal Direction
 | 
			
		||||
figure;
 | 
			
		||||
% Amplitude
 | 
			
		||||
ax1 = subaxis(2,1,1);
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
set(gca, 'XTickLabel',[]);
 | 
			
		||||
ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
% Phase
 | 
			
		||||
ax2 = subaxis(2,1,2);
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'VC - Light');
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dx', 'Fx'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light');
 | 
			
		||||
set(gca,'ColorOrderIndex',1)
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy');
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz_iff.G_cart('Dx', 'Fx'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy');
 | 
			
		||||
set(gca,'xscale','log');
 | 
			
		||||
yticks(-180:90:180);
 | 
			
		||||
ylim([-180 180]);
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
 | 
			
		||||
legend('Location', 'southwest');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
linkaxes([ax1,ax2],'x');
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_hori_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
 | 
			
		||||
%% New Damped Plant - Vertical Direction
 | 
			
		||||
figure;
 | 
			
		||||
% Amplitude
 | 
			
		||||
ax1 = subaxis(2,1,1);
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
set(gca, 'XTickLabel',[]);
 | 
			
		||||
ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
% Phase
 | 
			
		||||
ax2 = subaxis(2,1,2);
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'VC - Light');
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz.G_cart('Dz', 'Fz'), freqs, 'Hz'))), 'DisplayName', 'PZ - Light');
 | 
			
		||||
set(gca,'ColorOrderIndex',1)
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_vc_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'VC - Heavy');
 | 
			
		||||
plot(freqs, 180/pi*angle(squeeze(freqresp(G_light_pz_iff.G_cart('Dz', 'Fz'), freqs, 'Hz'))), '--', 'DisplayName', 'PZ - Heavy');
 | 
			
		||||
set(gca,'xscale','log');
 | 
			
		||||
yticks(-180:90:180);
 | 
			
		||||
ylim([-180 180]);
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
 | 
			
		||||
legend('Location', 'southwest');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
linkaxes([ax1,ax2],'x');
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_vert_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
 | 
			
		||||
%% Ground motion Transmissibility - Horizontal Direction
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dx', 'Dbx'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dx', 'Dbx'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_db('Dx', 'Dbx'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_db_hori_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
 | 
			
		||||
%% Ground motion Transmissibility - Vertical Direction
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_db('Dz', 'Dbz'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_db('Dz', 'Dbz'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_db('Dz', 'Dbz'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_db_vert_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
 | 
			
		||||
%% Direct Forces Compliance - Horizontal Direction
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fi('Dx', 'Fix'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fi('Dx', 'Fix'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_fi('Dx', 'Fix'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_fi('Dx', 'Fix'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_fi_hori_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
 | 
			
		||||
%% Direct Forces Compliance - Vertical Direction
 | 
			
		||||
figure;
 | 
			
		||||
hold on;
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc.G_fi('Dz', 'Fiz'), freqs, 'Hz'))));
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz.G_fi('Dz', 'Fiz'), freqs, 'Hz'))));
 | 
			
		||||
set(gca,'ColorOrderIndex',1);
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_vc_iff.G_fi('Dz', 'Fiz'), freqs, 'Hz'))), '--');
 | 
			
		||||
plot(freqs, abs(squeeze(freqresp(G_light_pz_iff.G_fi('Dz', 'Fiz'), freqs, 'Hz'))), '--');
 | 
			
		||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
 | 
			
		||||
xlabel('Frequency [Hz]'); ylabel('Amplitude [m/N]');
 | 
			
		||||
hold off;
 | 
			
		||||
 | 
			
		||||
if save_fig; exportFig('G_fi_vert_iff', 'normal-normal', struct('path', 'active_damping')); end
 | 
			
		||||
							
								
								
									
										8
									
								
								active_damping/act_damp_main.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								active_damping/act_damp_main.m
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
% Generate the IFF controls
 | 
			
		||||
run act_damp_iff_generate.m
 | 
			
		||||
 | 
			
		||||
% Identification of the damped plant
 | 
			
		||||
run act_damp_iff_id.m
 | 
			
		||||
 | 
			
		||||
% Plot new transfer functions
 | 
			
		||||
run act_damp_iff_plots.m
 | 
			
		||||
		Reference in New Issue
	
	Block a user