.. _objects_wtg: WTG Object Service ================== The ObjWtgService is giving access to wind turbine generator objects. To make a new wtg object, you can use the ObjectService. Then getting the properties of the wtg with the ``ObjWtgService.GetWtgObject``. These properties can be manipulated and then send back to windPRO with ``ObjWtgService.SetWtgObject``. Adding a path with a wtg file is enough to do a basic calculation. More advanced manipulation is not possible at the moment. Properties of the object can be found here :ref:`TApiObjWtg `. It is possible to change the power and noise curves that are used in a turbine. Each curve is identified by a unique ID. To get access to those you need to open the wtg file with :ref:`services_wtgExplorerService`. You can do that with ``WtgExplorerService.GetWtgFromFile(filename=file_name, details=True)`` displaying all information that is stored inside the wtg (though not the actual power curve values). You need to assign the right UID to identify the choice of power curve, noise data etc. .. list-table:: Which value to modify to choose power curve, noise data etc. :widths: 40 40 :header-rows: 1 * - UniqueID WtgExplorerService - Where to assign in TApiObjWtg * - WTGDTPowerCurve - Powercurve * - WTGDTNoise - Noisedata * - WTGDTVisual - Noisedata * - WTGDTeGrid - Noisedata * - WTGDTAny - * - WTGDTPCNoiseList - PCNoise * - WTGDTPowerMatrix - PowerMatrix * - WTGDTVisual3D - Additionally, you need to set the boolean flags correctly to correctly set the power or noise curves. * For any choice that is not using default power curves use: ``UseDefault = False``. * For using classical powre curves use: ``LegacyMode = True`` and ``PowerMatrixMode = False``. * For power noice pairs format use: ``LegacyMode = False`` and ``PowerMatrixMode = False``. * For Powermatrix format use: ``LegacyMode = False`` and ``PowerMatrixMode = True``. Curtailments can also be added to WTGs (both NewWTGs and ExistingWTGs). A list of Curtailments can be given for each turbine. It is possible to control if the turbine is shut down or reduced with the property ``OperationMode``. ``ApiCOMShutdown`` for shutting down the turbine and ``ApiCOMPowerCurve`` for using a power curve specified in ``ActionUID``. For WTGs with power matrix the UniqueID in the WTG file (as accessible from the :ref:`services_wtgExplorerService`) is referring the the whole power matrix. For those turbines the ``ActionUID`` needs to be the combined string of the ``UniqueID`` and ``ModeName``. Curtailment conditions are specified in (``CurtailmentCondition``) with a starting (``ConditionFrom``) and end (``ConditionTo``) date. Conditions associated with dates and time need to be given as floats. .. list-table:: Date related values in curtailment. :widths: 40 40 80 :header-rows: 1 * - Date-time - ApiCCDateTime - Days since 30.12.1899 * - Time - ApiCCTime - Hour of day / 24h * - Sunrise and Sunset - ApiCCSunriseSunset - See ObjWtgService.GetSunriseAndSunsetValues * - Date - ApiCCDate - Days since 30.12.1899 * - Weekday - ApiCCWeekday - 0 (Monday) to 6 (Sunday) Find below a working example that can be run on the test project New Salem. .. literalinclude:: ../../../python/examples/fromDocs/objects/wtg_object.py Find below an example showing the use of curtailments from Scripting. .. literalinclude:: ../../../python/examples/fromDocs/objects/wtg_object_curtailment.py Find below and example for using curtailments using information from a shadow calculation and adding all the the curtailments from that calculation: .. literalinclude:: ../../../python/examples/fromDocs/calculations/park_curtailment.py