[r20]: / ecu_at135_v1c_aladdin / StandardPLC / Plc Logic / Application / 013.BMS_Colibri / BMS_Colibri_T63 / svnobj  Maximize  Restore  History

Download this file

115 lines (113 with data), 19.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
(* Cadenceur 200ms *)
Cadenceur_1000ms(IN := Start_cad_1000ms, PT := T#1000MS, Q => Trame1000ms, ET =>);
IF (Trame1000ms = TRUE)
	THEN Start_cad_1000ms := FALSE;
	ELSE Start_cad_1000ms := TRUE;
(*Activation de la communication avec le BMS*)
Activation_bus_can_colibri(
	xEnable:= Activation_can_Colibri, 
	xError=> Error_bus_can_colibri, 
	eDiagInfo=> , 
	eChannel:= Channel_can_colibri, 
	eBaudrate:= 250);
(* RECEPTION PREMIER OBJET SUR NODE 1 - ID: 0x18A TPDO1 *)
Reception_colibri_0x18A(
	xEnable:= Activation_can_reception_Colibri, 
	xError=> , 
	xExtended:= FALSE, 
	aData=> Rx_0x18A, 
	usiDLC=> , 
	uiAvailable=> , 
	udiID:= 16#18A); 
	
(*Temperature Moyenne des cellules*)
Average_Cell_Temprature := Raw_average_cell_temperature * 0.125;
(*Status de la batterie*)
Battery_Status := BYTE_TO_BOOL(Rx_0x18A[2]);
(* RECEPTION PREMIER OBJET SUR NODE 1 - ID: 0x28A TPDO2*)
Reception_colibri_0x28A(
	aData=> Rx_0x28A, 
	udiID:= 16#28A); 
(* Tension de la Batterie *)
Raw_requested_charging_current := USINT_TO_WORD(Rx_0x38A[0]) + USINT_TO_WORD(Rx_0x38A[1]) * 256;
Battery_unique_ID := USINT_TO_WORD(Rx_0x18B[0]) + USINT_TO_WORD(Rx_0x18B[1]) * 256;
Fault := Rx_0x18B[2].0;
Precharge_contactor := Rx_0x18B[2].1;
Main_contactor_1 := Rx_0x18B[2].2;
Main_contactor_2 := Rx_0x18B[2].3;
Relay_fault := Rx_0x18B[2].4;
Charging_prohibited := Rx_0x18B[3].5;
Discharging_prohibited := Rx_0x18B[3].6;
Fault_code_stored := Rx_0x18B[4];
IF (Rx_0x18B[5].2 = TRUE)
	THEN Fault_flags := 'Communication Fault';
ELSIF (Rx_0x18B[5].3 = TRUE)
	THEN Fault_flags := 'Charge Overcurrent';
ELSIF (Rx_0x18B[5].4 = TRUE)
	THEN Fault_flags := 'Discharge Overcurrent';
ELSIF (Rx_0x18B[5].5 = TRUE)
	THEN Fault_flags := 'Over-Temperature';
ELSIF (Rx_0x18B[5].6 = TRUE)
	THEN Fault_flags := 'Undervoltage';
ELSIF (Rx_0x18B[5].7 = TRUE)
	THEN Fault_flags := 'Overvoltage';
ELSE
	Fault_flags := 'No Fault';
IF (Rx_0x18B[6].0 = TRUE)
	THEN Warning_flags := 'Warning: Low Voltage';
ELSIF (Rx_0x18B[6].1 = TRUE)
	THEN Warning_flags := 'Warning: High Voltage';
ELSIF (Rx_0x18B[6].2 = TRUE)
	THEN Warning_flags := 'Warning: Charge Overcurrent';
ELSIF (Rx_0x18B[6].3 = TRUE)
	THEN Warning_flags := 'Warning: Discharge Overcurrent';
ELSIF (Rx_0x18B[6].4 = TRUE)
	THEN Warning_flags := 'Warning: Low Temperature';
ELSIF (Rx_0x18B[6].5 = TRUE)
	THEN Warning_flags := 'Warning: High Temperature';
	Warning_flags := 'No Warning';
IF (Rx_0x18B[7].0 = TRUE)
	THEN Maintenance_flags := 'Blocked for maintenance';
	Maintenance_flags := 'No Maintenance - Normal Operation';	
IF (Rx_0x18B[7].1 = TRUE)
	THEN Authorisation := 'Authorized';
	Authorisation := 'Battery Locked';	
(* RECEPTION PREMIER OBJET SUR NODE 2 - ID: 0x38B TPDO3*)
Reception_colibri_0x38B(
	aData=> Rx_0x38B, 
	udiID:= 16#38B); 
VAR_INPUT
	Activation_can_reception_Colibri:	BOOL;
END_VAR
	Error_bus_can_colibri:			BOOL;
	Battery_status:					BOOL;	//0=Not ready; 1=Ready
	Battery_current:				UDINT;	//Ampere
	State_of_charge:				BYTE;	//Autonomie (%)
	Battery_avg_pack_temperature:	SINT;	//Degr
(s) Celsius
	Battery_max_temperature:		SINT;	//Degr
(s) Celsius
	Fault:							BOOL;
	Main_contactor_1:				BOOL;
	Relay_fault:					BOOL;
	Discharging_prohibited: 		BOOL;
	Fault_flags: 					STRING;
	Maintenance_flags: 				STRING;
VAR
	Start_cad_200ms:				BOOL;
	Trame200ms:						BOOL;
	(*D
claration des block fonctions *)
	Cadenceur_1000ms:			TON;
	Reception_colibri_0x18A:	ifmRCAN.CAN_Rx;
	Reception_colibri_0x38A:	ifmRCAN.CAN_Rx;
	Reception_colibri_0x38B:	ifmRCAN.CAN_Rx;
	(*Table de reception des trames*)
	Rx_0x28A: ARRAY [0..7] OF USINT;
	Rx_0x18B: ARRAY [0..7] OF USINT;
	Rx_0x48B: ARRAY [0..7] OF USINT;
	Raw_average_cell_temperature:	WORD;
	Raw_requested_charging_current: WORD;
589
{8e575c5b-1d37-49c6-941b-5c0ec7874787}
ChildObjectGuids
AddAttributeSubsequent