Miata Turbo Forum - Boost cars, acquire cats.

Miata Turbo Forum - Boost cars, acquire cats. (https://www.miataturbo.net/)
-   MEGAsquirt (https://www.miataturbo.net/megasquirt-18/)
-   -   Alternator Control box for standalone MS install for NB (https://www.miataturbo.net/megasquirt-18/alternator-control-box-standalone-ms-install-nb-21621/)

WestfieldMX5 05-28-2009 01:34 PM

Mmm, I get raising amps with raising voltage:
10.7mA at 11.5V
11.1mA at 12.0V
12.1mA at 13.0V
13.1mA at 14.0V
14.0mA at 14.9V

mmm, seems something is not right here. I should be getting lower charge current at higher voltages, no?

Any clue what might be wrong?

I wish I had your skills Jim ... and Jason for that matter :)

Reverant 05-28-2009 02:18 PM

4 Attachment(s)
Pics.

Configurable options:

Cranking RPM (below cranking you are in non-running mode)
Min non-running voltage (flashing battery light when below, steady light when above)
Min running voltage (flashing battery light when below, light switched off when above)
Basic target voltage (trimmed based on air temp)
Max error voltage (deadband)
P Gain
I Gain
D Gain

Settings are saved in internal EEPROM so no battery is required to retain the settings.

Jim

JasonC SBB 05-28-2009 09:30 PM

What's the voltage at the center point of the TL431 when at 14.4V?

JasonC SBB 05-29-2009 01:09 AM

Reverant,

As a microcontroller stud, would you want to tackle closed loop boost control?
Here's what *I* need.

I have an AEM. It has:

1) a 3D boost target table with RPM and TPS as axes,
2) a 3D table for base solenoid duty cycle with RPM and MAP as axes
3) a 2D table for additional duty cycle vs. boost target
4) a 2D table for additional duty cycle vs. boost error (like a nonlinear 'P' in PID)
5) and an 'I' gain term for the I in PID

Features 1 to 4 rock for enabling one to tune throttle and RPM based boost and to instantly get CLOSE to boost target (within 1 psi).

However it has a fatal flaw in its closed loop control, which makes it overshoot or oscillate. IT HAS NO 'D'. In addition, its 'I' parameter should ONLY kick in once boost is closed (like say within 2 PSI), AND it should RESET to zero just before it kicks in.

So... Given the AEM's capability, I'd like to use its tables 1 - 4. I'd like the microcontroller to have an internal boost target vs. RPM and TPS table internally which is fixed, and mirrors that in the AEM - and I'd like the micro to implement the I and the D. This I and D should each have 2 gain parameters - a gain term when above, and a gain term when below, target boost. And it should have an adjustable "window" (e.g. 2 psi) - I and D are zeroed out (i.e. system runs open loop) when target boost minus actual boost is greater than this window.

Is it possible to first implement the algorithm in a high level language such as MATLAB/SIMULINK or C, and run on a PC->USB gizmo, before writing the code into a micro? This way the algorithm can be developed on a platform wherein datalogging and tracing is easy.

Sound like fun?

Reverant 05-29-2009 01:24 AM

Jason, I wouldn't mind tackling such a project, though I would first prefer to go closed loop on my VVT controller (vs open loop right now). The fact that I run N/A will not make things easy.

FYI I always code in Codevision C, with very little assembly in interrupt handlers.

Jim

WestfieldMX5 05-29-2009 11:31 AM

I have

2.31V at 14.0V
2.34V at 14.2V
2.39V at 14.4V
2.43V at 14.6V
2.46V at 14.8V

y8s 05-29-2009 12:47 PM


Originally Posted by Reverant (Post 413094)
Jason, I wouldn't mind tackling such a project, though I would first prefer to go closed loop on my VVT controller (vs open loop right now). The fact that I run N/A will not make things easy.

FYI I always code in Codevision C, with very little assembly in interrupt handlers.

Jim

small request to have your controller output a stock ECU friendly signal to prevent OBDII codes?

