Skip to content
Snippets Groups Projects
Commit 0f004238 authored by David Verelst's avatar David Verelst
Browse files

Merge branch 'master' of gitlab.windenergy.dtu.dk:toolbox/WindEnergyToolbox

parents 6a853ff1 8cdba6c9
No related branches found
No related tags found
No related merge requests found
Pipeline #
Auto-generation of DLB Spreadsheets
===================================
Introduction
------------
This manual explains how to automatically generate the set of spreadsheets that
defines a DLB and is required as input to the pre-processor.
This tool comes handy in the following scenarios:
* a DLB for a new turbine needs to be generated;
* a different wind turbine class needs to be evaluated;
* a new parameter needs to be included in the htc file;
* different parameters variations are required, e.g. different wind speed range or different number of turbulent seed.
The generator of the cases uses an input spreadsheet where the cases are defined
in a more compact way.
The tool is based on the "tags" concept that is used for the genetaion of the htc files.
Main spreatsheet
----------------
A main spreadsheet is used to defines all the DLC of the DLB. The file specifies the tags that are then required in the htc files.
The file has:
* a Main sheet where some wind turbines parameters are defined, the tags are initialized, and the definitions of turbulence and gusts are given.
* a series of other sheets, each defining a DLC. In these sheets the tags that changes in that DLC are defined.
The tags are devided into three possible different categories:
* Constants (C). Constants are tags that do not change in a DLC, e.g. simulation time, output format, ...;
* Variables (V). Variables are tags that define the number of cases in a DLC through their combinations, e.g. wind speed, number of turbilence seeds, wind direction, ..;
* Functions (F). Functions are tags that depend on other tags through an expression, e.g. turbulence intensity, case name, ....
...@@ -14,6 +14,8 @@ from __future__ import absolute_import ...@@ -14,6 +14,8 @@ from __future__ import absolute_import
from numpy import floor, arctan, pi from numpy import floor, arctan, pi
import pandas as pd import pandas as pd
import xlrd import xlrd
from argparse import ArgumentParser
import os
def multi_for(iterables): def multi_for(iterables):
...@@ -230,7 +232,9 @@ class GenerateDLCCases(GeneralDLC): ...@@ -230,7 +232,9 @@ class GenerateDLCCases(GeneralDLC):
self.add_formulas(dlc, general_functions) self.add_formulas(dlc, general_functions)
self.eval_formulas(dlc) self.eval_formulas(dlc)
df = pd.DataFrame(dlc) df = pd.DataFrame(dlc)
df.to_excel(folder+sheet.name+'.xls', index=False) if not os.path.exists(folder):
os.makedirs(folder)
df.to_excel(os.path.join(folder, sheet.name+'.xls'), index=False)
class RunTest(): class RunTest():
...@@ -257,6 +261,12 @@ class RunTest(): ...@@ -257,6 +261,12 @@ class RunTest():
assert_frame_equal(book1, book2, check_dtype=False) assert_frame_equal(book1, book2, check_dtype=False)
if __name__ == '__main__': if __name__ == '__main__':
parser = ArgumentParser(description = "generator of DLB spreadsheets")
parser.add_argument('--master', type=str, default='DLCs.xlsx', action='store',
dest='filename', help='Master spreadsheet file')
parser.add_argument('--folder', type=str, default='', action='store',
dest='folder', help='Destination folder name')
opt = parser.parse_args()
DLB = GenerateDLCCases() DLB = GenerateDLCCases()
DLB.execute() DLB.execute(filename=opt.filename, folder=opt.folder)
pass \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment