Engine control IC simulation

Alec_t

Joined Sep 17, 2013
12,897
Welcome to AAC!
Unless you can source a ready-made model file for that IC you would have to brew your own functional model. Fom its datasheet it looks like that would be a major challenge, in view of the IC's complexity.
 

Thread Starter

Sinaan.O

Joined Jun 17, 2022
3
What would you recommend to simulate functions such as switching, power consumption, spark duration timer etc? I need to simulate such features of this IC, is there a way to do this for products without spice model?
 

Papabravo

Joined Feb 24, 2006
18,806
What would you recommend to simulate functions such as switching, power consumption, spark duration timer etc? I need to simulate such features of this IC, is there a way to do this for products without spice model?
The only thing that comes to mind is to ask what "simulation" tools were used by the people who developed the chip. You may not be happy with the answer because it might involve the purchase of a development suite with hardware and software licenses that could run into the tens of thousands of dollars. When we were doing ASICS at Allen-Bradley in the mid 1990s it was about $12,000 a seat for the software on top of a Mentor Graphics workstation which I never knew the cost of. The division I worked in had about 25 of them. It took 6-12 hours to run simulations for a communications ASIC that was sending and receiving moderate sized packets of data. IIRC 256-512 bytes.
 

Alec_t

Joined Sep 17, 2013
12,897
What would you recommend to simulate functions such as switching, power consumption, spark duration timer etc?
Unless you know all the details of the chip internals you could only get an approximate simulation using standard LTS models.
Switching: The LTS sw model.
Power consumption: Run a Transient simulation and Left-click on a component while pressing the Alt key to display power.
Spark duration timer: Depends how the IC implements that. Behavioural voltage sources and comparators might be applicable.
 

ag-123

Joined Apr 28, 2017
238
it looks like it'd need some sort of specialized tools. Other possible ways is to simplify it into a 'model', and build a spice model for the surrogate model in place of the real thing. it 'isn't the same thing', so one would need to make the right assumptions.
Some of things can't be 'simulated', e.g. tuning torque, rpm vs fuel / air ratio
https://x-engineer.org/air-fuel-ratio/
https://www.formula1-dictionary.net/map_fuel.html
I'd guess some of these won't come out of a spice simulation and needs real world test data and interpolating from them.
there are no less of those would would try the extreme stints
https://hackaday.com/2014/01/01/building-an-engine-control-unit-with-the-stm32f4/
https://en.wikipedia.org/wiki/MegaSquirt
https://megasquirt.info/
 
Last edited:

Papabravo

Joined Feb 24, 2006
18,806
it looks like it'd need some sort of specialized tools. Other possible ways is to simplify it into a 'model', and build a spice model for the surrogate model in place of the real thing. it 'isn't the same thing', so one would need to make the right assumptions.
Some of things can't be 'simulated', e.g. tuning torque, rpm vs fuel / air ratio
https://x-engineer.org/air-fuel-ratio/
https://www.formula1-dictionary.net/map_fuel.html
I'd guess some of these won't come out of a spice simulation and needs real world test data and interpolating from them.
there are no less of those would would try the extreme stints
https://hackaday.com/2014/01/01/building-an-engine-control-unit-with-the-stm32f4/
https://en.wikipedia.org/wiki/MegaSquirt
https://megasquirt.info/
You can use behavioral sources to do unit conversions so you can represent physical quantities as voltages.
My other thought is that if you have access to Simulink (part of Matlab) there might be something like an "open source" engine control library.
 
Last edited:

ag-123

Joined Apr 28, 2017
238
I think I'd try to explore Matlab, it seemed for non-academic users it isn't free? well, I'd need to find out.
Simulink from Matlab is very well known, many tutorials, but I had not tried them. That is part of Matlab? or a separate software?

As for controlling electronic fuel injection, I'd make a speculation for something like such, this is purely speculative.
- first there is a map for throttle position and engine rpm vs the fuel to inject - this is for the 'open loop' part.
https://motofomo.com/open-loop-vs-closed-loop-fuel-injection/
accordingly that can even run on rather simple microcontrollers:
https://en.wikipedia.org/wiki/MegaSquirt
- next there is the "oxygen sensor" at the exhaust, that chart with the sensor output voltage is pretty illustrative
https://www.ngkntk.co.jp/english/product/sensors_plugs/zirconia_oxygen.html
this would give one an idea about whether one is running too lean (there is unburnt oxygen) or too rich (fuel completely burnt, possibly running hot)
and I'd guess this can be use as a feedback control to 'tune' the "open loop" values. This is so that the air fuel ratio is just about stoichiometric, i.e. there is enough air to just about burn up the fuel. I'm not sure if this would be PID or something like such (speculative).
The control I'd guess is for those fuel injectors which need to coincide with crank timings, so as to coincide with the stroke cycle. So I'd guess there'd be a stroke position sensor.
https://www.liveabout.com/how-to-clean-fuel-injectors-4582625
But i'd guess this is a specialized topic for those in autos.
 
