Jump to content

Motor control - PID settings


Britannia Builder

Recommended Posts

I have a Bachmann 3MT Tank loco with 8-TXS decoder running the Black 5 profile (V2). I've set a complex speed curve which gives pretty good chuff synchronisation at low speeds, and as a result I tend to run it more often at low speeds. I've noticed that sometimes when pulling a modest load of 7 wagons at low speed it slows down noticeably, almost to a standstill, when negotiating curves, points or gradients. This is probably at a voltage setting of just 3-5 on the speed curve. I had run the auto calibration prior to setting the complex speed curve. Running at medium and high speeds is fine.

I thought at first this was a mechanical problem and spent some time fiddling with the loco, oiling the motor bearings etc, to no effect.

It then occurred to me that it might be a problem with the back emf control, so yesterday I bit the bullet and switched to PID motor control (CV 149=1). With the default PID values of 4,8,1 this immediately cured the slowing down under load, but the motion at low speeds seemed a bit jittery. After tinkering with low values of P,I,D to no great effect, in frustration I swiped the CV sliders to the right to give P of about 90 and I of about 40. It then ran very smoothly!

So it appears that the jittery motion is caused by too little back EMF correction rather than too much, which had been my first assumption - ie the motor strays too far from the desired speed before the correction kicks in. I just wondered what experience others have had of PID setting, and what typical values might be?

Regards, John

Link to comment
Share on other sites

I've read the manual and it does give a very good explanation of the PID feedback mechanism, but no real guidance as to typical values. I was surprised that the values that seem to work for me are so far from the defaults, and I just wondered what others had found.

Incidentally I would have tried the PA control factors before resorting to PID, but the explanation of CV150-152 on page 116 of the manual is not very enlightening. Has anyone had success with these?

Regards, John

Link to comment
Share on other sites

The basic problem is that each loco and its motor/drive-train mix will create unique circumstances that affect any suggested settings so the defaults that each sound profile deploy are Hornby’s best guess for a particular loco/motor/scale. After that it is down to individual tuning or hoping for a reasonable outcome from auto-cal even if not perfect.

Edit - my understanding of the PA factors is they are the machine defined parameters, thus if fiddled with may not be the best solution, hence try the full PID fudge method of tweak this until it overcooks, back off, adjust the next variable, tweak a tad, etc and so on.

Link to comment
Share on other sites

I've experimented a bit more with the PID settings. Anything above single digits for P and I seems to give good results. I've settled on 40/30/0. I detect uneven running by watching the last 2 or 3 wagons of a 7 wagon rake and seeing if the couplings rhythmically tighten and slacken at low speeds - the motion of the loco itself always looks smooth. I couldn't detect any effect from the D factor, so left it at zero.

The beauty of the app CV editor is that it's possible to set the train running at the desired speed for testing and then adjust the CVs on the fly and instantly see the effect of each change - it would be hopeless trying to do this using the DCC programming track.

Regards, John

Link to comment
Share on other sites

Well done John.

The thing with PID is that they are first (P), second (I) and third (D) order effects so not surprising you were able to do it with the first two.

Then, if you were trying to continuously point your Parkes radio telescope directly at the Restaurant at the End of the Universe, you may need to go beyond third order. In fact, it was the need to accurately point radio telescopes that was the impetus to develop such sophistication in Control Theory in the first place.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
  • Create New...