JasonC SBB 05-29-2009 02:24 PM


Originally Posted by f_devocht (Post 413226)
I have

2.31V at 14.0V
2.34V at 14.2V
2.39V at 14.4V
2.43V at 14.6V
2.46V at 14.8V

Keep raising the voltage. Looks like your setpoint is close to 15V.
The reason it's so high is maybe the 1% resistors you used are wrong, or are 5% resistors. Or your voltmeter is inaccurate.

JasonC SBB 05-29-2009 02:31 PM


Originally Posted by Reverant (Post 413094)
Jason, I wouldn't mind tackling such a project, though I would first prefer to go closed loop on my VVT controller (vs open loop right now). The fact that I run N/A will not make things easy.

FYI I always code in Codevision C, with very little assembly in interrupt handlers.

Jim

Reverant, did you see my post in the ECU section of my observations of the VVT? The physical model and its characteristics is crucial in architecting the feedback system.

Point one - it inherently has an integrator built in. It CANNOT run in open loop, it will always integrate towards full advance or full retard.

Point two - the output of your feedback loop should be a solenoid CURRENT command, not a duty cycle.


BTW re: alternator control. A very simple effective control is a hysteretic controller, which is what my circuit does. No need for PID. And the output must be PWM. Turn alternator on if voltage is below 14.3. Turn it off if >14.35. After turning on or off, stay in that state a minimum of 50 uS, then make new decision. Polling for new decision should be at 10 uS sampling.

And, if RPM is dropping and is below 800 Hz, progressively drop voltage setpoint in order to help prevent the engine from stalling. (my circuit doesn't do this).

WestfieldMX5 05-29-2009 03:49 PM


Originally Posted by JasonC SBB (Post 413320)
Keep raising the voltage. Looks like your setpoint is close to 15V.
The reason it's so high is maybe the 1% resistors you used are wrong, or are 5% resistors. Or your voltmeter is inaccurate.

Sure enough, setpoint is at 15.27V (2.53Vref).
In the car, I measured 15.1V with running engine.
My el cheapo DVM must be off a bit.
I guess it's best if I lower my setpoint to the same voltage I have in the car (15.1V).

Is this just a matter of changing the values of R4 and R11 so that Vref is a bit lower in this formula?

15.1V=Vref*(1 + R4/R11)

Reverant 05-29-2009 03:50 PM


Originally Posted by y8s (Post 413269)
small request to have your controller output a stock ECU friendly signal to prevent OBDII codes?

Please explain, your request is not clear enough.

Jim

Reverant 05-29-2009 04:02 PM


Originally Posted by JasonC SBB (Post 413329)
Reverant, did you see my post in the ECU section of my observations of the VVT? The physical model and its characteristics is crucial in architecting the feedback system.

Point one - it inherently has an integrator built in. It CANNOT run in open loop, it will always integrate towards full advance or full retard.

Sorry, I haven't read your post, I only read the Megasquirt section on mt.net (I'm N/A and have no interest in other ECUs, duh)

My current system uses feedback from the oil pressure sensor I have. Its not much, but it roughly working.


Originally Posted by JasonC SBB (Post 413329)
Point two - the output of your feedback loop should be a solenoid CURRENT command, not a duty cycle.

Please explain.


Originally Posted by JasonC SBB (Post 413329)
BTW re: alternator control. A very simple effective control is a hysteretic controller, which is what my circuit does. No need for PID. And the output must be PWM. Turn alternator on if voltage is below 14.3. Turn it off if >14.35. After turning on or off, stay in that state a minimum of 50 uS, then make new decision. Polling for new decision should be at 10 uS sampling.

I understand what your circuit does, I try to emulate the stock ECU as much as possible though (hence the 250Hz, 2V PWM control signal)


