====== Getting spot prices with WattPrice driver ======
Mervis system can get spot prices of electrical energy. This functionalty is available only for Patron and Gate units.
{{ :files:img_warning-line_b.png?nolink |}}
{{ :en:hw:09_safety-instructions_pseudo-ISO-7010-attention.png?nolink |(!)}}
**Warning:** \\
Currently, getting prices is available only for Czech region. See [[cs:sw:01-mervis:wattprice-hidden?tns|czech translation of this page]] for up to date infromation.
{{ :files:img_warning-line_b.png?nolink |}}
{{ :en:hw:09_safety-instructions_pseudo-ISO-7010-attention.png?nolink |(!)}}
**Attetion:** \\
Due to format changes in messages from API. It is no longer possible to read currecnt prices in IDE 2.6.5. \\
Communication using WattPrice protocol is available from version [[https://kb.mervis.info/doku.php/en:mervis-ide:20-download:00-start|Mervis IDE 2.7.6]] and after updating the .NET server. This IDE version is distributed directly by Mervis developers on their site.
Tutorial on how to update the .NET driver can be found at [[https://kb.mervis.info/doku.php/en:mervis-ide:40-mervis-rt:70-dotnet-server|.Net Server pro Mervis RT]].
===== Enabling drivers in PLC configuration =====
To get the driver up and running, you have to enable the .NET server in PLC configuration, in the [[en:sw:01-mervis:updating-a-runtime-configuration-hidden#common_properties|Common Properties]] section, enable the **Enable .NET drivers** items. Configuration shall be [[en:sw:01-mervis:updating-a-runtime-configuration-hidden#uploading_a_runtime_configuration|uploaded]] to the PLC now.
===== Adding a channel and device =====
Right-click on the PLC and select //Add channel//:
{{:en:sw:01-mervis:wattprice:add-channel.png?direct|Adding a new channel}}
We click on newly created channel and in its properties we set //Protocol// to **Watt Price (.NET)**:
{{:en:sw:01-mervis:wattprice:protocol.png?direct|Selecting Watt Price protocol}}
We right-click on the channel and select //Add Library Device//:
{{:en:sw:01-mervis:wattprice:adding-library-device-path.png?direct|Adding a library device}}
Select the device:
* Watt Price 15-Minute Period (Array) – data will be in an array
* Watt Price 15-Minute Period (Variables) – data will be as individual variables
{{:en:sw:01-mervis:wattprice:adding-library-device.png?direct|Selecting a library device}}
===== Device properties =====
{{:en:sw:01-mervis:wattprice:overview.png?direct|Device properties}}
Properties of the device has to remain original, only following may be changed:
* Cache Timeout – timeout, after data will be updated
* Date Shift Days – shifts the data by a day (use value 1 for next day)
===== Datapoints =====
{{:cs:sw:01-mervis:wattprice:datapoints.png?direct|Datapoints}}
The driver provides following information for the Czech region:
* PriceInQH [real] – variables or array with prices for every interval
* QuarterHoursInDay [int] – number of quarter hours of the day (summer and winter shift cause different counts)
* PriceMinimum [real] – minimal price of the day
* PriceMaximum [real] – maximal price of the day
* PriceAverage [real] – average price of the day
* PriceCurrent [real] – actual price