Está en la página 1de 64

SCADA LAquis

Supervisory control and data acquisition software - LAquis

Simple introduction
application development

Leo Consultoria e Desenvolvimento de Sistemas Ltda Me, Brazil

http://laquisscada.com
http://www.lcds.com.br

Summary
Introduction.......................................................................................................3
Step by step......................................................................................................4
1 Definition of the tags (I/O points and variables).........................................4
2 Database / History / Report.......................................................................8
3 Visual Objects..........................................................................................10
4 Script.......................................................................................................18
5 Tag groups..............................................................................................19
Tags spreadsheet...........................................................................................24
Communication.............................................................................................31
Formulas......................................................................................................32
Database......................................................................................................33
Drivers.............................................................................................................34
Data and Report..............................................................................................37
Customizing reports......................................................................................37
Database......................................................................................................41
Network...........................................................................................................45
Server...........................................................................................................45
Client............................................................................................................46
Visual Objects.................................................................................................47
Vector drawing objects.................................................................................50
Inserting visual objects.................................................................................53
Panel configuration.......................................................................................53
Visual objects examples...............................................................................54
Script introduction...........................................................................................61

Introduction
SCADA LAquis is a supervisory control and data acquisition software. From data acquisition to
application development.

The main screen for development, is divided into two parts: in the bottom where there is a spreadsheet
with the tags and the top panel where the visual objects are placed.
On the spreadsheet tags IN and OUT points are defined. Equipments, variables, files, formulas, scales or
other properties and user defined properties for each case.
On the panel, visual objects can be used both for the development of specific systems via script and also
for simple accompaniment of a data acquisition. Each object can be related to a defined tag in the tag
sheet.
When setting a database in spreadsheet tags, you can generate reports, analysis, and charts with data
stored through the "Reports" menu.
To start a development of a new application click the New button. A window appears with several models
that generate predefined applications that can be changed as needed.

Step by step
Test the steps below, clicking the New button, select <blank>, click OK, type a name and save.
5 basic steps:
1 Definition of the tags (I/O points and variables).
2 File / Report
3 Visual Objects
4 Scripts
5 Groups of tags

1 Definition of the tags (I/O points and variables).


Set I/O points on the tags spreadsheet at the bottom of the main screen. These tags can be generic or
physical equipment variables.
The tags spreadsheet contains properties to define what will be read or written on the equipment. Some
of the main properties are: Name, Title, Value, Unit, Driver / PLC, Database, Param1, Param2, etc ....
Each propertie can be a column in this tags spreadsheet. Choose the equipment driver to be used in the
Driver / PLC column. The driver can be set by dragging the mouse pointer with the left button on the
Driver / PLC column, or by clicking on the Driver / PLC column title to select all tags desired at the group.

When you release the mouse button, the window for selecting the driver will be shown:

The driver to be chosen depends on the equipment (hardware / PLC) used.


To simulate a device use, for example, the driver DEMO.
For example, to communicate with a device that uses the protocol "MODBUS RTU" then choose the
driver MODBUS RTU. The Param1 will be the register address and Param2 will be the equipment node
number (Example: Param1 = 400001 Param2 = 1.). See the MODBUS parameters description.
Set up communication (port, speed, timing, etc ....) on the button Config at the driver's window.
The following window will appear for serial port settings:

Set the communication parameters. Sample conPicturetion for serial port COM1: 1:9600,N,8,1. (serial
port 1, 9600 baud, no parity, 8 data bits, stop bits 1).
To use OPC, the select OPC driver, click on the "Config" button. A window will appear to define the
ProgID and Item ID. Optionally, for remote connections, type the IP of the server in the Server field:

- Set the tag's properties.


In this example, name (Tag1), title (Value 1), unit ( C), Param1 (40x0000) and Param2 (1):

Example with four tags: (four first Holding registers will be read of equipment node 1 through Modbus
protocol)

To simulate, it can be used DEMOTESTE or DEMO driver:

To start reading the values and test communication click on the button
("Play" - Start application). Values will be shown in the Value column. If
there is a communication error, an "ERROR" message will appear in this column, and at the "Status"
column.
To disconnect the communication, press the button
("Stop" - Stop application)
The tag may be also a variable for generic purposes. Use, for example, the VAR driver.

Each tag has properties that can be customized: alarms, formulas, limits, etc ...

Formula:
Examples:
Tag1*Tag2
Tag3/7
*0.1
*Bit(0)

Multiplying two tags.


Divide by 7
Multiply by 0.1 at reading (IN) and divide by 0.1 on write (OUT).
Returns bit 0

To access formula options click on the button at the side of the formula column.

Alarm:
Click on the button at the right side to set alarm functions for a tag.
It can also be used to create descriptions for each tag value. Example:

2 Database / History / Report


Data acquisition in tags can be recorded to a file (database). Click on the database column. The database
can be set by dragging the mouse pointer with the left mouse button on the database column (like it was
done with the driver), or by clicking on the title of database column to select all tags at the group.

In this example, the values of the four tags will be stored in TEST.LB database:

The time interval in which the values are stored is set in the Recording column.
Note: by default, the data are recorded in the sub-folder "dados" inside the main application folder. To
change the database settings using the menu item "Reports" - "Edit Database".
With some data already recorded in the database it is possible to create reports.

To generate a report with the recorded data, click at the menu Data and Reports - Open (or insert a button
object on the panel and click "Show this button's report" - as explained in step 3).
At the first time, in this stage of development, a window will be shown for choosing a report template (that
can be customized later):

