Engineering Limits Challenged: Metering Device Project

In summary, the engineer is looking at a metering device that has an electromagnetic coil that actuates it, a variable resistor as a sensor for the actual position, and the ability to respond to changes in inputs quickly. They are considering having part of it analog (perhaps just a P-D loop), and are thinking about using a microcontroller to control it. They are looking for a voltage to PWM controller, and are concerned about stability.
  • #36
Something like this is a simpler version of the compensation network. Fewer components for the same function as the previous posts. But these designs aren't that simple in practice, you do have to know what you want.

edit: BTW R2 and C3 aren't part of "PID". They are there to make it actually work (stability).
img002 (2).jpg
 
Last edited:
  • Like
Likes Rx7man and yungman
Engineering news on Phys.org
  • #37
Diesel trucks are slow compared to the world of electronics. In practice (modern times) this would be a software implemented controller.

All of the ancillary features like start-up, shut-down, response to large transients, tuning, user interface, etc. are about a million times easier with software. The feedback controls could be a one IC solution if you choose the right micro-controller.
 
  • #38
This feels more like a total analog closed loop feedback project. Remember, if you put MPU into the loop, you have to have an ADC to convert the voltage into digital, work on the data, then put it out to a DAC to transform back to analog. Maybe you have much faster ADC inside the MPU now. When I was designing all the MPU controllers, they use Successive Approx ADC inside, it can get slow. You might add an extra pole you don't want and make life much more difficult. I was going to suggest a simple circuit like what DaveE drew in post #36. You have zeros, you have poles in case you need it or leave it if you don't.

In this kind of circuit, the electro mechanical part is the slowest, it can serves as the dominant pole. But it's hard to characterize the exact pole or zero or whatever. I am not an expert on closed loop control system, but I did a few in my career. In this situation, I use faster components( opamps) to make sure they stay out of my way. Use DaveE's type of circuit, start out with R1 and C1 that forms a lag-lead network. I want to lower the gain of the opamp as soon as it's out of the control frequency ( in this case, looks like it's in below 200Hz). I would use C1 to reduce the gain of the loop starting from say 1KHz or so, then adjust R1 to bend the bode plot up to get a smooth single pole crossover....R2 C2 to me is for emergency fix if still want to be more stable.

I don't go any further after this, I observe. If I power up, and I see the mechanical motion just ease to to the resting point, this is over compensate, all you have to do is make sure the response is fast enough, if so, you are done.

If the motion overshot and ease back to resting position one time, you are still ok. It just have one ring.

If it overshoot, then back under shoot a few times, you still have work to do. Look at the frequency of the oscillation and look at putting a zero to straighten it out.

The characterization of the electro mechanical component is very hard, I found it easier to do it this way. You start out with a sound basic closed loop stability design then try and see. The circuit daveE posted in #36 is a very good start.
 
  • #39
Having witnessed a diesel engine attempt to run away, I would take this project very seriously. Before any more effort is put into this I would determine if you actually need to incorporate a governor into this or just control the position of the rack. We haven't actually been told if this is an automotive project or not. What type of machine will this be powering?
 
  • Like
Likes DaveE
  • #40
If it is some sort of engine control for truck, I won't mess with it. I personally would NOT do anything to experiment on my car for sure, this is dangerous. It's fun and game over here, like pet project, homework that doesn't make any difference to real live. I won't mess with a car where your life depends on it. Last thing you want is your stuff fighting with what's in the car.

That said, there's another even bigger problem with using MPU inside the feedback loop. If the ADC inside the MPU is successive approx type, you have a more serious problem. Inside is doing a whole bunch of comparisons...bigger...smaller...It relies on the input analog signal is stable, not changing. If there's no sample and hold circuit, it tries to compare while the signal is moving...Huston, we got a problem! You literally can fail to acquire the data and have long dead time and can vary from time to time. You cannot model this as poles and zeros. Read the datasheet on the MPU you are using. I doubt it would have a flash ADC inside. Those MPU are meant for monitor voltages so successive approx is good enough.
 
  • Like
Likes Rx7man
  • #41
yungman said:
This feels more like a total analog closed loop feedback project. Remember, if you put MPU into the loop, you have to have an ADC to convert the voltage into digital, work on the data, then put it out to a DAC to transform back to analog. Maybe you have much faster ADC inside the MPU now. When I was designing all the MPU controllers, they use Successive Approx ADC inside, it can get slow.
Control of the solenoid is by microcontroller PWM, which is autonomous, energy efficient and replaces the DAC. The controller does not have to compute faster than the injector rack control.

