
% Script for plotting Snubber length comparison

close all
clear all
% Directory of first set of data files to load
suffix = 'IFREMER-600lbs-400d-NoSnubber-test17';
path = ['./',suffix,'/'];

% Load configuration "no Snubber" loads at design condition
load([path,'Res-2c-1.25s-400d-3.45A-13.5T-17.1W-.mat']);

% Convert lbf into kilo Newtons for base of buoy
Tn_t = T_t(:,end)*4.44822/1000;

% plotting Snubber length sensitivity at design conditions. Make background
% white
figure('color','w','Position',[487   703   756   391]);

%Create variables for plot axes
y1 = Tn_t; %Newtons on left side of plot y axis
y2 = T_t(:,end); %Lbs on right side of plot y axis

% Set X1 and X2 axis = number of time increments for 600 seconds run
x1 = [1:3001]
x2 = x1

% Plot first data set line
data1 = line(x1,y1,'Color','b');

% Pull current plot settings
ax1 = gca
% Set current axis color and font
set(ax1,'XColor','k','YColor','k','FontSize',12)
% Create second axes in same position as first axes but change location
ax2 = axes('Position',get(ax1,'Position'),...
           'XAxisLocation','top',...
           'YAxisLocation','right',...
           'Color','none',...
           'XColor','k','YColor','k','FontSize',12);

% Plot second data set line. This line is commented out for one data set
data2 = line(x2,y2,'Color','k','Parent',ax2);

% Set plot axes limits
ylim(ax1,[-3 25]) % For kN (L)axis
ylim(ax2,[-674.43 5620.22]) % For Lbf (R) axis. Scaled to match kN
xlim ((ax1),[2000 3000])
xlim ((ax2),[2000 3000])

% Make redundant(top) x axis ticks invisible.
set(ax2,'xtick',[])

% Make redundant data line invisible.
set (data2,'visible','off')

title('Snubber Length Effect on Cable Tensions Below Buoy - Design Condition','color','k','FontSize',12);
xlabel(ax1,'Simulation Time (seconds)','color','k','FontSize',12);
ylabel(ax1,'Tension Below Buoy kN','color','k','FontSize',12);
ylabel(ax2,'Lbf','color','k','FontSize',12);

