How to save PID Auto Setpoint, when returning from Cascade mode?

Hello, 

I have a PID flow loop that is configured to go from AUTO to CAS mode (when a certain condition occurs) to control the flow with a different setpoint. 

After returning to AUTO, is there away to save the Setpoint before the loop went to CAS?

I can not think of away such that the loop return back to the setpoint before going to CAS mode.

Thanks for any help or comments.

11 Replies

  • In your logic where you switch the loop to CAS, record the old SP in a parameter and then move it back once you are back in AUTO.

    How do you move the loop from CAS to AUTO, is this an operator action?
  • In reply to AdrianOffield:

    Thank you AdrianOffield,

    I have a calculation block (output ties into CAS input on PID) condition (if statement) that puts the loop in CAS, and calculates a new setpoint until the condition is false. If condition is false, I would like to put the loop in AUTO at the previous setpoint before going to CAS.

    My problem is if I program it like above, the Operator will not have control of the loop when not in CAS and the setpoint will be hard coded.

    Thank you
  • In reply to AdrianOffield:

    AdrianOffield,

    The loop will be in AUTO majority of the time with a 550 setpoint.

    When the loop is in CAS its stays there until a condition becomes false. The condition is a if statement. When the condition is True, the loop goes to CAS and the setpoint is calcuated via a formula. So the setpoint will be changing while in CAS and different from the setpoint before going to CAS.

    Thanks
  • In reply to DCS Newbie:

    But you would move the old SP using a oneshot (PDE) when the if condition is false, that way the SP would be released for the operator on the following scan.
  • In reply to AdrianOffield:

    Thank you, 

    I am not sure I understand. 

    Here is the logic fo the calc block for example:

    If valve = open,

    ELSE

    PID/MODE = CAS

    new_setpoint = Gas_flow*1.5 + 20.5  (as long as the valve is open, this new sepoint will control the PID block)

    OUT.CV = new_setpoint  

    ELSE

    **Here is where I am confused**  If the valve is closed, I would like the PID to go back to setpoint before going to CAS and put the PID mode in MAN. However, if I program this here, the Operator will not be able to put the PID in AUTO because its hardcoded when the valve is close PID will be placed in MAN. Futhermore, if I program to put PID in AUTO when condition is false, the Operator will not be able to put the loop in MAN, which mean they have no control of the loop. 

    I am tempted to do nothing in this ELSE place, and instruct the Operator to place the loop in AUTO at a the desired setpoint. This way the Operator have full control of the loop while the loop is not in CAS.

    ENDIF

    Thanks for your input.

  • In reply to DCS Newbie:

    You need a NDE function block linked to the your CALC output block (output = true means the PID is in CAS mode). After that you can test the output of the NDE block in a logic written in another ACT function block. Something like this(you need to create a new parameter OLD_SP ):

    IF ( PID/MODE = AUTO) THEN OLD_SP := PID/SP

    IF (NDE/OUT = 1) THEN PID/MODE := AUTO; PID/SP := OLD_SP
  • In reply to DCS Newbie:

    HI,

    It's never a good idea to write from code into PID SP parameter. This is because PID block itself writes intoSP parameter on some circumstancies (SP_PV track related options in example). Overwrites over PID SP may happen, leading to unexpected behavior.

    In your case I see a potential problem if CAS_IN vs stored SP difference is large. If so, a large change in SP will happen and this may generate a "kick" on output.

    Maybe using other function blocks instead of a CALC will help.
    First, if your CASCADE setpoint calculation is [new_setpoint = Gas_flow*1.5 + 20.5 (as long as the valve is open, this new sepoint will control the PID block)] this is exactly what a BiasGain function block provides:
    BG output = (SP + IN_1) * Gain.
    So, in your case, SP=1.5, IN_1=Gas_flow (comming from AI I guess...), and Gain=20.5. BiasGain will operate in AUTO mode.

    To restore previous AUTO SP when switching back from CAS to AUTO, think that when in CAS mode "something" is controlling the PID by setting it's CAS_IN value. One way to handle this is to let this "something" to store PID SP value when mode is AUTO and provide this value THROUGH PID CAS_IN when it's changing back to AUTO mode (mode.target=AUTO and mode.actual=CAS).
    If BiasGain was added it's TRACK_IN/TRACK_VAL, or ROUT mode, may be used for that.

    NOTE: And additional benefit of BiasGain use is that it's BAL_TIME or CONTROL_OPTIONS settings may help to get bumpless transfer when swithing modes.

    Regards
  • In reply to gamella:

    Thank you gamella for responding. 

    I will need some time to re-read your suggestions so I can understand. 

    Currently the loop is programmed to the following below which will puts the loop in CAS at all times.

    Below is programmed in a CALC block with output going to CAS_IN

    IF valve is open:

    PID/mode= CAS

    new_setpoint = Gas_flow*1.5 + 20.5

    CAL/out=new_setpoint 

    ELSE:

    PID/mode= CAS

    CAL/out=400

    The above code still  have the problem you mentioned above with the Loop making a big change when setpoint changes from new_setpoint to 400.

  • In reply to DCS Newbie:

    If you use these lines it is likely to see a big change. I think it would be best using setpoint ramp up (or down) in the Else part when changing setpoints this way preventing
    Gain to kick in.

    Martin
  • In reply to DCS Newbie:

    In order to minimize (or at least have some control over) the bump when the SP changes, take a look at the SP_RATE_UP and SP_RATE_DN parameters of the PID block. These parameters allow for a function block-controlled ramp of the SP from 400 to new_setpoint, or from new_setpoint to 400. If your process has a high integral component, you may have to adjust the RESET to account for wind-up when ramping. However, I've used this functionality quite a bit for similar situations.
  • In reply to DCS Newbie:

    So you need to set PID to a fixed SP (400) when  condition is met (valve is open). Otherwise PID SP must be Gas_flow*1.5 + 20.5.

    In this case is quite easy using BiasGain because PID SP in "normal" condition is Gas_flow*1.5 + 20.5, that is BiasGain output. U

    sing TRK_IN_D of BiasGain to wire in the condition (valve is not opened inside a Condition block maybe...) and setting 400 as value for BiasGain TRK_VAL.

    When going from tracking to CAS there is no BUMP because of BiasGain BAL_TIME takes care but, going from CAS to TRACKING generates a bump (400 value will be set as PID SP in one scan cycle). This is often needed and may be is not a problem, if it is then RAMPING TRK_VAL is required.

    Below is a solution:

    PARAM2 is the condition, may be replaced by a condition block evaluating if valve is open

    PARAM1 is the fixed SP value (400 in your case)

    Gas_Flow must be connected, or set, to BG1/IN_1

    BG1/GAIN must be set to1.5

    BG1/SP must be set to 20.5/1.5

    BG1 must operate in AUTO