Anda di halaman 1dari 21

GE Fanuc Automation Solutions Europe S.A.

Technical Paper
Using Proficy Real-time Information Portal for Event
Creation in Proficy Plant Applications

Software
EUROPE

18/07/2005
Version: 1.0

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

This Technical Paper describes a method to use Proficy Real-time Information Portal for Event Creation in
Proficy Plant Applications.

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 2 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Revision History
Table - Revision Status lists the latest version and date for the various sections of the specification.
Versions 0.X are prerelease draft versions.
Versions 1.X to X.X are post release versions.
The number to the left of the decimal in the version number indicates the major version number. The
number to the right of the decimal in the version number indicates the minor version number.
The major version number will change for the following reasons:
Information added to document.
Information removed from document.
Rearrangement of sections in the document.
Revisions to the scope or purpose of the document.
The minor version number will change for the following reasons:
Spelling corrections.
Page layout or formatting corrections.
Minor changes that do not affect the scope or purpose of the document.
Version

Date

1.0

18.07.2005

Description
Initial release

Table 0 Revision Status

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 3 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Table of Contents
1
2
3
4
5
6

Introduction.......................................................................................................................................................... 5
Overview............................................................................................................................................................... 6
Creating Local Result Set Tables................................................................................................................. 10
Creating 601 Models in PA................................................................................................................................ 11
Creating the SQL Historian................................................................................................................................. 8
Controls and Statements within RTIP..............................................................................................................13

6.1
DEFINE RTIP CONTROLS............................................................................................................ 13
6.1.1 Production Unit.................................................................................................................... 13
6.1.2 Production Line.................................................................................................................... 13
6.1.3 Department.......................................................................................................................... 13
6.1.4 Batch Number...................................................................................................................... 14
6.2
CREATE STATEMENT................................................................................................................... 14

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 4 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

1 Introduction
This document describes a method step-by-step to use Proficy Real Time Information Portal (from now on
RTIP) as a front end for Proficy Plant Applications (from now on PA). The versions used are RTIP version
2.5 build 2107 and PA version 4.1.
It is assumed that the reader is experienced in configuring and setup PA, including experience with SQL
Stored Procedures and Result Sets.

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 5 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

2 Overview
This method utilize the messaging system employed by PA, that allow safe updates of the database and
notify the standard thick PA clients about the changes made. Result Sets allow you to add real time
messages to Model based custom SQL Stored Procedures and to Plant Applications Variable Stored
Procedure Calculations. The Models are triggered by the Event Manager service and the Calculations are
triggered by the Calculation Manager service So it has to be one of these services that sends out a
result set for having the PA messaging system recognize it as an update of the PA database and to
ensure updates of the standard thick PA clients. These services are not directly accessible from within
RTIP.
One of the great features within RTIP is the possibility to write SQL statements, including end-user
selections as inputs. These statements can be select, insert, update or delete statements, but it can also
be a call statement that can execute a stored procedure. This method is utilizing this feature: the stored
procedure executes logic that transforms the end-user selections into the type of data needed for a
specific result set and the data is then inserted into a local Result Set table. The columns and order of
the local Result Set table are equivalent with the parameters and order of the specific result set.
There is a one-to-one relation between the type of events that should be created, updated or deleted from
RTIP and different local Result Set tables.
The stored procedure executed from within RTIP is also updating a tag within a SQL based historian. This
is done since RTIP do not have directly access to the Event Manager service or the Calculation Manager
service. The SQL Historian includes tags for each different event type that needs to be created, updated
or deleted from within RTIP. Using the generic 601 model, PA can be configured to have the Event
Manager service executing a stored procedure, when a tag in the SQL based historian is changing value.
The stored procedure (executed by the Event Manager service) is taking data from the local Result Set
table and sends it out as a result set the PA database will then be updated and the standard thick PA
clients will be notified about the changes.
Figure 1 below visualizes the method. The stored procedures and table on the PA side (the blue dotted
box on the right side of the figure) will be the same for each project and site, and only the configuration of
the pages and the statements on the RTIP side will differ which is bringing the implementation time
down.

Figure 1

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 6 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

