%simulinkTTPCDAm.m iteratively runs the simulink model BEControllerTTP with
%specified values for added mass and drag coefficient
clear all;
set(0,'DefaultAxesFontSize',14)
testCD = [.8 1 1.2 1.5];
testAM = [24.2 30 48.4];

nCD = length(testCD);
nAM = length(testAM);

cList = ['r' 'b' 'g' 'm' 'k' 'c'];
tIn = (0:0.1:100);
velDat = zeros(length(tIn),nCD*nAM);
figList = zeros(1,nAM);
for ai = 1:nAM
    figList(ai) = figure('color','w');
    for ci = 1:nCD
        cdIn = testCD(ci);
        amIn = testAM(ai);
        R=sim('Y:\Calcs\BEControllerTTP.slx');
        velDat(:,(ai-1)*nCD+ci) = velOut;
        hold on;
        lStr = sprintf('Cd: %0.2f \t AM: %0.2f',cdIn,amIn); 
        plot(tIn,velDat(:,(ai-1)*nCD+ci),cList(ci),'DisplayName',lStr);
    end
    legend('location','SouthEast')
    xlabel('Time (sec)')
    ylabel('Velocity (m/s)')
    title(['Float Velocity Profiles Varying Cd with Am = ' num2str(amIn)])
end

