popololote Posted August 21, 2023 Report Posted August 21, 2023 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. In FX3 we used a mitsubishi function block around the PID function, ¿Is there an equivalent for FX5? This is the interesting part: uxcolsts.bmp fmjpsbkl.bmp Quote
GreenMan Posted August 22, 2023 Report Posted August 22, 2023 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 Quote
popololote Posted August 23, 2023 Author Report Posted August 23, 2023 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 Quote
Recommended Posts
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.