The following sections will go step-by-step through Figure 1 (from right to left), starting with how to create
the SQL Historian, how to create the local Result Set tables, how to set up the 601 models and finalizing
with a section with an example on how to create statements in RTIP and linking end-user selection with
the statements.
The document includes import files and stored procedures that will cover most of the actions that needs
to be done, and the steps on the PA side will be equivalent for all projects including a RTIP as front-end
of PA scope.
This document includes result sets for Production Events, Variable Values, Grade Change, Downtime
Events, User Defined Events, Waste Events and Production Plan. It should be easy to use the attached
examples to extend the functionality to cover other Events than the one provided.

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 7 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

3 Creating the SQL Historian


The configuration of the SQL Historian is build up by two parts:
Implementation of a SQL table for the tags and their values
Configuration of the Historian in PA

3.1Implementation of a Historian SQL table


The table can be created executing the following script.

S QL His torian.zip

3.2Configuration of the Historian in PA


Select SQL Server as the Historian Type requires a number of option values to be set. The option values
can be set as (please insert the IP address of the server instead of XXX for the Connection String):
BrowseSQL
Connection String
DeleteSQL
ExecDirectFlag
InsertSQL
ReadAfterSQL

ReadBeforeSQL

ReadBetweenSQL

TimeSQL

Select convert(varchar(20),Tag_Id) as TagID, sDescription, sEngUnits,


'Float' from Local_SQLHistorian where convert(varchar(20),Tag_Id) like ?
TagId
DRIVER={SQL Server}; Server=XXX;Database=GBDB;UID=sa;PWD=sa
Delete from Local_SQLHistorian where tTimeStamp = ?TimeStamp and
Tag_Id = convert(int,?TagId) and IMilisecond is null
False
Set RowCount ?NumValues; Select tTimestamp, value = case when
sValue is null then convert(varchar(20), dValue) else sValue end, status =
case when dQuality = 0 then 'Good' else 'Bad' end from
Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp >
?TimeStamp order by tTimeStamp
Set RowCount ?NumValues; Select tTimestamp, value = case when
sValue is null then convert(varchar(20), dValue) else sValue end, status =
case when dQuality = 0 then 'Good' else 'Bad' end from
Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp <
?TimeStamp order by tTimeStamp desc
Set RowCount ?NumValues; Select tTimestamp, value = case when
sValue is null then convert(varchar(20), dValue) else sValue end, status =
case when dQuality = 0 then 'Good' else 'Bad' end from
Local_SQLHistorian where Tag_Id = convert(int,?TagId) and tTimeStamp >
?StartTime and tTimeStamp < ?EndTime order by tTimeStamp
Select getdate() as CurTime

More information about SQL Historian can be found in the Proficy Plant Applications Administrator
Documentation.
The Tag-Ids is the number of the Result Set Example: A value change for the tag with Tag-Id equals 1
will activate the 601 model for the Production Event.
Remark that it is needed to fill in a tag value for each tag in the SQL Historian before the tag can be seen
from a browse tag window in PA administrator. The scripts in Insert Tag Values zip file can be used to
Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 8 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

insert the first values for Production Events, Variable Values, Grade Change, Downtime Events, User
Defined Events, Waste Events and Production Plan.

Ins ert Tag Values .zip

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 9 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

4 Creating Local Result Set Tables


The local Result Set tables is following the structure of the Result Set for the Event and are all called
Local_RTIPXXX, where XXX is the Event type. Each local Result Set table includes a last column with
the header Flag. This is used by the 601 Model stored procedure to indicate and delete processed rows.
The zip-file below includes the local Result Set tables for Production Events, Variable Values, Grade
Change, Downtime Events, User Defined Events, Waste Events and Production Plan.

Local Res ult Set Tables.zip

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 10 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

5 Creating 601 Models in PA


The 601 models can be imported from Administer Models in the Global Configuration folder in the
Proficy Plant Applications Administrator, using the files included in the zip-file below. The model number
for the different models is 1000XX where XX is the Result Set Number (Example: 100001 is the model
number of the 601 model used for Production Events).

601 Models .zip

