add all files
This commit is contained in:
91
C3-test-bench-struts/src/extractNodes.m
Normal file
91
C3-test-bench-struts/src/extractNodes.m
Normal file
@@ -0,0 +1,91 @@
|
||||
function [int_xyz, int_i, n_xyz, n_i, nodes] = extractNodes(filename)
|
||||
% extractNodes -
|
||||
%
|
||||
% Syntax: [n_xyz, nodes] = extractNodes(filename)
|
||||
%
|
||||
% Inputs:
|
||||
% - filename - relative or absolute path of the file that contains the Matrix
|
||||
%
|
||||
% Outputs:
|
||||
% - n_xyz -
|
||||
% - nodes - table containing the node numbers and corresponding dof of the interfaced DoFs
|
||||
|
||||
arguments
|
||||
filename
|
||||
end
|
||||
|
||||
fid = fopen(filename,'rt');
|
||||
|
||||
if fid == -1
|
||||
error('Error opening the file');
|
||||
end
|
||||
|
||||
n_xyz = []; % Contains nodes coordinates
|
||||
n_i = []; % Contains nodes indices
|
||||
|
||||
n_num = []; % Contains node numbers
|
||||
n_dof = {}; % Contains node directions
|
||||
|
||||
while 1
|
||||
% Read a line
|
||||
nextline = fgetl(fid);
|
||||
|
||||
% End of the file
|
||||
if ~isstr(nextline), break, end
|
||||
|
||||
% Line just before the list of nodes coordinates
|
||||
if contains(nextline, 'NODE') && ...
|
||||
contains(nextline, 'X') && ...
|
||||
contains(nextline, 'Y') && ...
|
||||
contains(nextline, 'Z')
|
||||
|
||||
while 1
|
||||
nextline = fgetl(fid);
|
||||
|
||||
if nextline < 0, break, end
|
||||
|
||||
c = sscanf(nextline, ' %f');
|
||||
|
||||
if isempty(c), break, end
|
||||
|
||||
n_xyz = [n_xyz; c(2:4)'];
|
||||
n_i = [n_i; c(1)];
|
||||
end
|
||||
end
|
||||
|
||||
if nextline < 0, break, end
|
||||
|
||||
% Line just before the list of node DOF
|
||||
if contains(nextline, 'NODE') && ...
|
||||
contains(nextline, 'LABEL')
|
||||
|
||||
while 1
|
||||
nextline = fgetl(fid);
|
||||
|
||||
if nextline < 0, break, end
|
||||
|
||||
c = sscanf(nextline, ' %d %s');
|
||||
|
||||
if isempty(c), break, end
|
||||
|
||||
n_num = [n_num; c(1)];
|
||||
|
||||
n_dof{length(n_dof)+1} = char(c(2:end)');
|
||||
end
|
||||
|
||||
nodes = table(n_num, string(n_dof'), 'VariableNames', {'node_i', 'node_dof'});
|
||||
end
|
||||
|
||||
if nextline < 0, break, end
|
||||
end
|
||||
|
||||
fclose(fid);
|
||||
|
||||
int_i = unique(nodes.('node_i')); % indices of interface nodes
|
||||
|
||||
% Extract XYZ coordinates of only the interface nodes
|
||||
if length(n_xyz) > 0 && length(n_i) > 0
|
||||
int_xyz = n_xyz(logical(sum(n_i.*ones(1, length(int_i)) == int_i', 2)), :);
|
||||
else
|
||||
int_xyz = n_xyz;
|
||||
end
|
103
C3-test-bench-struts/src/initializeAPA.m
Normal file
103
C3-test-bench-struts/src/initializeAPA.m
Normal file
@@ -0,0 +1,103 @@
|
||||
function [actuator] = initializeAPA(args)
|
||||
% initializeAPA -
|
||||
%
|
||||
% Syntax: [actuator] = initializeAPA(args)
|
||||
%
|
||||
% Inputs:
|
||||
% - args -
|
||||
%
|
||||
% Outputs:
|
||||
% - actuator -
|
||||
|
||||
arguments
|
||||
args.type char {mustBeMember(args.type,{'2dof', 'flexible frame', 'flexible'})} = '2dof'
|
||||
|
||||
% Actuator and Sensor constants
|
||||
args.Ga (1,1) double {mustBeNumeric} = 0
|
||||
args.Gs (1,1) double {mustBeNumeric} = 0
|
||||
|
||||
% For 2DoF
|
||||
args.k (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*380000
|
||||
args.ke (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*4952605
|
||||
args.ka (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*2476302
|
||||
|
||||
args.c (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*20
|
||||
args.ce (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*200
|
||||
args.ca (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*100
|
||||
|
||||
args.Leq (6,1) double {mustBeNumeric} = ones(6,1)*0.056
|
||||
|
||||
% Force Flexible APA
|
||||
args.xi (1,1) double {mustBeNumeric, mustBePositive} = 0.01
|
||||
args.d_align_bot (3,1) double {mustBeNumeric} = zeros(3,1) % [m]
|
||||
args.d_align_top (3,1) double {mustBeNumeric} = zeros(3,1) % [m]
|
||||
|
||||
% For Flexible Frame
|
||||
args.ks (1,1) double {mustBeNumeric, mustBePositive} = 235e6
|
||||
args.cs (1,1) double {mustBeNumeric, mustBePositive} = 1e1
|
||||
end
|
||||
|
||||
actuator = struct();
|
||||
|
||||
switch args.type
|
||||
case '2dof'
|
||||
actuator.type = 1;
|
||||
case 'flexible frame'
|
||||
actuator.type = 2;
|
||||
case 'flexible'
|
||||
actuator.type = 3;
|
||||
end
|
||||
|
||||
if args.Ga == 0
|
||||
switch args.type
|
||||
case '2dof'
|
||||
actuator.Ga = -2.5796;
|
||||
case 'flexible frame'
|
||||
actuator.Ga = 1; % TODO
|
||||
case 'flexible'
|
||||
actuator.Ga = 23.2;
|
||||
end
|
||||
else
|
||||
actuator.Ga = args.Ga; % Actuator gain [N/V]
|
||||
end
|
||||
|
||||
if args.Gs == 0
|
||||
switch args.type
|
||||
case '2dof'
|
||||
actuator.Gs = 466664;
|
||||
case 'flexible frame'
|
||||
actuator.Gs = 1; % TODO
|
||||
case 'flexible'
|
||||
actuator.Gs = -4898341;
|
||||
end
|
||||
else
|
||||
actuator.Gs = args.Gs; % Sensor gain [V/m]
|
||||
end
|
||||
|
||||
actuator.k = args.k; % [N/m]
|
||||
actuator.ke = args.ke; % [N/m]
|
||||
actuator.ka = args.ka; % [N/m]
|
||||
|
||||
actuator.c = args.c; % [N/(m/s)]
|
||||
actuator.ce = args.ce; % [N/(m/s)]
|
||||
actuator.ca = args.ca; % [N/(m/s)]
|
||||
|
||||
actuator.Leq = args.Leq; % [m]
|
||||
|
||||
switch args.type
|
||||
case 'flexible frame'
|
||||
actuator.K = readmatrix('APA300ML_b_mat_K.CSV'); % Stiffness Matrix
|
||||
actuator.M = readmatrix('APA300ML_b_mat_M.CSV'); % Mass Matrix
|
||||
actuator.P = extractNodes('APA300ML_b_out_nodes_3D.txt'); % Node coordinates [m]
|
||||
case 'flexible'
|
||||
actuator.K = readmatrix('full_APA300ML_K.CSV'); % Stiffness Matrix
|
||||
actuator.M = readmatrix('full_APA300ML_M.CSV'); % Mass Matrix
|
||||
actuator.P = extractNodes('full_APA300ML_out_nodes_3D.txt'); % Node coordiantes [m]
|
||||
actuator.d_align_bot = args.d_align_bot;
|
||||
actuator.d_align_top = args.d_align_top;
|
||||
end
|
||||
|
||||
actuator.xi = args.xi; % Damping ratio
|
||||
|
||||
actuator.ks = args.ks; % Stiffness of one stack [N/m]
|
||||
actuator.cs = args.cs; % Damping of one stack [N/m]
|
45
C3-test-bench-struts/src/initializeBotFlexibleJoint.m
Normal file
45
C3-test-bench-struts/src/initializeBotFlexibleJoint.m
Normal file
@@ -0,0 +1,45 @@
|
||||
function [flex_bot] = initializeBotFlexibleJoint(args)
|
||||
% initializeBotFlexibleJoint -
|
||||
%
|
||||
% Syntax: [flex_bot] = initializeBotFlexibleJoint(args)
|
||||
%
|
||||
% Inputs:
|
||||
% - args -
|
||||
%
|
||||
% Outputs:
|
||||
% - flex_bot -
|
||||
|
||||
arguments
|
||||
args.type char {mustBeMember(args.type,{'2dof', '3dof', '4dof'})} = '2dof'
|
||||
|
||||
args.kRx (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*5
|
||||
args.kRy (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*5
|
||||
args.kRz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*260
|
||||
args.kz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*7e7
|
||||
|
||||
args.cRx (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cRy (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cRz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
end
|
||||
|
||||
flex_bot = struct();
|
||||
|
||||
switch args.type
|
||||
case '2dof'
|
||||
flex_bot.type = 1;
|
||||
case '3dof'
|
||||
flex_bot.type = 2;
|
||||
case '4dof'
|
||||
flex_bot.type = 3;
|
||||
end
|
||||
|
||||
flex_bot.kRx = args.kRx;
|
||||
flex_bot.kRy = args.kRy;
|
||||
flex_bot.kRz = args.kRz;
|
||||
flex_bot.kz = args.kz;
|
||||
|
||||
flex_bot.cRx = args.cRx;
|
||||
flex_bot.cRy = args.cRy;
|
||||
flex_bot.cRz = args.cRz;
|
||||
flex_bot.cz = args.cz;
|
45
C3-test-bench-struts/src/initializeTopFlexibleJoint.m
Normal file
45
C3-test-bench-struts/src/initializeTopFlexibleJoint.m
Normal file
@@ -0,0 +1,45 @@
|
||||
function [flex_top] = initializeTopFlexibleJoint(args)
|
||||
% initializeTopFlexibleJoint -
|
||||
%
|
||||
% Syntax: [flex_top] = initializeTopFlexibleJoint(args)
|
||||
%
|
||||
% Inputs:
|
||||
% - args -
|
||||
%
|
||||
% Outputs:
|
||||
% - flex_top -
|
||||
|
||||
arguments
|
||||
args.type char {mustBeMember(args.type,{'2dof', '3dof', '4dof'})} = '2dof'
|
||||
|
||||
args.kRx (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*5
|
||||
args.kRy (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*5
|
||||
args.kRz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*260
|
||||
args.kz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*7e7
|
||||
|
||||
args.cRx (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cRy (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cRz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
args.cz (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.001
|
||||
end
|
||||
|
||||
flex_top = struct();
|
||||
|
||||
switch args.type
|
||||
case '2dof'
|
||||
flex_top.type = 1;
|
||||
case '3dof'
|
||||
flex_top.type = 2;
|
||||
case '4dof'
|
||||
flex_top.type = 3;
|
||||
end
|
||||
|
||||
flex_top.kRx = args.kRx;
|
||||
flex_top.kRy = args.kRy;
|
||||
flex_top.kRz = args.kRz;
|
||||
flex_top.kz = args.kz;
|
||||
|
||||
flex_top.cRx = args.cRx;
|
||||
flex_top.cRy = args.cRy;
|
||||
flex_top.cRz = args.cRz;
|
||||
flex_top.cz = args.cz;
|
Reference in New Issue
Block a user