Re: [foxboro] Debugging Sequence Codes

  • From: Dirk Pauwels <dirk.pauwels@xxxxxxxxxx>
  • To: "foxboro@xxxxxxxxxxxxx" <foxboro@xxxxxxxxxxxxx>
  • Date: Wed, 17 Nov 2021 09:47:23 +0000

Hi Daniel,

We have aproxx 1100 seq blocks running overhere, so we use it a lot.

Try using exception handlers in your code, these send the line nr where the 
error exists to a string (in our case SN0010.
So when you test your seq the error is recorded and you can turn to the line nr 
to see what might be the problem.
My experience is that most of the time the error is caused by an invalid C:B:P 
address.

Also to test the logic of the seq  we use test blocks, (ie TEST:TEST_GDEV1, 
TEST:TEST_AIN1 etc...).
when you use #define, user labels and variables it's  easy to replace the test 
blocks by the real blocks when the logic is ok.
Also try to avoid external references like C:B:P in your code when possible. 
Use user labels.

Example exception handler for sys errors and user errors:


First Include   err_stmnt               :R;
                err_count               :R;
in your variables

BLOCK_EXCEPTION TO_SYS_ERROR {-------- Respond to System Error --------}
STATEMENTS
        IO0005 := 48;
        IF (OP_ERR < 0) OR (OP_ERR = 3) OR (OP_ERR = 18) THEN
                {This exception handlers retry 3 times when they encounter an 
error, just in case an C:B:P was temporarely unavailable}
                IF (BLOCK_STMNO = err_stmnt) THEN
                        err_count := err_count + 1;
                ELSE
                        err_stmnt := BLOCK_STMNO;
                        err_count := 0;
                ENDIF;
                IF err_count < 3 THEN
                        WAIT 3;
                        RETRY;
                ENDIF;
        ENDIF;
        {this code sends the line nr that contains the error to SN0010}
        SENDMSG (COMPOUND_NAME,".",BLOCK_NAME," Error=",OP_ERR," 
Stmt=",BLOCK_STMNO) TO SN0010;
        {these lines contain actions defined in subroutines to be performed in 
case of error}
        CALL UNCLAIM();
        WAIT 0.5;
        CALL CLOSE();
        WAIT 0.5;
        CALL RESET();IO0005 := 60;
        WAIT 10;IO0005 := 0;
        EXIT;
ENDEXCEPTION

BLOCK_EXCEPTION TO_USR_ERROR {----- Repsond to Application Error ------}
STATEMENTS
        IO0005 := 49;
        IF OP_ERR = 2401 THEN
                IF (BLOCK_STMNO = err_stmnt) THEN
                        err_count := err_count + 1;
                ELSE
                        err_stmnt := BLOCK_STMNO;
                        err_count := 0;
                ENDIF;
                IF err_count < 3 THEN
                WAIT 3;
                RETRY;
                ENDIF;
        ENDIF;
        SENDMSG (COMPOUND_NAME,".",BLOCK_NAME," Error=",OP_ERR," 
Stmt=",BLOCK_STMNO) TO SN0010;
        CALL UNCLAIM();
        WAIT 0.5;
        CALL CLOSE();
        WAIT 0.5;
        CALL RESET();IO0005 := 60;
        WAIT 10;IO0005 := 0;
        EXIT;
ENDEXCEPTION

You also have exception handlers for manual (in case of sys or user error the 
IND will go to manual)
And for inactive.

Good luck
Rgds,
Dirk

-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On ;
Behalf Of Theobald, Martin (Overton)
Sent: Wednesday, November 17, 2021 10:20 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Debugging Sequence Codes

****EXTERNAL EMAIL - Exercise caution, this email originated from outside of 
the company. DO NOT reply to, open attachments or click links if the email 
looks suspicious or is from an unknown sender.**** 
________________________________


Daniel,

Depending upon the block type, you may want to see if parameters such as the 
following can help you identify the cause of the "OP Error -1" indications:

OP_ERR, OP_GRP, OP_OPT, OP_PRI and OP_TXT.


Regards,

Martin Theobald


PUBLIC

-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx <foxboro-bounce@xxxxxxxxxxxxx> On Behalf Of 
Daniel Wu
Sent: 17 November 2021 04:19
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] Debugging Sequence Codes

[You don't often get email from daniel_wu@xxxxxxxxxxxx. Learn why this is 
important at http://aka.ms/LearnAboutSenderIdentification.]

CAUTION: This email is from an external source. Do not click links or open 
attachments unless you recognise the sender and know the content is safe. If in 
any doubt, please report suspicious emails to IT.

Hi List,

I don't use much sequence programs in our application; and, instead, I use I/A 
blocks.  Therefore, I am not familiar with the different commands listed in a 
Sequence FoxDetail screen to control the execution of a sequence program. These 
commands are  "NEXT STMNT",  "EXEC STMNT",  "EXEC STEP", "EXEC SBX" and so on.  
I wrote a sequence program to  control several GDEV's and control valves (PIDA) 
to charge raw materials to a kettle.  When I ran it, there were run time errors 
message like  "SBX SYSERR" and "OP Error -1" appeared briefly  on the FoxDetail 
screen.

Trying to debug the runtime errors, I  switched the sequence block to 'STEP" 
mode with the expectation that by executing one statement at a time, I would be 
able to identify which statement caused the problem.  I believe the problems 
occurred when the program was passing a CB name to a DEVICE subroutine to 
open/close a GDEV. However, using  "NEXT  STMNT", "EXEC STMNT" and "EXEC STEP" 
commands did not execute one statement at a time.  Instead, multiple statements 
were executed with the "SBX SYSERR" and "OP ERROR -1" flashed briefly on the 
FoxDetail page.  I believe by executing the DEVICE subroutine call, it stepped 
inside the subroutine; and resulted in executing multiple statement instead of 
one.

I did not have any luck in finding any information on how to use these 
commands.  Would you mind pointing me to the Foxboro users guides with 
information on how to use these commands or be kind enough to explain to me how 
to use these commands to trouble shoot my sequence program run time problems.


Thanks
Daniel




_________________________________________________________________________
This mailing list is neither sponsored nor endorsed by Schneider Electric 
(formerly The Foxboro Company).  Use the info you obtain here at your own 
risks.  See the disclaimer at 
https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.thecassandraproject.org%2Fdisclaimer.html&amp;data=04%7C01%7CMartin.Theobald%40portalspaper.com%7C8f7675f0d13d415f707108d9a9815ea4%7C5395909f599e45d2affa31c9553fc661%7C0%7C0%7C637727195368289321%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=385DA8dOAHPNPwU76EwZqwxjJZ8u7Mr6M%2B%2F%2FLfcB%2BNs%3D&amp;reserved=0

foxboro mailing list:               
https://gbr01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.freelists.org%2Flist%2Ffoxboro&amp;data=04%7C01%7CMartin.Theobald%40portalspaper.com%7C8f7675f0d13d415f707108d9a9815ea4%7C5395909f599e45d2affa31c9553fc661%7C0%7C0%7C637727195368289321%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=ERXThW7QieC5rBkv%2BBTlKj%2B8m%2FLReLnneoaSo6kEjAM%3D&amp;reserved=0
to subscribe:           mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:        mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave

***************************************************************************** 
This e-mail is sent on behalf of Portals Paper Limited (‘Portals’). The e-mail 
and any attached files are strictly confidential and are intended solely for 
the addressee. If you have received this email in error, please notify the 
sender and then delete the e-mail and any attachments. Where the content of 
this email is personal or otherwise unconnected with Portals’ or its customers' 
business, Portals accepts no responsibility or liability for such content. You 
are advised to ensure that you have adequate virus protection as Portals does 
not accept liability for any viruses. Portals Paper Limited (company 
No.11001841) is registered in England with its registered office at: Overton 
Mill, Station Road, Overton, Basingstoke, Hampshire, RG25 3JG. 
*****************************************************************************


_________________________________________________________________________
This mailing list is neither sponsored nor endorsed by Schneider Electric 
(formerly The Foxboro Company).  Use the info you obtain here at your own 
risks.  See the disclaimer at www.thecassandraproject.org/disclaimer.html

foxboro mailing list:               //www.freelists.org/list/foxboro
to subscribe:           mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:        mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave




________________________________
Lawter Notice: The information (including any attachments) contained in this 
communication is confidential, private and proprietary, may be privileged or 
otherwise protected by applicable law or legal rule, and is intended only for 
the use of the addressee(s). Unauthorized use, disclosure, distribution or 
copying is strictly prohibited and may be unlawful. If you have received this 
communication in error, please notify the sender immediately by reply e-mail, 
or by calling the sender, and then delete it completely from your system.
 
 
_________________________________________________________________________
This mailing list is neither sponsored nor endorsed by Schneider Electric
(formerly The Foxboro Company).  Use the info you obtain here at your own
risks.  See the disclaimer at www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:               //www.freelists.org/list/foxboro
to subscribe:           mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:        mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: