Working Matlab code
This commit is contained in:
103
matlab/src/initializeAPA.m
Normal file
103
matlab/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
matlab/src/initializeBotFlexibleJoint.m
Normal file
45
matlab/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
matlab/src/initializeTopFlexibleJoint.m
Normal file
45
matlab/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