📄 objective_funct.m
字号:
% This function is used to minimize elastic deformations at all contacts
function F = Objective_Funct(x)
global t % time trajectory
global Cn_Lw Ct_Lw Cn_cw Ct_cw
global Fg Side_L Set_Clamping_Force
global count
count = count+1;
%===========================================================================================================
% x(1): the Normal Elastic Deformation at the 1st contact
% x(2): the Normal Elastic Deformation at the 2nd Contact
% x(3): the Normal Elastic Deformation at the 3rd Contact
% x(4): the Normal Elastic Deformation at the 4nd Contact
% x(5): the Normal Elastic Deformation at the 5nd Contact
% x(6): the Normal Elastic Deformation at the 6nd Contact
% x(7): the Normal Elastic Deformation at the 7nd Contact
% x(8): the 1st Tangential Deformation at the 1st Contact
% x(9): the 1st Tangential Deformation at the 2nd Contact
% x(10): the 1st Tangential Deformation at the 3rd Contact
% x(11): the 1st Tangential Deformation at the 4th Contact
% x(12): the 1st Tangential Deformation at the 5th Contact
% x(13): the 1st Tangential Deformation at the 6th Contact
% x(14): the 1st Tangential Deformation at the 7th Contact
% x(15): the 2nd Tangential Deformation at the 1st Contact
% x(16): the 2nd Tangential Deformation at the 2nd Contact
% x(17): the 2nd Tangential Deformation at the 3rd Contact
% x(18): the 2nd Tangential Deformation at the 4th Contact
% x(19): the 2nd Tangential Deformation at the 5th Contact
% x(20): the 2nd Tangential Deformation at the 6th Contact
% x(21): the 2nd Tangential Deformation at the 7th Contact
%----------------------------------------------------------------------------------------------------------
% x(22): the Position Displacement along x-Direction of the Workpiece
% x(23): the Position Displacement along y-Direction of the Workpiece
% x(24): the Position Displacement along z-Direction of the Workpiece
% x(25): the Orientation Displacement around x-Direction of the Workpiece
% x(26): the Orientation Displacement around y-Direction of the Workpiece
% x(27): the Orientation Displacement around z-Direction of the Workpiece
%----------------------------------------------------------------------------------------------------------
% 100*x(28): the x Coordinate of the Clamping Point
% 100*x(29): the y Coordinate of the Clamping Point
%----------------------------------------------------------------------------------------------------------
for i = 1:6
force(i) = (Cn_Lw^(-3/2))*x(i)^(3/2);
force(i+7) = (Ct_Lw^(-1))*(Cn_Lw)^(-1/2)*x(i+7)*x(i)^(1/2);
force(i+14) = (Ct_Lw^(-1))*(Cn_Lw)^(-1/2)*x(i+14)*x(i)^(1/2);
end
force(7) = (Cn_cw^(-3/2))*x(7)^(3/2);
force(14) = (Ct_cw^(-1))*(Cn_cw)^(-1/2)*x(14)*x(7)^(1/2);
force(21) = (Ct_cw^(-1))*(Cn_cw)^(-1/2)*x(21)*x(7)^(1/2);
%===========================================================================================================
% Representation of 6 force equilibrium equations' constraints (START)
% The 1st Nonlinear Equality Constraints: Ceq(x) = 0
%-----------------------------------------------------------------------------------------------------------
% 7 unit normal vectors and 14 unit tangential vectors at 6 locators and 1 clamp
%-----------------------------------------------------------------------------------------------------------
n_L1 = [0 0 1]'; t_L11 = [1 0 0]'; t_L21 = [0 1 0]'; % n: normal vector; t: tangential vector
n_L2 = [0 0 1]'; t_L12 = [1 0 0]'; t_L22 = [0 1 0]'; % L: locator; c: clamp
n_L3 = [0 0 1]'; t_L13 = [1 0 0]'; t_L23 = [0 1 0]';
n_L4 = [0 1 0]'; t_L14 = [1 0 0]'; t_L24 = [0 0 1]';
n_L5 = [0 1 0]'; t_L15 = [1 0 0]'; t_L25 = [0 0 1]';
n_L6 = [1 0 0]'; t_L16 = [0 1 0]'; t_L26 = [0 0 1]';
n_c = [-sqrt(3)/3 -sqrt(3)/3 -sqrt(3)/3]';
t_c1 = [sqrt(2)/2 -sqrt(2)/2 0]';
t_c2 = [sqrt(6)/6 sqrt(6)/6 -2*sqrt(6)/6]';
%----------------------------------------------------------------------------------------------------------
% contact positions between the workpiece and locators/clamp
%----------------------------------------------------------------------------------------------------------
r_L1 = [0.8*Side_L 0.5*Side_L 0]';
r_L2 = [0.2*Side_L 0.8*Side_L 0]';
r_L3 = [0.2*Side_L 0.2*Side_L 0]';
r_L4 = [0.8*Side_L 0 0.5*Side_L]';
r_L5 = [0.2*Side_L 0 0.5*Side_L]';
r_L6 = [0 0.5*Side_L 0.5*Side_L]';
r_c = [122.1 99.1 2*Side_L-122.1-99.1]';
%----------------------------------------------------------------------------------------------------------
% Mapping Matrix (W) of the passive forces
%----------------------------------------------------------------------------------------------------------
for i=1:3
r_L1x(i,i) = 0;
r_L2x(i,i) = 0;
r_L3x(i,i) = 0;
r_L4x(i,i) = 0;
r_L5x(i,i) = 0;
r_L6x(i,i) = 0;
r_cx(i,i) = 0;
end
r_L1x(1,2) = -r_L1(3); r_L1x(1,3) = r_L1(2);
r_L1x(2,1) = -r_L1x(1,2); r_L1x(2,3) = -r_L1(1);
r_L1x(3,1) = -r_L1x(1,3); r_L1x(3,2) = -r_L1x(2,3);
r_L2x(1,2) = -r_L2(3); r_L2x(1,3) = r_L2(2);
r_L2x(2,1) = -r_L2x(1,2); r_L2x(2,3) = -r_L2(1);
r_L2x(3,1) = -r_L2x(1,3); r_L2x(3,2) = -r_L2x(2,3);
r_L3x(1,2) = -r_L3(3); r_L3x(1,3) = r_L3(2);
r_L3x(2,1) = -r_L3x(1,2); r_L3x(2,3) = -r_L3(1);
r_L3x(3,1) = -r_L3x(1,3); r_L3x(3,2) = -r_L3x(2,3);
r_L4x(1,2) = -r_L4(3); r_L4x(1,3) = r_L4(2);
r_L4x(2,1) = -r_L4x(1,2); r_L4x(2,3) = -r_L4(1);
r_L4x(3,1) = -r_L4x(1,3); r_L4x(3,2) = -r_L4x(2,3);
r_L5x(1,2) = -r_L5(3); r_L5x(1,3) = r_L5(2);
r_L5x(2,1) = -r_L5x(1,2); r_L5x(2,3) = -r_L5(1);
r_L5x(3,1) = -r_L5x(1,3); r_L5x(3,2) = -r_L5x(2,3);
r_L6x(1,2) = -r_L6(3); r_L6x(1,3) = r_L6(2);
r_L6x(2,1) = -r_L6x(1,2); r_L6x(2,3) = -r_L6(1);
r_L6x(3,1) = -r_L6x(1,3); r_L6x(3,2) = -r_L6x(2,3);
r_cx(1,2) = -r_c(3); r_cx(1,3) = r_c(2);
r_cx(2,1) = -r_cx(1,2); r_cx(2,3) = -r_c(1);
r_cx(3,1) = -r_cx(1,3); r_cx(3,2) = -r_cx(2,3);
r1xn1 = r_L1x*n_L1; r1xt11 = r_L1x*t_L11; r1xt21 = r_L1x*t_L21;
r2xn2 = r_L2x*n_L2; r2xt12 = r_L2x*t_L12; r2xt22 = r_L2x*t_L22;
r3xn3 = r_L3x*n_L3; r3xt13 = r_L3x*t_L13; r3xt23 = r_L3x*t_L23;
r4xn4 = r_L4x*n_L4; r4xt14 = r_L4x*t_L14; r4xt24 = r_L4x*t_L24;
r5xn5 = r_L5x*n_L5; r5xt15 = r_L5x*t_L15; r5xt25 = r_L5x*t_L25;
r6xn6 = r_L6x*n_L6; r6xt16 = r_L6x*t_L16; r6xt26 = r_L6x*t_L26;
rcxnc = r_cx*n_c; rcxtc1 = r_cx*t_c1; rcxtc2 = r_cx*t_c2;
for i=1:3
G_lct(i,1) = n_L1(i); G_lct(i,2) = t_L11(i); G_lct(i,3) = t_L21(i);
G_lct(i+3,1) = r1xn1(i); G_lct(i+3,2) = r1xt11(i); G_lct(i+3,3) = r1xt21(i);
G_lct(i,4) = n_L2(i); G_lct(i,5) = t_L12(i); G_lct(i,6) = t_L22(i);
G_lct(i+3,4) = r2xn2(i); G_lct(i+3,5) = r2xt12(i); G_lct(i+3,6) = r2xt22(i);
G_lct(i,7) = n_L3(i); G_lct(i,8) = t_L13(i); G_lct(i,9) = t_L23(i);
G_lct(i+3,7) = r3xn3(i); G_lct(i+3,8) = r3xt13(i); G_lct(i+3,9) = r3xt23(i);
G_lct(i,10) = n_L4(i); G_lct(i,11) = t_L14(i); G_lct(i,12) = t_L24(i);
G_lct(i+3,10) = r4xn4(i); G_lct(i+3,11) = r4xt14(i); G_lct(i+3,12) = r4xt24(i);
G_lct(i,13) = n_L5(i); G_lct(i,14) = t_L15(i); G_lct(i,15) = t_L25(i);
G_lct(i+3,13) = r5xn5(i); G_lct(i+3,14) = r5xt15(i); G_lct(i+3,15) = r5xt25(i);
G_lct(i,16) = n_L6(i); G_lct(i,17) = t_L16(i); G_lct(i,18) = t_L26(i);
G_lct(i+3,16) = r6xn6(i); G_lct(i+3,17) = r6xt16(i); G_lct(i+3,18) = r6xt26(i);
G_lct(i,19) = t_c1(i); G_lct(i,20) = t_c2(i);
G_lct(i+3,19) = rcxtc1(i); G_lct(i+3,20) = rcxtc2(i);
G_cn(i) = n_c(i);
G_cn(3+i) = rcxnc(i);
end
%----------------------------------------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -