test-bench-apa300ml/matlab/src/initializeAPA.m

99 lines
2.7 KiB
Mathematica
Raw Normal View History

2021-06-07 18:43:02 +02:00
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'
args.Ga (1,1) double {mustBeNumeric} = 0
args.Gs (1,1) double {mustBeNumeric} = 0
% For 2DoF
2021-06-09 19:03:07 +02:00
args.k (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*0.38e6
args.ke (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*1.75e6
args.ka (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*3e7
2021-06-07 18:43:02 +02:00
args.c (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*3e1
args.ce (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*2e1
args.ca (6,1) double {mustBeNumeric, mustBePositive} = ones(6,1)*2e1
args.Leq (6,1) double {mustBeNumeric} = ones(6,1)*0.056
% Force Flexible APA
args.xi (1,1) double {mustBeNumeric, mustBePositive} = 0.5
% 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'
2021-06-09 19:03:07 +02:00
actuator.Ga = -30.0;
2021-06-07 18:43:02 +02:00
case 'flexible frame'
actuator.Ga = 1; % TODO
case 'flexible'
actuator.Ga = 23.4;
end
else
actuator.Ga = args.Ga; % Actuator gain [N/V]
end
if args.Gs == 0
switch args.type
case '2dof'
actuator.Gs = 0.098;
case 'flexible frame'
actuator.Gs = 1; % TODO
case 'flexible'
actuator.Gs = -4674824;
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]
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]