[DRIVING] Renault Clio Electrique -97

Tell us about the project you do with the open inverter
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I've narrowed down the resolver signal issue to a faulty STM32. I have ordered parts needed for replacing it and meanwhile I will try and source some more parts needed for the permanent inverter installation in the car.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

Ok, so it wasn't the STM after all. Turns out it is due to voltage fluctuation on the 3,3V power bus due to high pulse current draw from both WiFi-module and CAN-tranceiver. More on this here:
viewtopic.php?f=7&t=1085

Now I've been out driving the car for short distances in the neighborhood and it is overall very nice to drive. I have some jitter at very slow speeds and low throttle pedal input. Also jitters before it comes to full stop with released pedal (regen).
Will check back on this when I have replaced the CAN-tranceiver.

I have ok acceleration up to 25km/h an then it degrades quickly so might not work with the low voltage (134V nom) battery pack I'm currently running or I have missed something with the parameter setting. Will try to test the car on the road for full speed acceleration.
Without load I can reach 90km/h or equivalent rpm so no overspeed limit at least.
Took me a while before I found the "throtcur" parameter which when adjusted gave me more motor current and as a result good acceleration before field weakening occurs.

These are my current parameters I run:
Yaris_MGR_FW4_94FOC_2020_10_23_3.json
(1.26 KiB) Downloaded 155 times
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

Very good :) With FOC I recommend slower ramps, especially for regen. So throtramp about 4 to 10, regenramp=0.3
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

johu wrote: Fri Oct 23, 2020 4:09 pm Very good :) With FOC I recommend slower ramps, especially for regen. So throtramp about 4 to 10, regenramp=0.3
Thanks! I will test this tomorrow.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

So these are my latest parameters:
Yaris_MGR_FW4_94FOC_2020_10_24.json
(1.26 KiB) Downloaded 114 times
Well the car drives great up to 20km/h. Above that it is very slow and also has odd behaviour when in regen.
At 20-25km/h the motor current drops from ~150A down to ~50A and then stays there for the rest of the acceleration. Look at last acceleration from 150A current and onwards. Full throttle acceleration from very slow speed.
IMG_1459_scale.JPG
I expect a more linera/exponential drop in current with increasing speed, not a almost cut in current and the constant current? Any parameters affecting this?
When at higher speeds 40-50km/h and slowly raising the throttle pedal I get regen before passing point of where it should happen and then when releasign further it jumps from strong regen to the regen I would expect regarding the throttle pedal position. Feels very odd this. I can't find any indication when looking at potnom.
IMG_1458_scale.JPG
What I do note is that potnom goes down to -30% when car is moving and as soon as car stops it jumps up to -22%? I do not understand why? Pedel is released the hole time. I'm using throttle over CAN if that has any effect. Pot1 is 0 but potnom is -22%?

Any ideas much appreciated!

I will try to make a plot with both motor currents and the motor speed.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

Here is one plot during acceleration. On the left axis is IL1 (red), IL2(cyan), POTNOM(blue) and on the right is motor speed (yellow). Divide motor speed by 65,8 and you get car speed in km/h.
IMG_1469_scale.JPG
Above 1500rpm there is no change in motor current amplitude? I would expect this current to continue to decrease as speed increases.
Also not shown in this plot but at speed over 30km/h I get the same acceleration with 25% throttle or 100% throttle. Even if the motor is in field weakening region I would expect the acceleration to be linear to throttle input.

One plot of deacceleration.
IMG_1470_scale.JPG
Starting at approx 50km/h or 3300rpm and setting throttle pedal close to potnom zero but still positive at around data point 18700 and still get quite hard regen? At 19500 the speed has droped and the regen stops, potnom still above 0. At 20125 I have released pedal enough to get some small regen and then at 20271 I suddenly again get a more powerful regen without change of potnom.

I think I have missed something in the setup? Will try to find whats causing this and try to fix it.
I also have some spikes in the current measurement, jumps to 5A when at standstill. Proably due to CAN-tranceiver disturbances.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

