diff --git a/matlab/src/initializeGranite.m b/matlab/src/initializeGranite.m index 35b79d3..2cd4b86 100644 --- a/matlab/src/initializeGranite.m +++ b/matlab/src/initializeGranite.m @@ -1,45 +1,48 @@ - function [granite] = initializeGranite(args) +function [granite] = initializeGranite(args) - arguments - args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible' - args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3] - args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = [5e9; 5e9; 5e9; 2.5e7; 2.5e7; 1e7] % [N/m] - args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = [4.0e5; 1.1e5; 9.0e5; 2e4; 2e4; 1e4] % [N/(m/s)] - args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m] - args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m] - args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m] - args.sample_pos (1,1) double {mustBeNumeric} = 0.8 % Height of the measurment point [m] - end - - granite = struct(); - - switch args.type - case 'none' - granite.type = 0; - case 'rigid' - granite.type = 1; - case 'flexible' - granite.type = 2; - end - - granite.density = args.density; % [kg/m3] - granite.STEP = 'granite.STEP'; - - granite.sample_pos = args.sample_pos; % [m] - - granite.K = args.K; % [N/m] - granite.C = args.C; % [N/(m/s)] - -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'granite', '-append'); - else - save('mat/nass_model_stages.mat', 'granite'); + arguments + args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible' + args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3] + args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = [5e9; 5e9; 5e9; 2.5e7; 2.5e7; 1e7] % [N/m] + args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = [4.0e5; 1.1e5; 9.0e5; 2e4; 2e4; 1e4] % [N/(m/s)] + args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m] + args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m] + args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m] + args.sample_pos (1,1) double {mustBeNumeric} = 0.775 % Height of the measurment point [m] end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'granite', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'granite'); + + granite = struct(); + + switch args.type + case 'none' + granite.type = 0; + case 'rigid' + granite.type = 1; + case 'flexible' + granite.type = 2; end + + granite.density = args.density; % [kg/m3] + granite.STEP = 'granite.STEP'; + + % Z-offset for the initial position of the sample with respect to the granite top surface. + granite.sample_pos = args.sample_pos; % [m] + + granite.K = args.K; % [N/m] + granite.C = args.C; % [N/(m/s)] + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'granite', '-append'); + else + save('mat/nass_model_stages.mat', 'granite'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'granite', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'granite'); + end + end + end diff --git a/matlab/src/initializeGround.m b/matlab/src/initializeGround.m index 9b16197..f679a90 100644 --- a/matlab/src/initializeGround.m +++ b/matlab/src/initializeGround.m @@ -1,34 +1,35 @@ - function [ground] = initializeGround(args) +function [ground] = initializeGround(args) - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid' - args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1) % Rotation point for the ground motion [m] - end - - ground = struct(); - - switch args.type - case 'none' - ground.type = 0; - case 'rigid' - ground.type = 1; - end - - ground.shape = [2, 2, 0.5]; % [m] - ground.density = 2800; % [kg/m3] - - ground.rot_point = args.rot_point; - -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ground', '-append'); - else - save('mat/nass_model_stages.mat', 'ground'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid' + args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1) % Rotation point for the ground motion [m] end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ground', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ground'); + + ground = struct(); + + switch args.type + case 'none' + ground.type = 0; + case 'rigid' + ground.type = 1; + end + + ground.shape = [2, 2, 0.5]; % [m] + ground.density = 2800; % [kg/m3] + + ground.rot_point = args.rot_point; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ground', '-append'); + else + save('mat/nass_model_stages.mat', 'ground'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ground', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ground'); + end end end diff --git a/matlab/src/initializeMicroHexapod.m b/matlab/src/initializeMicroHexapod.m index 5a9bc90..4c8619d 100644 --- a/matlab/src/initializeMicroHexapod.m +++ b/matlab/src/initializeMicroHexapod.m @@ -1,107 +1,108 @@ - function [micro_hexapod] = initializeMicroHexapod(args) +function [micro_hexapod] = initializeMicroHexapod(args) - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - % initializeFramesPositions - args.H (1,1) double {mustBeNumeric, mustBePositive} = 350e-3 - args.MO_B (1,1) double {mustBeNumeric} = 270e-3 - % generateGeneralConfiguration - args.FH (1,1) double {mustBeNumeric, mustBePositive} = 50e-3 - args.FR (1,1) double {mustBeNumeric, mustBePositive} = 175.5e-3 - args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180) - args.MH (1,1) double {mustBeNumeric, mustBePositive} = 45e-3 - args.MR (1,1) double {mustBeNumeric, mustBePositive} = 118e-3 - args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180) - % initializeStrutDynamics - args.Ki (6,1) double {mustBeNumeric, mustBeNonnegative} = 2e7*ones(6,1) - args.Ci (6,1) double {mustBeNumeric, mustBeNonnegative} = 1.4e3*ones(6,1) - % initializeCylindricalPlatforms - args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 10 - args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 - args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 207.5e-3 - args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 10 - args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 - args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3 - % initializeCylindricalStruts - args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 1 - args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 - args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 - args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 1 - args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 - args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 - % inverseKinematics - args.AP (3,1) double {mustBeNumeric} = zeros(3,1) - args.ARB (3,3) double {mustBeNumeric} = eye(3) - end - - stewart = initializeStewartPlatform(); - - stewart = initializeFramesPositions(stewart, ... - 'H', args.H, ... - 'MO_B', args.MO_B); - - stewart = generateGeneralConfiguration(stewart, ... - 'FH', args.FH, ... - 'FR', args.FR, ... - 'FTh', args.FTh, ... - 'MH', args.MH, ... - 'MR', args.MR, ... - 'MTh', args.MTh); - - stewart = computeJointsPose(stewart); - - stewart = initializeStrutDynamics(stewart, ... - 'K', args.Ki, ... - 'C', args.Ci); - - stewart = initializeJointDynamics(stewart, ... - 'type_F', 'universal_p', ... - 'type_M', 'spherical_p'); - - stewart = initializeCylindricalPlatforms(stewart, ... - 'Fpm', args.Fpm, ... - 'Fph', args.Fph, ... - 'Fpr', args.Fpr, ... - 'Mpm', args.Mpm, ... - 'Mph', args.Mph, ... - 'Mpr', args.Mpr); - - stewart = initializeCylindricalStruts(stewart, ... - 'Fsm', args.Fsm, ... - 'Fsh', args.Fsh, ... - 'Fsr', args.Fsr, ... - 'Msm', args.Msm, ... - 'Msh', args.Msh, ... - 'Msr', args.Msr); - - stewart = computeJacobian(stewart); - - stewart = initializeStewartPose(stewart, ... - 'AP', args.AP, ... - 'ARB', args.ARB); - - stewart = initializeInertialSensor(stewart, 'type', 'none'); - - switch args.type - case 'none' - stewart.type = 0; - case 'rigid' - stewart.type = 1; - case 'flexible' - stewart.type = 2; - end - -micro_hexapod = stewart; -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'micro_hexapod', '-append'); - else - save('mat/nass_model_stages.mat', 'micro_hexapod'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + % initializeFramesPositions + args.H (1,1) double {mustBeNumeric, mustBePositive} = 350e-3 + args.MO_B (1,1) double {mustBeNumeric} = 270e-3 + % generateGeneralConfiguration + args.FH (1,1) double {mustBeNumeric, mustBePositive} = 50e-3 + args.FR (1,1) double {mustBeNumeric, mustBePositive} = 175.5e-3 + args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180) + args.MH (1,1) double {mustBeNumeric, mustBePositive} = 45e-3 + args.MR (1,1) double {mustBeNumeric, mustBePositive} = 118e-3 + args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180) + % initializeStrutDynamics + args.Ki (6,1) double {mustBeNumeric, mustBeNonnegative} = 2e7*ones(6,1) + args.Ci (6,1) double {mustBeNumeric, mustBeNonnegative} = 1.4e3*ones(6,1) + % initializeCylindricalPlatforms + args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 10 + args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 + args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 207.5e-3 + args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 10 + args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 + args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3 + % initializeCylindricalStruts + args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 1 + args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 + args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 + args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 1 + args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 + args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 + % inverseKinematics + args.AP (3,1) double {mustBeNumeric} = zeros(3,1) + args.ARB (3,3) double {mustBeNumeric} = eye(3) end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'micro_hexapod', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'micro_hexapod'); + + stewart = initializeStewartPlatform(); + + stewart = initializeFramesPositions(stewart, ... + 'H', args.H, ... + 'MO_B', args.MO_B); + + stewart = generateGeneralConfiguration(stewart, ... + 'FH', args.FH, ... + 'FR', args.FR, ... + 'FTh', args.FTh, ... + 'MH', args.MH, ... + 'MR', args.MR, ... + 'MTh', args.MTh); + + stewart = computeJointsPose(stewart); + + stewart = initializeStrutDynamics(stewart, ... + 'K', args.Ki, ... + 'C', args.Ci); + + stewart = initializeJointDynamics(stewart, ... + 'type_F', 'universal_p', ... + 'type_M', 'spherical_p'); + + stewart = initializeCylindricalPlatforms(stewart, ... + 'Fpm', args.Fpm, ... + 'Fph', args.Fph, ... + 'Fpr', args.Fpr, ... + 'Mpm', args.Mpm, ... + 'Mph', args.Mph, ... + 'Mpr', args.Mpr); + + stewart = initializeCylindricalStruts(stewart, ... + 'Fsm', args.Fsm, ... + 'Fsh', args.Fsh, ... + 'Fsr', args.Fsr, ... + 'Msm', args.Msm, ... + 'Msh', args.Msh, ... + 'Msr', args.Msr); + + stewart = computeJacobian(stewart); + + stewart = initializeStewartPose(stewart, ... + 'AP', args.AP, ... + 'ARB', args.ARB); + + stewart = initializeInertialSensor(stewart, 'type', 'none'); + + switch args.type + case 'none' + stewart.type = 0; + case 'rigid' + stewart.type = 1; + case 'flexible' + stewart.type = 2; + end + + micro_hexapod = stewart; + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'micro_hexapod', '-append'); + else + save('mat/nass_model_stages.mat', 'micro_hexapod'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'micro_hexapod', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'micro_hexapod'); + end end end diff --git a/matlab/src/initializeRy.m b/matlab/src/initializeRy.m index ec1510b..a5275b2 100644 --- a/matlab/src/initializeRy.m +++ b/matlab/src/initializeRy.m @@ -1,54 +1,57 @@ - function [ry] = initializeRy(args) +function [ry] = initializeRy(args) - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - args.Ry_init (1,1) double {mustBeNumeric} = 0 - end - - ry = struct(); - - switch args.type - case 'none' - ry.type = 0; - case 'rigid' - ry.type = 1; - case 'flexible' - ry.type = 2; - end - - % Ry - Guide for the tilt stage - ry.guide.density = 7800; % [kg/m3] - ry.guide.STEP = 'Tilt_Guide.STEP'; - - % Ry - Rotor of the motor - ry.rotor.density = 2400; % [kg/m3] - ry.rotor.STEP = 'Tilt_Motor_Axis.STEP'; - - % Ry - Motor - ry.motor.density = 3200; % [kg/m3] - ry.motor.STEP = 'Tilt_Motor.STEP'; - - % Ry - Plateau Tilt - ry.stage.density = 7800; % [kg/m3] - ry.stage.STEP = 'Tilt_Stage.STEP'; - - ry.z_offset = 0.58178; % [m] - - ry.Ry_init = args.Ry_init; % [rad] - - ry.K = [3.8e8; 4e8; 3.8e8; 1.2e8; 6e4; 1.2e8]; - ry.C = [1e5; 1e5; 1e5; 3e4; 1e3; 3e4]; - -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ry', '-append'); - else - save('mat/nass_model_stages.mat', 'ry'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + args.Ry_init (1,1) double {mustBeNumeric} = 0 end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ry', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ry'); + + ry = struct(); + + switch args.type + case 'none' + ry.type = 0; + case 'rigid' + ry.type = 1; + case 'flexible' + ry.type = 2; end + + % Ry - Guide for the tilt stage + ry.guide.density = 7800; % [kg/m3] + ry.guide.STEP = 'Tilt_Guide.STEP'; + + % Ry - Rotor of the motor + ry.rotor.density = 2400; % [kg/m3] + ry.rotor.STEP = 'Tilt_Motor_Axis.STEP'; + + % Ry - Motor + ry.motor.density = 3200; % [kg/m3] + ry.motor.STEP = 'Tilt_Motor.STEP'; + + % Ry - Plateau Tilt + ry.stage.density = 7800; % [kg/m3] + ry.stage.STEP = 'Tilt_Stage.STEP'; + + % Z-Offset so that the center of rotation matches the sample center; + ry.z_offset = 0.58178; % [m] + + ry.Ry_init = args.Ry_init; % [rad] + + ry.K = [3.8e8; 4e8; 3.8e8; 1.2e8; 6e4; 1.2e8]; + ry.C = [1e5; 1e5; 1e5; 3e4; 1e3; 3e4]; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ry', '-append'); + else + save('mat/nass_model_stages.mat', 'ry'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ry', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ry'); + end + end + end diff --git a/matlab/src/initializeRz.m b/matlab/src/initializeRz.m index 98d863b..97bf4cf 100644 --- a/matlab/src/initializeRz.m +++ b/matlab/src/initializeRz.m @@ -1,45 +1,47 @@ - function [rz] = initializeRz(args) +function [rz] = initializeRz(args) - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - end - - rz = struct(); - - switch args.type - case 'none' - rz.type = 0; - case 'rigid' - rz.type = 1; - case 'flexible' - rz.type = 2; - end - - % Spindle - Slip Ring - rz.slipring.density = 7800; % [kg/m3] - rz.slipring.STEP = 'Spindle_Slip_Ring.STEP'; - - % Spindle - Rotor - rz.rotor.density = 7800; % [kg/m3] - rz.rotor.STEP = 'Spindle_Rotor.STEP'; - - % Spindle - Stator - rz.stator.density = 7800; % [kg/m3] - rz.stator.STEP = 'Spindle_Stator.STEP'; - - rz.K = [7e8; 7e8; 2e9; 1e7; 1e7; 1e7]; - rz.C = [4e4; 4e4; 7e4; 1e4; 1e4; 1e4]; - -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'rz', '-append'); - else - save('mat/nass_model_stages.mat', 'rz'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'rz', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'rz'); + + rz = struct(); + + switch args.type + case 'none' + rz.type = 0; + case 'rigid' + rz.type = 1; + case 'flexible' + rz.type = 2; end + + % Spindle - Slip Ring + rz.slipring.density = 7800; % [kg/m3] + rz.slipring.STEP = 'Spindle_Slip_Ring.STEP'; + + % Spindle - Rotor + rz.rotor.density = 7800; % [kg/m3] + rz.rotor.STEP = 'Spindle_Rotor.STEP'; + + % Spindle - Stator + rz.stator.density = 7800; % [kg/m3] + rz.stator.STEP = 'Spindle_Stator.STEP'; + + rz.K = [7e8; 7e8; 2e9; 1e7; 1e7; 1e7]; + rz.C = [4e4; 4e4; 7e4; 1e4; 1e4; 1e4]; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'rz', '-append'); + else + save('mat/nass_model_stages.mat', 'rz'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'rz', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'rz'); + end + end + end diff --git a/matlab/src/initializeTy.m b/matlab/src/initializeTy.m index 6730f9b..8f6f81e 100644 --- a/matlab/src/initializeTy.m +++ b/matlab/src/initializeTy.m @@ -1,69 +1,71 @@ - function [ty] = initializeTy(args) +function [ty] = initializeTy(args) - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - end - - ty = struct(); - - switch args.type - case 'none' - ty.type = 0; - case 'rigid' - ty.type = 1; - case 'flexible' - ty.type = 2; - end - - % Ty Granite frame - ty.granite_frame.density = 7800; % [kg/m3] => 43kg - ty.granite_frame.STEP = 'Ty_Granite_Frame.STEP'; - - % Guide Translation Ty - ty.guide.density = 7800; % [kg/m3] => 76kg - ty.guide.STEP = 'Ty_Guide.STEP'; - - % Ty - Guide_Translation12 - ty.guide12.density = 7800; % [kg/m3] - ty.guide12.STEP = 'Ty_Guide_12.STEP'; - - % Ty - Guide_Translation11 - ty.guide11.density = 7800; % [kg/m3] - ty.guide11.STEP = 'Ty_Guide_11.STEP'; - - % Ty - Guide_Translation22 - ty.guide22.density = 7800; % [kg/m3] - ty.guide22.STEP = 'Ty_Guide_22.STEP'; - - % Ty - Guide_Translation21 - ty.guide21.density = 7800; % [kg/m3] - ty.guide21.STEP = 'Ty_Guide_21.STEP'; - - % Ty - Plateau translation - ty.frame.density = 7800; % [kg/m3] - ty.frame.STEP = 'Ty_Stage.STEP'; - - % Ty Stator Part - ty.stator.density = 5400; % [kg/m3] - ty.stator.STEP = 'Ty_Motor_Stator.STEP'; - - % Ty Rotor Part - ty.rotor.density = 5400; % [kg/m3] - ty.rotor.STEP = 'Ty_Motor_Rotor.STEP'; - - ty.K = [2e8; 1e8; 2e8; 6e7; 9e7; 6e7]; % [N/m, N*m/rad] - ty.C = [8e4; 5e4; 8e4; 2e4; 3e4; 1e4]; % [N/(m/s), N*m/(rad/s)] - -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ty', '-append'); - else - save('mat/nass_model_stages.mat', 'ty'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ty', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ty'); + + ty = struct(); + + switch args.type + case 'none' + ty.type = 0; + case 'rigid' + ty.type = 1; + case 'flexible' + ty.type = 2; end + + % Ty Granite frame + ty.granite_frame.density = 7800; % [kg/m3] => 43kg + ty.granite_frame.STEP = 'Ty_Granite_Frame.STEP'; + + % Guide Translation Ty + ty.guide.density = 7800; % [kg/m3] => 76kg + ty.guide.STEP = 'Ty_Guide.STEP'; + + % Ty - Guide_Translation12 + ty.guide12.density = 7800; % [kg/m3] + ty.guide12.STEP = 'Ty_Guide_12.STEP'; + + % Ty - Guide_Translation11 + ty.guide11.density = 7800; % [kg/m3] + ty.guide11.STEP = 'Ty_Guide_11.STEP'; + + % Ty - Guide_Translation22 + ty.guide22.density = 7800; % [kg/m3] + ty.guide22.STEP = 'Ty_Guide_22.STEP'; + + % Ty - Guide_Translation21 + ty.guide21.density = 7800; % [kg/m3] + ty.guide21.STEP = 'Ty_Guide_21.STEP'; + + % Ty - Plateau translation + ty.frame.density = 7800; % [kg/m3] + ty.frame.STEP = 'Ty_Stage.STEP'; + + % Ty Stator Part + ty.stator.density = 5400; % [kg/m3] + ty.stator.STEP = 'Ty_Motor_Stator.STEP'; + + % Ty Rotor Part + ty.rotor.density = 5400; % [kg/m3] + ty.rotor.STEP = 'Ty_Motor_Rotor.STEP'; + + ty.K = [2e8; 1e8; 2e8; 6e7; 9e7; 6e7]; % [N/m, N*m/rad] + ty.C = [8e4; 5e4; 8e4; 2e4; 3e4; 1e4]; % [N/(m/s), N*m/(rad/s)] + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ty', '-append'); + else + save('mat/nass_model_stages.mat', 'ty'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ty', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ty'); + end + end + end diff --git a/matlab/ustation_simscape.slx b/matlab/ustation_simscape.slx index 7d260d6..af3cc85 100644 Binary files a/matlab/ustation_simscape.slx and b/matlab/ustation_simscape.slx differ diff --git a/simscape-micro-station.org b/simscape-micro-station.org index 42a60be..9b04c9c 100644 --- a/simscape-micro-station.org +++ b/simscape-micro-station.org @@ -3202,549 +3202,392 @@ function [xc,yc,R,a] = circlefit(x,y) ** Initialize Micro-Station Stages *** =initializeGround=: Ground -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeGround.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: +#+begin_src matlab :tangle matlab/src/initializeGround.m :comments none :mkdirp yes :eval no +function [ground] = initializeGround(args) -**** Function description -#+begin_src matlab - function [ground] = initializeGround(args) -#+end_src - -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid' - args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1) % Rotation point for the ground motion [m] - end -#+end_src - -**** Structure initialization -First, we initialize the =granite= structure. -#+begin_src matlab - ground = struct(); -#+end_src - -**** Add Type -#+begin_src matlab - switch args.type - case 'none' - ground.type = 0; - case 'rigid' - ground.type = 1; - end -#+end_src - -**** Ground Solid properties -We set the shape and density of the ground solid element. -#+begin_src matlab - ground.shape = [2, 2, 0.5]; % [m] - ground.density = 2800; % [kg/m3] -#+end_src - -**** Rotation Point - -#+begin_src matlab - ground.rot_point = args.rot_point; -#+end_src - -**** Save the Structure -#+begin_src matlab -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ground', '-append'); - else - save('mat/nass_model_stages.mat', 'ground'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid' + args.rot_point (3,1) double {mustBeNumeric} = zeros(3,1) % Rotation point for the ground motion [m] end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ground', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ground'); + + ground = struct(); + + switch args.type + case 'none' + ground.type = 0; + case 'rigid' + ground.type = 1; + end + + ground.shape = [2, 2, 0.5]; % [m] + ground.density = 2800; % [kg/m3] + + ground.rot_point = args.rot_point; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ground', '-append'); + else + save('mat/nass_model_stages.mat', 'ground'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ground', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ground'); + end end end #+end_src *** =initializeGranite=: Granite -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeGranite.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: +#+begin_src matlab :tangle matlab/src/initializeGranite.m :comments none :mkdirp yes :eval no +function [granite] = initializeGranite(args) -**** Function description -#+begin_src matlab - function [granite] = initializeGranite(args) -#+end_src - -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible' - args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3] - args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = [5e9; 5e9; 5e9; 2.5e7; 2.5e7; 1e7] % [N/m] - args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = [4.0e5; 1.1e5; 9.0e5; 2e4; 2e4; 1e4] % [N/(m/s)] - args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m] - args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m] - args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m] - args.sample_pos (1,1) double {mustBeNumeric} = 0.8 % Height of the measurment point [m] - end -#+end_src - -**** Structure initialization -First, we initialize the =granite= structure. -#+begin_src matlab - granite = struct(); -#+end_src - -**** Add Granite Type -#+begin_src matlab - switch args.type - case 'none' - granite.type = 0; - case 'rigid' - granite.type = 1; - case 'flexible' - granite.type = 2; - end -#+end_src - -**** Material and Geometry - -Properties of the Material and link to the geometry of the granite. -#+begin_src matlab - granite.density = args.density; % [kg/m3] - granite.STEP = 'granite.STEP'; -#+end_src - -Z-offset for the initial position of the sample with respect to the granite top surface. -#+begin_src matlab - granite.sample_pos = args.sample_pos; % [m] -#+end_src - -**** Stiffness and Damping properties - -#+begin_src matlab - granite.K = args.K; % [N/m] - granite.C = args.C; % [N/(m/s)] -#+end_src - -**** Save the Structure -#+begin_src matlab -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'granite', '-append'); - else - save('mat/nass_model_stages.mat', 'granite'); + arguments + args.type char {mustBeMember(args.type,{'rigid', 'flexible', 'none'})} = 'flexible' + args.density (1,1) double {mustBeNumeric, mustBeNonnegative} = 2800 % Density [kg/m3] + args.K (6,1) double {mustBeNumeric, mustBeNonnegative} = [5e9; 5e9; 5e9; 2.5e7; 2.5e7; 1e7] % [N/m] + args.C (6,1) double {mustBeNumeric, mustBeNonnegative} = [4.0e5; 1.1e5; 9.0e5; 2e4; 2e4; 1e4] % [N/(m/s)] + args.x0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the X direction [m] + args.y0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Y direction [m] + args.z0 (1,1) double {mustBeNumeric} = 0 % Rest position of the Joint in the Z direction [m] + args.sample_pos (1,1) double {mustBeNumeric} = 0.775 % Height of the measurment point [m] end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'granite', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'granite'); + + granite = struct(); + + switch args.type + case 'none' + granite.type = 0; + case 'rigid' + granite.type = 1; + case 'flexible' + granite.type = 2; end + + granite.density = args.density; % [kg/m3] + granite.STEP = 'granite.STEP'; + + % Z-offset for the initial position of the sample with respect to the granite top surface. + granite.sample_pos = args.sample_pos; % [m] + + granite.K = args.K; % [N/m] + granite.C = args.C; % [N/(m/s)] + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'granite', '-append'); + else + save('mat/nass_model_stages.mat', 'granite'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'granite', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'granite'); + end + end + end #+end_src *** =initializeTy=: Translation Stage -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeTy.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: +#+begin_src matlab :tangle matlab/src/initializeTy.m :comments none :mkdirp yes :eval no +function [ty] = initializeTy(args) -**** Function description -#+begin_src matlab - function [ty] = initializeTy(args) -#+end_src - -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - end -#+end_src - -**** Structure initialization -First, we initialize the =ty= structure. -#+begin_src matlab - ty = struct(); -#+end_src - -**** Add Translation Stage Type -#+begin_src matlab - switch args.type - case 'none' - ty.type = 0; - case 'rigid' - ty.type = 1; - case 'flexible' - ty.type = 2; - end -#+end_src - -**** Material and Geometry -Define the density of the materials as well as the geometry (STEP files). -#+begin_src matlab - % Ty Granite frame - ty.granite_frame.density = 7800; % [kg/m3] => 43kg - ty.granite_frame.STEP = 'Ty_Granite_Frame.STEP'; - - % Guide Translation Ty - ty.guide.density = 7800; % [kg/m3] => 76kg - ty.guide.STEP = 'Ty_Guide.STEP'; - - % Ty - Guide_Translation12 - ty.guide12.density = 7800; % [kg/m3] - ty.guide12.STEP = 'Ty_Guide_12.STEP'; - - % Ty - Guide_Translation11 - ty.guide11.density = 7800; % [kg/m3] - ty.guide11.STEP = 'Ty_Guide_11.STEP'; - - % Ty - Guide_Translation22 - ty.guide22.density = 7800; % [kg/m3] - ty.guide22.STEP = 'Ty_Guide_22.STEP'; - - % Ty - Guide_Translation21 - ty.guide21.density = 7800; % [kg/m3] - ty.guide21.STEP = 'Ty_Guide_21.STEP'; - - % Ty - Plateau translation - ty.frame.density = 7800; % [kg/m3] - ty.frame.STEP = 'Ty_Stage.STEP'; - - % Ty Stator Part - ty.stator.density = 5400; % [kg/m3] - ty.stator.STEP = 'Ty_Motor_Stator.STEP'; - - % Ty Rotor Part - ty.rotor.density = 5400; % [kg/m3] - ty.rotor.STEP = 'Ty_Motor_Rotor.STEP'; -#+end_src - -**** Stiffness and Damping properties - -#+begin_src matlab - ty.K = [2e8; 1e8; 2e8; 6e7; 9e7; 6e7]; % [N/m, N*m/rad] - ty.C = [8e4; 5e4; 8e4; 2e4; 3e4; 1e4]; % [N/(m/s), N*m/(rad/s)] -#+end_src - -**** Save the Structure -#+begin_src matlab -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ty', '-append'); - else - save('mat/nass_model_stages.mat', 'ty'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ty', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ty'); + + ty = struct(); + + switch args.type + case 'none' + ty.type = 0; + case 'rigid' + ty.type = 1; + case 'flexible' + ty.type = 2; end + + % Ty Granite frame + ty.granite_frame.density = 7800; % [kg/m3] => 43kg + ty.granite_frame.STEP = 'Ty_Granite_Frame.STEP'; + + % Guide Translation Ty + ty.guide.density = 7800; % [kg/m3] => 76kg + ty.guide.STEP = 'Ty_Guide.STEP'; + + % Ty - Guide_Translation12 + ty.guide12.density = 7800; % [kg/m3] + ty.guide12.STEP = 'Ty_Guide_12.STEP'; + + % Ty - Guide_Translation11 + ty.guide11.density = 7800; % [kg/m3] + ty.guide11.STEP = 'Ty_Guide_11.STEP'; + + % Ty - Guide_Translation22 + ty.guide22.density = 7800; % [kg/m3] + ty.guide22.STEP = 'Ty_Guide_22.STEP'; + + % Ty - Guide_Translation21 + ty.guide21.density = 7800; % [kg/m3] + ty.guide21.STEP = 'Ty_Guide_21.STEP'; + + % Ty - Plateau translation + ty.frame.density = 7800; % [kg/m3] + ty.frame.STEP = 'Ty_Stage.STEP'; + + % Ty Stator Part + ty.stator.density = 5400; % [kg/m3] + ty.stator.STEP = 'Ty_Motor_Stator.STEP'; + + % Ty Rotor Part + ty.rotor.density = 5400; % [kg/m3] + ty.rotor.STEP = 'Ty_Motor_Rotor.STEP'; + + ty.K = [2e8; 1e8; 2e8; 6e7; 9e7; 6e7]; % [N/m, N*m/rad] + ty.C = [8e4; 5e4; 8e4; 2e4; 3e4; 1e4]; % [N/(m/s), N*m/(rad/s)] + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ty', '-append'); + else + save('mat/nass_model_stages.mat', 'ty'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ty', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ty'); + end + end + end #+end_src *** =initializeRy=: Tilt Stage -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeRy.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: +#+begin_src matlab :tangle matlab/src/initializeRy.m :comments none :mkdirp yes :eval no +function [ry] = initializeRy(args) -**** Function description -#+begin_src matlab - function [ry] = initializeRy(args) -#+end_src - -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - args.Ry_init (1,1) double {mustBeNumeric} = 0 - end -#+end_src - -**** Structure initialization -First, we initialize the =ry= structure. -#+begin_src matlab - ry = struct(); -#+end_src - - -**** Add Tilt Type -#+begin_src matlab - switch args.type - case 'none' - ry.type = 0; - case 'rigid' - ry.type = 1; - case 'flexible' - ry.type = 2; - end -#+end_src - -**** Material and Geometry -Properties of the Material and link to the geometry of the Tilt stage. -#+begin_src matlab - % Ry - Guide for the tilt stage - ry.guide.density = 7800; % [kg/m3] - ry.guide.STEP = 'Tilt_Guide.STEP'; - - % Ry - Rotor of the motor - ry.rotor.density = 2400; % [kg/m3] - ry.rotor.STEP = 'Tilt_Motor_Axis.STEP'; - - % Ry - Motor - ry.motor.density = 3200; % [kg/m3] - ry.motor.STEP = 'Tilt_Motor.STEP'; - - % Ry - Plateau Tilt - ry.stage.density = 7800; % [kg/m3] - ry.stage.STEP = 'Tilt_Stage.STEP'; -#+end_src - -Z-Offset so that the center of rotation matches the sample center; -#+begin_src matlab - ry.z_offset = 0.58178; % [m] -#+end_src - -#+begin_src matlab - ry.Ry_init = args.Ry_init; % [rad] -#+end_src - -**** Stiffness and Damping properties - -#+begin_src matlab - ry.K = [3.8e8; 4e8; 3.8e8; 1.2e8; 6e4; 1.2e8]; - ry.C = [1e5; 1e5; 1e5; 3e4; 1e3; 3e4]; -#+end_src - -**** Save the Structure -#+begin_src matlab -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'ry', '-append'); - else - save('mat/nass_model_stages.mat', 'ry'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + args.Ry_init (1,1) double {mustBeNumeric} = 0 end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'ry', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'ry'); + + ry = struct(); + + switch args.type + case 'none' + ry.type = 0; + case 'rigid' + ry.type = 1; + case 'flexible' + ry.type = 2; end + + % Ry - Guide for the tilt stage + ry.guide.density = 7800; % [kg/m3] + ry.guide.STEP = 'Tilt_Guide.STEP'; + + % Ry - Rotor of the motor + ry.rotor.density = 2400; % [kg/m3] + ry.rotor.STEP = 'Tilt_Motor_Axis.STEP'; + + % Ry - Motor + ry.motor.density = 3200; % [kg/m3] + ry.motor.STEP = 'Tilt_Motor.STEP'; + + % Ry - Plateau Tilt + ry.stage.density = 7800; % [kg/m3] + ry.stage.STEP = 'Tilt_Stage.STEP'; + + % Z-Offset so that the center of rotation matches the sample center; + ry.z_offset = 0.58178; % [m] + + ry.Ry_init = args.Ry_init; % [rad] + + ry.K = [3.8e8; 4e8; 3.8e8; 1.2e8; 6e4; 1.2e8]; + ry.C = [1e5; 1e5; 1e5; 3e4; 1e3; 3e4]; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'ry', '-append'); + else + save('mat/nass_model_stages.mat', 'ry'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'ry', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'ry'); + end + end + end #+end_src *** =initializeRz=: Spindle -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeRz.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: +#+begin_src matlab :tangle matlab/src/initializeRz.m :comments none :mkdirp yes :eval no +function [rz] = initializeRz(args) -**** Function description -#+begin_src matlab - function [rz] = initializeRz(args) -#+end_src - -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - end -#+end_src - -**** Structure initialization -First, we initialize the =rz= structure. -#+begin_src matlab - rz = struct(); -#+end_src - -**** Add Spindle Type -#+begin_src matlab - switch args.type - case 'none' - rz.type = 0; - case 'rigid' - rz.type = 1; - case 'flexible' - rz.type = 2; - end -#+end_src - -**** Material and Geometry - -Properties of the Material and link to the geometry of the spindle. -#+begin_src matlab - % Spindle - Slip Ring - rz.slipring.density = 7800; % [kg/m3] - rz.slipring.STEP = 'Spindle_Slip_Ring.STEP'; - - % Spindle - Rotor - rz.rotor.density = 7800; % [kg/m3] - rz.rotor.STEP = 'Spindle_Rotor.STEP'; - - % Spindle - Stator - rz.stator.density = 7800; % [kg/m3] - rz.stator.STEP = 'Spindle_Stator.STEP'; -#+end_src - -**** Stiffness and Damping properties - -#+begin_src matlab - rz.K = [7e8; 7e8; 2e9; 1e7; 1e7; 1e7]; - rz.C = [4e4; 4e4; 7e4; 1e4; 1e4; 1e4]; -#+end_src - -**** Save the Structure -#+begin_src matlab -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'rz', '-append'); - else - save('mat/nass_model_stages.mat', 'rz'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'rz', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'rz'); + + rz = struct(); + + switch args.type + case 'none' + rz.type = 0; + case 'rigid' + rz.type = 1; + case 'flexible' + rz.type = 2; end + + % Spindle - Slip Ring + rz.slipring.density = 7800; % [kg/m3] + rz.slipring.STEP = 'Spindle_Slip_Ring.STEP'; + + % Spindle - Rotor + rz.rotor.density = 7800; % [kg/m3] + rz.rotor.STEP = 'Spindle_Rotor.STEP'; + + % Spindle - Stator + rz.stator.density = 7800; % [kg/m3] + rz.stator.STEP = 'Spindle_Stator.STEP'; + + rz.K = [7e8; 7e8; 2e9; 1e7; 1e7; 1e7]; + rz.C = [4e4; 4e4; 7e4; 1e4; 1e4; 1e4]; + + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'rz', '-append'); + else + save('mat/nass_model_stages.mat', 'rz'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'rz', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'rz'); + end + end + end #+end_src *** =initializeMicroHexapod=: Micro Hexapod -:PROPERTIES: -:header-args:matlab+: :tangle matlab/src/initializeMicroHexapod.m -:header-args:matlab+: :comments none :mkdirp yes :eval no -:END: -**** Function description -#+begin_src matlab - function [micro_hexapod] = initializeMicroHexapod(args) -#+end_src +#+begin_src matlab :tangle matlab/src/initializeMicroHexapod.m :comments none :mkdirp yes :eval no +function [micro_hexapod] = initializeMicroHexapod(args) -**** Optional Parameters -#+begin_src matlab - arguments - args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' - % initializeFramesPositions - args.H (1,1) double {mustBeNumeric, mustBePositive} = 350e-3 - args.MO_B (1,1) double {mustBeNumeric} = 270e-3 - % generateGeneralConfiguration - args.FH (1,1) double {mustBeNumeric, mustBePositive} = 50e-3 - args.FR (1,1) double {mustBeNumeric, mustBePositive} = 175.5e-3 - args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180) - args.MH (1,1) double {mustBeNumeric, mustBePositive} = 45e-3 - args.MR (1,1) double {mustBeNumeric, mustBePositive} = 118e-3 - args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180) - % initializeStrutDynamics - args.Ki (6,1) double {mustBeNumeric, mustBeNonnegative} = 2e7*ones(6,1) - args.Ci (6,1) double {mustBeNumeric, mustBeNonnegative} = 1.4e3*ones(6,1) - % initializeCylindricalPlatforms - args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 10 - args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 - args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 207.5e-3 - args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 10 - args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 - args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3 - % initializeCylindricalStruts - args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 1 - args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 - args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 - args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 1 - args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 - args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 - % inverseKinematics - args.AP (3,1) double {mustBeNumeric} = zeros(3,1) - args.ARB (3,3) double {mustBeNumeric} = eye(3) - end -#+end_src - -**** Function content -#+begin_src matlab - stewart = initializeStewartPlatform(); - - stewart = initializeFramesPositions(stewart, ... - 'H', args.H, ... - 'MO_B', args.MO_B); - - stewart = generateGeneralConfiguration(stewart, ... - 'FH', args.FH, ... - 'FR', args.FR, ... - 'FTh', args.FTh, ... - 'MH', args.MH, ... - 'MR', args.MR, ... - 'MTh', args.MTh); - - stewart = computeJointsPose(stewart); -#+end_src - -#+begin_src matlab - stewart = initializeStrutDynamics(stewart, ... - 'K', args.Ki, ... - 'C', args.Ci); - - stewart = initializeJointDynamics(stewart, ... - 'type_F', 'universal_p', ... - 'type_M', 'spherical_p'); -#+end_src - -#+begin_src matlab - stewart = initializeCylindricalPlatforms(stewart, ... - 'Fpm', args.Fpm, ... - 'Fph', args.Fph, ... - 'Fpr', args.Fpr, ... - 'Mpm', args.Mpm, ... - 'Mph', args.Mph, ... - 'Mpr', args.Mpr); - - stewart = initializeCylindricalStruts(stewart, ... - 'Fsm', args.Fsm, ... - 'Fsh', args.Fsh, ... - 'Fsr', args.Fsr, ... - 'Msm', args.Msm, ... - 'Msh', args.Msh, ... - 'Msr', args.Msr); - - stewart = computeJacobian(stewart); - - stewart = initializeStewartPose(stewart, ... - 'AP', args.AP, ... - 'ARB', args.ARB); -#+end_src - -#+begin_src matlab - stewart = initializeInertialSensor(stewart, 'type', 'none'); -#+end_src - -**** Add Type -#+begin_src matlab - switch args.type - case 'none' - stewart.type = 0; - case 'rigid' - stewart.type = 1; - case 'flexible' - stewart.type = 2; - end -#+end_src - -**** Save the Structure -#+begin_src matlab -micro_hexapod = stewart; -if exist('./mat', 'dir') - if exist('./mat/nass_model_stages.mat', 'file') - save('mat/nass_model_stages.mat', 'micro_hexapod', '-append'); - else - save('mat/nass_model_stages.mat', 'micro_hexapod'); + arguments + args.type char {mustBeMember(args.type,{'none', 'rigid', 'flexible'})} = 'flexible' + % initializeFramesPositions + args.H (1,1) double {mustBeNumeric, mustBePositive} = 350e-3 + args.MO_B (1,1) double {mustBeNumeric} = 270e-3 + % generateGeneralConfiguration + args.FH (1,1) double {mustBeNumeric, mustBePositive} = 50e-3 + args.FR (1,1) double {mustBeNumeric, mustBePositive} = 175.5e-3 + args.FTh (6,1) double {mustBeNumeric} = [-10, 10, 120-10, 120+10, 240-10, 240+10]*(pi/180) + args.MH (1,1) double {mustBeNumeric, mustBePositive} = 45e-3 + args.MR (1,1) double {mustBeNumeric, mustBePositive} = 118e-3 + args.MTh (6,1) double {mustBeNumeric} = [-60+10, 60-10, 60+10, 180-10, 180+10, -60-10]*(pi/180) + % initializeStrutDynamics + args.Ki (6,1) double {mustBeNumeric, mustBeNonnegative} = 2e7*ones(6,1) + args.Ci (6,1) double {mustBeNumeric, mustBeNonnegative} = 1.4e3*ones(6,1) + % initializeCylindricalPlatforms + args.Fpm (1,1) double {mustBeNumeric, mustBePositive} = 10 + args.Fph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 + args.Fpr (1,1) double {mustBeNumeric, mustBePositive} = 207.5e-3 + args.Mpm (1,1) double {mustBeNumeric, mustBePositive} = 10 + args.Mph (1,1) double {mustBeNumeric, mustBePositive} = 26e-3 + args.Mpr (1,1) double {mustBeNumeric, mustBePositive} = 150e-3 + % initializeCylindricalStruts + args.Fsm (1,1) double {mustBeNumeric, mustBePositive} = 1 + args.Fsh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 + args.Fsr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 + args.Msm (1,1) double {mustBeNumeric, mustBePositive} = 1 + args.Msh (1,1) double {mustBeNumeric, mustBePositive} = 100e-3 + args.Msr (1,1) double {mustBeNumeric, mustBePositive} = 25e-3 + % inverseKinematics + args.AP (3,1) double {mustBeNumeric} = zeros(3,1) + args.ARB (3,3) double {mustBeNumeric} = eye(3) end -elseif exist('./matlab', 'dir') - if exist('./matlab/mat/nass_model_stages.mat', 'file') - save('matlab/mat/nass_model_stages.mat', 'micro_hexapod', '-append'); - else - save('matlab/mat/nass_model_stages.mat', 'micro_hexapod'); + + stewart = initializeStewartPlatform(); + + stewart = initializeFramesPositions(stewart, ... + 'H', args.H, ... + 'MO_B', args.MO_B); + + stewart = generateGeneralConfiguration(stewart, ... + 'FH', args.FH, ... + 'FR', args.FR, ... + 'FTh', args.FTh, ... + 'MH', args.MH, ... + 'MR', args.MR, ... + 'MTh', args.MTh); + + stewart = computeJointsPose(stewart); + + stewart = initializeStrutDynamics(stewart, ... + 'K', args.Ki, ... + 'C', args.Ci); + + stewart = initializeJointDynamics(stewart, ... + 'type_F', 'universal_p', ... + 'type_M', 'spherical_p'); + + stewart = initializeCylindricalPlatforms(stewart, ... + 'Fpm', args.Fpm, ... + 'Fph', args.Fph, ... + 'Fpr', args.Fpr, ... + 'Mpm', args.Mpm, ... + 'Mph', args.Mph, ... + 'Mpr', args.Mpr); + + stewart = initializeCylindricalStruts(stewart, ... + 'Fsm', args.Fsm, ... + 'Fsh', args.Fsh, ... + 'Fsr', args.Fsr, ... + 'Msm', args.Msm, ... + 'Msh', args.Msh, ... + 'Msr', args.Msr); + + stewart = computeJacobian(stewart); + + stewart = initializeStewartPose(stewart, ... + 'AP', args.AP, ... + 'ARB', args.ARB); + + stewart = initializeInertialSensor(stewart, 'type', 'none'); + + switch args.type + case 'none' + stewart.type = 0; + case 'rigid' + stewart.type = 1; + case 'flexible' + stewart.type = 2; + end + + micro_hexapod = stewart; + if exist('./mat', 'dir') + if exist('./mat/nass_model_stages.mat', 'file') + save('mat/nass_model_stages.mat', 'micro_hexapod', '-append'); + else + save('mat/nass_model_stages.mat', 'micro_hexapod'); + end + elseif exist('./matlab', 'dir') + if exist('./matlab/mat/nass_model_stages.mat', 'file') + save('matlab/mat/nass_model_stages.mat', 'micro_hexapod', '-append'); + else + save('matlab/mat/nass_model_stages.mat', 'micro_hexapod'); + end end end #+end_src