Originally Posted by JasonC SBB (Post 413329)
And, if RPM is dropping and is below 800 Hz, progressively drop voltage setpoint in order to help prevent the engine from stalling. (my circuit doesn't do this).

I'm not following here.

Jim

Joe Perez 05-29-2009 04:08 PM


Originally Posted by Reverant (Post 413386)
I'm not following here.

He means to start lightening the load on the alternator (by turning down the output voltage) to reduce its drag on the engine if RPM falls below a certain level. This will prevent stalls / make idle recovery easier.

JasonC SBB 05-29-2009 04:55 PM


Originally Posted by f_devocht (Post 413377)
Sure enough, setpoint is at 15.27V (2.53Vref).
In the car, I measured 15.1V with running engine.
My el cheapo DVM must be off a bit.
I guess it's best if I lower my setpoint to the same voltage I have in the car (15.1V).

Is this just a matter of changing the values of R4 and R11 so that Vref is a bit lower in this formula?

15.1V=Vref*(1 + R4/R11)

The equation is correct, where Vref is 2.49 or 2.5V (TL431 spec).

Are you using 1% resistors?

I think step 1 is to get a more accurate voltmeter.

JasonC SBB 05-29-2009 04:59 PM


Originally Posted by Reverant (Post 413386)
Sorry, I haven't read your post, I only read the Megasquirt section on mt.net (I'm N/A and have no interest in other ECUs, duh)

My current system uses feedback from the oil pressure sensor I have. Its not much, but it roughly working.

Reading oil pressure is not feedback, it's feed-forward. ;)

The oil control solenoid responds to current, not PWM duty cycle. The current will change for a given duty cycle as system voltage changes. So the output of the PID plant should command a current, and a 2nd, faster, inner feedback loop should control the solenoid current by sensing it and outputting a PWM signal. This will prevent the cam angle from changing when there's an abrupt change in system voltage (lights or fans turning on, for example).

Find my post and read it, then ask questions there.

Cheers!

WestfieldMX5 05-29-2009 06:40 PM


Originally Posted by JasonC SBB (Post 413419)
The equation is correct, where Vref is 2.49 or 2.5V (TL431 spec).

Are you using 1% resistors?

I think step 1 is to get a more accurate voltmeter.

Ah, I used a 5% for 10K. Must have used a spare one from the MS build. That explains the higher values I'm seeing.
Will replace it with a 1% (and get a better DVM as well ;)).
Glad the circuit works though. Another step closer to MS2E completion. About getting time as well after 6 months :laugh:.
thx for your help.

Reverant 05-30-2009 05:22 AM


Originally Posted by Joe Perez (Post 413393)
He means to start lightening the load on the alternator (by turning down the output voltage) to reduce its drag on the engine if RPM falls below a certain level. This will prevent stalls / make idle recovery easier.

That's easy to do. However, at least on my car, anything less than 13V makes the engine want to stall anyway (on the stock ECU).

Jim

Joe Perez 05-30-2009 11:20 AM


Originally Posted by Reverant (Post 413567)
That's easy to do. However, at least on my car, anything less than 13V makes the engine want to stall anyway (on the stock ECU).

That's quite odd. During cranking, the alternator isn't making any power and the battery voltage is going to be somewhere in the 9-10v range, yet this is quite enough to get the engine started and running.

Is the mechanical load of the alternator going up for some reason as you reduce the field supply and drop the voltage? I can't imagine why it would, but then I can't find any other explanation for this behavior either.

Consider the situation of the alternator failing during engine operation, due to a broken belt for instance. The engine keeps running, being supplied only by battery voltage.

AbeFM 06-23-2009 08:32 PM

Jason, PM's full.

Thanks for catching that, I took a "R9, 1k" and made it "9k". Will Fix.


Yeah - I'm with Joe, low voltage sounds like a symptom, not a cause. The motor should run fine without the alternator on all the time. I've thought about opening an air leak or cutting the alternator on low RPM, but haven't implemented it yet.

Jason: I like the current on the VVT idea, where do you talk about this?

JasonC SBB 06-23-2009 09:15 PM

In the daddy ecu section.


All times are GMT -4. The time now is 10:04 AM.


© 2024 MH Sub I, LLC dba Internet Brands