The different models are triggering a stored procedure when a value change occurs for a specific tag in
the SQL Historian. The stored procedure follows the structure below (this example is using the Production
Event. The Local_RTIPProductionEvents is the local Result Set table and the Local_SQLHistorian is the
SQL Historian table):
CREATE Procedure spLocal_TriggerRTIPProductionEvents
@ReturnStatus int OUTPUT,
@ReturnMessage varchar(255) OUTPUT,
@EC_Id int,
@TriggerTimestamp datetime
AS
Declare
@MaxTimeStamp DateTime
-- In case a end-user inserts a new row during the execution of this SP
Update Local_RTIPProductionEvents Set Flag = 1 Where Flag = 0
-- Select * from local Result Set table
Select 1, Id, Transaction_Type, Event_Id, Event_Num, PU_Id, Convert(VarChar(30),TimeStamp,120),
Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update, Conformance,
TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId, EntryOn,
ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId, ExtendedInfo
From Local_RTIPProductionEvents Where Flag = 1
-- Deletes processed rows from the local Result Set table
Delete From Local_RTIPProductionEvents Where Flag = 1
-- Set @MaxTimeStamp to the latest time where the specific tag in the SQL Historian was changed
Select @MaxTimeStamp = Max(tTimeStamp) From Local_SQLHistorian Where Tag_Id = 1
-- Delete all tag changes from the SQL Historian but the last
Delete From Local_SQLHistorian Where Tag_Id = 1 and tTimeStamp <> @MaxTimeStamp
The zip file below includes the stored procedures for Production Events, Variable Values, Grade Change,
Downtime Events, User Defined Events, Waste Events and Production Plan. These scripts need to be
executed within a SQL Query Analyzer.

601 SPs .zip

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 11 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

The model has to be set up at any production unit in the Plant Model (one unit could be created only for
this purpose). The models can be configured importing the Excel sheet below. Remember to substitute
the Production Line, Production Unit, Event Subtype and name of the SQL Historian.

Configure Models .zip

Activate the models in the Proficy Plant Applications Administrator. Navigate to the unit where the Models
have been attached. Select Configure Events, select the Configure Event Detection Models and active
the models one-by-one.

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 12 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

6 Controls and Statements within RTIP


The following will focus on the left side of figure 1 the RTIP side. There are 3 steps that need to be
fulfilled on the RTIP side in order to create PA Events from within RTIP. These are:
1. Define RTIP controls that should be used as inputs for the PA Event (examples: start time,
production event number, process order number, reasons )
2. Create Statement used to insert data into the local Result Set table and update the SQL
Historian table
3. Create link between the RTIP controls and the Statement

6.1Define RTIP Controls


The following example will create a batch on a specific unit. The input that should be given is the
production unit and Batch Number the time when it is created in RTIP will be the time attached to the
Batch. The Production Unit can be selected using the Plant Applications Collector within RTIP. In this
example the end-user should first select Department, then Production Line and finally the Production Unit.

6.1.1
1.
2.
3.
4.
5.

