Title: | BASEstar Open Multiplatform Application Framework |
Notice: | Kit pointers: see topic 3 |
Moderator: | VARESE::CORBETTA |
Created: | Tue Oct 02 1990 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 607 |
Total number of notes: | 1971 |
A common example of B* application is a program that reads/writes data from/to a PLC in solicited way. Let's say we have the following objects: create protocol_profile XXX -applprof ... create vmd PLC -dvm_access "yyy":XXX ... create named_variable PLC.VAR -datatype INTEGER_32 ... create device_data_point DDP -datatype INTEGER_32 \ -device_access RDWR -update_policy SOLICITED \ -access_policy ALWAYS and a program which issues bstr_data_point_get_value() and bstr_data_point_put_value() on DDP. It is a good practice for such an application to "monitor" the connection status with PLC and to read/write DDP's value only when the connection is established, just to avoid issuing calls that will surely fail. The connection status is already made available by B*, thus all the application has to do is get it, i.e. by means of events. The following additional objects are needed: create event LINK_STATUS -parameter ( BOOLEAN ) create enbox ZZZ ... add subscription event LINK_STATUS ZZZ create filter LINK_DOWN \ -expression (#S BIT_AND C_LINK_DOWN) AND (NOT (#OS BIT_AND C_LINK_DOWN)) create filter LINK_UP \ -expression (NOT (#S BIT_AND C_LINK_DOWN)) AND (#OS BIT_AND C_LINK_DOWN) create trigger LINK_DOWN -data_point DDP -filter LINK_DOWN \ -trigger_evaluation ON_STATUS_CHANGE \ -event LINK_STATUS -eve_param ( FALSE ) create trigger LINK_UP -data_point DDP -filter LINK_UP \ -trigger_evaluation ON_STATUS_CHANGE \ -event LINK_STATUS -eve_param ( TRUE ) The application program receives event notifications from the ZZZ enbox; when the LINK_STATUS event is received, its parameter value will tell what the new connection status with PLC is : TRUE=conn.up, FALSE=conn.down. This value can be stored in a program's global variable that will be tested before attempting to any bstr_data_point_get/put_value() call: if( connection_up ) sts = bstr_data_point_get_value( ... ); else printf("Cannot read from PLC: connection is down\n"); NOTE: the LINK_STATUS event can be trigger by any device_data_point associated to any variable belonging to PLC.
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
574.1 | Works only if the DAS handles link failure | AMER::MORETTI | The black sheep | Wed Mar 12 1997 09:36 | 14 |
Ciao Beppe, what you are suggesting works fine if the DAS handles correctly the connexion and deconnexion with the VMD and/or if the protocol allows that kind of operation. This is true for MMS,H1,AP and others but is not true for JBUS or ETHWAY. Maybe there should be a common way to write a DAS so that the application can handle the lost of a connexion like you are explaining. regards maurice |