close all
clear all

d_p = 2*.0254;  %Piston Diameter
d_r = 1.5*.0254;  %Rod diameter
A_c = 0.25*pi*(d_p^2-d_r^2);  %Hydraulic Ram cross section

spd = 0:.05:1;  %piston speed (m/s)

PressureLimit = 3000*6894.757;  %Pa
PressureLimitBar = PressureLimit/100000;  %bar


Power = spd*A_c*PressureLimit;

%F11-5
disp = 4.9;  %cm^3/rev


figure
plot(spd,Power)
xlabel('Piston Speed (m/s)');
ylabel('Power (W)');


Kt = 0.62;  %AKM64S torque constant  N-m/Arms

PressureLimit = [1000:3000];
PressureLimitPa = PressureLimit*6894.757;  %Pa
PressureLimitBar = PressureLimitPa/100000;  %bar


eff = 0.9;

T = disp*PressureLimitBar*eff/63;  %From motor spec sheet, result is in N-m
Arms = T/Kt;

figure
subplot(2,1,1)
plot(PressureLimit,T)
xlabel('PressureLimit (psi)');
ylabel('Torque (N-m)');
subplot(2,1,2)
plot(PressureLimit,Arms)
xlabel('PressureLimit (psi)');
ylabel('Winding Current (Arms)');

