ST - Changing an input value of a UDF in code.

Psnikta

Member
Join Date
Mar 2020
Location
QLD
Posts
15
Hi All,


I am currently at the beginning of a new project for writing a PLC program (using CCW) for an old sugar centrifugal.

Most of our factory is Honeywell CEE function chart so I am wanting to make something resembling what would normally done in the CEE (Which would be individual Control modules for the devices that are controlled by a Sequential Control Module).


Building the UDF (device control block that handles the command, input status and permissive and override interlocks) is relatively straight forward, the only thing I am struggling with is the Input command to the UFD itself.


Typically what would happen in CEE for example if State0 was requested on the InputCommand to the block and an override interlock for another state was ON or the state0 permissive was OFF the block would reject the change to the InputCommand.
Another scenario would be that if the block was in State0 and the override interlock for State1 turned ON the InputCommand would then need to be set to State1 as well.


The problem is, is that the ST in the UFD cannot change the value of a variable that is on the input side... so I am at a loss for what to do about this.

Any thoughts?
Thanks.

Note: I do have a ladder program for one of these centrifugals (would require a bit of modification) but ladder is very problematic for the electricians and myself to easily identify operational problems.
 
If you think about it, that does all the sense to not be able to modify input value of a block from inside the block doesn't it?

So what you need, is either inout, or some other mechanism.

Be cautious about the calls also. When the block is called, its inputs are assigned, so did you also change the command in a way, that it wont try again?

Maybe a question: where is the command originating from? HMI/Scada? and how?
 
That is the reason why there are In/Out variables so they can be modified within the function block as well as outside in the calling block.
The input parameters are passed to local variables just as in any programming language & the outputs are passed from the local to the required variable (possibly global) however, this also varies as in most IDE's the variable used as an input could be a local to the main block calling the function.
For example
Global variables are available to all blocks
Local variables are only available to the block it is declared in, however, it can be passed to a function that is called within that block.
Many years ago I used to create what now would be considered function blocks, this was done in the code by creating a program using say a range of variables then in a program block transfer the "IN variables to the ones allocated in the program used as a function block, jump to the block, on return transfer any variables required back.
Mitsubishi actually do this now so that it is compatible with the older ladder system where all variables are fixed i.e. D0 to D7000 for registers & M0 to M7000. What they do is reserve say D9000 to D10000 & M9000 to M10000 for variables that have no physical address in the IDE to make it compatible with the newer ways of creating symbolic variables rather than using actual physical memory areas, so creating a symbolic variable without an actual address when compiled, a physical address is allocated at compile time and will be in the range as mentioned above.
Temporary variables for created function blocks also use this allocated area.
The only downside is that any communication i.e. an HMI variables must use allocated physical addresses
 
Looking at CCW your only options for UDFs are Var,VarOutput,VarInput.
So I have come up with a workaround to do what I want it to do kind of.


So the command to the block is an INT, using the same format at a CEE DEVTCL block the values are:
0 = No command
4 = Request State 0
5 = Request State 1


So I have put in some code records the previous value of the command and compares it to the current one and it will only perform command actions for a single execution provided the two values are different, this means that when making a command request to the block you will need to set the command to 0 first and then set it to the value for the state you want (4 = Shut, 5 = Open for example).


The next problem I have run into is that I mistakenly thought that CCW has SFC lanuguage... it doesn't so will have to come up with a structured text version.
 

Similar Topics

I'm running a CLX setup with the high speed analog I/O cards. I have a rung where I am doing a calculation, and check the divisor variable to make...
Replies
22
Views
4,629
Hello, I have a running system where I'm completing an overfill protection logic and noticed that one of my feedback inputs is configured as...
Replies
2
Views
1,498
I have been having problems with an analog input card(class 3). Everytime I go into the I/O configuration to look at its settings, they change...
Replies
14
Views
3,446
Hi guys, I installed a Bindicator on our dust collector to indicate when it plugs up. I have it all mapped correctly to a P_DIN Block in...
Replies
2
Views
2,045
I'm trying to take an input signal (boolean, not analog), delay it for a configurable amount of time, then output it via an AOI using as little...
Replies
2
Views
2,372
Back
Top Bottom