Michael Lloyd

How would you interpret this CPT

7 posts in this topic

Destination: FxTblStart ; this is an integer that is used as a pointer for some interesting array "stuff" (see PDF link below)

Source: FxNo-1 AND 7

In this case FxNo = 20

20-1 = 19 AND 7? AND is a boolean statement. The CPT instructions say AND is a bitwise operator (because it is) so the intent is not to add 19 and 7 together.

Fx17-24 (see the PDF), among other tags, is DataType REAL[8,2,16]. The arrays that I've used are x,y.

BTW, This is from the boiler control program that I've bi... complained about for a few years. It came without documentation. In my spare time I've manage to document a large part of it. The routine is, I think, my final WTH thing to figure out. As much as I want to hate it there's a level of old school programming skill that's enviable (and irritating) in this thing.

Before anyone jumps on the pulpit, yes, I'm very well versed in fired heater and boiler control as well as combustion. I've done it for 1/2 of my life. There is a simpler way to do what they did BUT I'm not going to rewrite the PLC program and HMI just because I don't understand what they did. I'd rather understand it than delete it.

Here's a PDF of the routine: https://www.dropbox.com/s/nmt5pepvn8qr6l3/Fx.pdf?dl=0

The tags aren't documented. That's what I'm working on now. The HMI has two screens that references most of the tags. The first screen (below) shows 20: as selected. I'm trying to troubleshoot why the feedback for the FGR Damper position doesn't match the setpoint. Visibly it's in the correct position. It looks like there's characterization for the output and the feedback but until I understand what Fx is doing I'm not going to let the tech touch anything. 

p4133212817-4.jpg

p4133212816-4.jpg

 

Share this post


Link to post
Share on other sites

what else is writing to FxTblStart?   How can FxNo-1 AND 7 = 1?    

Share this post


Link to post
Share on other sites
20 minutes ago, chelton said:

what else is writing to FxTblStart?   How can FxNo-1 AND 7 = 1?    

FxNo-1 AND 7 is the equation. FxNo MINUS 1 AND 7

Every time the pointer indexes something else is computed and read into and out of tables pointed to by FxNo (Function Number), I think....

FxTblStart is the pointer for the table.

FxNo is the index for the desired calculation.

I think... 

Share this post


Link to post
Share on other sites

All the CPT instruction is doing is making the range of FxTblStart from 0-7 from an input FxNo from 1 - 48

 

Edited by chelton

Share this post


Link to post
Share on other sites

If that's the case, and I'm not misunderstanding, the FXNo would never go above 7 and that's not happening in real life and can't happen or 3/4 of the control system wouldn't work.

_Fx is called from 14 different routines (some not used). The following is one of the calls that places 21 into the Input Parameter of the subroutine called _Fx. the input parameter is the tag FxNo

JSR(_Fx,2,21,MstrDmd,IbdPosGas)

 

Share this post


Link to post
Share on other sites

Using your example JSR(_Fx,2,21,MstrDmd,lbdPosGas)

Subrutine _Fx is called with input parameter 21 and MstDmd and returns lbdPosGas.

In the Subroutine,

Rung 1 will evaluate to 21-1 AND 7 = 4

Rung 4 will then be evaluated because FxNo is between 17-24 so the COP will copy 32 elements from  FX17_24[4,0,0] to FxX0 

......

That's as much as I can explain without knowing the value of MstDmd.

 

 

1 person likes this

Share this post


Link to post
Share on other sites
On 2/21/2021 at 0:11 PM, chelton said:

Using your example JSR(_Fx,2,21,MstrDmd,lbdPosGas)

Subrutine _Fx is called with input parameter 21 and MstDmd and returns lbdPosGas.

In the Subroutine,

Rung 1 will evaluate to 21-1 AND 7 = 4

Rung 4 will then be evaluated because FxNo is between 17-24 so the COP will copy 32 elements from  FX17_24[4,0,0] to FxX0 

......

That's as much as I can explain without knowing the value of MstDmd.

 

 

Apologies for dropping off. This helped turn the light on. The part that was missing for me, even though I pasted screenshots from the HMI, was that the HMI was the source for FXNo. This program is nearly impossible for a new tech to decypher. I've been working with the tech to learn how to get around this program. To his credit, even though he hasn't got much PLC experience he's picking up on it pretty well. Thanks for your help on this. 

************** 

“The nice thing about standards is that you have so many to choose from.” –Andrew Tanenbaum, Computer Networks, 2nd ed, p254.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now