Difference between revisions of "Tutorial7"

From HSYCO
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 9: Line 9:
  
 
== Creating a new Datalogger ==
 
== Creating a new Datalogger ==
 +
 +
Click on the "Settings" icon and then on the "I/O Servers" icon.
 +
 +
[[File:Tutorial5-1.png|200px]]
 +
 +
Click on the "Datalogger" icon. [[File:Tutorial7-1.png|50px]]
 +
 +
Select the type "counter".
 +
Counter: suitable for the creation of statistics of an incremental value (e.g. energy consumption or production). It calculates the variation (delta) of the value for each time interval with respect to the previous one. Further, it is possible to specify time slots and the relative rates to calculate for instance the costs for energy consumption.
 +
 +
Let's assign a generic ID to this Datalogger, for example "d1"
 +
 +
[[File:Tutorial7-2.png]]
 +
 +
The default settings are ok for this example. Leave everything unchanged.
 +
 +
[[File:Tutorial7-3.png|600px]]
 +
 +
Press the button [[File:Tutorial8-4.png]] and wait for Hsyco restart.
 +
 +
 +
=Datalogger logic =
 +
 +
Open the "Project Editor" and add a "button" object linked with datapoint "dummy.light.1"
 +
If you need further information about the Dummy I/O server please read this: [[Tutorial5]]
 +
 +
Then add a "text" object with this attributes:
 +
 +
[[File:Tutorial8-5.png]]
 +
 +
Here's the final result:
 +
 +
[[File:Tutorial8-6.png|600px]]
 +
 +
 +
Now edit the events.txt file from the "File Manager"
 +
Add these lines:
 +
 +
io dummy.light.1 = 1 : $counter! + 1
 +
$counter! : uiset display1.text = $counter!, datalogger d1 = $counter!
 +
 +
The first line increases by 1 the value of the variable $counter! any time the virtual DUMMY light is turned on.
 +
The second line updates the text object with id “display1” and the Datalogger “d1” to the new value of the “$counter!” variable
 +
 +
=Datalogger object =
 +
 +
Go back to the "Project Editor" and add a "Datalogger" object.
 +
 +
[[File:Tutorial7-7.png]]
 +
 +
Link the object to the datalogger "d1".
 +
 +
[[File:Tutorial7-10.png]]
 +
 +
Specify the flowing attributes attributes:
 +
 +
[[File:Tutorial7-8.png]]
 +
 +
Save the project and open a new tab in your browser with the following URL:
 +
 +
<nowiki>https://192.168.0.50/hsycoserver/test</nowiki>
 +
 +
[[File:Tutorial7-9.png|600px]]

Latest revision as of 17:17, 30 April 2014

This tutorial describes how to create a Datalogger.

To access the Project Editor enter the following URL in your Web Browser:

https://192.168.0.50/hsycoserver/manager

If you need more information about the first login to Hsyco please read first this: Tutorial1

Creating a new Datalogger

Click on the "Settings" icon and then on the "I/O Servers" icon.

Tutorial5-1.png

Click on the "Datalogger" icon. Tutorial7-1.png

Select the type "counter". Counter: suitable for the creation of statistics of an incremental value (e.g. energy consumption or production). It calculates the variation (delta) of the value for each time interval with respect to the previous one. Further, it is possible to specify time slots and the relative rates to calculate for instance the costs for energy consumption.

Let's assign a generic ID to this Datalogger, for example "d1"

Tutorial7-2.png

The default settings are ok for this example. Leave everything unchanged.

Tutorial7-3.png

Press the button Tutorial7-4.png and wait for Hsyco restart.


Datalogger logic

Open the "Project Editor" and add a "button" object linked with datapoint "dummy.light.1" If you need further information about the Dummy I/O server please read this: Tutorial5

Then add a "text" object with this attributes:

Tutorial7-5.png

Here's the final result:

Tutorial7-6.png


Now edit the events.txt file from the "File Manager" Add these lines:

io dummy.light.1 = 1 : $counter! + 1
$counter! : uiset display1.text = $counter!, datalogger d1 = $counter!

The first line increases by 1 the value of the variable $counter! any time the virtual DUMMY light is turned on. The second line updates the text object with id “display1” and the Datalogger “d1” to the new value of the “$counter!” variable

Datalogger object

Go back to the "Project Editor" and add a "Datalogger" object.

Tutorial7-7.png

Link the object to the datalogger "d1".

Tutorial7-10.png

Specify the flowing attributes attributes:

Tutorial7-8.png

Save the project and open a new tab in your browser with the following URL:

https://192.168.0.50/hsycoserver/test

Tutorial7-9.png