Can you plot fstat, uq, ud? Accelerate, regen, stop.
Maybe the controller gains must be tuned for this low voltage setup. I don't know.
Could also have the boost converter step up to 300V or so.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I will do the plots tomorrow.
johu wrote: Sat Oct 24, 2020 1:01 pm Could also have the boost converter step up to 300V or so.
This has crossed my mind. Seems like the cheapest way to test with a higher voltage.
The Lexus the MGR comes from runs a 288V battery so I woudn't be supprised if my battery voltage is on the low side. I will look into this.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

Yes, also there is a link between throtcur and the maximum field weakening current. I_maxfw = 100*throtcur/2 . So your setting would allow just 100A field weakening current. Maybe that is not sufficient?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I've tested by setting throtcur to 4 but with no effect on acceleration. It only made the throttle pedal more responsive.
I will however keep this relationship in mind when doing future tests.

I have also found out how to make screenshots on my tablet, so increased image quality. :)
Deacceleration.
Screenshot_2020-10-25-09-25-43.png
Acceleration.
Screenshot_2020-10-25-09-29-01.png
There are some jerkyness going on during deacceleration in the transistion from FW to normal, ~110Hz.

I do have a hard time finding the exact right value for syncofs. I've tried following the video but I get motor standstill between 31300 and 34000 so I have averaged it to 32650 for now. Maybe this also is a sign of to low battery voltage.?

There are also spikes in ud and uq so I think it is a good idea to get rid of them before digging to deep into other problems.
Will focus on testing with higher voltage using boost converter unless there are better ideas to test.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

Yeah you can see inverter goes full amplitude at like 60 Hz or so. From then on it has nothing more to give. You can try working on syncofs more and also see what happens with boosted voltage.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

Ok, great to know whats going on. This is not unexpected.
Next step, boosted voltage.

Thank you for your help once again! Much appreciated!
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I just relized that just boosting the voltage is a bad idea. You need to be able to buck as well to allow current to flow in both directions otherwise you will have big trouble as soon as you start to regen.
This just grew x10...
Doesn't seem so easy to test after all.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

Ah thats where Gen2 would be convenient as it's a synchronous converter. You can however do the same with gen3, just clock high side IGBT inversely to lowside and deadtime.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

You make it sound so easy... :) But is it really that easy?
I put together simple code (based of JB buck code) for the boost purpose before I relized the problem. Now I'm thinking that this code will proably have to slow reaction time to a case where going from full acc to full deacc?

Code: Select all

/*
Runs atmega328p buck/boost control on Prius Gen 3 and Yaris/Auris inverters in boost mode to raise battery HV up for higher MG voltage.
Experimental code. Only tested on the bench! Use at your own risk!
*/
// Change log
/*

1_0
* First version, based on buck version by D.Maguire

*/

// Include libraries
#include <Metro.h>

// Constant declaration
// Limits
const uint16_t setVoltage = 210; // Desired set point voltage

// I/O-PINS
const uint8_t highSidePIN = 10;
const uint8_t lowSidePIN = 9;

// Timing constants
Metro timer_pwm = Metro(5); // 5ms
Metro timer_serial = Metro(200); // 200ms


/********
* SETUP *
********/
void setup()
{
	pinMode(lowSidePIN, OUTPUT);
  analogWrite(lowSidePIN, LOW);
  
  pinMode(highSidePIN, OUTPUT);
  analogWrite(highSidePIN, LOW);
  
  TCCR1B = TCCR1B & B11111000 | B00000010; // Set Timer1 divisor to 8 for PWM frequency of 3921.16 Hz
	
	Serial.begin(115200);
}


/*******
* LOOP *
*******/
void loop()
{
	updatePWM();  //call pwm update routine.
}


/**********************
* Sets PWM duty-cycle *
**********************/
void updatePWM()
{
	static uint8_t PWMDuty = 0; // PWM duty-cycle
  static uint16_t HVLow = 0;
  static uint16_t HVHi = 0;
  
	if(timer_pwm.check())
	{
		HVLow = (analogRead(A0) * 20 / 37); // Division by 1.85
		HVHi = (analogRead(A1) * 5 / 4); // Multiplication by 1.25
		
		if(HVLow > 130) //if battery HV is above 130V start ramping up pwm and regulate to setpoint.
		{
			if (HVHi < setVoltage) PWMDuty++;
			if (HVHi > setVoltage) PWMDuty--;
			if (PWMDuty < 0) PWMDuty = 0;
			if (PWMDuty > 200) PWMDuty = 200;
			analogWrite(10, PWMDuty);
		}
		if(HVLow < 105)
		{
			PWMDuty--;  //if hv is lower then 105v ramp down pwm
			if (PWMDuty<0)  PWMDuty=0;
		}
	}
	
	if(timer_serial.check())
  {
		serialOUT(HVLow, HVHi, PWMDuty);
	}
}