Set a name for the report. It will be a file with a LGX extension that will contain a layout, formats,
formulas, scripts and other reporting features.
(If you want to create or join a report to the button, just click the right mouse over the button and select
"Show this button's report- see in step 3.)
It is possible to customize reports and also to create new templates.
Data and Reports - Edit.
See more details on reports at the Data and Report or Database topic.

3 Visual Objects
On top of the main software screen is located the visual objects panel. On this panel the objects and
visual controls are designed and can be used as the interface for the user. These objects can be displays,
pictures, animations, controls, etc...
Select the desired object and place on the panel. Click on the object icon at the toolbar or choose the
object in the right window (the object tab when no objects are being selected). Click on the panel or drag
the mouse pointer with the left button to draw the object.

At the example above, it was added an object "displaytext", and a "Edit" object used to change values.
Each visual object may be associated with a tag. For that, click twice on the visual object at the panel, or
select the "Formula" property of the object.

Select the "tag" to be associated with the visual object. In the example above, the Tag1.
The title property at tag's spreadsheet can be used as the description and passed automatically to the
visual object. (Tag's names also can be freely set, but must have no spaces and cannot be repeated in the
same group).

10

The visual objects has different properties. In the following example was included a button
clicking once on the button, a window at the right shows its properties.

. By

In the above example, this properties was changed: Text (with the value "Report") and Report (set to the
report lgx name). The Text property in this case is the title of the button. If you want to create or associate
a report to the button, just click the right mouse over the button and select "Show this button's report".
Another important button's property is Command. When the button is pressed the value of the associated
tag will be the value of Command property. Also check Page properties, PopupPage and ChangeTag.
See the button properties on the topic Visual Objects Examples.
Example thermometer visual object. The upper and lower limits can be associated to the worksheet.

11

Creating / Drawing vector objects


If you want to import ready examples through the Import button ...
To create new vector objects:
1 - Draw at the panel pages using vector objects by "drawing button

Uncheck "Drawing" button.


1 - At another page, add an "ObjectPage" object, indicating the property "Page" the drawing location.

2 - If you want to make it sensitive to the value of a tag, assign the tag to the PageObject and set the
corresponding values in the property "Pages". Tag value = page number. Example: Pagename1 = 1,
Pagename2 = 2 When the tag value is 0 then the drawing on page 1 will be displayed. If the tag value is 1
then the drawing at the second page will be displayed.
3 - If you want to turn it into a button activates the property "ChangeOnClick";

12

Animation:
3 - If you want to set up an animation, put the page numbers related to the animation frames in the "Pages"
property (each number must be separated by; - semicolon) and enable the "Animation" property. The first page (at
the "Page" property) will be activated when the "tag" associated with the object is 0. When the "tag" is 1 then there
the animation will be the switching between the remaining pages. Example: 3; 1: 2

4 - If you want to make the object sensitive to mouse, like a button, turn on the "ChangeOnClick" property. By
clicking on the object it switches the value of the "tag" from 1 to 0.

Instead of the page numbers may be used page names.


Example:
Pagename1;Pagename2;Pagename3
0=Pagename1;1=Pagename2
etc...
13

Before learning how to create new objects, it is needed to understand two concepts: Drawing vector
objects and PageObject.
Drawing objects:
To draw on the panel using vector objects click on the button.

More details of vector objects see the topic Drawing objects

PageObject:

It can define groups of objects based on a standard panel. One way to do this is using the PageObject object.
It is possible to create an object with a group of objects based on a standard panel. One way to do this is
using the PageObject

1 Set the objects on panel page (from page 1)

2 Associate the objects with tags. May be tags inside a group.


3 Place (on page 0) the PageObject object.
4 Associate the object PageObject to a tag or group.

14

Example of visual object Picture file. This visual object can be used to many purposes. Buttons of two
states, status information, simple illustration, etc .... Pictures files can be bmp, jpeg, gif or emf (vector).
In the example below Picture is set to double status button (Double state property):

When an application is executed, this visual object will become like a button (property ChangeOnClick). By
clicking on this object, the state of the tag associated changes to values alternating between 0 and 1. Its
display changes as the property "Current status". The name of the figure should have the format:
<name><state or value>.emf or .bmp. In this case, valve0.emf and valve1.emf.
It can also be used an animated gif file. Even then set the maximum number of states.

15

In the example below object Picture is configured as a button with animation. (Property Double State
unchecked):

When the application is executed this visual object also will act like a button (property ChangeOnClick). Clicking
on this object, the tag state associated with it will be changed to values switching between 0 and 1. But when
the property Current State became 1 then the object enter in a animation state switching states from 1 to the
maximum number of states. Picture name also must have the format <name><state>.emf or .bmp. In this
case, motor1.emf e motor2.emf. It can be used used too a gif animated file. Nevertheless set the
maximum number of states.
If its desired user intervention to change tag state set property ChangeOnClick.

More details about visual objects see the topic Visual Objects.

16

4 Script
Scripts are sequences of instructions or programs used to customize the application's actions to meet
the process. They are executed within the available events in the system.

Example:
Select an object, click on the Script tab text. Enter, for example, Tag(tag5) = 1.

Tag motor will receive the value 1.

Note that a simple operation like this, used in these examples do not necessarily requires a script - this
sample is just for understanding purposes. Same operation could be done, just setting in the button object,
Command property to 1.

To access some of the script functions press F4.

17

5 Tag groups
Tags can be divided into groups. These groups may be stations, equipments, modules,
machines, units, plants, etc ... Tags names can be equal to each other, just by changing the
groups and addresses.
PANELS:
Generally do not need to develop a panel for each group if the tags are equal or similar. If the
panel is the same, and changes only addresses / tags groups, just create one panel. Once set
the panel it may be associated in real time for any of the groups. This also applies to database
and reports.
DATABASE:
The database is recorded by group. It is not necessary to create a different database for each group. The
existence of several groups with the same bank, these groups will automatically be stored in parallel as
follows: each record will have a field for each tag name and the group name is recorded in GROUPNAME
field. At the report, they can be displayed individually or in groups. See the examples below.
Example 1: Click the menu New - Example with groups. If you want to use this example to start the
development of your application. Just select the example with groups, save and reset the tags, panels and
reports as required.
Example 2: Step by step manual (10 steps):
1 - Create a new blank application. (Menu New - <blank>)
2 - Click with the right mouse button on the groups list, left side of the tags spreadsheet.

3 Select option New group... Create a


group Group1.

4 - Click the button "+ VAR" to add tags in this group.

18

5 - Set for this group, the equipment, the tags names, databases, parameters, etc ... Example:

Optionally create tags VAR to represent the group, equipment, unit, central, module, product, etc ... (In the
example above ID)
Rename the group if needed. Click the with the mouse right button on the group's tab, and select the
"Rename group ..." option.

6 - To repeat or duplicate the groups, click with the mouse right button on the group's tab, select the
"Advanced " option - "Duplicate groups ...".
Type the number of groups to be added based on the current group and click OK.
Set the correct tags parameters for each group. Addresses, names, etc ... In general keep the same
database name, for all groups. In the database, the internal GROUPNAME field will automatically
differentiate the database's records.
Example:

19

7 - Now set a default panel for one group. Set names for the panel pages. Click with the mouse right button
on the page's tab, and select the Rename option. Example:

In this example it will be used the "Station" as a page name related to a group. Set the
visual objects on this page, and associate tags with the first group.
Example:

20

8 - In the main page, in this example named "Main", place buttons with the properties
Page with the value "Station" and ChangeTag with the property "1 - Yes". Associate each button with the
desired group.
Example:

In excution mode, when the user clicks on one of these buttons, the page "Station" will be shown, and its
objects automatically associated with the group.
Instead of creating buttons, you can create custom objects with information from each group. Use in this
case PageObject.
Example:

This example was made with 3 display texts, a button and a rounded rectangle.
This button has Page and ChangeTag properties set.

21

9 - Database: Use the same database name, for all groups. Automatically the internal GROUPNAME field
will differentiate the records in database.
Plays this application at least once. The system will create the database. Then stop the application.
In this example, to ensure that the field (tag) ID is a text, click on the menu "Data and Reporting" - "Edit
Database". Click on the Fields button. ID field type set to 1 - Text.
10 - Report: After stored some data in database, create a Button, click with mouse right button over it,
select "Show this button's report" option.
Select in this case, for example, "General by ID" template, etc ....

Set in the report which fields should appear in the listing (button fields). Or change report's layout as needed.
Example :

22

Tags spreadsheet
A simple data acquisition application can be made in the spreadsheet at the screen below.

Each row of the spreadsheet is a tag related to an I/O point of connected to an equipment (ex:
PLC), formula, variable, etc ... it depends on the driver. The spreadsheet contains this columns
as tags properties by default (it can be added more columns or properties as needed*):
Name: Tag's name. It will be the variable name used by the formula, visual object or script to access
its value. To access other properties (columns) of the same tag use a dot. (Examples: Tag1.setpoint,
Temperature1 = Tag1.LS * Tag7)
Title: Title or description of the tag's meaning . The title can be sent to all visual objects, databases
and reports related to tag.
[...] Unit.
Value: Tag's value.
Param1 and Param2: Values to address equipment variables. Their meanings depends on
driver. (Example: Param1 in MODBUS is the variable address, eg 40x0007. Param2 is the node)
Status: Status or error description of current tag. (Examples: Communcation Error, Alarms, Tag's
code description, etc...)
Database: Database name to store data and create reports. To set all tags group database click
on the column tile database.
Driver / PLC: Equipment related driver or tag type (ex: VAR to simple variable). Click on Config
button to set the communication configuration. To set all tags group driver click on the column tile
Driver / PLC.
Sampling: Time interval between each communication.
Recording: Time interval between each database data recording.
Formula: Formula, scale or bit related to the tag. The formula result will be constantly updated in
the tag value. To define a simple scale use the symbol * (Example: *0.01). More details see
topic Formula.
Alarm: Set tag alarm behavior Click on the button at alarm column side to settings options.
"Default": 0 = Off; 1 = Greater than LS; -1 Less than LI. Columns LI and LS are used as limits
defaults. (Superior and Inferior) are used as default for limits. Optionally, an alarm criteria by formula
can be created. Example 1: "=(x<10)+(x>30)". In this example alarm is triggered if tag value is less
than 10 or greater than 30. Example 2: "=(x<.Minimum)+(x>.Maximum)". In this example alarm is
triggered if tag value is less than Minimum or greater than Maximum, that are, for example,
customized columns that can be added.
To set values for each expression, optionally do like this example:
=(x<10)+(x>30)#3 (x>10)*(x<15)#5
(for x<10 or x>30 alarm value is 3, and for values between 10 a n d 15 alarm is 5)
For more advanced cases you want to use the script to change the alarm value.
The alarm can be used also to simply to define a descriptive text to be placed in the Status
column related to tag. Example: 0="State 0",1="State 1",2="State 2",3="State 3"

23

Optional columns:
* If necessary custom columns can be created defining customized properties for the tags.
These columns can also be recorded in database if the fields have been created.
Examples: safety limits, product name, event, non-compliance, etc ...
To create new columns use the option in the menu Tags - "Edit" "Customized tags
properties (columns)".
These names should be short, without space and no reserved, so they are easy to access
through formulas or script.
In script and the formula you can access tags defined in the spreadsheet through their
names. Examples: tag1, pressure, Temperatura1.Alarme.

24

Groups
Tags can separated between groups. Click with the right mouse button on the spreadsheet bottom or on
the list at the left. Select the menu item:
New group: to create new group.
Rename group: to rename the selected group.
Delete group: to delete the selected group.
Duplicate group: to duplicate contents of the selected group into a new group.

Each group can be used to separate a device, a station, a machine, a database, etc.... The database is
recorded by the group in parallel. If the names of the tags are the same for different groups, then the
system can record at the same database all groups independently. Registers are separated by the internal
field GROUPNAME. The panel with the visual objects, can also be prepared only once, and automatically
linked to any group when the application is running.

Add a "tag" in the selected group can be done several ways:


- Click on button
to add a tag by selecting a driver.
- Click on button
to add a generic variable tag.

30

Communication
To set the communication configuration.
1 - Drag mouse cursor over the tags spreadsheet cells at Driver / PLC column and select the driver.
or
2 Click on the tile Driver / PLC column at the tags spreadsheet and select the driver.
or
3 Click on menu - Driver and select the driver.

Pressing Config button to show a communication setting s window.

31

Formulas
Formula can be used on the tags worksheet (formula column) or visual objects.
Both in the script as in formula tags can be accessed by their names. Examples: Tag1, pressure,
Temperatura1.setpoint.
x is the current value.
Formulas examples:
Tag1*1.7 + 3
Celsius + 273.16
Farenheit > 100

Ex: Celsius + 273.16


Generic formulas:
Operators: + - * / > < >= <= = <> ^.
Other functions examples:
- *a+b: Multiply by a and sum b when the tag is updated. But do the inverse when tag is written. Example: *0.01
divide or multiply by 100.
- *Bit(x): Returns the bit value. Example: *Bit(7) returns the 7th bit.
- Bit(x,b1,b2): Return the value between the selected bits.
- Int(x): Returns the int part.. Example: Int(x*1000)/1000
- Abs(x): Returns the absolute value.
- Log(x): Logarithm base 10.
- Ln(x): Logarithm base e.
- Exp(x): Exponential.
- Sqr(x): Square root.
Formula in tags spreadsheet
Type the formula at the Formula column.
Example:

Own tag value:


To use the same tag value use x. Example: log(x)*1000
Scale:
To define a scale with multiplicative and additive factors use the syntax: *a + b where a is the
multiplicative factor and b the additive factor. EXAMPLE: *1000 + 3. Both reading and changing
values will be based on these factors. The scale can be used as conversion or even calibration.

Formulas may also be used in visual objects.


32

Database
To set a database where data will be stored click on the database column title or drag the cells.
A window will be shown:

Select or type a database name. If it not exists, the database will be automatically created at the first
recording. Fields will be created from the tags names defined in the worksheet.
Advanced users: to create a new database manually use the menu option 'Data and Reports "-" Edit
Database - "File" - "New".
Select or type a database name. If it not exists, the database will be automatically created at the first
recording.
To generate a report with the recorded data, click at the menu Data and Reports - Open (or insert a button
object on the panel and click "Show this button's report" - as explained in step 3).
At the first time, in this stage of development, a window will be shown for choosing a report template (that
can be customized later):

33

Drivers
The "driver" allows the computer to communicate with the equipment.

In LAquis, these drivers can be developed through a simple scripting language similar to "Basic" or
through an interpreted language LDriver or through dlls.
Some available drivers:
- MODBUS RTU or MODBUS TCP: protocol MODBUS . Used for communication with a wide variety of
equipments.
- VAR: tag as a generic variable.
- DEMO: simulated sine wave ranging from "Param1" to "Param2".
- OPC: OPC connection.
- TIMER: Counter in milliseconds. Double format Windows use TIMERFORMAT.
- NOW: Current date time in Windows double format.
Examples of communications: menu New.
To list available drivers click on Driver / PLC column title.
File drivers are in the CTRLS sub folder.

34

Example driver MODBUS RTU:


Column Param1 is the register address. Example: "400001".
Column Param2 is the node number.

* MODBUS address format:


- Holding registers: 4NNNNN or 40xNNNN
- Input registers: 3NNNNN or 30xNNNN
- Input status: 1NNNNN or 10xNNNN
- Coil: 0NNNNN or 00xNNNN
where NNNNN is the register address number in decimal or NNNN is the register address number in hexa.

35

Select a Driver
Select a driver by clicking the related cell to the desired tag and the column driver.
Select multiple rows by dragging the left mouse button over the cells.

The driver to be chosen depends on the equipment (hardware / PLC) used.

36

Data and Report


Customizing reports
Options in "Data and Reports" menu option:
Open ...: Opens or create reports.
- Edit ...: Edits reports.
Reports can be created, after recorded data in database by inserting a button object on the panel and
clicking with the left mouse button over it, and selecting option "Show this button's report".
At the first time, in this stage of development, a window will be shown for choosing a report template (that
can be customized later):
These reporting formats are recorded as a LGX format. Internally they are similar to spreadsheets.

Select a report template (Example: General with graph.lgx). The report will be generated based on the
template chosen.
A name is automatically created for the format: <filename> .lgx. This report format will be associated with
Button and is saved in the same folder as the LQS file.
Create new reports as needed.
Once created a report, it can be modified freely.

37

To edit the report fields, optionally click button "Fields".


To edit more advanced options as a spreadsheet, click button "Edit".

Buttons on the toolbar:


Open: Opens a report format.
Save. Saves the report format.
Print: Prints or exports report.
Edit: Enters in spreadsheet edit mode.
Run: Go to report run mode.
Graph: Opens graphic chart isolated from spreadsheet.
Format: Opens a spreadsheet cell formatting window.
Fields: Opens a simplified Field editor to help create a filter list.
Formula: Opens a browser with formulas available for the spreadsheet.

To edit the graph formatting double-click on it.

38

Formulas and commands


Some of the formulas available to use at in the report format spreadsheet:
=TAG(tag name)
Returns the specified tag. Example =TAG(Tag1)
=TAG(column,tag name
Returns the specified tag column cell.
=TITLE(tag name)
Returns tag title.
=FIELD(field name;id;date;database;idfield;filter)
Returns first field from database addressed by id. Only field name is mandatory. Others are optional.
=LASTFIELD(field name;id;date;database;idfield;filter)
Returns last field from database addressed by id. Only field name is mandatory. Others are optional.
=FIELDTOTAL(field name;id;date;database;idfield;filter)
Returns fields numeric sum from database addressed by id. Only field name is mandatory. Others are optional.
=LISTA(field name,filter,date,database,maximum,dateto,idfield,sampling)
Returns a list based on the filter from below cell.
=TEXT(cell)
Treat cell as a text.
=TEXTO(cell1,cell2,cell3,...)
Concatenate cells as text separated by spaces.
=CONCATENATE(cell1,cell2,cell3,...)
Concatenate cells as text.
=AVERAGE(cells)
Cells average.
=SUM(cells)
Cells sum.
=COUNT(cells)
Cells count.
=DESVPAD(cells)
Cells standard devation.
=MAXIMUM(cells)
Maximum value from cells.
=MINIMO(cells)
Minimum value from cells.
=AMPLITUDE(cells)
Cells amplitude.
=LAST(cell)
Last cell value.
=LASTTEXT(cell)
Last cell as text.
=LASTFILLEDTEXT(cell)
Last filled text.
=TSTUD(cells)
"TStudent" from cells.
=TAGTEXT(tag name)
Return tag as text.
=TAGGROUP(tagname,field optional)
Returns the group name of the tag or another tag field to return form that group.
=COMBO(text1,text2,text3,...)
Create a combo with texts.
=MAXABS(cells)
Maximum absolute cells value.
=SLOPE(cellsx,cellsy)
Slope form curve linear regression.
=INTERCEPT(cellsx,cellsy)
Interception form curve linear regression.
=CORRELATION(cellsx,cellsy)
Cells correlation.
=MVT(cells)
Converts mV to C thermocouple T
=MVJ(cells)
Converts mV to C thermocouple J
=MVK(cells)
Converts mV to C thermocouple K
=MVS(cells)
Converts mV to C thermocouple S
=MVR(cells)
Converts mV to C thermocouple R
@BUTTON(text)
Button to create actions at event "OnClick". Example: if colclicked=5 then: if rowclicked=3 then: msgbox("test"): end if: end if
@LISTBUTTON(text)
Opens a database listing of ID field in a window and returns the user selected register to the cell at left.
@LISTBUTTON(text,FIELD,DATABASE,DATE1,DATE2)
Opens a database listing of the field in a window and returns the user selected register to the cell at left.
@COMBOGROUPS
Combo with groups. Returns to the cell at left.
@COMBOGROUPS(field,exclusive)

39

Combo with groups and the field. Returns to the cell at left. If exclusive does not repeat.
@COMBODATABASE(database,field,filter,exclusive)
Combo with database fields with the filter. Returns to the cell at left.If exclusive does not repeat.
@COMBOTAGS
Combo with the tag names. Returns to the cell at left.
@COMBOSUBTAGS
Combo with the tags names under the groups. Returns to the cell at left.
@BUTTONEDITLIST(text)
Fields edition window in main listing.

Scripts of the report:


In the report template edit mode create scripts for programming specific processes for each event.
Example OnAfterCalculation event.

n=ldbcount

' Count registers in the main table

if n>0 then
for i=1 to n

' Scan the registers in the main table

x=LdbCellN("Tag1",i) ' Returns the


y=LdbCellN("Tag2",i) ' Returns the
if x*y>10 then
LdbCellN("Tag3",i) = 1 ' Writes a
else
LdbCellN("Tag3",i) = 0 ' Writes a
end if

value in the column Tag1


value in the column Tag2
value in the column Tag3
value in the column Tag3

next
end if
Spreadsheets for reporting and analysis formats are flexible and can be used for many different types of
reports, using or not the data stored in database. This spreadsheet has generic and specific functions to
build reports with calculations, graphics and tables based on the stored data.
The report formats is written in files with LGX extension.

40

Database
The database is a flexible structure where information is recorded. It can be from data acquisition or
auxiliary tables (users, alarms, products, etc...).
Fields can be customized according to the application.

Data can be stored in database with formats LBX (binary), DBF or TXT. Data can be exported too.

For historic purposes this database format as default is separated internally by date. Performance are not
too much affected after years of storing data.
Example: filename<ddmmyy>.LBX.
Fields can be created automatically by setting a database name at the tags spreadsheet and recording
for the first time.
Or can be created manually:
Menu Data and Reports, Edit Database...
Choose or create database:

Menu:
Arquivo
Edit
Edit or list (filter) database stored data
Fields
Edit fields
41

New
Creates new database
Delete
Delete data from database
Change database fields:

Field columns:
- Name: Field name. Can be the tag name if related to tags.
- Type: Field type:
0 - Number: Numeric field.
Size:
empty or 8: Double (8 - bytes) floating point.
1: byte.
2: Integer (2 - bytes) signed.
4: Long integer (4 - bytes) signed.
1 - Text: Text field; Maximum length in Size column.
- Size: Numeric size or text maximum length.
- Format: Number format in simple listing. Example: hh:nn:ss (double to time format).

42

Database configuration

Database folder: Example: c:\temp\. Default: <.>dados\ (files are stored in the current folder\dados\)
Table: file name. D a t e s e p a r a t i o n f o r m p e r f o r m a n c e p u r p o s e s uses
<ddmmyy>. Example: FILE<ddmmyy>.LBX.
User: user name optional.
Senha: password optional.

43

Editing database
Edits, lists, filters, exports or imports stored data in the selected database:

Menu
File
Research: simple database filter for testing purposes.
Export: Export data to TXT or CSV.
Import: Import data from TXT or CSV files.
Edit
New: Creates new register.
Delete: Deletes selected register.
Copy: Copies selected cells to the clipboard.
Select All: Selects all the data.
Copy all: Copy all data and header to the clipboard.

44

Network
A SCADA LAquis application can be used as a network server via TCP or WEB. Others SCADA (LAquis)
applications can be used as client and vice-versa.
Network communication can be made via OPC too.

Server
TCP:
Menu File Client & Server.

Turn on Server by TCP.


Click configure TCP Server to select port (default 1234).
Turn on generate client (at least once).
Click OK.
Save.
WEB:
Menu File WEB server.
Click activate WEB server.

The url address will appear for testing.

45

Client
Automatically:
Goto to url address. If needed via TCP download client.
Examples: http://localhost:1234/ or http://servername:1234/
Manually via TCP:
Open the project application file that will be used at the client computer.
Menu File Client & Server.

Turn on Client.
Type server IP address and click OK.

46

Visual Objects

Visual objects are inserted on the panel for specific applications developments as well as for monitoring
and tag control.

To associate the object with a tag (or his property) click twice on the object, or with mouse right button
choose Tag option (type, if necessary, a formula):

Select a tag or group or tag and a property.

47

To change its properties, click on the object and use the window at right side of the panel.
For each object type, different properties list may be available as font sizes, scales, alarms, colors, etc.

Titles of the objects are defined by the column "Title" in tags spreadsheet.

48

Vector drawing objects

Objects used for background drawings and objects creation.


The objects for vector drawings are treated differently from visual objects.
Editing vector drawing objects is activated by Button

Use:
1 - They can be combined to generate new visual objects
2 - Plants for the generation of 3D interfaces.
3 - Animations.
4 - Simple illustrations.

You can also associate the tag value for some of the object properties.
For example, draw a scale object and draw a polygon object as follows:

Double-click on the polygon object to open its properties. Click on the cell of the column tag associated
with coordinated MY (midpoint on the vertical axis of the object). Select the tag and click OK.

When running the application, the polygon position will vary by tag within the defined range.

50

Types of vector objects:


Generic:
Pipe or wire. (The pipe can be used in the plant for 3D interface also)
Polygon.
Ellipse.
Cube (projected in 2D).
Cylinder (projected in 2D).
Rectangle rounded border.
3D interface plant:
Wall 3D.
Panel 3D.
Object (file) 3D.
Object creation:
Scale
Simple text
Click twice on the object to edit its attributes.

51

Attributes of vector drawing objects

Name: Vector object name.


Visible: Visibility.
Line: Line border attributes.
Color (line): Line border color
Width: Line width.
Style: Line style.
Fill: Fill attributes.
Color (fill): Vector object fill color.
Pattern (fill): Vector object pattern fill.
Fill 2 (gradient): Gradient attributes.
Color (fill 2): Destiny color of gradient color.
Dimensions:
Through these properties, object dimensions and positions can be associated with tags.
X1: position of the left side of the object.
Y1: Position of the upper side of the object.
Width: Object width.
Height: Object height.
X2: Position the right side of the object.
Y2: lower side position of the object.
MX: Average position of the object horizontally.
MY: Average position of the object vertically.

52

Inserting visual objects

1 - Choose an object from the top of the panel, just below the menu, clicking on it.
2 - In the clean area between the "menu" and the spreadsheet there is a panel, hold the left mouse button
and drag, creating a rectangle, releasing the mouse button after completion. The chosen object should
appear within the rectangle.
3 - Adjust the height and width of the object for better viewing.
4 - Create other objects, similarly. Every object created, the program will associate it with a sequential way
channel.
5 - To manually associate the visual object to a spreadsheet channels: select the object, click twice on this
and choose the tag.
6 - To change the properties of the object select the object, use the window at the right side.

Panel configuration
Click with the right mouse button at the panel and select option Panel background and size:

Picture: set a background bitmap for the panel page.


Color: set a background color for the panel page.
Side by side: Tile background bitmap.
Window: Width and Height Window size (without menus and tags spreadsheet).

53

Visual objects examples


Generic visual objects examples:
-

DisplayText
Display tag.

Edit
Edit tag.

Picture
Picture for background, animation and state response.

Button
Event activation button.

Text
Text.

PageObject
Object to replicate group of objects.

LCombo
Combo tag.

Graph
Graphic chart.

Bar
Bar.
- Check
Check (on/off).

54

DisplayText
DisplayText
Display tag value or text.

Main properties:
Tag: Tag name or formula.
Title: Object title (default is the tag title)
Name: Object name.
Color: Text color.
Back Color: Display background color.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
TitleSize: Title size character size.
Border: 1 - Yes. 0 - No.
Format: Number format.
Alignment: 0 - Left. 1 - Center. 2 Right.
ShowUnit: 1 - Yes. 0 - No.
TitleColor: Display title background color.
TitleTextColor: Title text color.
LI: Limit Inferior (lower limit). Default: .LI (from tag column LI)
LS: Limit Superior. Default: .LS (from tag column LS)
ShowLimits: 1 Shows arrows indicating limit surpassing.
AlarmColor: Background color when alarm is on.
InternalBorder: 1- Internal border.
Size: 0 - Text size automatically resized with display height. Otherwise text font size.
ForceTitle: Forces a title text.
UnitForce: Forces a unit text.
ForceText: Forces a text.
TransparentTitle: 1 Title background is transparent.
Style: 0 Normal border. 1 Rounded border.

55

Edit
Edit
Tag value or text editor.

Main properties:

Tag: Tag name or formula.


Title: Object title (default is the tag title)
Name: Object name.
Color: Text color.
Back Color: Display background color.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
TitleEditor: Forces editor title.
Size: 0 - Text size automatically resized with display height. Otherwise text font size.
TransparentTitle: 1 Title background is transparent.
Alignment: 0 - Left. 1 - Center. 2 Right.
PosTitleEditor: Title position. 0 - Left; 1 Top.
ShowUnit: 1 - Yes. 0 - No.
TitleColor: Display title background color.
TitleTextColor: Title text color.
Font: Text font name.
Bold: 1 - Bold. 0 - Normal.
Italic: 1 - Italic. 0 - Normal.
Border3D: 1 3D Border.
Edit: 1 Allows typing. 0 Disable typing.
EditText: Text shown at the optional editor window (click).
Format: Number format.
TagsSpreadsheet: 1 Value connected to the tags spreadsheet (default 1).
Maximum: Maximum allowed value.
Minimum: Minimum allowed value.
Step: Numeric step used at spin button to change value.
Editor: 1 Panel editor. 0 Window editor (click).
MaxChar: Maximum characters count.
PasswordDepends: Depends on password to type.

56

Picture
Picture
Background picture, double state or
animation.

If the picture is associated with a tag then its value will determine its behavior in states or animation mode.
To set an animation or multiple states, it can be used files with numerical values after their names. Example:
Motor001.emf, Motor002.emf and Motor003.emf. The States property defines the maximum number of
states or frames for animation.
Main properties:
Picture: Picture name. Can be bmp, jpg, emf ou gif (animated or not).
Tag: Tag name or formula.
Name: Object name.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
Transparent: Transparent background.
Fixed size: Picture original fixed size.
Border: Draw a border around the picture.
States: Nmaximum states number for animation. (0 .. n)
CurrentState: Current state number.
DoubleState: Defines if picture behavior will be two states, otherwise is an animation.
ChangeClick: Switches tag or state value between 0 and 1 or the configured states.
Antialias: Do an antialias effect over stretched picture.
Value=State: Associates tag value to the state number.

57

Button
Button
Event activation button.

Main properties:
Tag: Tag name or formula.
Title: Object title (default is the tag title)
Name: Object name.
Color: Button color.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
Text: Text shown on button. For keyboard shortcuts inserts and & before the desired letter.
TextColor: Text button color.
Report: Report format file name. Can be selected by clicking with right mouse button over it and
selecting "Show this button's report" menu option .
Command: Value to be sent to tag.
Page: Panel page number to change when user clicks on button. It is the same as in the script at
OnClick event doing this for example: Panel.Page = 7.
ChangeTag: When a panel page is changed their tags are changed to the new tag or group
reference.
HotSpot: Invisible but active button.
Margin: Margin width.
CharacterSize: Button's font size.
Bold: Font bold style: 1 - Bolrd. 0 - Normal.
PagePopup: Calls a panel page as a popup window.
Pulse: When pressing the button the tag value changes between High and Low properties waiting
PulseTime property time in miliseconds.

58

PageObject

PageObject
Includes objects of another page panel. Several purposes:
1 - Replicates objects with different tags or groups.
2 - Creates multiple states objects
3 Vector drawing objects animation.

Main properties:
Tag: Tag name or group name.
Title: Object title (default is the tag title)
Name: Object name.
Color: Button color.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
Page: Panel page name or number.
Pages:
- Multiple state: Panel pages and their tag associated values. Example: 0=pagename1;1=pagename2.
(behavior: when tag is 0 then panel page "pagename1" is shown in the pageobject. If tag is 1 then
panel page is "pagename2").
- Animation: Panel pages are animation frames if referenced tag is active. Example:
pagename1;pagename2;pagename3. When tag is 1 then animation will be the switching between
the panel pages.
Examples can be imported by Import button.

59

Graph
Graph
Simple graphic chart to monitor in real time.

Main properties:
Tag: Tag name or group name.
Title: Object title (default is the tag title)
Name: Object name.
Color: First curve color.
Back color: Chart background color.
Visibility: if 0 invisible, otherwise visible. Can be a formula. (Example: Tag1>30)
Maximum: Y axis maximum.
Mnimo: Y axis minimum.
AutoScale: If active then Maximum and minimum are automatically calculated.
GridColor: Chart grid color.
DivisionsX: Divisions count at axis X.
DivisionsY: Divisions count at axis Y.
Points: Maximum points allowed to the chart.
Restart: 1 - Restart chart monitoring.
TimeFormat: Time format at axis X. Example: hh:nn:ss
TimeDelta: Maximum time interval shown at chart.
TextColor: Text color (numbers and text).
Sampling: Smaller time interval, in miliseconds, of chart update.
Thickness: Curves line thickness.
Border: Border around chart.
CharSize: Text font size .
TitleSize: Tile font size at top of chart.
Color2: Curve 2 color
Color3: Curve 3 color.
Color4: Curve 4 color.
Color5: Curve 5 color.
Legend: 1 Shows legend.
Legend1: Curve 1 legend.
Legend2: Curve 2 legend.
Legend3: Curve 3 legend.
Legend4: Curve 4 legend.
Legend5: Curve 5 legend.

FixX: 1 Fixed X axis. Otherwise roll as a paper.

60

Script introduction
Language to create customized applications processes and actions.
Example:
Create a button. Program your action through the script.
Run the application. When this button is clicked its script will run.

Events
There are two types of events where scripts can be run: generic events and events in
objects.

Generic events:
OnAfterScanning
Defines what happens after tags main scanning;
OnStart
Defines what happens when application is started;
<Global>
Defines global functions;
OnGroups
Defines what happens after tags main scanning to each group of tags. Tags.Group is the updated group
name. Use Tag("tagname") to access a tag from the updated group.
OnFinish
Defines what happens when application is finished;
OnBeforeScanning
Defines what happens before tags main scanning;
61

OnInterScanning
Defines what happens during tags scanning;
OnTag
Defines what happens when a tag is updated. Use Tag() to access tag.
OnAlarm
Defines what happens when Alarm is triggered. Use Tag() to access alarmed tag.
Use Tag().alarme to access alarm.
OnBeforeRecording
Defines what happens before tags recording. Tag() is the tag to be recorded.
OnAfterRecording
Defines what happens after tags recording. Tag() is the recorded tag.
OnKeyDown
Defines what happens after keyboard is pressed. Key is key number.
Visual objects events:
OnClick
Defines what happens when an object is clicked. Tag() is the clicked object associated tag.
Panel.ThisObject access clicked object properties.
OnMouseDown
Defines what happens when an object is clicked (mouse button down). Tag() is the clicked object associated
tag. Panel.ThisObject access clicked object properties.
OnMouseMove
Defines what happens when an object is clicked and mouse pointer is moved over this object.
OnMouseUp
Defines what happens after an object is clicked (mouse button up). Tag() is the clicked object associated tag.
Panel.ThisObject access clicked object properties.

62

Commands browser
To query tags, objects and commands available use the browser option.
In script window click Button "F4 - Commands" or press F4.

Select a tag, object or a command.


Tip: Type the beginning of the command name. A window will present a survey of
available commands.

63

Accessing tags in script


Examples:
x = tagname (returns to variable x the tag value whose name is tagname)
t = Temperatura1*100 ( returns to variable x the tag value Temperatura1 x 100 )
x = Tag1.LS (returns to variable x the tag Tag1 property LS)
x = Tag("Tag1") (returns to variable x the tag value whose name is Tag1)
s = Tag$(7) (returns to a string variable s the tag text whose spreadsheet line number is 7)
x = Tag("teste").LI (returns to variable x the Tag1 property LI)
y = Tag("Group1_Value1") (returns to variable x the Value1 tag from group Group1)
.
y = Tag() (returns to variable y current object tag value)
Access other tags spreadsheet features with object Tags. Example, returns the tags count number: x =
Tags.Count.
To use a tag as a simple variable without an external device, use driver VAR.

64

Script variables
Variables can be created and used freely in script on assignments of values or as
function parameters. (A tag can also be used as variables, generic or associated with
equipment).

There are two types of variables:


- Text
- Number
Creating numeric variables examples:
x=0
y = 7.43675
w = &HEEBBFF ' in hexadecimal
i = &B011010011101111111 ' binary
y=y+1
They can be calculated using operators + - * / or through predefined mathematical functions.
Creating text variables, examples:
s = ""
text1 = "scada"

Number to text conversion: s = CStr( x )


Text to number conversion: x = Val( s )
Text constants are set in quotation marks. Texts can be concatenated using
+ operator.
Text concatenation example ". s = "Realized " + CStr( x ) + " test(s). "
(NOTE: The command IF requires == operator to string comparison)
Text variables can be also byte packets memory. They can be used for communication or binary processing
data. (see functions like BytesToStr)
NOTE: Tags names are predefined variables.

Basic operations

= : Association. Ex: y = 1 .
+ : Sum. Ex: y = y + 1 .
- : Subtraction. Ex: y = y 1 .
* : Multiply. Ex: y = y*2 .
/ : Division. Ex: y = y / 2 .
= : Association. Ex: s = text .
+ : Text concatenation. Ex: s = s + text .

65

Commands and basic expressions

IF expression (condition)
If expression indicates a decision based on condition.
Example1:
If <expression> Then
...
End If
If ( Tag1 = 2 ) Then
message1 = "value is 2"
End If
Exemple2:
Text variable.
If Not ( response == "ERROR" ) Then
Tag1 = 3
End If
Example3:
Else and ElseIf expression:
If Tag1 > 3 Then
Tag7 = 3
ElseIf Tag1 = 1 Then
Tag7 = 1
Else
Tag7 = 2
End If
Expression ElseIf demands an Else at final.

For
For command indicates an iteration where a variable i gets n1 to n2 values.

66

Expression While (loop)


Expression While indicates a loop while a condition is true
Syntax:
While <condition>
...
WEnd
Example:
reading = 1
x=0
While ( reading = 1 ) And ( x <= 20 )
...
Tag1.atualiza
reading = Tag1
...
x=x+1
WEnd

GoTo
Command GoTo leads execution to a label position.

Visual objects
Use panel object to access visual objects. Use script to access visual objects only as a last resort. Prefer
choosing to associate tags to objects and their properties and change only the tags.

Panel.<object name>.<property> [ = value ]


Each object has specific properties.
Common properties:
Refresh
Refresh object.
Value
Main object value (in most cases came from tag)
Update
Update object. Panel.text1.Update.
Other properties go to Panel object topic

67

Panel object
The Panel object has properties that access the visual objects panel.
Main properties:
Page:
Get or set current page number or name. Ex: Panel.Page=0
ChangeTagsFromPage ( page, tag name or group ):
Associates panel page objects tags to another tag ou group.
Tag:

Current visual object tag.

Grupo:

Current visual object group name. Ex: Tag(Panel.Group+_temp) = 1.

Refresh:

Panel refresh. Panel.refresh

Focus:

Set panel focus

FullScreen:

Set panel full screen. Ex: Panel.FullScreen = True.

Window ( [x,y,] window, height ):


Converts panel to a window. sinze Panel.Window(600,400)

Tags objects
Tags objects allows script directly access tags spreadsheet.
Main properties:
RowWhoseName (tag name):
Returns tag spreadsheet row.
StartRecord [(group name)]:
Start database recording. Ex: Tags.StartRecord.
StopRecord [(group name)]:
Stop database recording. Ex: Tags.StopRecord.
RecordNow [(group name)]:
Forces recording at the moment.
TagName (row):
Tag name from tag spreadsheet.
TagRow (tag name):
Tag row number from tag spreadsheet.
Update (tag name):
Force tag update from equipment. Ex: Tag.Update (Tag1)
Play (tag name):
Inicia a leitura na line especificada. Planilha.Liga(3)
Pause (tag name):
Pausa a leitura na line especificada. Planilha.Pausa(3)
Count:
Number of tags.
On (tag):
Tag is turned on.
Recording (tag):
Tag is being recorded.
Save (file name):
Save current application project file.
SaveColumn (file name, column_name):
Exports tag spreadsheet column data.
OpenColumn (file name, column_name):
Imports tag spreadsheet column data.

Example (OnAfterScanning)
Example using OnAfterScanning.
If Tag(Tag1) > 20 Then
Tag$(Message) = "Passed 20"
Else
Tag$(Message) = ""
End if

Example Global event

Function MyCalculation( x )
MyCalculation = x * 1.7
End Function

In an visual object event:


y = MyCalculation( x )

Global object
Global object create variables that can be accessed in all internal script events.
Syntax:
Global.<variable name> [ = value ]
Example:
Global.Variable = 5
Global.Test = 2
' At other event
x = Global.Variable
y = Global.Test
OBS:
Global.Variable = 5 is the same as StoreValue(5, "Variable")

90

También podría gustarte