Switching between permitted modes

I want to switch between RCAS and CAS using some logic based on operator selection of natural gas or methane.

I am using MODE parameters to do this, but there seems to be something I am missing to make this work.

When the operator switches mode there is a integrity error in the CALC block with it trying to write to the PID1. I can clear the problem by moving the NORMAL MODE from the mode I want to MANUAL. The PID gets written to, the faceplate changes, I am permitted to choose the mode I want.

 So what am I missing that is preventing a nice smooth transition between the modes?

thanks

Gary

  • For the PID1 the parameters TARGET_MODE shoud be set instead of the MODE parameters:
    /PID1/TARGET_MODE := RCAS
  • If you are trying to change the mode of the block, as Werner indicates, it should be Target mode but the actual path is '^/PID1/MODE.TARGET'.

    If you have any foundation fieldbus PID blocks (you should probably do this logic anyway), you should write the logic to only write the mode when required and not continually write the mode every scan. So you would add a check to see if the MODE.TARGET != RCAS or CAS before writing the MODE.TARGET to that value.

    Very bad things happen if you don't do this logic when PID block is in a fieldbus device and write it every scan of the module.
  • What exactly do you want to have the logic do?
    Should the logic actually set the mode of the PID block to CAS or RCAS based on the expression?
    The MODE.NORMAL value is used solely for visualisation whether the actual mode of a block is the selected normal mode or not.
    With the MODE.PERMITTED value the allowed modes for the functionblock are set.

    The problem with your expression is that the MODE.NORMAL still has the previous value (e.g. CAS) when you change the MODE.PERMITTED (removing CAS and setting RCAS). Since the value of MODE.NORMAL is not included in the permitted modes, your CALC block will give an error and the permitted mode will not be written.

    In case you don't bother about setting the normal mode and permitted mode (allow both CAS and RCAS in all situations) you only have to select those permitted modes in PID1/MODE parameter and write the actual mode in the CALC block: '^/PID1/MODE.ACTUAL' := CAS; and '^/PID1/MODE.ACTUAL' := RCAS;

    In case you want to set the actual mode to the right value (switch to CAS / RCAS) and set the normal mode and actual mode accordingly you should make sure that the normal and actual modes are allowed modes when changing the permitted mode. You can do that as follows:

    IF GAS_FIRE OR METH_FIRE THEN
    IF GAS_FIRE AND NOT METH_FIRE THEN
    '^/PID1/MODE.PERMITTED' := 121; (* OOS, MAN, AUTO, CAS and RCAS *)
    '^/PID1/MODE.NORMAL := CAS;
    '^/PID1/MODE.ACTUAL := CAS;
    '^/PID1/MODE.PERMITTED' := 57; (* OOS, MAN, AUTO and CAS *)
    ENDIF;
    IF METH_FIRE THEN (* Note that this will be executed if both GAS_FIRE and METH_FIRE are true *)
    '^/PID1/MODE.PERMITTED' := 121; (* OOS, MAN, AUTO, CAS and RCAS *)
    '^/PID1/MODE.NORMAL := RCAS;
    '^/PID1/MODE.ACTUAL := RCAS;
    '^/PID1/MODE.PERMITTED' :=89; (* OOS, MAN, AUTO and RCAS *)
    ENDIF;
    ELSE
    '^/PID1/MODE.NORMAL := MAN;
    '^/PID1/MODE.ACTUAL := MAN;
    '^/PID1/MODE.PERMITTED' := 57; (* OOS, MAN, AUTO and CAS *)
    ENDIF;
  • In reply to Alfred Pol:

    Alfred's suggestion needs the MODE.ACTUAL changed to be MODE.TARGET and there are some missing single quotes after the MODE.NORMAL and MODE.TARGET (after the suggested change).

    I would highly recommend only writing to the PID parameters if they are needing to be changed. Continually writing to these parameters on every scan of the module when PID block is assigned fieldbus will have very bad results and it's a good programming practice.
  • Thanks.
    I would like the transition to be not dependent on the operator....they flip a switch to choose what gas to use and the DeltaV moves seamlessly to accommodate.
    I am gathering that I would abandon the MODE PARAMETERs and do everything in the CALC.
    I can see where the error of my ways with the MODE.NORMAL.
    I'll give it a try today.

    Gary
  • thanks for the help....
    There were some modifications.
    For example, I moved the '^/PID1/MODE.TARGET' out of this CALC block as I didn't want to lock the operator out from changing the mode and didn't see anyway to set it once inside the CALC block, so used a PDE and a ACT blocks instead.
    The switch used for the natural gas or methane is a HOA style switch, it seemed that the MODE_LOGIC CALC block inputs needed to go to 0 for a scan to set the PID to MAN. So stuck a few secs delay on those inputs, as the operators just flip the switch with out waiting at the OFF position.

    So ended up with this in the MODE_LOGIC CALC block
    GAS_FIRE := IN1;
    METH_FIRE := IN2;
    OUT1 := IN1 OR IN2;

    IF GAS_FIRE OR METH_FIRE
    THEN
    IF GAS_FIRE AND NOT METH_FIRE
    THEN
    '^/PID1/MODE.PERMITTED' := 121 ; rem (OOS,MAN,AUTO,CAS,AND RCAS)
    '^/PID1/MODE.NORMAL' := cas ;
    '^/PID1/MODE.PERMITTED' := 57 ;rem (OOS,MAN,AUTO,CAS)
    OUT2 := 1;
    OUT3 := 0;
    OUT4 := 0;
    ENDIF;
    IF METH_FIRE
    THEN '^/PID1/MODE.PERMITTED' := 121; rem (OOS,MAN,AUTO,CAS,AND RCAS)
    '^/PID1/MODE.NORMAL' := RCAS ;
    '^/PID1/MODE.PERMITTED' := 89 ; rem (OOS,MAN,AUTO,AND RCAS)
    OUT3 := 1;
    OUT2 := 0;
    OUT4 := 0;
    ENDIF;
    ELSE
    '^/PID1/MODE.NORMAL' := man;
    '^/PID1/MODE.TARGET' := man ;
    '^/PID1/MODE.PERMITTED' := 57 ;rem (OOS,MAN,AUTO,CAS)
    OUT4 := 1;
    OUT2 := 0;
    OUT3 := 0;
    ENDIF;

    I was going to place the picture of the final configuration, but don't see how to import with in this reply....

    Thanks again
    Everything seemed to work in my test module...moving it on-line.

    Gary