/**************************************
* Sends information to serial monitor *
**************************************/
void serialOUT(uint16_t HVLow, uint16_t HVHi, uint8_t PWMDuty)
{
  Serial.print("Low Vbus = ");
	Serial.print(HVLow);
	Serial.print("Volts");
	Serial.print("\t High Vbus = ");
	Serial.print(HVHi);
	Serial.print("Volts");
	Serial.print("\t PWMDUTY = ");
	Serial.println(PWMDuty);
}
I'm thinking more like reconfigure my battery pack for higher voltage and asking myself why I choose the Yaris inverter when a Prius would handle a higher battery voltage better?
My battey pack today is made of 210pc of Headway LiFePO4 cells connected 42S5P (134V nom).
I think the Yaris inverter will handle 300V on the low HV side which makes it still usable as a charger. So batteries connected 70S3P (224V nom) should work but doesn't provide that much higher voltage, only 1,67 times.
Using higher voltage is possible if connecting directly to high HV side but then charging has to be solved in another way. Batteries connected 105S2P (336V nom) results in 2,5 times higher voltage.
Both options require my BMS to be upgraded or replaced.
Or maybe replace the entire pack with cells from a OEM EV.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I have now modified the code for complementary drive including deadtime.
Works on the bench on a Arduino Pro Mini. Next step to test in inverter with low voltage and then with battery voltage.

Code: Select all

/*
Runs atmega328p buck/boost control on Prius Gen 3 and Yaris/Auris inverters in buck/boost mode to raise battery voltage to run higher motor voltage with current flow in both directions.
Experimental code. Only tested on the bench! Use at your own risk!
*/
// Change log
/*

1_2
* Switched to invert PIN10 (PIN9) in setup()
* Switched deadtime addition/subtraction in SetPWM() to match above
* Added constants for PWMDutyMin and PWMDutyMax for easier settings

1_1
* Replaced Metro library with use of millis() 

1_0
* First version

*/

// Include libraries

// Constant declaration
// Limits
const uint16_t setVoltage = 210; // Desired set point voltage
const uint8_t half_dead_time = 2; // Total deadtime = half_dead_time * 2 * 0.5us
const uint8_t PWMDutyMin = 1;
const uint8_t PWMDutyMax = 190; // To limit maximum output voltage VoutMax = Vin * 255 / (255 - PWMDutyMax)

// I/O-PINS
const uint8_t lowSidePIN = 9;
const uint8_t highSidePIN = 10;

// Timing constants
const uint32_t timePeriod5ms = 5; // delay, 5ms
const uint32_t timePeriod200ms = 200; // delay, 200ms


/********
* SETUP *
********/
void setup()
{
	pinMode(lowSidePIN, INPUT);   //PWM is set to input before PWM initialized to prevent start up short circuit
  pinMode(highSidePIN, INPUT);   //PWM is set to input before PWM initialized to prevent start up short circuit
	
  TCCR1A = 0b10110001; // mode 1: phase correct PWM 8-bit, TOP = 0x00FF, active for PIN9 and inv. PIN10
  TCCR1B = 0b00000010; // mode 1: phase correct PWM 8-bit, TOP = 0x00FF; prescaler 8 (frequency to 3.9kHz)
	
	setPWM(0); // Set start condition
		
	pinMode(lowSidePIN, OUTPUT);
  pinMode(highSidePIN, OUTPUT);
  	
	Serial.begin(115200);
}


/*******
* LOOP *
*******/
void loop()
{
	updatePWMDuty();  //call pwm update routine.
}


