%% Simulation Data
simu = simulationClass();               %Create the Simulation Variable
simu.simMechanicsFile = 'wec3.slx';    %Location of Simulink Model File
% simu.mcrCaseFile='batch.mat'; 
simu.mode = 'normal';                   %Specify Simulation Mode ('normal','accelerator','rapid-accelerator')
simu.explorer='on';                     %Turn SimMechanics Explorer (on/off)
simu.solver = 'ode4';                   %simu.solver = 'ode4' for fixed step & simu.solver = 'ode45' for variable step 
simu.dt = 0.01; 						%Simulation time-step [s]
simu.rampTime = 100;                       %Wave Ramp Time Length [s]
simu.startTime = 0;                     %Simulation Start Time [s]
simu.endTime=500;            %Simulation End bdcloseTime [s]
simu.b2b  = 1;                          %Body-to-body interactions
simu.rho = 1025;                        %Water density - default = 1000 ! 
simu.nlHydro = 0;                       %Non-linear FK force
simu.ssCalc = 0;						%Control option to use state space model 
simu.CITime=100;
% simu.dtFeNonlin=1*simu.dt;            %Non-linear FK force time-step
simu.paraview=0;                        %Output files for visualisation in Paraview (0-No ; 1-Yes)
simu.domainSize=100;                     %Side-length of the square domain for viewing
simu.dtOut = 0.01;
simu.saveMat = 0;
simu.numIntMidTimeSteps = 1;

if simu.paraview==1
    waves.viz.numPointsX=50;
    waves.viz.numPointsY=5;
end
%% Wave Information 
%% noWaveCIC, no waves with radiation CIC  
% waves = waveClass('noWaveCIC');         %Create the Wave Variable and Specify Type      

% Regular Waves  
% waves = waveClass('regularCIC');        %Create the Wave Variable and Specify Type                               
% waves.H = 2.25;                          %Wave Height [m]
% waves.T = 9;                            %Wave Period [s]

%% Irregular Waves using PM Spectrum with Convolution Integral Calculation
waves = waveClass('irregular');        %Create the Wave Variable and Specify Type
waves.H = 2.75;                        %Significant Wave Height [m]
waves.T = 8;                          %Peak Period [s]
waves.waveDir=0;                       %Wave Direction [deg]  
waves.spectrumType = 'BS';             %Wave Spectrum Type 
waves.phaseSeed=2;                %Wave Seed 

%% Irregular Waves using User-Defined Spectrum
% waves = waveClass('irregularImport');  %Create the Wave Variable and Specify Type
% waves.spectrumDataFile = 'ndbcBuoyData.txt';  %Name of User-Defined Spectrum File [2,:] = [omega, Sf]

%% User-Defined Time-Series
% waves = waveClass('userDefined');     %Create the Wave Variable and Specify Type
% waves.etaDataFile = 'umpqua46229_6_2008.mat'; % Name of User-Defined Time-Series File [:,2] = [time, wave_elev]

%% Body Data
%% Float
body(1) = bodyClass('.\hydro\wec3.h5');      
body(1).mass = 727e3;
body(1).momOfInertia = [2.1e7 2.1e7 3.7e7];  %Moment of Inertia [kg*m^2]     
body(1).geometryFile = '.\geometry\wec3_Float.stl';    %Location of Geomtry File

%% Spar
body(2) = bodyClass('.\hydro\wec3.h5');      
body(2).mass = 903e3;                  
body(2).momOfInertia = [9.4e7 9.4e7 2.9e7];  %Moment of Inertia [kg*m^2]     
body(2).geometryFile = '.\geometry\wec3_Spar.stl';    %Location of Geomtry File
body(2).viscDrag.cd = [0 , 0 , 4.0 , 4.0 , 4.0 , 0];
body(2).viscDrag.characteristicArea = [0, 0, pi*15^2, 4.05e5, 4.05e5, 0] ;
%% PTO and Constraint Parameters
%% Floating (6DOF) Joint
constraint(1) = constraintClass('Constraint1'); %Create Constraint Variable and Set Constraint Name
constraint(1).loc = [0 0 0];                    %Constraint Location [m]


%% Translational PTO
pto(1) = ptoClass('PTO1');                      %Create PTO Variable and Set PTO Name
pto(1).k=0;                                     %PTO Stiffness [N/m]
pto(1).c=0;                                   %PTO Daming [N/(m/s)]
pto(1).loc = [0 0 0];                           %PTO Location [m]

%% Mooring (linear representation)
mooring(1) = mooringClass('mooring');
mooring(1).ref=[0 , 0 , -15];
Kmoor=[1.0e4, 1.0e4 , 0, 0 , 0 , 1e3];
Cmoor=[0.0 , 0.0 , 0.0 , 0.0, 0.0, 0.0 ];

mooring(1).matrix = struct(...                          % Structure defining damping, stiffness, and pre-tension.
                        'c',          diag(Cmoor), ...              % Mooring damping, 6 x 6 matrix. 
                        'k',          diag(Kmoor), ...             % Mooring stiffness, 6 x 6 matrix.
                        'preTension', [0 0 0 0 0 0]);