The Production Unit control has been dragged from the system tree (see figure
The Object Type has been selected as a combo box
Both Unit Description and Unit Id columns has been displayed
Selected Item Column is Unit Description
Selected Value Column is Unit Id

6.1.2
1.
2.
3.
4.
5.
6.

Production Line

The Production Line control has been dragged from the system tree
The Object Type has been selected as a combo box
Both Line Description and Line Id columns has been displayed
Selected Item Column is Line Description
Selected Value Column is Line Id
The Select Value Property has been linked to the Line Id of the Production Unit control

6.1.3
1.
2.
3.
4.
5.
6.

Production Unit

Department

The Department control has been dragged from the system tree
The Object Type has been selected as a combo box
Both Department Description and Department Id columns has been displayed
Selected Item Column is Department Description
Selected Value Column is Department Id
The Select Value Property has been linked to the Department Id of the Production Line control

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 13 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Figure 2

6.1.4

Batch Number

1. Add a textbox for the Batch Number input

Figure 3

6.2Create Statement
The only task for the statement used from RTIP to Create, Update or Delete an event in PA is to insert the
parameter values into the local Result Set table. This is done using a Call statement, executing a
stored procedure. The Call statement will include input values coming from the end-user selections (in
our example this will be the Production Unit Id and Batch Number). These input values can now be used
directly as parameter values into the local Result Set table or used to derive other parameter values.
In our example the stored procedure looks as follows:

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 14 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

CREATE PROCEDURE spLocal_InsertBatch


@BatchNum VarChar(25),
@PUId Int
AS
Declare
@Max int,
@BatchExist int,
@Timestamp VarChar(30),
@Event_Id int
-- If no Batch Number has not been transferred to the SP, error message and return
If @BatchNum is Null
Begin
Select 'No Batch Number' as Message
Return
End
-- If no Production Unit has not been transferred to the SP, error message and return
If @PUId is Null
Begin
Select 'No Production Unit' as Message
Return
End
-- Does the Batch already exist in the PA database
Select @BatchExist = Count(*) From Events where Event_Num = @BatchNum and PU_Id = @PUId
-- Create the batch if it does not exist in the PA database
If @BatchExist = 0
Begin
Select @Timestamp = Convert(VarChar(30),GetDate(),120)
-- Hot insert, inserts the Batch directly in the database
Execute spServer_DBMgrUpdEvent @Event_Id OUTPUT, @BatchNum, @PUId, @Timestamp, Null,
Null, 26, 1, 0, 6, Null, Null, Null, Null, Null, 0
--Send insert to bus (post = 1, Pre = 0)
-- Sends the Batch to the client (Post_Update = 1)
Insert into Local_RTIPProductionEvents (Id, Transaction_Type, Event_Id, Event_Num, PU_Id,
TimeStamp, Applied_Product, Source_Event, Event_Status, Confirmed, User_Id, Post_Update,
Conformance, TestPctComplete, StartTime, TransNum, TestingStatus, CommentId, EventSubTypeId,
EntryOn, ApprovedUserId, SecondUserId, ApprovedReasonId, UserReasonId, UserSignOffId,
ExtendedInfo, Flag)
Values(1,1,@Event_Id,@BatchNum,@PUId,@Timestamp,Null, Null, 5, Null, 8, 1, Null, Null, Null, Null,
Null, Null, Null, Null, Null, Null, Null, Null, Null, Null, 0)
-- Increment the tag value for the Production Event tag
Select @Max = Max(dValue) From Local_SQLHistorian Where Tag_Id = '1'
Insert into Local_SQLHistorian (Tag_Id, sDescription, sEngUnits, Float, tTimeStamp, sValue, dValue,
dQuality)
Values('1','Production Events',Null, Null, Getdate(),Null,@Max+1,0)
End
-- If the Batch already exists, send error message and return
Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 15 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

If @BatchExist <> 0
Begin
Select 'Batch already exists' as Message
Return
End
-- Send success message
Select 'Success Updating: ' + @BatchNum as Message
This script needs to be executed in a SQL Query Analyzer and can be found in the zip-file below:

Ins ert Batch.zip

Before using the stored procedure in a Call statement it has to be included in a Schema (see RTIP
documentation for how to create Schemas). Select the Schema where you want to include the stored
procedure in the SQL Statement Builder, right click and select Add Table etc..

Figure 4
Select that the Schema contains Procedures. Click Next >.

Figure 5

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 16 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Select the stored procedures that should be added to the Schema. Click Next > and Finish, and the
stored procedure are now included.
Select New Statement in the SQL Statement Builder and select Call as the type of SQL statement.
Hereafter drag the stored procedure from the Schema folder into the empty Table Diagram frame.

Figure 6
Save the Statement and give it a name.
RTIP has already built the Statement in the SQL Statement frame, and has selected names for the input
parameters (par0_@BatchNum and par1_@PUId). RTIP concludes these input parameters by looking at
the header of the stored procedure, but it is needed to execute the stored procedure from inside RTIP for
RTIP to know what type of output it should expect. Execute Statement
will prompt for values for the
input parameters.

Figure 7

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 17 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Click OK.

Figure 8
The result frame displays the output of the stored procedure (Message: Success Updating: ABC002).
Return to the configure mode of the display with the input parameter, select the Data Source tab in the
System Tree and drag the Statement just created into the display. Select the Object Type as Text Box and
select to display the message column.

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 18 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Figure 9
Select the Production Unit Combo Box and link the Selected Value property to the Message Text Box
par1_@PUId.

Figure 10
Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 19 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Select the Batch Number Text Box and link the Text property to the Message Text Box par0_@BatchNum.

Figure 11
Now the two input values are linked to the input parameter of the statement. The last thing is a button to
execute the statement. Insert the button and link the control to the Text Box Insert Batch (the Message
Text Box).

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 20 of 21
Jakob Hall

Software

Technical Paper
Using Proficy Real-time Information
Portal for Event Creation in Proficy
Plant Applications

GE Fanuc Automation

Figure 12
Thats it. Now change the display to Run Mode and Select Department, Production Line, Production Unit
and Insert Batch Number and Click on the Create Batch button to create a new Batch within the Proficy
Plant Applications Database.

Figure 13

Release: 18/07/2005
File: 287775018.doc

Error: Reference source not found

Page 21 of 21
Jakob Hall

Anda mungkin juga menyukai