/**********************
* Sets PWM duty-cycle *
**********************/
void updatePWMDuty()
{
	static uint32_t lastMillisPWM = millis(); // For timing
  static uint32_t lastMillisSerial = millis(); // For timing
  	
	static uint8_t PWMDuty = 0; // PWM duty-cycle
  static uint16_t HVLow = 0;
  static uint16_t HVHi = 0;
  
	if(millis() - lastMillisPWM >= timePeriod5ms)
	{
		lastMillisPWM = millis();  // Reset timer
		
		HVLow = (analogRead(A0) * 20 / 37); // Division by 1.85
		HVHi = (analogRead(A1) * 5 / 4); // Multiplication by 1.25
		
		if(HVLow > 130) // If battery voltage is above 130V start ramping up pwm and regulate to setpoint.
		{
			if(HVHi < setVoltage) PWMDuty++;
			if(HVHi > setVoltage) PWMDuty--;
			if(PWMDuty < PWMDutyMin) PWMDuty = PWMDutyMin;
			if(PWMDuty > PWMDutyMax) PWMDuty = PWMDutyMax;
		}
		
		if(HVLow < 105)
		{
			PWMDuty--;  // If battery voltage is lower then 105v ramp down pwm
			if(PWMDuty < 1) PWMDuty = 1;
		}
		
		setPWM(PWMDuty);
	}
	
	if(millis() - lastMillisSerial >= timePeriod200ms)
  {
		lastMillisSerial = millis();  // Reset timer
		
		serialOUT(HVLow, HVHi, PWMDuty);
	}
}


/*******************
* Sets PWM outputs *
*******************/
void setPWM(uint8_t PWMDuty)
{
 //Limit the pwm_phx so it take the dead time into account so it not will swap over when reach end limit of workable PWM range
 if(PWMDuty > (255 - half_dead_time))
 {
   PWMDuty = (255 - half_dead_time);
 }
 
 if(PWMDuty < half_dead_time)
 {
   PWMDuty = half_dead_time;
 }
 
 //All The PWM will run from 0xFF to 0x00 and up again to TOP 0xFF
 //The OCRnx will automatic update when TCNTn is on TOP 0xFF by hardware
 //Therefor it is sutible to change both OCRnx pair on a place where TCNT not update to ensure that the hardware automatic update NOT occur exact when only one of the two OCRnx have changed by this code
 while(TCNT1 > 0x7F)
 {
 }
 //Now it's safe to update OCR1x pair (connect to same transistor pair)
  OCR1A = (PWMDuty - half_dead_time); // Low side IGBT
  OCR1B = (PWMDuty + half_dead_time); // High side IGBT
}


/**************************************
* Sends information to serial monitor *
**************************************/
void serialOUT(uint16_t HVLow, uint16_t HVHi, uint8_t PWMDuty)
{
  Serial.print("Low Vbus = ");
	Serial.print(HVLow);
	Serial.print("Volts");
	Serial.print("\t High Vbus = ");
	Serial.print(HVHi);
	Serial.print("Volts");
	Serial.print("\t PWMDUTY = ");
	Serial.println(PWMDuty);
}
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

That simple piece of code actually works!!
I testdrowe the car with a DC-voltage of 236V according to inverter, feed from a 134V battery pack. I could do regen as well. I drove a bit carfully and tried to avoid fast acceleration to hard regen but the voltage seem suprisingly stable. But it is very noisy with switch frequency of ~4kHz, almost needing ear protection to drive the car.

But the test drive got a bit more exciting then needed. First drove the car at low speed in the neighborhood and it worked. Then out on puplic road for speed test and the car started to be jerky. Turned of the main road and it got worse and worse. Was thinking, how am I gone get the car home and what has happend? A quick look at spotvalues revealed TMPHSMax, scroll down to temperature and ~70 degree C in heatsink, my limit set to 85. AHA! I had disconnected the cooling water pump during tests in the garage and forgot to reconnect it. Car now worked again and I could drive it home without problems.

With higher voltage acceleration was improved and I could pull more current from the battery at higher speed than before. But to have the car accelerate at a resonable level even higher voltage is needed. My choise of voltage corresponds to 70S LiFePO4 pack.
I will test with higher voltage settings to find out what battery pack modifications needed.
Next step is to test 288V (Lexus RX450H voltage level). Then 336V, which is 105S LiFePO4.

The code I used in todays test. Feel free to comment, specially with improvements!

Code: Select all

