Jump to content

Recommended Posts

Posted

Hi all,

I'm looking for a way to do a bumpless transfer (adjust the integral par automatically, so it continues from the last manipulated value after forcing it) using the PID function in a FX5 CPU. This is a function in the temperature control module, but I can't find it in the normal PID function.imagen.thumb.png.3806c9a003c7aed8632e2d7

In FX3 we used a mitsubishi function block around the PID function, ¿Is there an equivalent for FX5? This is the interesting part:

imagen.thumb.png.6250d672dd2eeddc9e46191

uxcolsts.bmp

fmjpsbkl.bmp

Posted

Hi

Try this

 

// ---------- Init ----------
FMOV(SM402 , 0 , 29 , wParam[0]);

// ---------- PID parameters ---------
wParam[0]        := i_wSamplingTime;
wParam[1].0     := i_bOperationDirection;
wParam[1].5     := i_bOutputLimitEnable;
wParam[2]        := i_wInputFilterConstant;
wParam[3]        := i_wProportionalGain;
wParam[4]        := i_wIntegralTime;
wParam[5]        := i_wDifferentialGain;
wParam[6]        := i_wDifferentialTime;
wParam[22]        := i_wUpperMVLimit;
wParam[23]        := i_wLowerMVLimit;

// --------- PID auto ---------
PID(i_bEnablePID , i_wTargetValue , i_wProcessValue , wParam[0] , o_wManipulatedValue);

// --------- Manual value ---------
MOV(i_bAutoManual , i_wManualValue , o_wManipulatedValue);

// ---------- Zero output when PID is disabled ----------
MOV(NOT i_bEnablePID , 0 , o_wManipulatedValue);

// ---------- Bumpless mode transfer ----------
IF i_bAutoManual THEN
    INT2DINT(TRUE , o_wManipulatedValue , dTempReg);
    dTempReg := 100 * dTempReg;
    bTempArray[0] := DINT_TO_BITARR(dTempReg , 32);
    wParam[18] := BITARR_TO_INT(bTempArray[0] , 16);
    wParam[19] := BITARR_TO_INT(bTempArray[16] , 16);
END_IF;

  • Like 1
Posted

Thanks @GreenMan, I tried forcing the manipulated value by limiting it with the upper and lower limit parameters. I guessed that the PID was internally recalculating the integral part, so it didn't grow indefinitely while limited. That doesn't seem to work.

Right now I'm testing the version of the FX3 library you translated to ST, and it seems to be working, so I guess didn't update the function much from FX3 to FX5.

Thanks for the code! I'll test it and write back if I see something interesting.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...