.. _calculations_mcp: MCP Calculation Service ======================= The CalcMCPService gives access to the MCP module in windPRO. It contains methods to get and set (``CalcMCPService.GetMCPCalc`` and ``CalcMCPService.SetMCPCalc``) the calculations similar to other calculation services. An MCP calculation needs a site data object. The MCP calculation is different as there are sessions in the calculation where MCP calculation are performed. To add a session you can use the ``CalcMCPService.AddSession`` function. The function ``CalcMCPService.GetTemplateModels`` generates all available models with their default setting to make it easier to add them. Sseveral of these models can be assigned to the MCP calculation object. To Assign them in windPRO (and to generate the correct model handle) use ``CalcMCPService.SetMCPCalc``. The MCP calculation object has different handles and IDs that need to be set. For convenience they are listed below with a description. .. list-table:: Data types available from online :widths: 25 100 :header-rows: 1 * - Property - Description * - Handle - Handle of the MCP calculation * - Sessions.TApiMcpSession[].Handle - Handle of the specific session * - Sessions.TApiMcpSession[].SGSiteDataHandle - Handle for the site data object * - Sessions.TApiMcpSession[].MeasureMeteoHandle - Handle of the meteo object with the measurement data * - Sessions.TApiMcpSession[].MeasureMeteoUID - ID to identify the correct height in the meteo object * - Sessions.TApiMcpSession[].ReferenceMeteoHandle - Handle of the meteo object with the reference data * - Sessions.TApiMcpSession[].ReferenceMeteoUID - ID to identify the correct height in the meteo object * - Sessions.TApiMcpSession[].SelectedModelHandle - Model to be used for performing MCP calculation * - Sessions.TApiMcpSession[].Models.TApiMCPModel[].Handle - Handle for the specific models It is important to remember that assigning values to the object in python (or your preferred programming language) does not set them in windPRO. This needs to be done with ``CalcMCPService.SetMCPCalc`` to take effect in further calculations. The different models can be calculated for training and testing with ``CalcMCPService.TrainAndTest``. This will calculate all models of the selected session. There are several functions to get access to different statistics that are available in the interactive session in the meteo object. ``CalcMCPService.PredictToWindStat`` Their use us shown in the example below. For obtaining these statistics the calculation needs to be open from windPRO scripting unlike for calculating other calculations. The final MCP calculations are performed by adding a time series with ``CalcMCPService.PredictToMeteo`` or by making a wind statistics with ``CalcMCPService.PredictToWindStat``. For the latter, a site data object needs to be assigned to the MCP session. Properties of the calculation object can be found here :ref:`TApiCalcMCP `. The example below shows how to set up an MCP calculation from scratch in a project with existing meteo objects. .. literalinclude:: ../../../python/examples/fromDocs/calculations/mcp_calculation.py