Historic

<< Click to Display Table of Contents >>

 

Historic

1.Create Internal Tags "CommandType", "CommandUnit", and "User", and configure the data type of the Value property of these Tags as String.

Internal Tags

Internal Tags

2.Create a Historic object, called "HistCommand", and configure the ScanTime property, or the Interval between records (ms) option on the Historic's Property Window, with the value 0 (zero). In this Historic, create three fdText-type fields and link them to the Value property of the Internal Tags created in the previous item.

Historic object

Historic object

 

NOTE

When configuring a field with an fdText data type, users must also configure this Field's size.

 

3.After creating the Historic and generating the table on the database, users must establish which Commands are registered on this database. Elipse Power's Command objects contain a property called EnablePowerConfigEvent, whose function is enabling or disabling the generation of OnCommand events of the PowerConfiguration object, described on the next item. Therefore, in this item the EnablePowerConfigEvent property of the position Commands (SwitchPosition) of Switches 29-02 and 29-04 must be configured as True, as shown on the next figure.

EnablePowerConfigEvent property

EnablePowerConfigEvent property

4.Now create a script on the OnCommand event of the PowerConfiguration object. This event is triggered whenever a Command is executed, if the EnablePowerConfigEvent property is configured to True. This event returns the parameters CommandUnit, the Command Unit object receiving this Command, CommandAction, an integer indicating the type of Command: 1 - Operate, 2 - Select, or 3 - Cancel, and ActorID, the name of the user who sent the Command. This script is developed to configure all information relative to each Command to the Internal Tags created previously, and then insert a new row on a database's table. As explained earlier, the OnCommand event returns 3 (three) parameters that must be linked to the value of the Internal Tags. Notice that the CommandUnit parameter returns an object, so users must use a property of this object. In this exercise, type the next script.

Select Case CommandAction
  Case 1
    Application.GetObject("Data.CommandType").Value = "Operate"
  Case 2
    Application.GetObject("Data.CommandType").Value = "Select"
  Case 3
    Application.GetObject("Data.CommandType").Value = "Cancel"
End Select
Application.GetObject("Data.CommandUnit").Value = CommandUnit.PathName
Application.GetObject("Data.User").Value = ActorId

 

5.After linking the parameters returned by this event to the Internal Tags, insert a new record on the table using the WriteRecord method of the HistCommand object, according to the next line.

Application.GetObject("HistCommand").WriteRecord()

 

6.Finally, the script must look like the next figure.

Script of the OnCommand event

Script of the OnCommand event

Was this page useful?