Professional Documents
Culture Documents
ClearSCADA Automation Interface Training Rev 3.0 2007 PDF
ClearSCADA Automation Interface Training Rev 3.0 2007 PDF
ClearSCADA Automation Interface Training Rev 3.0 2007 PDF
Interface
Training Notes
Revision 3.0
30th May, 2007
Issue Details
Issue
1.0
2.0
2.1
3.0
Date
5th December, 2004
27th June, 2005
6th August, 2005
30th May, 2007
Author
G. Russ
G. Russ
G. Russ
R. Rogers
Comments
Initial Version
Updated for 2005 Edition
Updated for ClearSCADA 2005 Edition
Updated for ClearSCADA 2007 Edition
References
y
Required Hardware
y
Required Software
y
y
y
Windows 2000 SP2 (or higher), Windows XP SP2 (or higher) or Windows
2003 Server
ClearSCADA 2007 Edition
Microsoft Word, Excel, or Access with Visual Basic for Applications
Revision
3.0
Table of Contents
Issue Details .................................................................................................................. i
References .................................................................................................................... i
Required Hardware ....................................................................................................... i
Required Software......................................................................................................... i
Table of Contents ..........................................................................................................ii
List of Figures ............................................................................................................... iii
List of Tables ................................................................................................................ iii
1
Object Oriented Concepts.................................................................................. 1
1.1
Properties....................................................................................................... 2
1.2
Methods ......................................................................................................... 3
1.3
Derived Classes and Inheritance ................................................................... 3
2
Introduction to the Automation Interface ............................................................ 5
2.1
What is the Automation Interface ................................................................... 5
2.2
Supported Programming Languages.............................................................. 6
2.3
Required ClearSCADA Components ............................................................. 6
2.4
Adding the Automation Interface to the VBA Project ...................................... 6
2.5
A Simple Example .......................................................................................... 7
2.6
The VB Object Browser.................................................................................. 8
2.7
Automation Interface Classes ........................................................................ 9
3
Connecting to an ClearSCADA System ........................................................... 11
3.1
Security ........................................................................................................ 11
4
Finding Objects in the ClearSCADA Database ................................................ 13
4.1
ScxV6Server.FindObject .............................................................................. 13
4.2
ScxV6Server.LookupObject ......................................................................... 13
4.3
ScxV6Object.Find......................................................................................... 14
5
Reading and Modifying ClearSCADA Object Properties.................................. 15
5.1
ScxV6Object.Property .................................................................................. 15
5.2
ScxV6Object.Class.Name ............................................................................ 16
6
Creating, Renaming and Deleting ClearSCADA Objects ................................. 18
6.1
ScxV6Server.CreateObject and ScxV6Object.Create .................................. 18
6.2
ScxV6Object.Rename .................................................................................. 19
6.3
ScxV6Server.DeleteObject........................................................................... 20
7
Collections ....................................................................................................... 21
7.1
The ScxV6Objects Object ............................................................................ 21
8
Calling Methods on ClearSCADA Objects ....................................................... 23
9
Aggregates ...................................................................................................... 24
9.1
ScxV6Object.Aggregate ............................................................................... 24
9.2
ScxV6Aggregate.Enable .............................................................................. 24
9.3
ScxV6Aggregate.Property and ScxV6Aggregate.Interface .......................... 25
9.4
CHistory.LoadDataValue and CHistory.LoadDataFile .................................. 25
10
Templates and Instances................................................................................. 27
10.1 CTemplateInstance.TemplateId ................................................................... 27
10.2 CScxV6Object.PropertyOverride.................................................................. 27
10.3 Reading and Writing Properties in Instances ............................................... 28
Appendix A
VBScript Example............................................................................... 29
Appendix B
Inserting Historic Data ........................................................................ 30
B.1 PresetTimestamp and PresetQuality............................................................ 30
B.2 CHistory.LoadDataValue.............................................................................. 30
Revision
3.0
ii
B.3
CHistory.LoadDataFile ................................................................................. 31
List of Figures
Figure 1-1 - Accessing the ClearSCADA Database Schema using Internet Explorer.1
Figure 2-1 - ClearSCADA DatabaseApplication Interfaces .....................................5
Figure 2-2 - ClearSCADA Client Configuration...........................................................6
Figure 2-3 - SCX V6 Automation Interface in VBA Project References ......................7
Figure 2-4 - Automation Interface in the Object Browser............................................8
Figure 2-5 - Properties of ScxV6Object ......................................................................9
Figure 3-1 - Unknown System Name........................................................................11
Figure 3-2 - System Offline.......................................................................................11
Figure 3-3 - Permission Denied ................................................................................12
Figure 3-4 - Insuficient Privideges ............................................................................12
Figure 4-1 - Accessing Property of a Nothing Object................................................13
Figure 5-1 - Attempt to Write to a Read-Only Property.............................................15
Figure 5-2 - Attempt to Read or Write a Non-Existent Property................................16
Figure 6-1 - Non-Existent Class Name .....................................................................18
Figure 6-2 - Non-Creatable Class Name ..................................................................18
Figure 6-3 - Create in Non-Existent Group ...............................................................19
Figure 6-4 - Create in a Template Instance ..............................................................19
Figure 6-5 - Invalid Object Name..............................................................................19
Figure 6-6 - Deleting an Object Referenced by other Objects ..................................20
Figure 7-1 - Calling the List Method on an Object that is not a Group ......................21
Figure 7-2 - Invalid Item Number ..............................................................................21
Figure 8-1 - Invalid Argument to ClearSCADA Method ............................................23
Figure 9-1 - Named Aggregate does not Exist..........................................................24
Figure 9-2 - Using ViewX to Enable an Aggregate ...................................................24
Figure 9-3 - Accessing Properties or Methods of a Disabled Aggregate ..................25
Figure 10-1 - PropertyOverride Called on an Object that is not a Template .............27
Figure 10-2 - Property Override Called with an Object not in the Template .............28
Figure 10-3 - Property Override Called on a Non-Existent Field...............................28
Figure 10-4 - Attempt to Write to a Property in an Instance that is not Overridden...28
List of Tables
Table 9-1 - OPC Quality Values ...............................................................................26
Revision
3.0
iii
Configuration Fields Define the behaviour of the object. For example, all
objects have a Name property which stores the name of the object in the
ClearSCADA database.
Data Fields Define the state of the object. For example, all Points have
a CurrentValue field which stores the current value of the point.
NOTE: Configuration and Data Fields and collectively known as
properties.
In ClearSCADA, the available classes are listed in the Schema which can be
accessed using Internet Explorer by browsing to http://<server>/schema. If the
ClearSCADA server is running on the local machine, http://localhost/schema will
access the schema of the local server.
NOTE: If you are running a web server such as Apache, IIS etc on the same
computer as the ClearSCADA server, the ClearSCADA server may not be able to
run its web server, and the schema will not be available.
Figure 1-1 - Accessing the ClearSCADA Database Schema using Internet Explorer
Exercise
1.
2.
3.
Revision 3.0
When a user creates an object in the ClearSCADA database, they are creating an
instance of one of the classes listed in the schema. For example, an Internal Analog
Point is an instance of the CPointAlgManual class and therefore has all the
properties and methods listed in the schema for the CPointAlgManual class.
Exercise
1.
2.
3.
4.
1.1 Properties
Configuration fields are set by the user and define the configuration of the individual
instance of the class (object). The configuration fields are displayed in the object
properties in ViewX
Exercise
1.
2.
3.
4.
5.
6.
Revision 3.0
1.2 Methods
Methods are built in functions that perform actions on an object. For example Logic
Program classes (such as CLogicSTProgram) define a number of Execute methods.
These methods allow the program to be executed with a different number of
parameters. Methods are covered in more detail in Section 8.
NOTE: The Description column in the schema for Execute0, Execute1, to Execute12
has ** DEPRECATED Use Execute Method instead **. These methods have been
replaced by a new method Execute. Deprecated methods are still implemented in
ClearSCADA for backward compatibility, but should not be used in when creating
new ClearSCADA projects.
Redefine all of the properties and methods defined on Class A on Class B and
then defined the additional properties and methods on Class B
Inherit the properties and methods defined on Class A, and only define the
additional properties and methods on Class B
Exercise
1.
2.
3.
4.
5.
6.
Revision 3.0
NOTE: Typically, base classes cannot be instantiated (i.e. no object of the class can
be created). There are some exceptions, for example CGroup is the base class for
CTemplate and CTemplateInstance All of these classes can be instantiated. In
ClearSCADA, CDBObject is the base class for nearly every class in the database.
Exercise
1.
Revision 3.0
Standby Server
Computer
SCX6 Database
SCX6 Database
SCX6 Client
Interface
SCX6
Automation
Interface
Application
Client Computer
Read and modify properties (that are not read-only) of objects in the
ClearSCADA database
Create instances of ClearSCADA classes in the ClearSCADA database
Call methods on objects in the ClearSCADA database
Revision 3.0
The client is configured using the Configure ClearSCADA Connections applet. The
client must be configured with a Type of ClearSCADA Server to allow the automation
interface to connect to the associated server(s) (see Figure 2-2).
Revision 3.0
2.
3.
Revision 3.0
oServer.Disconnect
End Function
Exercise
1.
2.
3.
4.
5.
Create a new Internal Analog Point in the ClearSCADA Database using ViewX
Enter the program listed above
Run the program and confirm its results in ViewX
Modify the program to change the point value to 20
Confirm the program by checking the points value in ViewX
Exercise
1.
2.
3.
Create another Internal Analog Point in the ClearSCADA database using ViewX
Modify the program to change the value of the second point to 12.5
Confirm the program by checking the points value in ViewX
Exercise (Advanced)
1.
2.
3.
Create a third Internal Analog Point in the ClearSCADA database using ViewX
Modify the program to set the value of the third point to the sum of the values of
the other two points
Confirm the program by checking the points value in ViewX
The object browser can be used to display the properties and methods of classes
available using the automation interface as shown below in Figure 2-5.
Revision 3.0
2.7.1 ScxV6Server
The ScxV6Server class provides the functionality required to connect to a
ClearSCADA system. Multiple operations can be performed on a ClearSCADA
system using a single instance of this class. If the program connects to multiple
ClearSCADA systems simultaneously, multiple instances of this class are required.
This class also contains methods to allow the programmer to create, delete and
search for objects in the ClearSCADA database.
2.7.2 ScxV6Object
The ScxV6Object class provides the functionality to examine and modify objects in
the ClearSCADA database. This class is used to reference objects of all
ClearSCADA database classes. The automation interface does not provide a class
for each different ClearSCADA database class.
The search functions provided by ScxV6Server return a ScxV6Object
Revision 3.0
2.7.3 ScxV6Objects
The ScxV6Objects class is a collection class of ScxV6Object objects. Objects of this
class can be treated as an array of ScxV6Object objects. The number of
ScxV6Object objects of the array can be determined using the Count property of the
ScxV6Objects object. Each ScxV6Object object can be retrieved from the array
using the Item property.
2.7.4 ScxV6Aggregate
Some ClearSCADA database objects contain (as briefly mentioned in the
introduction) Aggregates. Each Aggregate class, like all other ClearSCADA classes,
contains properties (configuration fields and data fields) and methods. Aggregates
allow the same set of properties and methods to be provided on multiple
ClearSCADA classes in a consistent manner.
The ScxV6Aggregate automation interface class provides functionality to examine
and modify ClearSCADA aggregate objects.
Aggregates will be examined in more detail in Section 9.
2.7.5 ScxV6Class
The ScxV6Object and ScxV6Aggregate classes each contain a read-only Class
property of type ScxV6Class. The Name property of the ScxV6Class provides the
programmer with the name of the ClearSCADA class (CPointAlgManual for example)
of the ScxV6Object object.
2.7.6 ScxV6Systems
The ScxV6Systems class is a collection class of strings. Each string in this collection
is the name of a ClearSCADA system defined in the Configure ClearSCADA
Connections applet. The ScxV6Server object class contains a read-only Systems
property which is used to obtain a ScxV6Sytstems object.
Revision 3.0
10
After the ScxV6Server object has been successfully created, the Connect method
can be called on the ScxV6Server object, providing the System Name, Username
and Password. The following example connects to the ClearSCADA system called
MAIN with no username or password
oServer.Connect "MAIN", "", ""
If the specified system has not been registered in the ClearSCADA Client
Configuration applet (first parameter spelt incorrectly for example), the following error
will be generated in VB
If the specified system is offline, or the ClearSCADA Client has not been configured
for ClearSCADA Access, the following error will be generated in VB
3.1 Security
The level of access granted to a program using the automation interface using any
given Username/Password is the same as in ViewX using the same
Username/Password. For example, if a given user does not have Configure access
to a given ClearSCADA database object, a program using the automation interface
with the same Username/Password will not be able to modify the properties of that
ClearSCADA database object.
If an operation on the ClearSCADA database (or any ClearSCADA object in the
database) is attempted where the supplied username/password has insufficient
Revision
3.0
11
privileges to perform the operation, one of the errors shown below in Figure 3-3 and
Figure 3-4 will occur.
Exercise
1.
2.
3.
4.
5.
6.
7.
Use the ClearSCADA Service Manager to stop the ClearSCADA Server service
Rename the C:\ClearSCADADB folder
Use the ClearSCADA Service Manager to start the ClearSCADA Server service
Right-click on the ClearSCADA system tray icon and select Start Database
Click on Start Database on the warning dialog
Right-click on the ClearSCADA system tray icon and select Configuration
Select Security in the System Configuration folder of the Server Configuration
applet
8. Turn on the Enabled tick-box
9. Right-click on the server in the Server Configuration applet and select Apply
Changes
10. Close the Server Configuration applet
11. Open ViewX and import the file AutmationInterfaceSecurity.sde
NOTE: You will may get an Access is denied error This can be ignored.
The ClearSCADA database will now contain two users admin (password: admin01)
and operator (password: operator01). The admin user has full access to the
ClearSCADA database. The operator user only has Read, Browse, and Control
access to the ClearSCADA database.
Exercise
1.
2.
3.
4.
Revision
3.0
12
ScxV6Server.FindObject
ScxV6Server.LookupObject
ScxV6Object.Find
If the programmer does not check for Nothing, the error shown below in Figure 4-1 is
likely to occur.
4.1 ScxV6Server.FindObject
This method allows the programmer to obtain a reference to an object in the
ClearSCADA database by providing an absolute object name.
Exercise
1.
2.
3.
4.
4.2 ScxV6Server.LookupObject
This method allows the programmer to obtain a reference to an object in the
ClearSCADA database by providing an integer Object ID. All objects in the
ClearSCADA database have a unique Object ID which can be obtained using the ID
property of the ScxV6Object class.
Revision
3.0
13
Exercise
1.
2.
3.
Use the ID property of ScxV6Obejct to obtain the ID of the point created in the
previous exercise
Use the LookupObject method of the ScxV6Server object to obtain a reference
to the point using the ID (declare a new ScxV6Obejct in the VB code to store
this reference)
Display the current value of the new point using the ScxV6Object obtained in
step 2
Exercise (Advanced)
1.
2.
4.3 ScxV6Object.Find
This method allows the programmer to obtain a reference to an object located in a
Group, (or Template or Instance) in the ClearSCADA database. This method can be
used only if the ClearSCADA database object referred to by the ScxV6Object is a
CGroup, (or an object derived from CGroup). This method cannot find objects more
the one level deep in the Group.
The following code is not valid
Set oObject1 = oServer.FindObject (Group1)
Set oObject2 = oObject1.Find (Group2.Object)
oObject2 will equal Nothing even if the object Group1.Group2.Object exists in the
ClearSCADA database.
The following code is valid (provided the object Group1.Group2.Object exists in the
ClearSCADA database).
Set oObject1 = oServer.FindObject (Group1)
Set oObject2 = oObject1.Find (Group2)
Set oObject3 = oObject2.Find (Object)
Exercise
1.
2.
3.
Revision
3.0
14
5.1 ScxV6Object.Property
All properties of and ClearSCADA database object are accessed using
ScxV6Object.Property. The syntax on this automation interface property was shown
in Section 2.5 as:
oObject.Property("CurrentValue")
This statement retrieves the current value of the ClearSCADA database object (a
Point) referenced by oObject. The example also demonstrated that the current value
could be written to:
oObject.Property("CurrentValue") = 10
This statement set the value of the ClearSCADA database object (a Point)
referenced by oObject to 10.
By using the schema to obtain the names and types of the properties of a
ClearSCADA class, the programmer can access any property on a ClearSCADA
database object using the automation interface.
Exercise
1.
2.
3.
Use the automation interface to change the Full Scale of the point to 200
HINT: There are three Full Scale properties Standard, Current, and Tuned.
Only one of them is read-write. If you pick the wrong one, you will get the error
message shown in Figure 5-1.
Exercise (Advanced)
Revision
3.0
15
1.
2.
3.
5.2 ScxV6Object.Class.Name
As shown in the introduction, the properties defined on each of the ClearSCADA
classes are listed in the schema. The schema shows that different ClearSCADA
classes define different properties. However, ScxV6Object is used to reference
database objects of all ClearSCADA classes. If the program using the automation
interface attempts to read from, or write to, a property that does not exist on the
referenced ClearSCADA database object, the error shown in Figure 5-2 will occur.
Once the ClearSCADA class has been determined, the program can selectively
access the ClearSCADA database object properties applicable to that class.
Exercise
1.
2.
3.
4.
5.
Write a code that determines the ClearSCADA Class of the object linked to the
Link Parameter.
Write code that will set the State 0 Description of the linked object to Off if it is
an Internal Digital Point.
Revision
3.0
16
HINT: Use the VB If Then... ElseIf End If statement, or the Select Case
End Select statement.
6.
7.
Write code that will set the Over-range description of the linked object to Too
High if it is an Internal Analog Point.
Test you code by changing the point linked to in the link parameter.
Exercise (Advanced)
1.
2.
3.
Exercise (Advanced)
1.
2.
Revision
3.0
17
ScxV6Server.CreateObject
ScxV6Object.Create
ScxV6Object.Rename
And one method for deleting objects from the ClearSCADA database
y
ScxV6Server.DeleteObject
The programmer must also ensure that the specified class is one of the Creatable
Classes. Creatable classes have a description string in parentheses after the class
name in the schema. If a non-creatable class is specified, an error similar to the one
shown in Figure 6-2 will occur.
Exercise
1.
2.
Revision
3.0
18
in the ClearSCADA Database the error shown in Figure 6-3 will occur. If the named
object is a Template Instance, the error in Figure 6-4 will occur.
6.2 ScxV6Object.Rename
This method allows the programmer to rename objects in the ClearSCADA
database. This method is typically used to rename objects created with the object
creating methods described above.
The programmer must ensure that the new name adheres to the ClearSCADA object
naming rules. If the supplied name is invalid, an error similar to the one shown in
Figure 6-5 will occur.
Revision
3.0
19
Exercise
1.
2.
3.
4.
6.3 ScxV6Server.DeleteObject
This method allows objects in the ClearSCADA database to be deleted. If the Force
parameter is not set to True, and the object in the ClearSCADA database that is
being deleted is referenced by other objects, an error similar to the one shown in
Figure 6-6 will occur.
Exercise
1.
Use the automation interface to delete one of the groups (and all objects inside
the group) created in the previous exercises
HINT: ScxV6Server.DeleteObject will delete all objects within a Group if the
Object ID of a Group in the ClearSCADA database is supplied.
Revision
3.0
20
7 Collections
The methods ScxV6Server.Objects and ScxV6Object.List both return a collection of
instances of ScxV6Object. Each instance will reference an object in the ClearSCADA
database that is either an instance of the specified ClearSCADA class, or an
instance of any class derived from the specified ClearSCADA class.
ScxV6Server.Objects returns all objects in the ClearSCADA database of the
specified class.
ScxV6Object.List can only be called on ScxV6Object objects that reference an
instance of CGroup, (or instances of classes derived from CGroup) in the
ClearSCADA database. If the ScxV6Object reference an object which is not an
instance of CGroup (or one of its derived classes), the error shown in Figure 7-1 will
occur.
Figure 7-1 - Calling the List Method on an Object that is not a Group
NOTE: ScxV6Object.List only return objects inside the group, it does not return
objects that are contained in groups within the referenced Group.
Chapter 7 - Collections
Revision
3.0
21
Exercise
1.
2.
3.
4.
5.
6.
One of the most common ways of using the ScxV6Objects class is with a For/Next
loop
Dim oObjects as ScxV6Objects
Dim oObject as ScxV6Object
Dim iCurrentObject as Integer
Set oObjects = oServer.Objects (CPointAlgManual)
If (Not oObjects Is Nothing) Then
For iCurrentObject = 1 to oObjects.Count
Set oObject = oObjects.Item (iCurrentObject)
...Do something with oObject...
Next
End If
Exercise
1.
Use the automation interface to set the State 0 Description of all Internal Digital
Points in the ClearSCADA database to On
Exercise (Advanced)
1.
2.
3.
4.
Exercise (Advanced)
1.
Repeat the previous exercise, this time creating multiple groups (and multiple
levels).
HINT: The easiest way to do this is with a recursive function.
Chapter 7 - Collections
Revision
3.0
22
Where <Method> is the method defined by the ClearSCADA class and <ArgX> are
the arguments required by the method defined on the ClearSCADA class (refer to
the schema for the number and type of the arguments)
The following example will accept the current active alarm on the ClearSCADA
database object Analog Point with the comment This is a Comment
Set oObject = oServer.FindObject("Analog Point")
If (Not oObject Is Nothing) Then
oObj.Interface.AcceptWithComment This is a Comment
End If
If the arguments supplied to the ClearSCADA method are incorrect (wrong number
of arguments, or wrong data type) the error shown below in Figure 23 will occur
Exercise
1.
2.
3.
4.
Revision
3.0
23
9 Aggregates
An Aggregate is a collection of related ClearSCADA properties and methods that can
be included in a ClearSCADA class. The most common aggregate accessed using
the automation interface is the Historic (CHistory) aggregate. The Single and Dual
Network (CSingleNetwork and CDualNetwork) aggregates are also used frequently
when configuring network outstations. The PSTN (CAdvPSTN) and its derived class
are used when configuring dial-up outstations.
9.1 ScxV6Object.Aggregate
The Aggregate property of ScxV6Object returns an instance of the ScxV6Aggregate
class which references the named aggregate of the ClearSCADA database object
referenced by the ScxV6Object object. If the named aggregate does not exist on the
referenced object, the error shown in Figure 9-1 will occur.
Exercise
1.
Use the automation interface to display the class name of the Historic
aggregate of any internal point created in the previous exercises.
HINT: The Class property of the ScxV6Aggregate class is not the same as
ScxV6Object Use the object browser to determine the data type of this
property.
9.2 ScxV6Aggregate.Enable
Before the properties and methods defined on the aggregate can be accessed, the
aggregate must be enabled. The aggregate may be enabled in ViewX be checking
the Enable check box in the aggregates configuration as shown in Figure 9-2.
Chapter 9 - Aggregates
Revision
3.0
24
The aggregate can also be enabled using the automation interface by setting the
Enable property of the ScxV6Aggregate object to True as shown in the following
example
Set oAgg = oObject.Aggregate ("Historic")
If (Not oAgg Is Nothing) Then
oAgg.Enable = True
End If
Use ViewX to disable the Historic aggregate of any internal point created in the
previous exercises
Use the automation interface to enable the Historic aggregate disabled in step 1
Confirm the aggregate is enabled in ViewX
NOTE: You will need to close the properties dialog on the ClearSCADA object
in ViewX and open it again
Use the automation interface to enable historic compression of the point that
had its Historic aggregate enabled in the previous exercise.
Chapter 9 - Aggregates
Revision
3.0
25
The first argument to LoadDataValue is the data values Point Quality which has the
same numeric values as OPC Point Qualities. The following qualities are defined in
ClearSCADA
Quality
Bad
Uncertain
Good
Bad Configuration
Not Connected
Device Failure
Sensor Failed
Last Known
Communication Failed
Out of Service
Last Useable
Bad Sensor Calibration
Engineering Units Exceeded
Sub Normal
Value
0
64
192
4
8
12
16
20
24
28
68
80
84
88
Chapter 9 - Aggregates
Revision
3.0
26
10.1 CTemplateInstance.TemplateId
An instance of ScxV6Object referencing a CTemplateInstance object in the
ClearSCADA database has a property, TemplateId which is a reference to a
template in the ClearSCADA database.
Exercise
1.
2.
3.
10.2 CScxV6Object.PropertyOverride
If the instance of ScxV6Object references a template object in the ClearSCADA
database, the PropertyOverride property can be used to query the state of, and
enable/disable the property overrides of the referenced template. PropertyOverride is
called in the ScxV6Object referencing the template, and requires the ClearSCADA
object id of the object located in the template, and the name of a configuration field
(of the object within the template) to be specified.
If the object in the ClearSCADA database referenced by the ScxV6Object is not a
template, the error shown in Figure 10-1 will occur.
If the object id of the object within the template is not the object id of an object within
the template (or the object does not exist), the error shown in Figure 10-2 will occur.
Revision
3.0
27
Figure 10-2 - Property Override Called with an Object not in the Template
If the requested configuration field does not exist on the ClearSCADA database
object with the specified object id the error shown in Figure 10-3 will occur
Exercise
1.
2.
3.
Create a new Internal Analog Point in the template created the previous
exercise
Use the automation interface to enable the property override for the Full Scale
configuration field of the internal Analog point created in step 1
Confirm the property override in ViewX
Revision
3.0
28
Appendix A
VBScript Example
The following code is the VBScript equivalent of to the example provided in Section
2.5. The only differences are
1.
2.
Revision
3.0
29
Appendix B
There are three methods if inserting historical data into the ClearSCADA database
using the automation interface.
B.2 CHistory.LoadDataValue
The Chistory aggregate defines the LoadDataValue method which allows a historic
value to be added to the history of a point.
The following example stores a value of 10 at 10th December 2004, 1:00:01PM
(Local Time) with Good Quality (192) in the history of the point New Analog Point
Dim oHis As ScxV6Aggregate
Dim oObj As ScxV6Object
Set oObj = oServer.FindObject ("New Analog Point")
Set oHis = oObj.Aggregate ("Historic")
oHis.Enable = True
oHis.Interface.LoadDataValue 192, "2004-12-10 13:00:01", 10
Revision
3.0
30
B.3 CHistory.LoadDataFile
The Chistory aggregate defines the LoadDataFile method which allows a series of
historic values to be added to the history of a point from data stored in a file on the
servers file system.
The data file is series of comma separated data. Each row in the data file represents
a single historic value. The format of each row is:
<year>,<month>,<day>,<hour>,<minute>,<second>,<value>,<quality>
For example, the following line represents a value of 12.3 with good quality at
1:15:30PM on the 15th December 2004.
2004,12,15,13,15,30,12.3,192
The following example loads the historic data file C:\Temp\History.dat into the history
of the point New Analog Point
Dim oHis As ScxV6Aggregate
Dim oObj As ScxV6Object
Set oObj = oServer.FindObject ("New Analog Point")
Set oHis = oObject.Aggregate ("Historic")
oHis.Enable = True
oHis.Interface.LoadDataFile "C:\Temp\History.DAT"
Revision
3.0
31