New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Air Conditioning Control - Feature Implementation #665
Conversation
AC control feature added, better than the existing idle-up feature (which can still be used for other things, e.g. electrical load detection). Air conditioning is locked out with coolant temp, RPM high/low, and high TPS. So the A/C automatically cuts out when driving hard. Idle step now works correctly with closed loop PWM, open loop PWM, and closed+open loop PWM. Untested with stepper motor, but no reason it shouldn't work.
This is so cool! I have AC in my car with speeduino and it gives me headache to constantly must think on it when i want overtake or do silly stuff on revlimitter :D |
Hey Great work, I had a look and have a couple of comments and suggestions:
In fact I would suggest a general "delay from off" state where if turned off for any reason, it won't request the compressor back on within XX sec (thinking 2-5sec is a reasonable range). This covers all sorts of intermitent request signals / bad wiring etc.
becomes
one line updates and comparisons, sometimes make it tricky to follow
could be
It's minor but does make it clear as to the order of operations. |
Thanks for the feedback, HWright9!
EDIT: should be
otherwise acStartDelay will overflow... |
-Renamed engineRunSeconds to acAfterEngineStartDelay -Formatted large if statements better -Fixed acStartDelay overflow bug -Improved readability of logic
-Add high/low RPM lockout delay, similar to the high TPM lockout delay -General tidy-up
There we go, there's now another configurable compressor re-engagement delay for the RPM high/low lockout 😎 All done, I'm not planning on making any more changes. Maybe a feature to add in the future could be on-board compressor cycling based on a refrigerant pressure sensor, or A/C compressor discharge temperature (as someone mentioned on Slack). However for the target application here, the car should have a pressure/temperature switch that cuts the A/C request signal to the ECU (external to the engine management system). |
Great stuff! I was wanting something like this early on in my speeduino build but was able to get all of it sorted with just programmable outputs. Check out my PR for idle up rpm adder, this helped tremendously keep my RPMs stable when the a/c cycles on and off by itself: #586 |
I have finally got my ac and idle up working properly using programmable outputs, my ac condensor fan is one of those outputs and ac compressor relay the other, would it be reasonable to add ac condensor fan control as an option that people who dont need it seperate can just disable it, but people who need it can choose output pin and delay? Thanks for all your help so far and I am thinking I might start testing your pr soon. |
I'll give it a shot, although it looks like noiymime's latest commit for some SD card logging stuff has kicked me out of EEPROM page 13 in TS... I might have to shuffle some stuff around and/or make a new page. |
-Added additional configurable stand-alone A/C fan output, for when there is dedicated cooling fan for the A/C compressor. This is independent of the engine cooling fan logic. -Moved config storage in EEPROM to configPage9, as noisymime's SD card logging has used the (previously unused) bytes I had used in configPage13. -Minor bug fix - rename Aux in 1-16 to Aux in 0-15
The dedicated A/C fan output has been added, along with moving my config data to page 9 to avoid noisymime's SD logging EEPROM data. Some of the merging between the SD logging software and the extras I'd tacked onto my last commit got a bit messy, I'd appreciate a second pare of eyes over it ;) |
@Afroboltski where I can find TunerStudio ini for that new A/C config? |
It's not ready to be merged with the master branch yet, unfortunately. You can freely download my forked code I believe (i.e. go to https://github.com/Afroboltski/speeduino) but it's based on an old version of the master branch, and not extensively tested. I'll hopefully get it ready to be merged with the master branch before the next official FW release. |
based on noisymime#665
I tried to get @HazuTo25 's Extra Features Page 15 changes(was added for this PR) up to date with the current master although I haven't looked over the whole thing in detail yet but maybe it will help you two by posting it here. It compiles without errors but like I said I have not tested it or looked over it much at all. Edit: https://github.com/Corey-Harding/speeduino/tree/AC-Control-Clean-3 |
About that Page 15 stuff, I haven't really tested it, so I don't really sure that it's gonna work without any issue.
What do you mean about that? Do you mean about the line is being commented or because I change the "bits".
I read this and I work on that yesterday, I have done that but haven't "push" it yet, because I am not sure it even work, and I want to fix other stuff too. disclaimer: I don't really understand how to work with programing language, especially with C/C#/C++. But I hope I can help anything that I could ( : |
Disregard the speeduino.ini comment I need to check again but think its a nonissue. Pretty sure all it needs is something like This is a typo, should be 128?
|
Yes, It was a typo.
This too.
updates.ino And add if(readEEPROMVersion() == 20)
} storage.h You using the development firmware right, but my branch still using the release version of the firmware just because, I just gonna put it in I don't know if this the right way to do it. Edit: Do you need to put only one or all of it? |
Adding A/C Fan status indicator on request from @Corey-Harding comment on the original PR noisymime#665 noisymime#665
Are we trying to get the AC Control ready to merge for the next firmware release? 😃 Let me know what I can do to help. |
Here is the branch that is "mergeable without conflicts" although it needs to be tested. @HazuTo25 added everything to Page 15 and I brought it up to date with current master. https://github.com/Corey-Harding/speeduino/tree/AC-Control-Clean-3 |
yes, it should be 127, I just realize that. (either way it just on a name to show how much left in what page size?)
meaning?
Let me know what I can do to help. maybe you can update some of your code on @Corey-Harding or my repo. like I said before, I am not really familiar with this programing language. |
Question Do this code work for ac fan indicator? I follow this line in auxiliary.h |
I merged @HazuTo25 's fan indicator changes but also caught this, the coolant lockout bit was overlooked right? I think its close to the point that I will try to test although it may take a couple weeks to get around to it. It is still too cold here for AC and I like to test during my normal daily driving conditions. https://github.com/Corey-Harding/speeduino/tree/AC-Control-Clean-3 |
Nice catch! My initial implementation just had a single "lockout" bit, then I separated the three lockouts out for reasons that I can't remember. So to confirm, you need nothing else from me in order to get this ready for the next firmware release? I'm running with the assumption here that you're on the development team 😛 |
Adding yet another commit - just a minor change. Adding the 3 |
Ok, thanks, i will check that. |
Add PWM Fan Control Minimum Clamp Value when A/C Compressor Engaged
Pin was unable to be used in prog. I/O even if fan was disabled, because it was always initialised as an output even if it was disabled. Fixed in this commit.
Wow, I was just thinking about using my speeduino in my 1zz turbo car, but didn't want to lose the AC, looks like there is excellent work done here, can't wait to try it! |
Cheers, I appreciate the feedback! |
Hello, and thanks for the great work! |
I'm having some issues configuring this. If I have an idle-up input pin set to normal, I assume that using that same pin as the AC request input is fine. But the idle-up and RPM adding don't seem to be engaging. Idle up works ordinarily just fine. |
I just had a look - the way I wrote it, the air compressor pin has to be non-zero for the whole function to work - so you'd have to set it to an unused pin.
Hard to say without more info unfortunately! I suppose if you accidentally set the "Air Compressor Output" pin to be the same as the "Idle Up Input" pin, both functions may not work (Idle up due to the |
I don't have an output pin used as my circuit to engage the compressor is just a simple relay triggered by the physical button in my dash. My ECU is only used for idle up via IACV which already has a set pin it can use. Here's how I have it. If I enable Air conditioning control or leave it on while keeping idle up on (in the idle up settings window), I still have normal idle up behavior as it is set in the separate idle-up window, but do not appear to have the rpm adder working or the idle up that is set in the AC control working. If I disable idle up in that idle up settings window and turn on AC control, it does not appear to idle up at all however or add RPMs to the target. It seems to behave as if the AC control does nothing. Maybe this should be a separate feature request but the idle up in AC control and the separate idle up window explicitly can conflict (ie can set one to 10 and other to 20). I am not sure which takes priority or if one should be removed to stop a conflict as there might be other reasons of having idle up separate from AC control. |
AC control feature added, better than the existing idle-up feature (which can still be used for other things, e.g. electrical load detection).
Air conditioning is locked out with:
-Coolant temp above limit
-RPM above high limit
-RPM below low limit
-TPS above a high limit, with a re-engagement delay to prevent cutting in on gear changes
So the A/C automatically cuts out when driving hard :)
There is also the option of automatically starting the cooling fan any time the A/C compressor is running.
In addition, the idle duty cycle can be stepped up before the compressor engages (using the "A/C Compressor On Delay", which delays the A/C request signal from engaging the compressor, but does not delay the idle step or cooling fan activation).
The extra configuration data for A/C control is tacked into the unused bytes of page 13 - the programmable outputs page, so no additional pages were created.
Log entry size increased from 121 bytes to 122 bytes to allow for 1 byte of air conditioning data (bitfield). The bits are:
#define BIT_AIRCON_REQUEST 0 //Indicates whether the A/C button is pressed
#define BIT_AIRCON_COMPRESSOR 1 //Indicates whether the A/C compressor is running
#define BIT_AIRCON_LOCKOUT 2 //Indicates the A/C is locked out either due to the RPM being too high/low, or high coolant temp.
#define BIT_AIRCON_TPS_LOCKOUT 3 //Indicates the A/C is locked out due to high TPS, or the post-high-TPS "stand-down" lockout period
#define BIT_AIRCON_TURNING_ON 4 //Indicates the A/C request is on (i.e. A/C button pressed), the lockouts are off, however the start delay has not yet elapsed. This gives the idle up time to kick in before the compressor.
and bits 5-7 are unused.
Additional minor fixes in this pull request (sorry, I didn't think it was worth splitting it up):
-Air conditioning idle step up now works correctly with closed loop PWM, open loop PWM, and closed+open loop PWM. Untested with stepper motor, but no reason it shouldn't work. This was implemented incorrectly with the idle-up feature, and appeared only to work with open loop. The way the "closed loop duty cycle step" works is by artificially incrementing the feed-forward term (for open+closed loop), and by creating a "pseudo feed-forward" term inline for normal closed loop. (Side note - there appears to be nothing currently that cuts closed loop PWM idle control if you step on the throttle?)
-Fixed issue number #655 - aux. pins now initialise correctly
I appreciate any feedback and/or criticism! The testing I've done is fairly minimal as I don't have a running test car at the moment, however I've done sufficient testing to ensure the basic functionality works, and the configuration parameters are all written and used in the software correctly.