Skip to content

Commit

Permalink
Include DRC_Fortran forked from Nikhar-Abbas
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Sep 26, 2019
1 parent af03a13 commit 0caf01c
Show file tree
Hide file tree
Showing 29 changed files with 2,532 additions and 0 deletions.
46 changes: 46 additions & 0 deletions DRC_Fortran/#Archive/CONSTSteps_MPS.wnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
!Wind file for Trivial turbine.
!Time Wind Wind Vert. Horiz. Vert. LinV Gust
! Speed Dir Speed Shear Shear Shear Speed
0.00 7.0 0.00 0.00 0.00 0.00 0.00 0.00
0.10 7.0 0.00 0.00 0.00 0.00 0.00 0.00
100.00 7.0 0.00 0.00 0.00 0.00 0.00 0.00
100.10 8.0 0.00 0.00 0.00 0.00 0.00 0.00
200.00 8.0 0.00 0.00 0.00 0.00 0.00 0.00
200.10 9.0 0.00 0.00 0.00 0.00 0.00 0.00
300.00 9.0 0.00 0.00 0.00 0.00 0.00 0.00
300.10 10.0 0.00 0.00 0.00 0.00 0.00 0.00
400.00 10.0 0.00 0.00 0.00 0.00 0.00 0.00
400.10 11.0 0.00 0.00 0.00 0.00 0.00 0.00
500.00 11.0 00.0 0.00 0.00 0.00 0.00 0.00
500.10 10.00 0.00 0.00 0.00 0.00 0.00 0.00
600.00 10.00 0.00 0.00 0.00 0.00 0.00 0.00
600.10 11.00 0.00 0.00 0.00 0.00 0.00 0.00
700.00 11.00 0.00 0.00 0.00 0.00 0.00 0.00
700.10 12.00 0.00 0.00 0.00 0.00 0.00 0.00
800.00 12.00 0.00 0.00 0.00 0.00 0.00 0.00
800.10 13.00 0.00 0.00 0.00 0.00 0.00 0.00
900.00 13.00 0.00 0.00 0.00 0.00 0.00 0.00
900.10 14.00 0.00 0.00 0.00 0.00 0.00 0.00
1000.00 14.00 0.00 0.00 0.00 0.00 0.00 0.00
1000.10 15.00 0.00 0.00 0.00 0.00 0.00 0.00
1100.00 15.00 0.00 0.00 0.00 0.00 0.00 0.00
1100.10 16.00 0.00 0.00 0.00 0.00 0.00 0.00
1200.00 16.00 0.00 0.00 0.00 0.00 0.00 0.00
1200.10 17.00 0.00 0.00 0.00 0.00 0.00 0.00
1300.00 17.00 0.00 0.00 0.00 0.00 0.00 0.00
1300.10 18.00 0.00 0.00 0.00 0.00 0.00 0.00
1400.00 18.00 0.00 0.00 0.00 0.00 0.00 0.00
1400.10 19.00 0.00 0.00 0.00 0.00 0.00 0.00
1500.00 19.00 0.00 0.00 0.00 0.00 0.00 0.00
1500.10 20.00 0.00 0.00 0.00 0.00 0.00 0.00
1600.00 20.00 0.00 0.00 0.00 0.00 0.00 0.00
1600.10 21.00 0.00 0.00 0.00 0.00 0.00 0.00
1700.00 21.00 0.00 0.00 0.00 0.00 0.00 0.00
1700.10 22.00 0.00 0.00 0.00 0.00 0.00 0.00
1800.00 22.00 0.00 0.00 0.00 0.00 0.00 0.00
1800.10 23.00 0.00 0.00 0.00 0.00 0.00 0.00
1900.00 23.00 0.00 0.00 0.00 0.00 0.00 0.00
1900.10 24.00 0.00 0.00 0.00 0.00 0.00 0.00
2000.00 24.00 0.00 0.00 0.00 0.00 0.00 0.00
2000.10 25.00 0.00 0.00 0.00 0.00 0.00 0.00
2100.00 25.00 0.00 0.00 0.00 0.00 0.00 0.00
53 changes: 53 additions & 0 deletions DRC_Fortran/#Archive/Debug/CompileRunAndDebug.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
:: Compiling and Testing Discon.f90

echo off

:: Set this to the absolute path of FAST. In that
:: case also make sure the correct drive is selected
set "FASTdir=C:\FAST"

:: Set these to the absolute path of your archive directory. Does not necessarily have
:: to be the current directory
set "ArchiveDir=C:\FASTArchive"

:: Go to the drive where FAST is located
C:

Remove old .dll file
DEL %FASTdir%\CertTest\5MW_Baseline\ServoData\DISCON_gwin32.dll

:: Compile new .dll file
cd %FASTdir%\Compiling
mingw32-make.exe

:: Run Test18
echo off
cd ..\CertTest
echo on
FAST_Win32.exe Test18.fst

echo off
:: Make new directory with correct timestamp

Get the timestamp
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%"
set "stamp=%YYYY%_%MM%_%DD%_%HH%%Min%"

:: Put together the directory name and create it
set "dbFolder=%ArchiveDir%\%stamp%"
mkdir %dbFolder%

:: Copy debug files to this directory
copy Test18.sum %dbFolder%\Test18.sum
copy Test18.AD.sum %dbFolder%\Test18.AD.sum
copy Test18.ED.sum %dbFolder%\Test18.ED.sum
copy Test18.out %dbFolder%\Test18.out
copy Test18.SrvD.dbg %dbFolder%\Test18.SrvD.dbg
copy Test18.SrvD.dbg2 %dbFolder%\Test18.SrvD.dbg2


:: Echo the debug directory so matlab can potentially pick it up
echo %dbFolder%
pause
22 changes: 22 additions & 0 deletions DRC_Fortran/#Archive/Debug/CompileRunAndPause.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:: Compiling DISCON dll and run Test 18
:: Pauses afterwards so command window output can be read

:: Change these to the absolute path of FAST. In that
:: case also make sure the correct drive is selected
set "FASTdir=C:\FAST"

:: Go to the correct drive
C:

:: Remove old .dll file
DEL %FASTdir%\CertTest\5MW_Baseline\ServoData\DISCON_gwin32.dll

:: Compile new .dll file
cd %FASTdir%\Compiling
mingw32-make.exe

:: Run Test18
cd ..\CertTest
FAST_Win32.exe Test18.fst

pause
170 changes: 170 additions & 0 deletions DRC_Fortran/#Archive/Debug/PlotDebugData.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
%% PlotDebugData
% Imports and plots data from dbg and dbg2 files

%% Cleaning
close all
clearvars
clc

%% Settings
% set timeStamp (format: YYYY_MM_DD_TTTT or 2017_01_01_1200) to the test
% directory you want to import and plot
timeStamp = '2017_08_17_1448';
% Run the CompileRunAndDebug.cmd file from this matlab script
runCmdFromHere = false;

%% Loading
totalTime = tic;
if(runCmdFromHere) % Run CompileRunAndDebug.cmd and get the correct folder

