Sign in to follow this  
Followers 0
popololote

FX5 PID Bumpless transfer

3 posts in this topic

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

Share this post


Link to post
Share on other sites

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;

1 person likes this

Share this post


Link to post
Share on other sites

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.

1 person likes this

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
Sign in to follow this  
Followers 0