Alan,
There are a number of option:
1) Write a program
2) Buy a program
3) Use a package that includes this functionality
4) Use a kludge base on the WP.
Personally, I think option 2) is the best bet, but tastes (and budgets
differ) so here is some food for thought.
As always. Free advice is worth what you paid for it.
Regards,
AJ
******************** Various ways to exectute a script **************************
The I/A Series uses a program called 'mles', My Little Exectution Server for
the trivial buffs out there, but the protocol has never been published.
I (and many others) have written programs to register a PROCESS name with
the OM and wait for messages. Mine is called cpShell, but there are others.
You can find the information on how to use Foxboro Inter-Process
commnication (IPC) calls in Inter-Process Communications Calls (B0193BB).
Done properly, this mechanism can actually acknowledge to the CP that the
command has been executed. (One uses SENDACK and sets up to have the script
acknowledge the action.)
RBatch offered this capability as a standard part of its functionality.
You can use a WP to do it as shown from this excerpt from my (non-published,
sigh...) book 'Applying the I/A Series':
**************** Danger. Free advice begins here. Use good judgement before
proceeding. ***********
Most people do not realize that many of the WP globals are also OM
variables. One such is DMCMD. Once each second, the DM/FV checks its DMCMD
for a command string and if there is one executes it.
The OM name of a DM's DMCMD variable is '<dmname>DMCMD', e.g., WP0001's
DMCMD is WP0001DMCMD.
Since it is a OM variable, the DMCMDs can be set from within a sequence
block as follows:
:WP0001DMCMD := "dmcmd e /usr/customer/Initial_Disp";
Here is an example of a program that waits on an event and sends a command
to a DM.
CONSTANTS
VARIABLES
WP : S12[10]; {Array of WP letterbugs}
WPLBUG : S12; {The DMCMD variable for the target WP}
USER_LABELS
DESTCRT : II0001; {Requested Target WP's number in this console}
DISPNO : II0002; {Encoded Display Name and Default WP}
TARGET : IO0001; {Actual Target WP's number in this console}
KEY : IO0002; {Key number}
PANEL : IO0003; {Panel number}
WP01 : SN0001; {Letterbug of the Default WP in this console}
WP02 : SN0002; {Letterbug of the Second WP in this console}
WP03 : SN0003; {Letterbug of the Third WP in this console}
WP04 : SN0004; {Letterbug of the Fourth WP in this console}
WP05 : SN0005; {Letterbug of the Fifth WP in this console}
WP06 : SN0006; {Letterbug of the Sixth WP in this console}
WP07 : SN0007; {Letterbug of the Seventh WP in this console}
WP08 : SN0008; {Letterbug of the Eighth WP in this console}
WP09 : SN0009; {Letterbug of the Ninth WP in this console}
WP10 : SN0010; {Letterbug of the Tenth WP in this console}
STATEMENTS
{Fill the WP array with the letterbugs of the WPs in the consoles}
WP[01] := WP01;
WP[02] := WP02;
WP[03] := WP03;
WP[04] := WP04;
WP[05] := WP05;
WP[06] := WP06;
WP[07] := WP07;
WP[08] := WP08;
WP[09] := WP09;
WP[10] := WP10;
<<CHECK>>
{Wait until a WP is specified or a display is specified}
WAIT UNTIL ((DESTCRT <> 0) OR (DISPNO <> 0));
{If the target WP is non-zero, wait for a display to be specified.
If no display is specified in a short amount of time, start over}
IF (DESTCRT <> 0) THEN
WAIT UNTIL (DISPNO <> 0) AFTER 10 GOTO CLEANUP;
ENDIF;
{Determine from DISPNO the display to call up}
KEY := DISPNO MOD 100;
PANEL := (DISPNO MOD 10000 - KEY) DIV 100;
{If a Target WP is not specified, use the default as encoded}
IF (DESTCRT = 0) THEN
TARGET = DISPNO DIV 10000;
ELSE
TARGET = DESTCRT;
ENDIF;
*************** HERE'S THE GOOD STUFF *****************
{Send a command to the WP to raise the display}
WPLBUG := WP[CRTNO],"DMCMD";
:'WPLBUG' := "e /usr/applic/dspRedir/",NAME,"/WP",TARGET-1,"/P",PANEL,"/K",KEY;
*************** DONE WITH GOOD STUFF *****************
<<CLEANUP>>
DESTCRT := 0;
DISPNO := 0;
GOTO CHECK;
ENDSEQUENCE
A couple of caveats:
1) The WP might be down. If that happens you will get an error that needs to
be trapped by the Sequence Block.
2) Other programs are setting DMCMD too. Since the DM/FV only checks the
contents of DMCMD once each second,
you may have your command overwritten by someone elses or vice versa.
Therefore, you need to build a confirmation
mechanism into your code.
The ICC manuals (Integrated Control Configurator (B0193AV) and Integrated
Control Software Concepts (B0193AW) ) covers the Sequence Block language,
but here is an example of how to trap setting an error on a Shared Variable
that does not exist:
{ Trap errors and increment a counter}
BLOCK_EXCEPTION TO_SYS_ERROR
STATEMENTS
IF (SYSERROR < 100 )
THEN
SYSERROR := SYSERROR + 1;
ELSE
SYSERROR := 0;
ENDIF;
GOTO ERROR;
ENDEXCEPTION
> -----Original Message-----
> From: Alan J Schaff [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, March 21, 2000 3:26 PM
> To: Foxboro DCS Mail List
> Subject: Script Execution
>
> Does anyone have any experience with running a script triggered by an
> event in a
> CP? Ideally I want to trigger a script to run from sequence code or when
> a CIN
> block goes true.
>
> Thanks,
> Alan Schaff
> BASF Corp.
>
>
>
>
-----------------------------------------------------------------------
This list is neither sponsored nor endorsed by the Foxboro Company. All
postings from this list are the work of list subscribers and no warranty
is made or implied as to the accuracy of any information disseminated
through this medium. By subscribing to this list you agree to hold the
list sponsor(s) blameless for any and all mishaps which might occur due to
your application of information received from this mailing list.
To be removed from this list, send mail to
[EMAIL PROTECTED]
with "unsubscribe foxboro" in the Subject. Or, send any mail to
[EMAIL PROTECTED]