[~,output] = dos('CompileRunAndDebug.cmd', '-echo');
i = strfind(output,'C:');
i = i(end);
debugFolder = [output(i:end-1) '\'];
clearvars output TimeStamp

else % otherwise get the debugfolder with the manual timestamp

debugFolder = [timeStamp '\'];
clearvars d order

end

% Import data from Test18.out and put in the debug structure
dbRaw = dlmread([debugFolder 'Test18.SrvD.dbg'],'\t',8,0);
[~,vars] = size(dbRaw);

fid = fopen([debugFolder 'Test18.SrvD.dbg']);
header = textscan(fid,'%s','delimiter','\t');
fclose(fid);

header = strtrim(header{1,1}(1:vars));
for i = 1:vars
db.(header{i}) = dbRaw(:,i);
end

% Import avrSWAP debug file
avrSWAP = dlmread([debugFolder 'Test18.SrvD.dbg2'],'\t',8,0);
avrTime = avrSWAP(:,1);
avrSWAP = avrSWAP(:,2:end);


%% Plotting
figure
title('GenSpeed')
hold on
plot(db.Time,db.GenSpeed)
plot(db.Time,db.GenSpeedF)
legend('GenSpeed','GenSpeedF')
ylabel('Speed [rpm]')

figure
title('GenTorque')
hold on
plot(avrTime,avrSWAP(:,47))

% figure
% title('Pitch')
% hold on
% subplot(2,1,1), plot(Time,PitCom1)
% legend('PitCom1')
% subplot(2,1,2), plot(Time,PitRate1)
% legend('PitRate1')
%
figure
title('Pitch')
hold on
plot(db.Time,db.PitCom1)
% plot(Time,PitRate1)
plot(db.Time,db.BlPitch1)
plot(db.Time,db.PitComT1)
% plot(Time,PitComT)
% plot(Time,GenTrq)
legend('PitCom1','BlPitch1','PitComT')

figure
title('rootMOOP')
hold on
plot(db.Time,db.rootMOOP1)
% plot(Time,rootMOOPF1)
% plot(Time,rootMOOP2)
% % plot(Time,rootMOOPF2)
% plot(Time,rootMOOP3)
% plot(Time,rootMOOPF3)
legend('rootMOOP1')

figure
title('PitComIPC')
hold on
plot(db.Time,db.PitComF1)
% plot(Time,PitComIPCF2)
% plot(Time,PitComIPCF3)
legend('PitComIPCF1')
%
figure
title('WindVelocity')
hold on
plot(db.Time,db.HorWindV)
legend('HorWindV')

% figure
% title('PitComT')
% hold on
% plot(Time,PitComT1)
% plot(Time,PitComT2)
% plot(Time,PitComT3)
% legend('PitComT1','PitComT2','PitComT3')
%
% figure
% title('PitRate')
% hold on
% plot(Time,PitRate1)
% plot(Time,PitRate2)
% plot(Time,PitRate3)
% legend('PitRate1','PiRate2','PitRate3')
%
% figure
% title('PitCom')
% hold on
% plot(Time,PitCom1)
% plot(Time,PitCom2)
% plot(Time,PitCom3)
% legend('PitCom1','PitCom2','PitCom3')
%
% figure
% title('Measured yaw error')
% hold on
% plot(db.Time,db.MErr)
% plot(db.Time,db.ErrLPFFast)
% plot(db.Time,db.ErrLPFSlow)
% plot(db.Time,rad2deg(avrSWAP(:,37)))
% legend('MErr','ErrLPFFast','ErrLPFSlow','Turibine yaw')
%
% figure
% title('Integral of fast yaw error')
% hold on
% grid on
% plot(db.Time,db.ErrLPFFast)
% plot(db.Time,db.Y_AccErr)
% legend('ErrLPFFast','AccErr')

% figure
% title('Yaw Rate')
% hold on
% grid on
% plot(db.Time,avrSWAP(:,48))
% legend('Yaw Rate')

% figure
% title('YawTorque')
% hold on
% grid on
% plot(avrTime,avrSWAP(:,41))
% legend('YawTorque')
%
% figure
% title('Yaw end time')
% hold on
% plot(db.Time,db.Y_YawEndT)
% plot(db.Time,db.Time)
% legend('YawEndT','Time')
10 changes: 10 additions & 0 deletions DRC_Fortran/#Archive/Debug/saveFigs.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%% saveFigs
% Saves all current figures. Can only be used after plotData is excecuted.
% Same code as in plotData, used so it can easily be executed from the
% command window.
figArray=findall(0,'type','figure');
for i = 1:length(figArray)
figure(figArray(i).Number)
saveas(figArray(i),[debugFolder 'fig' get(get(gca,'title'),'string') '.fig']);
end
disp(['Saved all figures to ' debugFolder(1:end-1)]);
Binary file added DRC_Fortran/#Archive/README.docx
Binary file not shown.
17 changes: 17 additions & 0 deletions DRC_Fortran/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Gitignore
~$README.docx
ControllerSchematic.pptx

# Compiled code, unnecessary for git
Source/Obj_win32
Source/Obj_lin64
*.mod
Source/x64/
Source/Release/

# Archive
Scripts/CompileDISCONHereCopyRun\.cmd
\.vs/

# Temp Files
*~
21 changes: 21 additions & 0 deletions DRC_Fortran/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Delft Center for Systems & Control, Data-Driven Control (TU Delft)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 0caf01c

Please sign in to comment.