/*
Runs atmega328p buck/boost control on Prius Gen 3 and Yaris/Auris inverters in buck/boost mode to raise battery voltage to run higher motor voltage with current flow in both directions.
Experimental code. Only tested on the bench! Use at your own risk!
*/
// Change log
/*

1_2
* Switched to invert PIN10 (PIN9) in setup()
* Switched deadtime addition/subtraction in SetPWM() to match above
* Added constants for PWMDutyMin and PWMDutyMax for easier settings
* Added 10s delay at startup to allow precharge to complete

1_1
* Replaced Metro library with use of millis() 

1_0
* First version

*/

// Include libraries

// Constant declaration
// Limits
const uint16_t setVoltage = 224; // Desired set point voltage
const uint8_t half_dead_time = 2; // Total deadtime = half_dead_time * 2 * 0.5us
const uint8_t PWMDutyMin = 1;
const uint8_t PWMDutyMax = 190; // To limit maximum output voltage VoutMax = Vin * 255 / (255 - PWMDutyMax)

// I/O-PINS
const uint8_t lowSidePIN = 9;
const uint8_t highSidePIN = 10;

// Timing constants
const uint32_t timePeriod2ms = 2; // delay, 2ms
const uint32_t timePeriod200ms = 200; // delay, 200ms


/********
* SETUP *
********/
void setup()
{
	pinMode(lowSidePIN, INPUT);   //PWM is set to input before PWM initialized to prevent start up short circuit
  pinMode(highSidePIN, INPUT);   //PWM is set to input before PWM initialized to prevent start up short circuit
	
  TCCR1A = 0b10110001; // mode 1: phase correct PWM 8-bit, TOP = 0x00FF, active for PIN9 and inv. PIN10
  TCCR1B = 0b00000010; // mode 1: phase correct PWM 8-bit, TOP = 0x00FF; prescaler 8 (frequency to 3.9kHz)
	
	setPWM(0); // Set start condition

  delay(10000); // Delay to allow precharge to complete
    
	pinMode(lowSidePIN, OUTPUT);
  pinMode(highSidePIN, OUTPUT);
  	
	//Serial.begin(115200);
}


/*******
* LOOP *
*******/
void loop()
{
	updatePWMDuty();  //call pwm update routine.
}


/**********************
* Sets PWM duty-cycle *
**********************/
void updatePWMDuty()
{
	static uint32_t lastMillisPWM = millis(); // For timing
  //static uint32_t lastMillisSerial = millis(); // For timing
  	
	static uint8_t PWMDuty = 0; // PWM duty-cycle
  static uint16_t HVLow = 0;
  static uint16_t HVHi = 0;
  
	if(millis() - lastMillisPWM >= timePeriod2ms)
	{
		lastMillisPWM = millis();  // Reset timer
		
		HVLow = (analogRead(A0) * 20 / 37); // Division by 1.85
		HVHi = (analogRead(A1) * 5 / 4); // Multiplication by 1.25
		
		if(HVLow >= 105) // If battery voltage is above 105V start ramping up pwm and regulate to setpoint.
		{
			if(HVHi < setVoltage) PWMDuty++;
			if(HVHi > setVoltage) PWMDuty--;
			if(PWMDuty < PWMDutyMin) PWMDuty = PWMDutyMin;
			if(PWMDuty > PWMDutyMax) PWMDuty = PWMDutyMax;
		}
		
		if(HVLow < 105) // If battery voltage is lower then 105v ramp down pwm
		{
			PWMDuty--;
			if(PWMDuty < 1) PWMDuty = 1;
		}
		
		setPWM(PWMDuty);
	}
	
	/*if(millis() - lastMillisSerial >= timePeriod200ms)
  {
		lastMillisSerial = millis();  // Reset timer
		
		serialOUT(HVLow, HVHi, PWMDuty);
	}*/
}


