Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:sw:01-mervis:storing-data-to-mervis-db-hidden [2020/05/25 14:37]
avsetula
en:sw:01-mervis:storing-data-to-mervis-db-hidden [2024/04/03 10:03] (current)
avsetula [Storing data into Mervis DB]
Line 1: Line 1:
-/* 
- 
 ====== Storing data into Mervis DB ====== ====== Storing data into Mervis DB ======
 +<WRAP group>
 +<WRAP half column 81%>
 In this tutorial, we are going to demonstrate how to use history logs for long-term storing of data from Unipi controllers running Mervis OS.  In this tutorial, we are going to demonstrate how to use history logs for long-term storing of data from Unipi controllers running Mervis OS. 
 +</​WRAP>​
 +<WRAP half column 15%>
 +;;#
 +<​html><​span class="​dev-tag dev-patron">​Patron</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-neuron">​Neuron</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-gate">​Gate</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-unipi11">​Unipi&​nbsp1.1</​span></​html>​ \\
 +<​html><​span class="​dev-tag dev-axon">​Axon</​span></​html>​
 +;;#
 +</​WRAP>​
 +</​WRAP>​
  
 <WRAP center round box> <WRAP center round box>
 <​html><​span class="​kbBlue-H4alt">​Prerequisites</​span></​html>​ <​html><​span class="​kbBlue-H4alt">​Prerequisites</​span></​html>​
   * Unipi controller running Mervis OS   * Unipi controller running Mervis OS
-  * 24V power supply+  * 24 V⎓ power supply
   * Mervis IDE project created according to [[storing-data-to-history-log-hidden|Storing data to history log]]   * Mervis IDE project created according to [[storing-data-to-history-log-hidden|Storing data to history log]]
-  * [[en:​sw:​01-mervis:​03-mervis-db|Mervis DB]] login info ([[en:​sw:​01-mervis:​getting-mervis-licence-hidden|a tutorial]] how to obtain it)+  * [[en:​sw:​01-mervis:​03-mervis-db|Mervis DB]] credentials
 </​WRAP>​ </​WRAP>​
 +
 +<WRAP center round info>
 +The Mervis DB credentials are generated together with the Mervis SCADA project and are intended for all PLCs connected to this SCADA project. ​
 +
 +----
 +
 +If you are only interested in the Mervis DB without Mervis SCADA, please [[https://​www.unipi.technology/​contacts|contact our sales department]] for an individual offer.
 +</​WRAP>​
 +
  
 ===== PLC properties settings ===== ===== PLC properties settings =====
-The first step is to  [[https://​kb.unipi.technology/​en:​sw:​01-mervis:​storing-data-to-history-log-hidden#​memory_storage_settings|set up the storage]].+The first step is to  [[storing-data-to-history-log-hidden#​memory_storage_settings|set up the storage]]. 
 + 
 +/* Přeložit z CZ - rozděleno na dva odstavce */
  
 If you wish to use the Mervis DB service to back up variables using our servers, you need to set its communication parameters first. In the **left panel**, select PLC.  If you wish to use the Mervis DB service to back up variables using our servers, you need to set its communication parameters first. In the **left panel**, select PLC. 
Line 25: Line 47:
   * **Communication period [min]**: this is the period in which the PLC will send the gathered data   * **Communication period [min]**: this is the period in which the PLC will send the gathered data
   * **Certificate validation**:​ set to ''​FALSE''​ by default, more info in the [[en:​sw:​01-mervis:​ssl-certification-validation-hidden|Certificate validation]]   * **Certificate validation**:​ set to ''​FALSE''​ by default, more info in the [[en:​sw:​01-mervis:​ssl-certification-validation-hidden|Certificate validation]]
-  * **Username**:​ the Mervis DB username ​you obtained from your account on [[http://​unipi.technology|unipi.technology]] +  * **Username**:​ the Mervis DB username 
-  * **Password**:​ the Mervis DB password ​you obtained from your account on [[http://​unipi.technology|unipi.technology]]+  * **Password**:​ the Mervis DB password
  
-<WRAP center round tip 80%>+<WRAP center round info 90%
 +Mervis DB credentials are available in the [[https://​www.unipi.technology/​customer/​scada/​|Mervis SCADA project administration]] (customer portal). 
 +</WRAP>
  
 +<WRAP center round tip 90%>
 Observant users probably realized we just entered a second different time parameter, namely the **Communication period**. ​ Observant users probably realized we just entered a second different time parameter, namely the **Communication period**. ​
  
Line 40: Line 65:
 </​WRAP>​ </​WRAP>​
  
-Since we changed the configuration of the PLC, we need to upload it. Right click on the PLC in the **Left panel** and select the <​html><​span class="​avBlueText">​PLC Operation</​span></​html>​ -> <​html><​span class="​avBlueText">​PLC Setup</​span></​html>​ -> <​html><​span class="​avBlueText">​Upload configuration</​span></​html>​. If you are not sure, check out the [[en:​sw:​01-mervis:​updating-a-runtime-configuration-hidden|Uploading a RunTime configuration]] tutorial.+Since we changed the configuration of the PLC, we need to upload it. Right click on the PLC in the **Left panel** and select the <​html><​span class="​avBlueText">​PLC Operation</​span></​html>​ ->​ <​html><​span class="​avBlueText">​PLC Setup</​span></​html>​ ->​ <​html><​span class="​avBlueText">​Upload configuration</​span></​html>​. If you are not sure, check out the [[en:​sw:​01-mervis:​updating-a-runtime-configuration-hidden|Uploading a RunTime configuration]] tutorial.
  
 {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-03-upload-configuration.png?​direct |}} {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-03-upload-configuration.png?​direct |}}
  
-You will be asked how to connect to the PLC. If you are on the same network, you can select **UDP Broadcast**. If not (ie. you use a proxy connection), select **Use deploy parameters** and confirm by clicking on **OK**.+You will be asked how to connect to the PLC. If you are on the same network, you can select **UDP Broadcast**. If not (ie. you connect to the PLC via Mervis Proxyn), select **Use deploy parameters** and confirm by clicking on **OK**.
  
 {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-04-probing-method.png?​direct |}} {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-04-probing-method.png?​direct |}}
  
-Deploy the solution, start the Debugging Mode and open the **System status** tab located on the **main panel**. In the **MervisDB** section (or **RcWareDB** in older versions of the IDE), you can check if the PLC communicates with Mervis DB. If the **Communication interval [min]** is set to 1 minute, the **Saved logs** value will increase every 60 seconds. ​+Deploy the solution, start the Debugging Mode and open the **System status** tab located on the **main panel**. In the **MervisDB** section (or **RcWareDB** in older versions of the IDE), you can check if the PLC communicates with Mervis DB. If the **Communication interval [min]** is set to 1 minute, the **Records saved** value will increase every 60 seconds. ​
  
 {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-12-system-status.png?​direct |}}  {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-12-system-status.png?​direct |}} 
  
-Let's move into the Mervis DB Viewer - a web tool for analyzing data stored by controllers. Open a web browser and enter [[https://​db.unipi.technology/​viewer|]] address. A login screen will appear - enter the login info used in the PLC settings. Upon entering them, click on **Set** and then on **Close**. ​ +Let's move into the Mervis DB Viewer - a web tool for analyzing data stored by controllers. Open a web browser and enter [[https://​db.unipi.technology/​viewer|]] address. A login screen will appear - enter the login info used in the PLC settings. Upon entering them, click on **Set** and then on **Close**. ​
  
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-10-mervis-db-viewer-login.png?​direct |}} +<WRAP center round box> 
- +If Mervis DB fails to display data even if you configured everything correctlyit is probably caused by the fact Mervis DB does not have any logged ​data yetClose the Mervis DB Viewer and wait until the first log is uploaded ​- the required time for this varies depending on communication intervals set for the PLC and DB, or on the history log intervalThe interval can be synchronous (egwith a fixed upload time) or asynchronous (the interval depends on how long it takes for data to be logged)If the issue persists even then, check Mervis DB login and password, ​make sure the address is set correctly ​and also make sure you [[en:​sw:​01-mervis:​updating-a-runtime-configuration-hidden|uploaded the configuration into the PLC]] correctly.
-Mervis DB web interface will open. In its **left panel** your PLC should be visible, identified by the name you entered into **History runtime identification**. Click on it to display ​a list of variables selected in the History log. Select them all to start parsing their values.  +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-11-mervis-db-viewer-workspace.png?​direct |}} +
- +
-You can visually check our simple temperature regulator project works. Using the cursor ​you can display parsed data valuesset various different graph types and many more options.  +
- +
-*/ +
- +
-====== Storing data into Mervis DB ====== +
-In this tutorial, we are going to demonstrate how to use cloud-based [[en:​sw:​01-mervis:​03-mervis-db|Mervis DB]] for long-term storing of data from UniPi controllers running Mervis. +
- +
-===== Prerequisites ===== +
- +
-  * UniPi controller running Mervis OS +
-  * Temperature regulator project from the [[en:​sw:​01-mervis:​attaching-1-wire-devices-hidden#​download|Attaching 1-Wire devices]] tutorial. +
-  * 24V power supply +
-  * 1-Wire temperature sensor +
-  * [[en:​sw:​01-mervis:​03-mervis-db|Mervis DB]] credentials ([[en:​sw:​01-mervis:​getting-mervis-licence-hidden|tutorial]] how to obtain it) +
- +
-In this tutorial, we will use [[https://​www.unipi.technology/​cs/​unipi-neuron-l523-p329|Unipi Neuron L523]]. +
- +
-===== Setting the storage ===== +
-If you followed the **Prerequisites**,​ your workspace should look like this: +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-01-workspace.png?direct |}} +
- +
-First, we will configure ​the connection parameters to Mervis DB. Select ​the PLC in the **Left panel**. +
- +
-{{ :en:sw:01-mervis:​storing-data-to-mervis-db-02-mervis-db-parameters.png?​direct |}} +
- +
-In the **Properties panel** you need to change the **History Runtime Identification**. This property is used as a name of the PLC for identification in the Mervis ​DB Viewer. Set it to something descriptivee.g. location of the PLC or its function. +
- +
-Lower in the PLC's properties is section **Mervis DB Parameters**Set the values as follows: +
- +
-  * **Enable**: set to true to enable the logging +
-  * **URL**: the URL of the Mervis DB serviceFor controllers running **Mervis OS v2.3.0 ​or newer**, use ''<​nowiki>​https://​db.unipi.technology/​plc/​save</​nowiki>''​. For the rest, use ''<​nowiki>​http://​db.unipi.technology/​plc/​save</​nowiki>''​ +
-  * **Communication period [min]**: this is the period in which the PLC will send the gathered ​data +
-  * **Certificate validation**:​ set to ''​FALSE''​ by default, more info in the [[en:​sw:​01-mervis:​ssl-certification-validation-hidden|Certificate validation]] +
-  * **Username**:​ the Mervis DB username you obtained from your account on [[http://​unipi.technology|unipi.technology]] +
-  * **Password**: ​the Mervis DB password ​you obtained from your account on [[http://​unipi.technology|unipi.technology]] +
- +
-Since we changed the configuration of the PLCwe need to upload it. Right click on the PLC in the **Left panel** ​and select the <​html><​span class="​avBlueText">​PLC Operation</​span></​html>​ -> <​html><​span class="​avBlueText">​PLC Setup</​span></​html>​ -> <​html><​span class="​avBlueText">​Upload configuration</​span></​html>​. If you are not sure, check out the [[en:​sw:​01-mervis:​updating-a-runtime-configuration-hidden|Uploading a RunTime ​configuration]] tutorial. +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-03-upload-configuration.png?​direct |}} +
- +
-You will be asked how to connect to the PLC. If you are on the same network, you can select **UDP Broadcast**,​ otherwise use the **Deploy parameters** and confirm by clicking on **OK**. +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-04-probing-method.png?​direct |}} +
- +
-Next we need to define a **History log** into which we will set variables for storing. In the **Left panel** right click on the **History** and from the context menu select the **Add New History**. +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-05-add-new-history.png?​direct |}} +
- +
-A new **History log** will appear under the **History** in the **Left panel**. Select it a move over to the **Properties panel**. +
- +
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-06-history-properties.png?​direct |}} +
- +
-Change the **History log** properties accordingly:​ +
-  * **History Saved on PLC**: enable the saving of this log by setting the value to ''​true''​ +
-  * **Type**: set to ''​Synchronous''​ +
-  * **Save Period**: this will set the period of saving the variable values for this History log. +
- +
-\\ +
-<WRAP center round tip 80%> +
-As you can see, we already configured two different time period parameters: The Communication Period in PLC's properties and the Save Period in the History'​s log. So what is the difference between them? +
- +
-The **Save Period** defines how often the PLC will sample variable values. The **Communication Period** is how often the PLC will send those samples to the Mervis DB.+
 </​WRAP>​ </​WRAP>​