Last edited:

Papabravo

Joined Feb 24, 2006
18,806
I think I'd try to explore Matlab, it seemed for non-academic users it isn't free? well, I'd need to find out.
Simulink from Matlab is very well known, many tutorials, but I had not tried them. That is part of Matlab? or a separate software?

As for controlling electronic fuel injection, I'd make a speculation for something like such, this is purely speculative.
- first there is a map for throttle position and engine rpm vs the fuel to inject - this is for the 'open loop' part.
https://motofomo.com/open-loop-vs-closed-loop-fuel-injection/
accordingly that can even run on rather simple microcontrollers:
https://en.wikipedia.org/wiki/MegaSquirt
- next there is the "oxygen sensor" at the exhaust, that chart with the sensor output voltage is pretty illustrative
https://www.ngkntk.co.jp/english/product/sensors_plugs/zirconia_oxygen.html
this would give one an idea about whether one is running too lean (there is unburnt oxygen) or too rich (fuel completely burnt, possibly running hot)
and I'd guess this can be use as a feedback control to 'tune' the "open loop" values. This is so that the air fuel ratio is just about stoichiometric, i.e. there is enough air to just about burn up the fuel. I'm not sure if this would be PID or something like such (speculative).
The control I'd guess is for those fuel injectors which need to coincide with crank timings, so as to coincide with the stroke cycle. So I'd guess there'd be a stroke position sensor.
https://www.liveabout.com/how-to-clean-fuel-injectors-4582625
But i'd guess this is a specialized topic for those in autos.
I don't know if there are companion simulation engines with the Matlab clones like Octave and Scilab. If there are it would be worth a look.
Ask and ye shall receive!
https://alternativeto.net/software/simulink/
 

ag-123

Joined Apr 28, 2017
238
off-topic:
I don't know if there are companion simulation engines with the Matlab clones like Octave and Scilab. If there are it would be worth a look.
Ask and ye shall receive!
https://alternativeto.net/software/simulink/
I think one of them is this
https://www.scilab.org/about/scilab-open-source-software
edit:
https://www.scilab.org/software/xcos/control-systems
Control systems Blockset
Scilab and Xcos were initially thought as a control system design and analysis tools.
It has been leveraged in many other fields, but it remains a tool taylored to control needs.
As such, you can establish your control strategy by simulating your system in open and closed loop.
Here is a perfect example of a simple physical system regulated by a PID controller:
Howevr today, I think matlab + simulink is still one of the more established and widely used.

But for now as my needs are rather modest, I decided to just take the ODE and integrate it.
The ODE themselves are difficult to work for exact symbolic solutions. Needs laplace transforms and all, then for buck converters add driving functions, CCM, DCM etc, unsolvable. Then I decided to take the *lazy* route, just take the ODE and ask the computer to work it.
https://forum.allaboutcircuits.com/...ing-simulation-differential-equations.187476/
Luckly it works :D
I think the better SPICE implementations does similar things, probably more complete than my ODE approach.
 
Last edited:

Papabravo

Joined Feb 24, 2006
18,806
The nice thing about freedom is that you can follow your own path regardless of where it leads. It is only after going down a number of rabbit holes that I have achieved enlightenment.
 

LowQCab

Joined Nov 6, 2012
2,171
The MegaSquirt guys have what they call a "Jim-Stim",
( an Engine "Sensor-Emulator" ), ( and it's cheap ).
This will let You create just about any Engine situation that you'd care to try,
the results are then displayed on a configurable set of Gauges on your Computer-Screen.
Any additional data requires an Oscilloscope.
And it will Data-Log all of it, for later analysis.

Just buy a MegaSquirt,
they've been refining all the different versions for over ~30-years,
and the Software is open-source,
so You can screw it up any way You please.

They also have a simpler version called "MicroSquirt",
which is usually used on Motorcycles, ATVs, PWCs, etc.

A MegaSquirt will do anything You can imagine, except maybe wash your socks.
https://www.diyautotune.com/product/ms3pro-ultimate-standalone-ecu-only/
.
.
.
 
Top