nass-simscape/src/initializeMirror.m

62 lines
1.8 KiB
Mathematica
Raw Normal View History

function [] = initializeMirror(args)
arguments
args.type char {mustBeMember(args.type,{'none', 'rigid'})} = 'rigid'
args.shape char {mustBeMember(args.shape,{'spherical', 'conical'})} = 'spherical'
args.angle (1,1) double {mustBeNumeric, mustBePositive} = 45 % [deg]
end
mirror = struct();
switch args.type
case 'none'
mirror.type = 0;
case 'rigid'
mirror.type = 1;
end
mirror.h = 0.05; % Height of the mirror [m]
mirror.thickness = 0.025; % Thickness of the plate supporting the sample [m]
mirror.hole_rad = 0.120; % radius of the hole in the mirror [m]
mirror.support_rad = 0.1; % radius of the support plate [m]
% point of interest offset in z (above the top surfave) [m]
switch args.type
case 'none'
mirror.jacobian = 0.20;
case 'rigid'
mirror.jacobian = 0.20 - mirror.h;
end
mirror.rad = 0.180; % radius of the mirror (at the bottom surface) [m]
mirror.density = 2400; % Density of the material [kg/m3]
mirror.cone_length = mirror.rad*tand(args.angle)+mirror.h+mirror.jacobian; % Distance from Apex point of the cone to jacobian point
mirror.shape = [...
0 mirror.h-mirror.thickness
mirror.hole_rad mirror.h-mirror.thickness; ...
mirror.hole_rad 0; ...
mirror.rad 0 ...
];
if strcmp(args.shape, 'spherical')
mirror.sphere_radius = sqrt((mirror.jacobian+mirror.h)^2+mirror.rad^2); % Radius of the sphere [mm]
for z = linspace(0, mirror.h, 101)
mirror.shape = [mirror.shape; sqrt(mirror.sphere_radius^2-(z-mirror.jacobian-mirror.h)^2) z];
end
elseif strcmp(args.shape, 'conical')
mirror.shape = [mirror.shape; mirror.rad+mirror.h/tand(args.angle) mirror.h];
else
error('Shape should be either conical or spherical');
end
mirror.shape = [mirror.shape; 0 mirror.h];
save('./mat/stages.mat', 'mirror', '-append');