-\\ 
- 
-We defined the **History log** and now we can add some variables to it. In the **Main window** you should see the main program canvas. Simply right-click on the office_Temperature global variable and in the context menu click on the **Add to History**. A similar method can be used to add variables into history directly from the **Variable Browser**. 
- 
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-07-add-to-history.png?​direct |}} 
- 
-A **Add to History** dialog will appear. Select the correct history log and click on **OK**. 
- 
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-08-add-to-history-dialog.png?​direct |}} 
- 
-And repeat the process for the rest of the variables. After you finish, double click on the history log in the **Left panel**. A complete list of variables assigned to the history log will appear as a new tab in the **Main window**. 
- 
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-09-history-list.png?​direct |}} 
- 
-Deploy the solution, switch to Debugging mode and open the **System status** tab in the **Main window**. In the **MervisDB** (for older IDE ** RcWareDB **) section you can check, whether the communication of the PLC with Mervis DB works. If you left the **Communication Period [min]** set to 1 minute, the **Records saved** will increase each minute. 
- 
-{{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-12-system-status.png?​direct |}}  
  
-Now to the Mervis DB Viewer - a web-based tool for analyzing the data saved by PLCs. Open the web browser and enter the address [[https://​db.unipi.technology/​viewer|]]. You will be presented with the login screen, where you have to enter the same credentials you used in the PLC's settings. After filling the username and password, click on **Set** and then on **Close**. 
  
 {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-10-mervis-db-viewer-login.png?​direct |}} {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-10-mervis-db-viewer-login.png?​direct |}}
  
-You will be presented with the Mervis DB web interface. In the **Left panel**, ​you should see a device with the name you set as the **History ​Runtime Identification**. Click on it and you should see a list of variables you set to the History log. Select all of them and their values will be automatically charted.+Mervis DB web interface ​will open. In its **left panel** ​your PLC should be visibleidentified by the name you entered into **History ​runtime identification**. Check the box next to their names to start plotting their data in the graph.
  
 {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-11-mervis-db-viewer-workspace.png?​direct |}} {{ :​en:​sw:​01-mervis:​storing-data-to-mervis-db-11-mervis-db-viewer-workspace.png?​direct |}}
  
-You can visually check that our simple temperature regulation works. You can use the mouse cursor ​to check the values ​of the charted data, set different ​chart types and periods and so on.+Using the cursor ​you can display parsed data values, set various ​different ​graph types and many more options.