Motor temp does not support negative numbers (car_tmotor)
Hi (Mark). In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C. Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h? Best regards Håkon
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer. On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com>wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...? Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy? Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc. I think that this problem might apply to all vehicles(?). Mark, do you have any suggestion for solution? Br. Håkon 2014/1/13 Collin Kidder <collink@kkmfg.com>
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen < hakon.markussen@gmail.com> wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Easy to hit 100C on the Roadster... Kevin Sharpe | Founder & Trustee | Zero Carbon World, a UK Registered Charity From: Håkon Markussen <hakon.markussen@gmail.com<mailto:hakon.markussen@gmail.com>> Reply-To: OVMS Developers <ovmsdev@lists.teslaclub.hk<mailto:ovmsdev@lists.teslaclub.hk>> Date: Monday, 13 January 2014 14:13 To: OVMS Developers <ovmsdev@lists.teslaclub.hk<mailto:ovmsdev@lists.teslaclub.hk>> Subject: Re: [Ovmsdev] Motor temp does not support negative numbers (car_tmotor) The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...? Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy? Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc. I think that this problem might apply to all vehicles(?). Mark, do you have any suggestion for solution? Br. Håkon 2014/1/13 Collin Kidder <collink@kkmfg.com<mailto:collink@kkmfg.com>> I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer. On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com<mailto:hakon.markussen@gmail.com>> wrote: Hi (Mark). In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C. Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h? Best regards Håkon _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Håkon, it is industry standard to apply an offset of -40C. We should do that instead of transforming it to signed, as Collin said. That would also be directly compatible to the CAN message from the twizy. Let's wait for Mark's opinion. Regards MG 2014/1/13 Håkon Markussen <hakon.markussen@gmail.com>
The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat
I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...?
Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy?
Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc.
I think that this problem might apply to all vehicles(?).
Mark, do you have any suggestion for solution?
Br. Håkon
2014/1/13 Collin Kidder <collink@kkmfg.com>
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen < hakon.markussen@gmail.com> wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
I was not aware of the industry standard -40C offset, so thank you (all) for good inputs. The "problem" is hereby addressed :) @Kevin: Can you recall the highest motor temperature ever seen on the Roadster? Do you know is Model S has the same temperature characteristics as the Roadster? Br. Håkon 2014/1/13 Mastro Gippo <gipmad@gmail.com>
Håkon, it is industry standard to apply an offset of -40C. We should do that instead of transforming it to signed, as Collin said. That would also be directly compatible to the CAN message from the twizy. Let's wait for Mark's opinion. Regards MG
2014/1/13 Håkon Markussen <hakon.markussen@gmail.com>
The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat
I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...?
Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy?
Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc.
I think that this problem might apply to all vehicles(?).
Mark, do you have any suggestion for solution?
Br. Håkon
2014/1/13 Collin Kidder <collink@kkmfg.com>
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen < hakon.markussen@gmail.com> wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
On i-Miev the motor temperature is with a -40C offset from the car. Highest motor temperature I have seen is ~50C on i-Miev. Regards, Thomas mandag 13. januar 2014 skrev Håkon Markussen følgende:
I was not aware of the industry standard -40C offset, so thank you (all) for good inputs. The "problem" is hereby addressed :)
@Kevin: Can you recall the highest motor temperature ever seen on the Roadster? Do you know is Model S has the same temperature characteristics as the Roadster?
Br. Håkon
2014/1/13 Mastro Gippo <gipmad@gmail.com>
Håkon, it is industry standard to apply an offset of -40C. We should do that instead of transforming it to signed, as Collin said. That would also be directly compatible to the CAN message from the twizy. Let's wait for Mark's opinion. Regards MG
2014/1/13 Håkon Markussen <hakon.markussen@gmail.com>
The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat
I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...?
Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy?
Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc.
I think that this problem might apply to all vehicles(?).
Mark, do you have any suggestion for solution?
Br. Håkon
2014/1/13 Collin Kidder <collink@kkmfg.com>
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen < hakon.markussen@gmail.com> wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Hi Håkon, No, I don't know the highest temperature for the Roadster but someone with access to the server logs might be able to tell us. The Model S is liquid cooled and Roadster air so no direct correlation. Keep up the good work! Kevin Sharpe | Founder & Trustee | Zero Carbon World, a UK Registered Charity From: Håkon Markussen <hakon.markussen@gmail.com<mailto:hakon.markussen@gmail.com>> Reply-To: OVMS Developers <ovmsdev@lists.teslaclub.hk<mailto:ovmsdev@lists.teslaclub.hk>> Date: Monday, 13 January 2014 14:31 To: OVMS Developers <ovmsdev@lists.teslaclub.hk<mailto:ovmsdev@lists.teslaclub.hk>> Subject: Re: [Ovmsdev] Motor temp does not support negative numbers (car_tmotor) I was not aware of the industry standard -40C offset, so thank you (all) for good inputs. The "problem" is hereby addressed :) @Kevin: Can you recall the highest motor temperature ever seen on the Roadster? Do you know is Model S has the same temperature characteristics as the Roadster? Br. Håkon 2014/1/13 Mastro Gippo <gipmad@gmail.com<mailto:gipmad@gmail.com>> Håkon, it is industry standard to apply an offset of -40C. We should do that instead of transforming it to signed, as Collin said. That would also be directly compatible to the CAN message from the twizy. Let's wait for Mark's opinion. Regards MG 2014/1/13 Håkon Markussen <hakon.markussen@gmail.com<mailto:hakon.markussen@gmail.com>> The highest motor temperature I ever have seen on Think City is ~45 C. This is the offset for the cooling thermostat I cannot even imagine that other EV-motors should reach a temperature near 100C? Then the cooling system have to be out of order ... or ...? Anybody who knows the expected operation range of motor temp for Roadster, Leaf, iMiEV and Zwizy? Think City reports temperature in 8 bits - signed. When bit8 (msb) is set to "1" it means negative temperature, so when the motor temp actually is -1C , OVMS reports 255C. When motor temp is -11 Ovms reports 245C ,etc. I think that this problem might apply to all vehicles(?). Mark, do you have any suggestion for solution? Br. Håkon 2014/1/13 Collin Kidder <collink@kkmfg.com<mailto:collink@kkmfg.com>> I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer. On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com<mailto:hakon.markussen@gmail.com>> wrote: Hi (Mark). In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C. Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h? Best regards Håkon _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev _______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk<mailto:OvmsDev@lists.teslaclub.hk> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Sound advise. Given just a handful of temperatures, it is probably least impacting to just change to 16 bit signed and put this one to rest. It keeps coming back, and it would be good to solve it once and for all. Impact is 1 byte extra ram per temperature, plus some flash for the 16 vs 8 bit. Moving to a 40C offset is tricky to maintain backwards compatibility. Regards, Mark
On 13 Jan, 2014, at 9:51 pm, Collin Kidder <collink@kkmfg.com> wrote:
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com> wrote: Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Reviewing this, I find: extern signed char car_ambient_temp; // Ambient Temperature (celcius) extern signed char car_tpem; // Tpem extern unsigned char car_tmotor; // Tmotor extern signed char car_tpms_t[4]; // TPMS temperature The car_tbattery and car_cooldown_tbattery are already signed int. I propose to change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int. For the sake of 7 bytes I don't think it is worth the risk. Code in vehicle_twizy.c is a good example of guarding for this: // MOTOR TEMPERATURE: if (CAN_BYTE(5) > 40 && CAN_BYTE(5) < 0xf0) car_tmotor = CAN_BYTE(5) - 40; else car_tmotor = 0; // unsigned, no negative temps allowed... Simplifying code like that will probably save as much flash as we lose in going from 8 to 16 bits. Once we've got over the current compilation flags / space issue with the 1.6 firmware, I'll make this change. Regards, Mark. On 13 Jan, 2014, at 10:46 pm, Mark Webb-Johnson <mark@webb-johnson.net> wrote:
Sound advise.
Given just a handful of temperatures, it is probably least impacting to just change to 16 bit signed and put this one to rest. It keeps coming back, and it would be good to solve it once and for all. Impact is 1 byte extra ram per temperature, plus some flash for the 16 vs 8 bit.
Moving to a 40C offset is tricky to maintain backwards compatibility.
Regards, Mark
On 13 Jan, 2014, at 9:51 pm, Collin Kidder <collink@kkmfg.com> wrote:
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com> wrote: Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Hi Mark. it looks like you have forgot to change the car_tmotor to signed int?
From changes.txt:
# Change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int
From ovms.c:
unsigned int car_tmotor = 0; // Tmotor Regards, Thomas 2014/1/14 Mark Webb-Johnson <mark@webb-johnson.net>
Reviewing this, I find:
extern signed char car_ambient_temp; // Ambient Temperature (celcius) extern signed char car_tpem; // Tpem extern unsigned char car_tmotor; // Tmotor extern signed char car_tpms_t[4]; // TPMS temperature
The car_tbattery and car_cooldown_tbattery are already signed int.
I propose to change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int. For the sake of 7 bytes I don't think it is worth the risk.
Code in vehicle_twizy.c is a good example of guarding for this:
// MOTOR TEMPERATURE: if (CAN_BYTE(5) > 40 && CAN_BYTE(5) < 0xf0) car_tmotor = CAN_BYTE(5) - 40; else car_tmotor = 0; // unsigned, no negative temps allowed...
Simplifying code like that will probably save as much flash as we lose in going from 8 to 16 bits.
Once we've got over the current compilation flags / space issue with the 1.6 firmware, I'll make this change.
Regards, Mark.
On 13 Jan, 2014, at 10:46 pm, Mark Webb-Johnson <mark@webb-johnson.net> wrote:
Sound advise.
Given just a handful of temperatures, it is probably least impacting to just change to 16 bit signed and put this one to rest. It keeps coming back, and it would be good to solve it once and for all. Impact is 1 byte extra ram per temperature, plus some flash for the 16 vs 8 bit.
Moving to a 40C offset is tricky to maintain backwards compatibility.
Regards, Mark
On 13 Jan, 2014, at 9:51 pm, Collin Kidder <collink@kkmfg.com> wrote:
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen < hakon.markussen@gmail.com> wrote:
Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
I've fixed it, and should be ok now. Regards, Mark. On 21 Jan, 2014, at 2:29 am, Thomas Bergo <thomas.bergo@gmail.com> wrote:
Hi Mark.
it looks like you have forgot to change the car_tmotor to signed int?
From changes.txt: # Change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int
From ovms.c: unsigned int car_tmotor = 0; // Tmotor
Regards, Thomas
2014/1/14 Mark Webb-Johnson <mark@webb-johnson.net> Reviewing this, I find:
extern signed char car_ambient_temp; // Ambient Temperature (celcius) extern signed char car_tpem; // Tpem extern unsigned char car_tmotor; // Tmotor extern signed char car_tpms_t[4]; // TPMS temperature
The car_tbattery and car_cooldown_tbattery are already signed int.
I propose to change car_ambient_temp, car_tpem, car_tmotor and car_tpms_t to signed int. For the sake of 7 bytes I don't think it is worth the risk.
Code in vehicle_twizy.c is a good example of guarding for this:
// MOTOR TEMPERATURE: if (CAN_BYTE(5) > 40 && CAN_BYTE(5) < 0xf0) car_tmotor = CAN_BYTE(5) - 40; else car_tmotor = 0; // unsigned, no negative temps allowed...
Simplifying code like that will probably save as much flash as we lose in going from 8 to 16 bits.
Once we've got over the current compilation flags / space issue with the 1.6 firmware, I'll make this change.
Regards, Mark.
On 13 Jan, 2014, at 10:46 pm, Mark Webb-Johnson <mark@webb-johnson.net> wrote:
Sound advise.
Given just a handful of temperatures, it is probably least impacting to just change to 16 bit signed and put this one to rest. It keeps coming back, and it would be good to solve it once and for all. Impact is 1 byte extra ram per temperature, plus some flash for the 16 vs 8 bit.
Moving to a 40C offset is tricky to maintain backwards compatibility.
Regards, Mark
On 13 Jan, 2014, at 9:51 pm, Collin Kidder <collink@kkmfg.com> wrote:
I don't think you'd want to do that. 127 deg C really isn't that terribly hot and -128C is extremely cold. If it is necessary to retain use of an 8 bit variable then the standard solution is to just offset the temperature stored by -40. That way you can read -40 to 215C which is a pretty reasonable range. Unfortunately, I fear such a change would necessitate many other changes in code. It might be better to expand to a signed 16 bit integer.
On Mon, Jan 13, 2014 at 7:50 AM, Håkon Markussen <hakon.markussen@gmail.com> wrote: Hi (Mark).
In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor
Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C.
Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h?
Best regards Håkon
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
_______________________________________________ OvmsDev mailing list OvmsDev@lists.teslaclub.hk http://lists.teslaclub.hk/mailman/listinfo/ovmsdev
Highest Motor Temperature on Roadster is 157°C. Then the Power will be reduced to cool down the Motor. Rgards Pierre Uhl Von: ovmsdev-bounces@lists.teslaclub.hk [mailto:ovmsdev-bounces@lists.teslaclub.hk] Im Auftrag von Håkon Markussen Gesendet: Montag, 13. Januar 2014 13:50 An: OVMS Developers Betreff: [Ovmsdev] Motor temp does not support negative numbers (car_tmotor) Hi (Mark). In ovms.h the motor temperature is defined as unsigned char (non-negative): extern unsigned char car_tmotor; // Tmotor Currently the weather is cold in Norway (-15 C) and I noticed that motor temp was 244C. Is it possible to update the car_tmotor to extern signed char car_tmotor; // Tmotor in ovms.h? Best regards Håkon
participants (7)
-
Collin Kidder -
Håkon Markussen -
Kevin Sharpe ZCW -
Mark Webb-Johnson -
Mastro Gippo -
Pierre Uhl -
Thomas Bergo