Skip to content
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

Fix CHAdeMO Vehicles, Battery #621

Merged
merged 11 commits into from
Nov 22, 2024
Merged

Conversation

NJbubo
Copy link
Contributor

@NJbubo NJbubo commented Nov 17, 2024

Issues #548, Pull request #550

What

I added the CHAdeMO GPIO configuration.
I fixed a lot of faults.

  • lowByte <-> highByte replace,
  • variable declaration uint16_t <-> uint8_t replace (Voltage, Current),
  • Added x102_chg_session.s.status.StatusVehicleDischargeCompatible = bitRead(rx_frame.data.u8[5], 7),
  • changed the direction of a relationship (x100_chg_lim.MaximumBatteryVoltage < x108_evse_cap.threshold_voltage),
  • Separate lowByte / highByte x209_evse_dischg_est.remaining_discharge_time,
  • Park position not invertd,
  • Added CAN message to ISA SHUNT,
  • Fix ISA SHUNT send CAN messages,
  • Added ISA SHUNT GET command,
  • Modified the ISA SHUNT byte order to Big Endian (this is the ISA default) and the same as CHAdeMO.

Why

The CHAdeMO battery software not working.

How

It is necessary to configure the GPIOs. In particular, setting the initial state of the outputs and enabling the inputs.

In my test, I use the CHADEMO_PIN_7 input as a start button.
I can't imagine how you intended to use "plug_inserted" as a signal according to the program.
I think the CHAdeMO connector pin 7 is connected directly to GND/0V when viewed from the side of the charger.

NJbubo and others added 6 commits November 17, 2024 05:35
I added the CHAdeMO GPIO configuration. I thought it was fine that way, but the inputs still didn't work.
Add GPIO INPUT config.
I fixed a lot of faults.
 - lowByte <-> highByte replace,
 - variable declaration uint16_t <-> uint8_t replace (Voltage, Current),
 - Added x102_chg_session.s.status.StatusVehicleDischargeCompatible = bitRead(rx_frame.data.u8[5], 7),
 - changed the direction of a relationship     (x100_chg_lim.MaximumBatteryVoltage < x108_evse_cap.threshold_voltage),
 - Separate lowByte / highByte x209_evse_dischg_est.remaining_discharge_time,
 - Park position not invertd.
@dalathegreat
Copy link
Owner

Nice work @NJbubo ! 🙌


Serial.println("initialization \n");
ISA_STOP();
delay(500);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note on delay() blocks, these will stop all periodic CAN message sending, and might impact the functionality towards inverter. Would be great to get these replaced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it stops the program, but I thought it might be acceptable. These program parts should and can only be used for the one-time setup of the ISA SHUNT. They do not work during normal use. At most every CPU startup during setup(). Possibly for queries and debugging without normal working.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder that these were deliberately removed per discussion @dalathegreat .

@NJbubo
Copy link
Contributor Author

NJbubo commented Nov 17, 2024

You removed the init_battery() function from the Software.ino file. This also removed the intervalUpdateValues ​​= 800 line.
I added this line to CHADEMO_BATTERY.cpp but it's not good. I commented (removed).
Should this setting be used or not? If so, then in another place. Back to setup() function in Software.ino?

@dalathegreat
Copy link
Owner

You removed the init_battery() function from the Software.ino file. This also removed the intervalUpdateValues ​​= 800 line. I added this line to CHADEMO_BATTERY.cpp but it's not good. I commented (removed). Should this setting be used or not? If so, then in another place. Back to setup() function in Software.ino?

You can remove the entire intervalUpdateValues ​​= 800. This was only needed before, when the application ran at a default 5000ms update rate for values. It is now increased to 1000ms, which should be good also for Chademo use

@smaresca
Copy link
Collaborator

smaresca commented Nov 19, 2024

There are several good improvements here, including some that I addressed but hadn't pushed yet due to time conflicts, so I am glad to see them done.

NOTE: Because of the many variants of ISA shunt, I am concerned we are introducing some incompatibilities here..e.g., I know of multiple ISA shunts that ship little endian from the factory. Another issue: Several users have contacted me lately indicating that their shunts need to be reconfigured to use the default (documented) CAN IDs because they were set with incompatible values deviating from those in manufacturer documentation.

I think (my personal) preferred course of action would be a shunt 'setup' tool not compiled by default in the battery emulator code tree. I've written some of that already to help those individuals.

Thoughts/Opinions? @NJbubo @dalathegreat

@dalathegreat
Copy link
Owner

@smaresca
We could make a separate PR that allows shunt setup via the Webserver. Similar implementation was made in #582 where we send diagnostic CAN data from the webserver:

image

Maybe let's merge this PR as-is for now, and handle shunt setup in a separate PR?

@NJbubo you can fix the pre-commit failing build by following this guide https://github.com/dalathegreat/Battery-Emulator/blob/main/CONTRIBUTING.md

@dalathegreat dalathegreat marked this pull request as ready for review November 22, 2024 08:14
@dalathegreat
Copy link
Owner

Let's merge this, and continue with more Shunt PRs? :)

@dalathegreat dalathegreat merged commit 22c47f2 into dalathegreat:main Nov 22, 2024
40 checks passed
@lenvm lenvm mentioned this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants