function [] = PostProc2(filenm)
close all
%clear all

%filenm = 'foo';

data = readtable(filenm);
datetime(data.Var1(10), 'ConvertFrom', 'posixtime')

t = data.Var1;
t = t-t(1);

TargTension = data.Var2;
MeasTension = data.Var3;
TorqueCmd = data.Var4;
TorqueAct = data.Var5;
RPM_Cmd = data.Var6;
RPM_Act= data.Var7;
SD_TorqueAct = data.Var8;
SD_RPM_Act = data.Var9;
SD_Pos = data.Var10;
PID_FF = data.Var11;
PID_P = data.Var12;
PID_I = data.Var13;
PID_D = data.Var14;
PID_Tf = data.Var15;
cmd_min = data.Var16;
cmd_max = data.Var17;
SD_RPM_Cmd = data.Var18;
SWC_OilPressure = data.Var19;
SWC_OilPressureAlarmLimit = data.Var20;
TorqueMode_VFD_RPMLimit = data.Var21;
TorqueMode_PID_RPMLimit = data.Var22;
CraneIndoorMode = data.Var23; 
OutHaulerActive = data.Var24;




num_plots = 5;
figure('Position', [1 1 1280 599.3333]);
ah1 = subplot(num_plots,1,1);
plot(t,TargTension);
hold all;
plot(t,MeasTension,'-');
legend('Target Tension','Measured Tension');
ylabel('kg');
grid on;

ah2 = subplot(num_plots,1,2);
plot(t,TorqueCmd);
hold all;
plot(t,TorqueAct);
%plot(t,cmd_min,'k--');
%plot(t,cmd_max,'k--');
legend('Cmd Torque','Actual Torque');
grid on;

ah3 = subplot(num_plots,1,3);
plot(t,RPM_Cmd);
hold all;
plot(t,RPM_Act);
legend('Target RPM','Actual RPM');
ylabel('RPM');
grid on;

ah4 = subplot(num_plots,1,4);
plot(t,PID_P);
hold all;
plot(t,PID_I);
plot(t,PID_D);
plot(t,PID_Tf);
legend('P','I','D','Tf');
grid on;

ah5 = subplot(num_plots,1,5);
plot(t,PID_FF);
legend('PID_FF)');
grid on;

ah3 = subplot(num_plots,1,4);
plot(t,RPM_Cmd);
hold all;
plot(t,RPM_Act);
legend('Target RPM','Actual RPM');
ylabel('RPM');
grid on;


linkaxes([ah1 ah2 ah3 ah4 ah5],'x');


SD_TorqueAct = data.Var8;
SD_RPM_Act = data.Var9;
SD_Pos = data.Var10;

num_plots = 4;
figure('Position', [1 1 1280 599.3333]);
ah1 = subplot(num_plots,1,1);
plot(t,SD_TorqueAct);
legend('SD_TorqueAct');
ylabel('%');
grid on;

ah2 = subplot(num_plots,1,2);
plot(t,SD_RPM_Act);
hold all;
plot(t,SD_RPM_Cmd);
plot(t,RPM_Act);
legend('SD_RPM_Act','SD_RPM_Cmd','TW Actual RPM');
grid on;
ylabel('RPM');

ah3 = subplot(num_plots,1,3);
plot(t,SD_Pos);

legend('TSD_Pos');
ylabel('%');
grid on;

ah4 = subplot(num_plots,1,4);
plot(t,SWC_OilPressure);
hold all
plot(t,SWC_OilPressureAlarmLimit);



legend('SWC_OilPressure','Alarm Limit');
ylabel('bar');
grid on;

linkaxes([ah1 ah2 ah3 ah4],'x');



end