Microcontrollers for motor control typically have two or more internal A-D converters, with 8 or more MUX inputs. There is plenty of time to do the ADC, it will take less than 20 usec in the background. SAR A-D converters are faster than quad slope by a factor of 1000.

Take at look at an AC motor microcontroller. It is over 100 times faster than is needed for diesel injection rack control. The internal computations can all be 16 bit integer. The PID requires 3 multiplies, one subtraction and 4 additions, which now takes less than 10 usec.

The software solution is the minimum chip count solution. The hardware required is 1. A microcontroller; 2. A low-side gate driver; 3. N-chan MOSFET; 4. Freewheel diode.
 
  • Like
Likes Rx7man and Averagesupernova
  • #42
yungman said:
if you put MPU into the loop, you have to have an ADC to convert the voltage into digital, work on the data, then put it out to a DAC to transform back to analog. Maybe you have much faster ADC inside the MPU now. When I was designing all the MPU controllers, they use Successive Approx ADC inside, it can get slow.
Old school. This part costs $2 and can sample 12bits at 1Ms/sec. There are lots and lots of other choices. IMO, the speed is probably really limited by extra sw features and poor code/algorithms. However, even with a few floating point MACs in each sample period, you can still run much faster than a truck.
https://www.digikey.com/product-detail/en/silicon-labs/EFM32TG11B120F128GM32-B/336-5683-ND/9677675
 
  • #43
I am out of date.
 
  • #44
yungman said:
If it is some sort of engine control for truck, I won't mess with it. I personally would NOT do anything to experiment on my car for sure, this is dangerous.
Then some of the things I do would make you squirm. Not limited to passenger vehicles.
 
  • Like
Likes Joshy and Rx7man
  • #45
yungman said:
I am out of date.
LOL, me too.
BTW, I've never met anybody that is really good at doing this with analog circuits or digital controls (including me). It is really two very different disciplines. There are control system types (like me) that can do the modeling with Laplace transforms or Z-transforms, and can design algorithms, but they either can't do analog design, or they can't write good code (like me).
 
  • Like
Likes Rx7man
  • #46
yungman said:
If it is some sort of engine control for truck, I won't mess with it. I personally would NOT do anything to experiment on my car for sure, this is dangerous. It's fun and game over here, like pet project, homework that doesn't make any difference to real live. I won't mess with a car where your life depends on it. Last thing you want is your stuff fighting with what's in the car.
In any case, don't drive it on the streets. Consider your liability exposure if things go wrong. Like the cost of rebuilding the front of someone's house, replacing a Porsche, or negligent homicide, for example. You just can't do the kind of testing, engineering procedures, and QA that a real car manufacturer is required to do; that the judge/jury at your trial will expect.
 
  • Like
Likes yungman
  • #47
That was a lot of good reading, thanks for the replies.
This isn't designed to control the SPEED of the engine (that's a slow process and will be done digitally for sure), it's intended to make sure the fuel (or timing) racks are in the position they're commanded to be, which happens pretty quick.

There is hardly anything original on my truck, and being a manual, if something does fail, I can always hit the clutch

Here's what I'm reading right now on analog PID controllers (starts at page 8) https://www.dialog-semiconductor.co...of_a_dc_motor_using_analog_pid_controller.pdf
 
  • #48
I think you can find better references on the web than this one. I have some serious problems with how they've described Integrators. They don't require an error, and they typically don't overshoot. Although how anyone could make a statement about the transient response (overshoot, for example) without fully describing the system dynamics and the gains chosen is beyond me.
 
  • #49
DaveE said:
I think you can find better references on the web than this one. I have some serious problems with how they've described Integrators. They don't require an error, and they typically don't overshoot. Although how anyone could make a statement about the transient response (overshoot, for example) without fully describing the system dynamics and the gains chosen is beyond me.
I'm no expert on this, but just going by the circuit diagram it appears that they all require an error in order to be active, with the exception of the D term which requires a change in error, rather than an absolute error. And the integrator usually would cause overshoot because of windup.. yes, the entire system does need to be taken into account though, but a poorly tuned I term would certainly cause it.

Going back to circuit analysis, I noticed with the electrolytic caps, they have them in serial with backwards polarities.. is this common and good practice for systems where you can have either polarity? Should there be a bypass diode to prevent reverse charging ?
1596384310718.png
 
  • #50
Using electrolytic caps in that way is not a good design practice IMO. There are better ways to get long time constants without them. There are also ways of adding a DC bias into the circuit to ensure the correct polarity at all times if you do use them.
 
  • Like
Likes Rx7man

Similar threads

Back
Top