WTG explorer Service
The WTG Explorer Service gives access to the WTG Catalogue within windPRO. It contains power and noise curves together with other relevant information for more than a thousand turbines to be used within windPRO. These files are located with your windPRO installation. The data is saved in windPRO native files that can then be used for PARK calculations.
The WTG Explorer Service gives you an interface to identify and find these files.
The list of all manufacturers can be accessed with WtgExplorerService.GetManufactorList
.
You can use WtgExplorerService.GetWtgsWithFilter
to search for wind turbines by criteria.
The response includes a UID that is a unique identifier for that turbine.
Turbines can also be accessed with this UID WtgExplorerService.GetWtgFromUID
to get to the turbine meta data and the path to the file.
This way the generated scripts will reliably access the correct wind turbine.
Is is also possible to get wind turbines by index WtgExplorerService.GetWtgFromNdx
.
This is not advised for accessing a specific turbine, as this number might change when more turbines are added.
Nonetheless, it can be useful if it is necessary to make more custom filters that are not covered by WtgExplorerService.GetWtgsWithFilter
.
For getting detailed information about a wtg file use WtgExplorerService.GetWtgFromFile(filename=file_name, details=True)
displaying all information that is stored inside the wtg
A small example is provided below.
"""
Copyright 2023 EMD International
License for this script: MIT https://opensource.org/license/mit/
License for windPRO commercial software: https://www.emd-international.com/contact-us/general-terms-conditions-sale/
"""
import os
from pprint import pprint
from windproapi.utils import get_windpro_sample_path
from windproapi import nan_to_skipvalue
from windproapi import WindProApi
# Opening windPRO
_windproapi = WindProApi()
_windproapi.start_windpro_random_port()
wtg_explorer_service = _windproapi.get_service('WtgExplorerService')
obj_wtg_service = _windproapi.get_service('ObjWtgService')
project_service = _windproapi.get_service('ProjectService')
objects_service = _windproapi.get_service('ObjectsService')
windpro_service = _windproapi.get_service('WindproService')
working_dir = os.path.join(get_windpro_sample_path('4.0'), 'New Salem\\4.0')
project_path = os.path.join(working_dir, 'New Salem.w40p')
# Loading New Salem project
project_service.LoadFromFile(filename=project_path)
# Wind turbine Data Catalogue access
all_manufacturers = wtg_explorer_service.GetManufactorList()
pprint(all_manufacturers)
# Total number of turbines
N_wtgexpl = wtg_explorer_service.GetWtgCount()
print(f'{N_wtgexpl} wind turbines in the catalogue')
# Filtering data
wtgs = wtg_explorer_service.GetWtgsWithFilter(manufactor='VESTAS',
minRatedPower=2000,
maxRatedPower=2500,
minHubHeight=0,
maxHubHeight=1000,
minRotorDiameter=0,
maxRotorDiameter=1000)
print(wtgs)
# Getting a single wind turbine from a unique identifier.
# Preferrable to using the index if data base is updated and more turbines added
wtg = wtg_explorer_service.GetWtgFromUID(uid=wtgs[0].UID)
# Finding a turbines by its user label
objs = objects_service.GetObjects(apiObjType='NewWTG')
wtg_T40 = [o for o in objs if o.UserLabel == 'T40'][0]
# Doing coordinate transformations to find the coordiates for moving a turbine 500 m.
# Get the UTM zone of the current project
utm_zone = project_service.GetUtmWgs84EpsgForProject()
# Convert data from EPSG 4326, the coordinate system used internall in windPRO to utm
utm_coords_T40 = windpro_service.ConvertCoorEPSG(x=wtg_T40.Lng,
y=wtg_T40.Lat,
inEpsg=4326,
toEpsg=utm_zone)
# Converting UTM coordinates with an offset to EPSG 4326 to add to the objects in windPRO
new_wtg_coord = windpro_service.ConvertCoorEPSG(x=utm_coords_T40.X + 500,
y=utm_coords_T40.Y,
inEpsg=utm_zone,
toEpsg=4326)
# Adding the new objects. Be careful latitude is stored in Y and longitude in X
new_obj = objects_service.AddObject(apiObjType='NewWTG',
lat=new_wtg_coord.Y,
lng=new_wtg_coord.X,
userDesc='T100')
wtgObj = obj_wtg_service.GetWtgObject(new_obj.Handle)
wtgObj.UserLabel = 'T100'
# Adding file path found from the wind turbine catalogue
wtgObj.Filename = wtg.FileName
# Hub height needs to be given explicitely
wtgObj.Hubheight = wtg.DefHubHeight
# Needed to handle None values when communicating with zeep
nan_to_skipvalue(wtgObj)
# Set everything back into the wtg object
obj_wtg_service.SetWtgObject(wtgObj)