Slashdot Mirror


Linux Controls a Gasoline Engine With Machine Learning

An anonymous reader writes: Here's a short (2 min) video of PREEMPT_RT Linux controlling a gasoline engine from one burn to the next using a Raspberry Pi. It's using an adaptive machine learning algorithm that can predict near chaotic combustion in real-time. A paper about the algorithm is available at the arXiv.

41 of 89 comments (clear)

  1. I didn't see any mention of efficiency. by allaunjsilverfox2 · · Score: 1

    I am not familiar with combustion engine computation. Does this make the engine more or less efficient? And if it is more effiecent, how does it compare with commercial offerings of comparable use?

    --
    Restore the madness of youth's lechery
    1. Re:I didn't see any mention of efficiency. by ls671 · · Score: 3, Informative

      Here the goal is to make the engine spend as much fuel as possible, hence the term "chaotic combustion". The system can maintain the engine in a "chaotic combustion" state in real time ;-)

      --
      Everything I write is lies, read between the lines.
    2. Re: I didn't see any mention of efficiency. by Anonymous Coward · · Score: 1

      That's because you read the summary, not the paper...

      tl;dr?

    3. Re:I didn't see any mention of efficiency. by dannybackx · · Score: 2

      As much fuel as possible ? Hardly.
      The conclusion says "the broader objective of this new modeling approach is to enable a new class of cycle-to-cycle predictive control strategies that could potentially bring HCCI’s low engine-out NOx and high fuel efficiency to production feasible gasoline engines."

    4. Re:I didn't see any mention of efficiency. by Anonymous Coward · · Score: 1

      by burn as much fuel as possible he probably meant
      "get the most energy out of the fuel in the chamber"
      not
      "use the most fuel"

    5. Re:I didn't see any mention of efficiency. by Anonymous Coward · · Score: 5, Informative

      In HCCI, you operate the engine *without* the throttle (for practical purpose, they probably left the throttle in but operated at WOT: pedal to the metal). This improves the efficiency for sure right there.

      HCCI *is* about efficiency: without the throttle in the way, things go much better thermally in the machine. Torque output (thus power) is then controlled by fuel injection and the motor autoignites (like a diesel).

      Combustion at every cycle starts according to current conditions (pressure and temperature). This means that earlier cycles are essentially what determines the current combustion... You only get to control fuel timming and quantity supply...

      This is hard people...

      The article is about a *control* strategy. It is normal to seek worst case conditions (hence the chaos, variability, etc) and to try to demonstrate robustness... Efficiency will certainly be evaluated next, once robustness is set. Given the article was written in october 2013, they probably have this figured-out by now ;-)

  2. Re:Is that engine even running? by Dutchmaan · · Score: 1

    "I don't hear the engine running, so I highly doubt that this video is legit."

    Oh! ... well everyone stand back then!

  3. Re:Oh no, Linux Lockup Bug strikes again! by mysidia · · Score: 2

    Don't worry. It's not going to be in cars anytime soon.

    I think a Pi running realtime Linux with machine learning looks much more interesting as a possible candidate for replacement of legacy control systems in nuclear fission-based power plants with a much more modern less-expensive system based on current generation commodity off-the-shelf hardware.

  4. 'Linux?' by Sarusa · · Score: 4, Insightful

    Oh come on - I like Linux and use it for my servers and even some RTOS... but 'Linux' has almost nothing to do with that. It'd work just as well on any RTOS. Would you give credit to Windows for every single freaking program that can run on it?

    Something like 'Raspberry Pi Controls a Gasoline Engine With Machine Learning Using Eigen
    C++ Matrix Library' would be far more descriptive.

    1. Re:'Linux?' by itzly · · Score: 1

      Dell XYZ controls sound levels for my DJ show

      What operating system ?

    2. Re:'Linux?' by Imbrondir · · Score: 2

      I dont think its clear from the video, but if its actually doing the entire realtime engine control process loop on the raspberry pi, then Id say hats off to PREEMPT_RT. Not something windows could do. Using a rb pi is a decent demo of low resource usage.

    3. Re:'Linux?' by burni2 · · Score: 1

      Windows Vista - not somehting it could do
      WIndows 7 - not something it could do

      WindowsXP - can do
      Windows2000 - can do

      That's part of the answer why winnt5/5.1 are actually widley used, they are used in realtime equipment, along with their low memory and cpu footprint (winxp can be tuned very good).

      And hopefully nobody dares to connect Win2ksp4 or winxpsp3 on these appliances to the pure-internet nor to any intranet consisting of more than one not connected computer.

      But WinXP and 2k are very good & smooth OSes (Microsoft did much on XP to optimise it to the performance level of 2k) for these types, and many people with these needs, are not very pleased with win7.

      But PREEMPT is funny that it is mentioned now, I can remember some 2.4.X kernel, or was it even 2.2.16/18ish ? when I patched the Preempt scheduler into and needed to make manually a new patch from the previous patched kernel source because one version later the patch failed.

      Later the option was present in the menuconfig as experimental.

      Really was preempt forgotten so fast ??

    4. Re:'Linux?' by jellomizer · · Score: 1

      Linux is the kernel. Windows is a full operating system.
      You take the NT kernel and strip out the extra stuff like the gui then it could run on the pi as well

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    5. Re:'Linux?' by amiga3D · · Score: 1

      BSD

    6. Re:'Linux?' by jones_supa · · Score: 1

      Please explain what you specifically mean about his message.

    7. Re:'Linux?' by burni2 · · Score: 1

      And I'm sure that you are just funny, go back to sleep kid.

    8. Re:'Linux?' by gatkinso · · Score: 1

      It is a cool implementation to be sure, but we are talking timing deadlines of about 8-9 Hz per cylinder at (2000RPM). Not very much of a test of a RTOS or the HW it is running on.

      --
      I am very small, utmostly microscopic.
    9. Re:'Linux?' by gatkinso · · Score: 2

      >> That's part of the answer why winnt5/5.1 are actually widley used, they are used in realtime equipment

      BS. No hard real time system uses any Windows variant. There are RT packages for Windows, but all the RT functionality is in the package kernel - Windows rides along as an preemptable process on top of the RT nanokernel. Tenasys and other vendors IIRC.

      RT_PREMPT is alive and well - however AFAIK most folks leverage it through Xenomai.

      --
      I am very small, utmostly microscopic.
    10. Re:'Linux?' by gatkinso · · Score: 1

      Checkout Xenomai - you can get hard realtime determinism at microsecond level.

      --
      I am very small, utmostly microscopic.
    11. Re:'Linux?' by gatkinso · · Score: 1

      That video showed a whole lot of Windows, BTW.

      --
      I am very small, utmostly microscopic.
    12. Re:'Linux?' by drinkypoo · · Score: 1

      It is a cool implementation to be sure, but we are talking timing deadlines of about 8-9 Hz per cylinder at (2000RPM). Not very much of a test of a RTOS or the HW it is running on.

      They claim they're sampling combustion at multiple points during the cycle per cylinder, so it's probably in the tens of Hz. Which is still not much of a test.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    13. Re:'Linux?' by sumdumass · · Score: 1

      I thought BSD died?

    14. Re:'Linux?' by Anonymous Coward · · Score: 1

      Umm, instead of guessing numbers, you can look at the actual work and see where it is stated that sampling is done over 100 kHz and response time needs to be on the order of 0.1-1 ms.

  5. Re: Is that engine even running? by aaronb1138 · · Score: 2

    Computationally, running a car engine is trivial for a raspberry pi. Early EFI used processors in the KHz range and even current ECUs like Megasquirt use 16 bit 50 or 100 MHz processors.

    Fuel injection and spark events only occur at the 10s of Hz scale (topping out at around 60 each per second). Even if you handle cam phasing and MAF sampling at 100 times that interval, you're still within the computational work load of a couple dozen MHz of instructions.

    The research is only interesting because they are taking advantage of way overspecced processing power to approach combustion more granularly per event and trying to learn from each one and control the next. It only got press here because they used Linux (anything production grade would use QNX or similar).

    The expensive part of an ECU isn't the processor. It is supporting circuitry to tolerate lots of EMI noise, varying supply voltages, and lastly, driving fuel injectors (they're actually a PITA because of voltage / current / pulsing).

    If they really want to get ambitious, their system will learn the exact intake geometry effects(intake asymmetry) , individual injector flow characteristics, and cylinder geometry (build up, hot spots) and thermal trends just by watching I/O.

  6. Re: Is that engine even running? by drinkypoo · · Score: 1

    The research is only interesting because they are taking advantage of way overspecced processing power to approach combustion more granularly per event and trying to learn from each one and control the next.

    I only wish the abstract had been informative, and I'm not going to bother to read the whole paper. What are they claiming that sampling the process at more points is buying them? Because we already monitor each and every combustion event, and in some cases we will take action on it before the next combustion event already, and have been doing that approximately since the late eighties when we implemented knock detection.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  7. Re: Is that engine even running? by Mashiki · · Score: 1

    I can't say there's much of anything interesting at all. Since a lot of the stuff, except what's covered in your last sentence has been done by the old ECU's since the 90's. Even varying supply voltage has been under control since around 1996, the variation of voltage for ECU connected components was down to 0.03v, it's 0.01v these days. It doesn't *have* to be any better than that when the tolerance is +/- 0.04v per sensor. There isn't really a problem with injectors though. It's not hard to figure out the pulse timing per injector when measured against the cam and crank sensors. Even the TBI injectors that came up in the late 80's through 90's before MPFI became the mainstream used only a crank sensor.

    --
    Om, nomnomnom...
  8. Re:Is that engine even running? by ledow · · Score: 1

    Why would it put car companies out of business?

    What a ridiculous statement.

    Cars ran for decades without ECUs at all, all due to proper engineering. ECU have been around for decades too. The first were literally nothing more than simple circuits on a PCB. Modern ones are not that much more complicated. The ECU in your car can be interfaced and controlled with by a £5 bluetooth adaptor and a free app.

    You can get ECU replacement chips for almost any model of car, and even switches to switch between genuine ECU and your own custom one. The ECU isn't doing much, it's just doing it fast enough that simple engineering on its own couldn't manage. But even a couple of MHz is way within the range of a viable "homebrew" ECU for almost any vehicle if you want to spend the time on it.

    Even if ECU's were dirt cheap (and they already are), the car industry isn't going collapse because of it (proof - they're still here). Few people would ever replace an ECU, replacing an ECU voids your warranty, and garages aren't going to start voiding your warranty for you to save a pittance. Even if you could, what do you think you'll gain? A handful of stats and you'd burn a lot more fuel.

    ECU's are LIMITING your engine to legal emission levels. That's their primary purpose and the reason they exist. They are not necessary to build a working car, just one that meets the emission requirements. And they do it by being more efficient about how much fuel you actually end up burning.

    You can get better performance by replacing the ECU (which is why there are kits to do so and people doing it every day, and ECU switches so you can pass the emission tests and then put your car back into illegal "boy-racer" mode), you can't spend less on fuel (in fact, the opposite).

    Put the car companies out of business? What a ridiculous statement. And ECU's used to not exist for many decades of the automobile industry.

  9. Re: Oh no, Linux Lockup Bug strikes again! by MightyYar · · Score: 1

    Probably because a lockup in the fuel-metering system would not cause the engine to explode.

    --
    W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
  10. I don't get why you would need this in production by klubar · · Score: 1

    On a production engine, the specs of every unit will be identical (to machining tolerances .001 in). So once you solve the problem just encode the parameters in the controller and you can use something much less powerful (and more reliable). For solving the problem, use whatever high-power equipment you'd like. Attach a hundred sensors and throw a supercomputer at it. Even better, rather than "machine learning" (aka, we don't understand it, we will let the computer tweak it until it gets better), simulate the physics and solve the equations for a complete solution.

  11. Re:Oh no, Linux Lockup Bug strikes again! by Blaskowicz · · Score: 3, Funny

    Do we really want a computer program to learn from its mistakes at running a nuclear power plant?

  12. GNU/Windows by tepples · · Score: 1

    Who wrote the compiler that the Linux kernel was is compiled with?

    If I use MinGW (GCC for Windows) and MSYS (GNU Make, Bash, and Coreutils) to compile applications for Windows, am I using GNU/Windows?

  13. Re: Is that engine even running? by Baloroth · · Score: 1

    Fuel injection and spark events only occur at the 10s of Hz scale (topping out at around 60 each per second). Even if you handle cam phasing and MAF sampling at 100 times that interval, you're still within the computational work load of a couple dozen MHz of instructions.

    Aye. Now try controlling the engine and fuel injection system, and achieving combustion, without using a spark plug. Because that's what the story is actually about. They're using compression-based ignition (like a diesel engine) rather than spark based ignition (like a conventional gasoline engine), which requires a detailed knowledge of the state of the engine at each cycle.

    The research is only interesting because they are taking advantage of way overspecced processing power to approach combustion more granularly per event and trying to learn from each one and control the next. It only got press here because they used Linux (anything production grade would use QNX or similar).

    Nah, it's interesting because it's an application of machine learning algorithms applied to an actual physical problem that might have real-world practical use (the whole Rasberry Pi/Linux angle is a side note in the paper just to show that the algorithm is fast enough for real-world application). A possible 30% fuel efficiency increase in all/some new cars? Car makers would certainly be interested.

    --
    "None can love freedom heartily, but good men; the rest love not freedom, but license." --John Milton
  14. HCCI are efficient like diesel by spike+hay · · Score: 4, Informative

    HCCI engines are a really cool technology, but very hard to do.

    Efficiency of internal combustion engines is related to the compression ratio - the ratio of the combustion chamber from largest to smallest capacity.

    Gasoline engines usually have a compression ratio around 9:1. Higher, and the compressional heating combined with the heat off of the walls can cause "knocking," which detonation of pockets of fuel/air away from the flame front from the spark plug. Engines with premium gas can run higher compression ratios. Higher-octane fuels can be compressed more without burning, but of course there is no benefit to running it on engines rated for regular.

    Diesel engines run ratios of around 17:1, resulting in much greater efficiency. Diesel engines of course don't have spark plugs. The fuel is injected just before top dead center, where the air is compressed maximally. This is in contrast to a gasoline engine, where it is well mixed with air before entering the combustion chamber. Due to compressional heating, it spontaneously combusts very quickly, much faster than the combustion in a spark-plug-ignited gas engine.

    HCCI well-mixes the air and gas upon intake, but ignites by compression like diesel. This gives diesel efficiency. In addition to the better compression ratio, HCCI controls power by the amount of fuel injected, like a diesel. Gasoline engines use a throttle to choke off the air supply, which induces losses because the engine has to work harder to pull air at lower power. That's how engine braking works, and also why diesel trucks use a separate "jake brake" to use the engine to brake.

    It must run under a leaner mixture. It's really hard to have complete burning of fuel, and avoid knocking. That's why it has to be very carefully computer controlled based on temperature and such.

    --
    If you don't understand any of my sayings, come to me in private and I shall take you in my German mouth.
    1. Re:HCCI are efficient like diesel by drinkypoo · · Score: 1

      Most gasoline engines have a compression even below 9:1, but now compression ratios over 10:1 are starting to become common because gasoline engines are now going direct injection. Direct-injection diesels run ratios of around 17:1, the old IDIs ran more like 21 or 22:1 which makes them much better in non-turbocharged applications. However, nobody is really making naturally aspirated diesels any more, because they stink on ice. However however, we can expect the same trend to happen for gasoline engines as they go to smaller-displacement direct injection designs. See: Ford, BMW, Audi... really everyone competent.

      God, it feels weird to describe Ford as "competent"

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:HCCI are efficient like diesel by drinkypoo · · Score: 1

      Direct-injection diesels run ratios of around 17:1, the old IDIs ran more like 21 or 22:1 which makes them much better in non-turbocharged applications.

      That's mostly a function of turbocharged vs. NA, not IDI vs DI. E.g. 2005 VW 1900cc PD SDI ran 21.3:1

      2005? You're off by over a decade from the vehicles I'm talking about. I'm talking about the IDI days. The NA and turbocharged pre-powerstroke 7.3 liter fords have the same compression, around 21.5:1. Same for the turbocharged and non-turbocharged Mercedes. Everyone who could manage to build a high compression engine and have it be reliable did that, and so did International. Actually, the 6.9 was a rock, but when they bored it out to 7.3 they made the walls too thin. I have a 7.3 in my yard which has died the death of cavitation. If it had been lower compression, it would probably still be with us.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  15. Re: Is that engine even running? by drinkypoo · · Score: 1

    A possible 30% fuel efficiency increase in all/some new cars? Car makers would certainly be interested.

    They would, but you don't get those kinds of gains over GDI+Spark, only over traditional IDI+Spark injection/ignition systems. The only advantage is eliminating the spark. Problem is, having the spark gives you more control over combustion! Being able to vary both injection and ignition timing is still superior to having your ignition timing dependent on your injection timing, which is why GDIs will eventually equal diesels for efficiency. They do have all the same drawbacks, but less of most of them. The problem with compression ignition is that using it induces more vibration, a serious problem on any engine without opposed cylinders which is usually solved by throwing more mass at the problem. The only benefit is being able to run lean all the time, and while that is not inconsiderable, GDIs are headed in the direction where they'll be able to run lean much of the time anyway.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  16. Re:Is that engine even running? by drinkypoo · · Score: 1

    ECU's are LIMITING your engine to legal emission levels. That's their primary purpose and the reason they exist.

    It's the reason why they came into being when they did, perhaps, but we would have had computerized engine management eventually whether there was an emissions-related motivation or not. It offers superior efficiency, which means more power and/or range, so it's desirable anyway. The self-tuning aspect is justification enough. Fuel injection wasn't invented because of emissions, it was invented because it was thought to be a better way to deliver fuel. It became popular because it was a necessity for certain engine cycles. It became ubiquitous when it was seized upon as a means of improving emissions, and developed to the point of general usefulness, and now we even have fuel injected small engines.

    Saying that we got ECUs for emissions is like saying we got electronic ignition for emissions, it just ain't so. But electronic ignition became a way that emissions control was implemented.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  17. Re: Oh no, Linux Lockup Bug strikes again! by MightyYar · · Score: 1

    No, but I have built a fuel injection computer. I've burned out injectors by using them over their duty cycle and leaned out an engine to the point of failure. But sorry, no explosions.

    --
    W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
  18. Re:I don't get why you would need this in producti by Anonymous Coward · · Score: 1

    On a production engine, the specs of every unit will be identical

    Wow. That is fabulously naive.

    Manufacturers deal in tolerances. They do NOT make "identical" engines. There is a range of acceptable tolerances for everything. Then there is tolerance stack up, sort of a second derivative of a simple tolerance. A cylinder volume at top-dead-center will vary due to the sum of; the rod journal and pin clearance, the distance between the rod journal and piston pin holes, the position of the pin hole in the piston, the milling height of the cylinder deck, the milling of the cylinder head and variations in the mold that forms the chambers of the cylinder head. There are doubtless many more.

    All of the above have a range of acceptable tolerances. These stack up in an assembled engine; each of the above can conspire to make a given cylinder have a compression ratio on the limit of the high side while a cylinder in a different bank of the SAME ENGINE will have a stack up that puts the ratio on the low limit.

    All of this is perfectly normal and manufacturers employ engineers to compute tolerance stackups in engine designs to arrive at cost effective yields of working parts. In other words, how much can they get away with and still make engines that are acceptable in a market filled with competitive rivals.

    Besides what can vary in manufacture you have what will vary over the life cycle of an engine. Just off the top of my shade tree mechanics head, what can vary in a traditional internal combustion engine that cannot be controlled through precision manufacture;

    Cylinders and pistons wear. A high mileage engine will be several thousands out of spec due to wear, and the wear is not uniform, due to minute differences in material hardness, the slightly different forces encountered by different cylinders, non-uniform lubrication and temperature gradients due to non-uniform cooling. The combined effect of both the cylinder and piston wear can get rather large with enough miles; .008-.010" in is not unusual, with each cylinder having different rates of wear in the same engine.

    Cylinders and chambers become contaminated by carbon deposits over time, changing the shape of the chamber, the volume of the chamber and temperature gradients on the chamber surface. This effect is dynamic; a cylinder will have more or less carbon deposit over time due to driving habits, air temp, fuel and a host of other factors. This is a big reason knock sensors are used to correct ignition timing in real time.

    Wear on rod bearings and piston pins or pin holes change cylinder volume over time.

    Piston rings wear and accumulate damage with time, reducing sealing effectiveness which changes cylinder compression. This is non-uniform due again to minute differences in materials and randomly accumulated damage. On the other hand, new piston rings improve sealing as an engine breaks in.

    Heat expansion changes the behavior of an engine dramatically and in non-uniform ways while operating.

    Then you have repairs.

    Replacement parts are frequently not identical to original parts. The things that will vary a chamber during repairs include replacement pistons, gasket thickness and milling cylinder deck or head surfaces. Some of these are not common with modern passenger car engines any longer, but they remain common with industrial engines and probably always will.

    Finally, there are ordinary run time variables that affect engine operation.

    Fuel is a big one here. Fuel has become a plaything of government regulators as they mandate difference mixtures for different regions and prevailing weather. Fuel can change significantly long after an engine is manufactured in ways the manufacturer did not anticipate (or deliberately ignored); higher alcohol percentages and new additives are examples of this.

    Air varies in myriad ways. Density, variations in molecular ratios (humidity, oxygen ratio, etc.) particulates including w

  19. Re:Oh no, Linux Lockup Bug strikes again! by ultranova · · Score: 1

    Do we really want a computer program to learn from its mistakes at running a nuclear power plant?

    Shouldn't matter. Even non-nuclear plants tend to have a "physical" layer of security beneath the computer. If, for example, a reactor vessel becomes overly full, it triggers a switch which directly closes all the feed valves, overriding the computer in the process. The computer only has control when processes are running within safe parameters.

    --

    Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

  20. Re:Oh no, Linux Lockup Bug strikes again! by mysidia · · Score: 1

    Shouldn't matter. Even non-nuclear plants tend to have a "physical" layer of security beneath the computer. If, for example, a reactor vessel becomes overly full, it triggers a switch which directly closes all the feed valves

    Yup. They have extra layers of safety in power plants you won't find in microcontroller-controlled mechanical devices designed for the consumer.

    Then look at one of the more modern fast breeder or molten salt reactor concepts such as ThorCon, which claim to incorporate more inherent safety, and I think the fact that there are millions cars driving around with humans behind the wheel, some of them carrying large quantities of hazardous or explosive materials, some of them drunk, some of them insane or asleep, is a scary as hell, compared to the more benign idea, that a machine-learning system would be controlling some industrial processes....