/*******************
* Sets PWM outputs *
*******************/
void setPWM(uint8_t PWMDuty)
{
 //Limit the pwm_phx so it take the dead time into account so it not will swap over when reach end limit of workable PWM range
 if(PWMDuty > (255 - half_dead_time))
 {
   PWMDuty = (255 - half_dead_time);
 }
 
 if(PWMDuty < half_dead_time)
 {
   PWMDuty = half_dead_time;
 }
 
 //All The PWM will run from 0xFF to 0x00 and up again to TOP 0xFF
 //The OCRnx will automatic update when TCNTn is on TOP 0xFF by hardware
 //Therefor it is sutible to change both OCRnx pair on a place where TCNT not update to ensure that the hardware automatic update NOT occur exact when only one of the two OCRnx have changed by this code
 while(TCNT1 > 0x7F)
 {
 }
 //Now it's safe to update OCR1x pair (connect to same transistor pair)
  OCR1A = (PWMDuty - half_dead_time); // Low side IGBT
  OCR1B = (PWMDuty + half_dead_time); // High side IGBT
}


/**************************************
* Sends information to serial monitor *
**************************************/
void serialOUT(uint16_t HVLow, uint16_t HVHi, uint8_t PWMDuty)
{
  Serial.print("Low Vbus = ");
	Serial.print(HVLow);
	Serial.print("Volts");
	Serial.print("\t High Vbus = ");
	Serial.print(HVHi);
	Serial.print("Volts");
	Serial.print("\t PWMDUTY = ");
	Serial.println(PWMDuty);
}
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Renault Clio Electrique -97

Post by Jack Bauer »

Great work bexander:)
I'm going to need a hacksaw
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

That's great news! Good thing Toyota engineers didn't let you fry the inverter.
I'd try running the converter at a less audible frequency like 10 kHz, see how it copes. I tried the Leaf inverter with 4k4 it was horrible.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

Yes, those Toyota engineers truly are the protectors of the smoke!
arber333
Posts: 3241
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Has thanked: 74 times
Been thanked: 223 times
Contact:

Re: Renault Clio Electrique -97

Post by arber333 »

bexander wrote: Mon Oct 26, 2020 6:28 pm That simple piece of code actually works!!
Congratulations! I am really impressed.
@Johannes, we discussed fixed voltage regulation and a battery to battery interface. I think we have that here.

@Bexander, do you think your code will support a current limit setpoint and a voltage ramp? Amps and voltage would be set in serial with eeprom so it could start automatically with preset. That would be excellent for 3phase charging directly from RST!
Imagine a setpoint of 20A limit and voltage limit of 392Vdc. Inverter would begine from 600V rectified and tried to match PWM to 320Vdc battery actual voltage.
Or You could use it as charge converter from 160Vdc battery charging 50A into 388Vdc battery! This could serve as a mobile extender unit with voltage matching for boot aux battery pack.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

arber333 wrote: Tue Oct 27, 2020 5:41 pm
bexander wrote: Mon Oct 26, 2020 6:28 pm That simple piece of code actually works!!
Congratulations! I am really impressed.
@Johannes, we discussed fixed voltage regulation and a battery to battery interface. I think we have that here.

@Bexander, do you think your code will support a current limit setpoint and a voltage ramp? Amps and voltage would be set in serial with eeprom so it could start automatically with preset. That would be excellent for 3phase charging directly from RST!
Imagine a setpoint of 20A limit and voltage limit of 392Vdc. Inverter would begine from 600V rectified and tried to match PWM to 320Vdc battery actual voltage.
Or You could use it as charge converter from 160Vdc battery charging 50A into 388Vdc battery! This could serve as a mobile extender unit with voltage matching for boot aux battery pack.
I think celeron55:s code is better to start from to use as a chager.
https://github.com/celeron55/prius3charger_buck

My code is very basic and only intended for short tests. It is free to use, at your own risk, but I have no intention at this point to develope it further.
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Renault Clio Electrique -97

Post by bexander »

I just did short testdrive. Above 300V I get ok acceleration. I also noted that the heatsink temperature rises quite fast when running the buck/boost like this.
My next step is to figure out if I should reconfigure my excisting battery pack or replace it with a better/newer.
Will also try to source a Prius gen3 inverter as well which I think will handle this voltage and still allow use as a charger.
jap
Posts: 32
Joined: Fri Jun 26, 2020 5:14 pm
Location: Finland

Re: Renault Clio Electrique -97

Post by jap »

Super exciting to follow your progress, congrats! What kind of top speed can one expect with your tire size and 300ish V?
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Renault Clio Electrique -97

Post by johu »

It is interesting to see that field weakening, apparently, can't maintain reasonable torque just by itself.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply