code
code
N = 9; % Number of pistons
a = 1.45 * 10^-3; % [m] Axial distance from piston-slipper joint to yoke pivot
alfa = 0.33;
theta1 = 77 * 2 * pi / 360;
theta2 = 81 * 2 * pi / 360;
theta3 = 99 * 2 * pi / 360;
% Extract Variables
% Plot Results
figure;
subplot(3, 1, 1);
xlabel('Theta [rad]');
ylabel('Pressure [Pa]');
grid on;
subplot(3, 1, 2);
xlabel('Theta [rad]');
ylabel('Torque');
grid on;
subplot(3, 1, 3);
xlabel('Theta [rad]');
ylabel('Alfa Dot');
grid on;
% ODE Function
P = Y(1);
T = Y(2);
% Constants
P_S = 3000;
w = 183.3;
C_d0 = 0.75;
n_0 = 1.489;
C_dn = 0.75;
gama = 0.384;
row = 912;
N = 9;
R = 22.38 * 10^-3;
a = 1.45 * 10^-3;
alfa = 0.33;
theta1 = 77 * 2 * pi / 360;
theta2 = 81 * 2 * pi / 360;
theta3 = 99 * 2 * pi / 360;
dpdth = 0;
R^2 * C_dn * (tan(gama)^2) * ((th - theta1)^2) * sqrt(2 / row * abs(P - P_S)) - K_l * P);
R^2 * C_dn * (tan(gama)^2) * ((th - theta1)^2) * sqrt(2 / row * abs(P - P_S)) - K_l * P);
R^2 * C_dn * (tan(gama)^2) * ((th - theta4)^2) * sqrt(2 / row * abs(P_D - P)) - K_l * P);
R^2 * C_dn * (tan(gama)^2) * ((th - theta4)^2) * sqrt(2 / row * abs(P_D - P)) - K_l * P);
end
% Compute dT/dth
dTdth = N / (2 * pi) * (-P * A_p * (R * sin(th) - a * sin(alfa)) / (cos(alfa)^2));
% Store alfa_dot
dalfa_dot_dth = 50 / pi;
end