1. Introduction
This application illustrates how to use an hour meter with the resources available in Elipse E3, with both partial and total values being displayed.
2. Settings
An XObject called xoHourmeter was created with four properties:
- OnOff (turns on/off the device and/or counter)
- Partial (partial time with the device on)
- Total (total time with the device on)
- Animate (for animating the rotor)
On the xoHourmeter‘s OnStopRunning event is the following script:
Parent.Save()
On OnOff property’s OnPropertyChange event is the following script:
If OnOff = False Then Total = Total + (Partial / 86400)
NOTE: The value 86400 means the received data is being converted into seconds, as follows: 60 (seconds per minute) x 60 (minutes per hour) x 24 (hours per day) = 86400 seconds.
Inside this library is a Counter Tag called PartialCount, with the following links:
- Value with a reverse link to xoHourmeter.Partial
- Enabled with a simple link to xoHourmeter.OnOff
There is also a Demo Tag called Animate, with the following links:
- Value with a reverse link to xoHourmeter.Animate
- Enabled with a simple link to xoHourmeter.OnOff
3. Usage
This XObject can be used in any application, linked to a device, button, or tag, among others, or even to an XControl (according to the attached application).
In the sample application, there is an XControl with an engine linked to the OnOff property (which turns the Counter Tag on/off), and also to the engine’s animation.
The Partial and Total properties are linked to displays, and can show how long they have been working in seconds, minutes, and hours, or then in Double (Regular Read).
A historic was also created (Hist1) to show it is possible to save the data received in a database (Database1), and later check it in an E3Browser.
4. Demo application in action
When the demo application is open, the following screen appears:
By clicking the device, the counter is turned on:
By clicking it again, both the partial and the total counter record this data:
By turning the device on, the partial counter resumes counting: