Introduction
WindPRO (desktop) scripting offers functionality to run windPRO from an external script. You need a license for the windPRO SCRIPTING service to use this feature. WindPRO scripting is running with an open instance of the windPRO GUI on your PC. This has the advantage that the user can work with the GUI and scripts intermittently. During execution of a script objects and calculations will appear in main windPRO GUI. Popup windows that are usually used for setting properties are not opened when using the scripting interface.
WindPRO scripting is organized along the known objects, calculations, and tools. We call each of these provided interfaces a service. Each of these services has end points that can be called from the script. Scripts are made using these end points together the functionality of the scripting language used, e.g. python. This combination gives a high degree of flexibility to integrate windPRO scripting into an existing IT infrastructure.
WindPRO is a large tool suit that has many interactive features. Not all functionality available within windPRO is available from windPRO scripting. The focus of windPRO scripting are objects, calculations, and tools needed for the wind resources assessment and environmental impact assessment. Not all functionality available within these objects, calculations, and tools within windPRO is accessible from scripting. WindPRO scripting is developed along the needs of our customers where priority is given to the features that are most needed.
The Interface
The windPRO scripting API is accessible via SOAP protocol. The very first step in using windPRO API is to start windPRO with a command line argument like this:
"C:\Program Files\EMD\windPRO4.1\windpro.exe" /ApiPort=50904
This will start windPRO in a mode where it opens a port for receiving commands on that given port. Note, that this port is an example and there is a chance that some other service on your computer is using it at the moment. Only one instance of windPRO can be using scripting, i.e. have an open port. Errors will occur if two windPRO instances with an open for are running at the same time.
After starting windPRO with the ApiPort command line parameter you can inspect the available services via any browser using this URLs:
If you cannot reach this page while working with windPRO scripting it could be that you are running on a difference port. This is for example the case when running the start up with a random free port from the provided python module. If you do not have the windPRO scripting license activated on your machine you cannot reach this link.
The rest of this documentation will use the SOAP protocol with Python (via the Zeep Library) as the scripting language as a reference and syntax. However, many other programming and scripting languages also has support for SOAP which makes it possible to use the documentation and but not the examples in other languages. For getting started with using scripting we recommend using our provided python package to be able to run the examples.
Logic of windPRO scripting
WindPRO scripting gives access to functionality via Services that can be called. All scripting features are available via services that are described within this documentation. There are different categories of service that are also :
- Services General
These services are giving access to general windPRO functionality not specific to a certain object, calculation, or tool. CalculationService give access to running calculation and reporting. ObjectsService is used for generating windPRO objects and general common functionality common to all objects.
- Tools
In the windPRO GUI objects and calculations are most present but more functionalities are available under under tools. Some of these can be accessed via windPRO scripting.
- Objects
Some objects have their own specialized service that gives access to detailed properties and functionality from this object. With these functions it is e.g. possible to setup up these objects from scripting.
- Calculations
Some calculations have their own specialized service. These calculations can be setup from scratch in scripting.
Both calculations and objects always have a GET function GetCALCULATIONCalc
or Getobjectobject
for getting data from windPRO
and a SET function SetCALCULATIONCalc
or Setobjectobject
for setting data in windPRO.
The objects in scripting are generally containing specialized data types.
Those are necessary so that windPRO can interpret the data structure correctly.
They are generally close to the data representation within windPRO and some of the data fields can contain information that is non-intuitive.
Therefore, a good workflow to set up objects in a calculation is to use the windPRO GUI.
After adding an object in the windPRO GUI and modifying it to the state that you need, it can then be accessed via the scripting interface via GetCALCULATIONCalc
or Getobjectobject
.
This way, more complex data structures are represented correctly in python and it is easier to see how the object/calculation can be set up with scripting.
This part is the power of the desktop part of “desktop scripting”.
Warning
windPRO scripting will assume that the script is running without interference from the user. Therefore, it is important to close all open objects or calculations in windPRO while code is executing.
For adding more complex data structures in python you can use windproapi.windproapi.get_factory('WindproService')
.
It gives access to data structures that are needed inside windPRO.
All data types used in windPRO scripting are available withing this documentation in Data Types.
The workflow in windPRO desktop scripting tightly follows that of windPRO. Many of the functions in the endpoints are a one to one representation of buttons within windPRO. All services with their endpoints are defined in this documentation in Overview Services. At the moment, there is no description of the individual methods due to limitations in the auto-documentation. Mostly, it is possible to understand the purpose of a method from its name.
Objects and calculations have a unique identifier called handle. This handle makes it possible to uniquely identify an object or link objects to calculations.
Coordinate system
Within windPRO there is the possibility to use many different coordinate systems, depending on the requirements for the project. Within windPRO all data is kept in lattitude/longitude with EPSG 4326 to keep consistency in the calculations. Only in the GUI, is the data transferred back to the coordinate system chosen in the project. WindPRO scripting follows the internal logic of windPRO and therefore all coordinates given to windPRO must be in EPSG 4326. Coordinate transformation can be performed with Windpro Service while the coordinate system associated with the project can be taken from Project Service. If other inputs are in different coordinate systems, they can be transformed using the EPSG number as input alone. The strict enforcement of one coordinate system is an advantage when different coordinate system are used or coordinate systems might change over time.
Possible errors
WindPRO scripting gives you a powerful tool to manipulate windPRO in new ways. Often it is necessary to set the path to a file or give an handle to connect calculations or objects. Within windPRO, these choices are limited to the right objects of file types. For example, file are filtered by extension and when linking objects only objects that can be used in the calculation are shown. These checks do not exist while using scripting. It is possible to set wrong files or link wrong objects. Errors will only occur once windPRO attempts to use these files or objects. Therefore, care needs to be taken when linking objects, e.g. for Statgen Calculation Service or Resource Calculation Service.