Batteri Management System til Elbil

bms-citroen-c1-evie

Istedet for den oprindelige BMS i citroen c1 evie elbil, er der valgt en australsk løsning. Valget har været at finde den mest simple BMS, som er kendt for stabilitet.

Filmen herunder viser funktionaliteten, af BMS

Lidt sjovt for mig som er arduino nørd, er at der bruges en picaxe i BMS der kører et open source basic program. PicAXE er en MCU der mest bliver brugt i skolesammenhænge, og bla. bruges den i house of technology’s grundforløb til at lære at programmere.

Open Source picAXE basic program fra ev-power.com.au til BMS MCU 

 '*****************************************************************************************************************************
#PICAXE 08M2
'  
'              BMS-BCU-MICRO-08 - BATTERY CONTROL UNIT FOR  EV POWER BMS CELL MODULES
'
'              This simple unit monitors cell module input.  If error for 10 seconds
'               disconnection occurs.
'
'               FOR USE WITH THREE WIRE LATCHING RELAYS
'
'               2.1 - added latching variable, same code for MICRO-A and B
'                        added code to switch off relay when powered ON with enable ON
'		2.2 - 20-11-12  - added code for 11V - 16V switch range     11V = 104, 16V = 151
'		2.3 - 11-1-13 - removed 11-16V switching range, needs more thought
'
'
'*****************************************************************************************************************************

'
symbol latchingvalue = 1		  ' set latching = 1 for MICRO-A and latching = 0 for MICRO-B
'symbol hysterisis	= 5		' hysterisis value for offvoltage

' PICAXE pin assignments
symbol alarmpin      = 0
symbol contactoroff = 1
symbol contactoron = 2
symbol cellmodules = pin3
symbol switchinput = 4

' Define constants
'symbol offvoltage = 104            '<20 = switchoff
symbol offvoltage = 20            '<20 = switchoff
symbol overvoltage = 255

' Define variables
symbol voltage      = b0
symbol acount       = b1
symbol latching     = b2
symbol errorflag    = b3
symbol lastsecond = w2
'symbol offplushysterisis 	= b6

'***************************************************************************************************************************
' MAIN PROGRAM
start0:

latching = latchingvalue                    ' set latching = 1 for MICRO-A and latching = 0 for MICRO-B
'offplushysterisis = offvoltage + hysterisis

suspend 1

gosub relayoff
errorflag = 0

'low contactoroff           ' set output so not in indeterminate state
'low contactoron

initialise:

readadc switchinput, voltage       ' stay switched off if unit is powered up with switch on
'debug voltage
pause 100
if voltage => offvoltage then : goto initialise endif

gosub sleepsomemore

main:

if cellmodules = 0 then
   for acount = 1 to 15                          ' 15 seconds from warning to shutdown
         pause 500
         gosub flasher
         errorflag = 1
         readadc switchinput, voltage
         if voltage < offvoltage then : gosub sleepsomemore : endif
 	if cellmodules <> 0 then
 		errorflag = 0
	 	goto modulesok 
 	endif
   next acount
   gosub closedown
endif

modulesok:

readadc switchinput, voltage
pause 100
'debug voltage
if voltage < offvoltage then : gosub sleepsomemore : endif

goto main
end

'subroutines
'*******************************************************************************************************************************
'  CLOSE DOWN if voltage or cell modules are out of range, only re-enable if switch is off/on again

closedown:
if voltage< offvoltage or voltage > overvoltage then
   low alarmpin
else
   high alarmpin
endif
gosub relayoff
errorflag = 2

stayclosed:
readadc switchinput, voltage
pause 100
if voltage => offvoltage then : goto stayclosed : endif

gosub sleepsomemore

goto main
return

'******************************************************************************************************************************
'   SLEEP if switch is off

sleepsomemore:
gosub relayoff
low alarmpin
errorflag = 0

stayoff:	

readadc switchinput, voltage
pause 100
if voltage < offvoltage then : goto stayoff : endif

gosub relayon

goto main
return

'******************************************************************************************************************************
' FLASH the alarmpin

flasher:
high alarmpin
pause 500
low alarmpin

return
'******************************************************************************************************************************
'  RELAY ON pulse for latching relay

relayon:
if latching = 0 then
	high contactoroff
	high contactoron
else
	low contactoroff
	high contactoron
	pause 100
	low contactoron
endif
pause 1000

return
'******************************************************************************************************************************
' RELAY OFF pulse for latching relay

relayoff:
if latching = 0 then
	low contactoroff
	low contactoron
else
	low contactoron
	high contactoroff
	pause 100
	low contactoroff
endif
pause 1000

return

'*******************************************************************************************************************************
'  PARALLEL PROGRAM TO OUTPUT TERMINAL INFORMATION

start1:

pause 200

main1:

waitasecond:
if time = lastsecond then
	goto waitasecond
else
	lastsecond = time
endif

if voltage < offvoltage then
	sertxd ("STA=OFF")
else
	sertxd ("STA=ON")
endif

sertxd (" ERR=",#errorflag,cr,lf)

if time = 60 then : time = 0 : endif

goto main1
end

interrupt:return

 

 

 

 

 

 

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *

%d bloggers like this: