function updateDetails(details) { var candyKey, candyValue; // ReceptionTime candyKey = CANDY['ReceptionTime']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#reception-time').html( candyValue ); } // Mainswitch candyKey = CANDY['Mainswitch']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( candyValue.toUpperCase() ); if (candyValue == 'on') { shadow = SHADOW_GREEN; } else { shadow = ''; } $('#sbi-'+candyKey).css('text-shadow', shadow); $('#sbi-switch').html( candyValue.toUpperCase() ); if (candyValue == 'on') { shadow = SHADOW_GREEN; } else { shadow = ''; } $('#sbi-switch').css('text-shadow', shadow); } // EngineSpeed candyKey = CANDY['EngineSpeed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( Math.round(candyValue) ); if (candyValue > 3000) { shadow = SHADOW_RED; } else if (candyValue > 2000) { shadow = SHADOW_YELLOW; } else { shadow = ''; } $('#sbi-'+candyKey).css('text-shadow', shadow); $('#sbi-engine_speed').html( Math.round(candyValue) ); if (candyValue > 3000) { shadow = SHADOW_RED; } else if (candyValue > 2000) { shadow = SHADOW_YELLOW; } else { shadow = ''; } $('#sbi-engine_speed').css('text-shadow', shadow); } // WheelBasedVehicleSpeed candyKey = CANDY['WheelBasedVehicleSpeed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( Math.round(candyValue) + ' km/h' ); if (candyValue > 90) { shadow = SHADOW_RED; } else if (candyValue > 75) { shadow = SHADOW_YELLOW;} else { shadow = ''; } $('#sbi-'+candyKey).css('text-shadow', shadow); $('#sbi-speed').html( Math.round(candyValue) + ' km/h' ); if (candyValue > 90) { shadow = SHADOW_RED; } else if (candyValue > 75) { shadow = SHADOW_YELLOW;} else { shadow = ''; } $('#sbi-speed').css('text-shadow', shadow); } // HighResolutionTotalVehicleDistance candyKey = CANDY['HighResolutionTotalVehicleDistance']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( Math.round(candyValue/1000).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' km' ); $('#sbi-km_total').html( Math.round(candyValue/1000).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' km' ); } // PowerSupply candyKey = CANDY['PowerSupply']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( parseFloat(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:1}) + ' volt' ); if (candyValue < 21) { shadow = SHADOW_RED; } else if (candyValue < 23) { shadow = SHADOW_YELLOW; } else { shadow = ''; } $('#sbi-'+candyKey).css('text-shadow', shadow); $('#sbi-power').html( parseFloat(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:1}) + ' volt' ); if (candyValue < 21) { shadow = SHADOW_RED; } else if (candyValue < 23) { shadow = SHADOW_YELLOW; } else { shadow = ''; } $('#sbi-power').css('text-shadow', shadow); } // GpsBearing candyKey = CANDY['GpsBearing']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( formatGpsBearing(candyValue) ); $('#sbi-gps_bearing').html( formatGpsBearing(candyValue) ); } // Door candyKey = CANDY['Door']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( candyValue ); } // AmbientAirTemperature candyKey = CANDY['AmbientAirTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html( Math.round(candyValue) + ' ℃' ); } // energy_charged candyKey = CANDY['SolarisTripEnergyCharged']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-energy_charged').html( Math.round(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' kWh' ); } // energy_consumed candyKey = CANDY['SolarisTripEnergyDischarged']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-energy_consumed').html( Math.round(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' kWh' ); } // energy_returned candyKey = CANDY['SolarisTripEnergySaved']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-energy_returned').html( Math.round(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' kWh' ); } /////**** */ // energy_in candyKey = CANDY['SolarisTractionContainerEnergyIn']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-energy_in').html( Math.round(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' kWh' ); } // energy_out candyKey = CANDY['SolarisTractionContainerEnergyOut']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-energy_out').html( Math.round(candyValue).toLocaleString('ro-RO',{maximumFractionDigits:0}) + ' kWh' ); } // HighResolutionTotalVehicleDistance candyKey = CANDY['HighResolutionTotalVehicleDistance']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(Math.round(candyValue/1000) != Math.round(currentData.vehicles[SelectedVehicle][CANDY['HighResolutionTotalVehicleDistance']]/1000) || forceInitUpdate) { $('#sbi-' + candyKey).html(Math.round(candyValue / 1000).toLocaleString('ro-RO', {maximumFractionDigits: 0}) + ' km'); //} } // Fuel Tank Lid candyKey = CANDY['D[500]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['D[500]']]) || forceInitUpdate) { let sbi = $('#sbi-fuel-tank-lid'); if (candyValue == '1') sbi.html('Deschis'); else if (candyValue == '0') { sbi.html('Închis'); } else sbi.html('-'); //} } // Total Passengers embark1 = (details[CANDY['Embark1']] == '' || details[CANDY['Embark1']] == '-') ? 0 : parseInt(details[CANDY['Embark1']]); embark2 = (details[CANDY['Embark2']] == '' || details[CANDY['Embark2']] == '-') ? 0 : parseInt(details[CANDY['Embark2']]); embark3 = (details[CANDY['Embark3']] == '' || details[CANDY['Embark3']] == '-') ? 0 : parseInt(details[CANDY['Embark3']]); embark4 = (details[CANDY['Embark4']] == '' || details[CANDY['Embark4']] == '-') ? 0 : parseInt(details[CANDY['Embark4']]); $('#sbi-total_passengers').html(embark1 + embark2 + embark3 + embark4); // MobileUpTime candyKey = CANDY['MobileUpTime']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(To_HH_MM(candyValue)); } // EngineCoolantTemperature candyKey = CANDY['EngineCoolantTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue+ ' ℃'); } // FuelLevel candyKey = CANDY['FuelLevel']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue + ' L'); } // CatalystTankLevel candyKey = CANDY['CatalystTankLevel']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue + ' %'); } // D[005] candyKey = CANDY['D[005]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['D[005]']]) || forceInitUpdate) { $('#sbi-hybrid-' + candyKey).html(candyValue); //} } // D[006] candyKey = CANDY['D[006]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['D[006]']]) || forceInitUpdate) { $('#sbi-hybrid-' + candyKey).html(candyValue); //} } // EngineInstantaneousFuelEconomy candyKey = CANDY['EngineInstantaneousFuelEconomy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(parseInt(candyValue).toFixed(0) + ' L/100km'); } if (!IsEmpty(details['c']) && !IsEmpty(details['c']['hybrid-consumption-today'])){ if (IsEmpty(currentData.vehicles[SelectedVehicle]['c']['hybrid-consumption-today'])) $('#sbi-hybrid-consumption-today').html(parseFloat(details['c']['hybrid-consumption-today']).toLocaleString('ro-RO', {maximumFractionDigits: 2}) + ' L'); } // FuelConsumptionRateDay candyKey = CANDY['FuelConsumptionRateDay']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html((candyValue * 100).toFixed(0) + ' L/100km'); } // EngineInstantaneousFuelEconomy candyKey = CANDY['EngineInstantaneousFuelEconomy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['EngineInstantaneousFuelEconomy']]) || forceInitUpdate) { $('#sbi-' + candyKey).html((100 / candyValue).toLocaleString('ro-RO', {maximumFractionDigits: 2}) + ' L/100km'); //} } // EngineAverageFuelEconomy candyKey = CANDY['EngineAverageFuelEconomy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['EngineAverageFuelEconomy']]) || forceInitUpdate) { $('#sbi-' + candyKey).html((100 / candyValue).toLocaleString('ro-RO', {maximumFractionDigits: 2}) + ' L/100km'); //} } // HighResolutionEngineTotalFuelUsed candyKey = CANDY['HighResolutionEngineTotalFuelUsed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //if(!candyValue.iEqual(currentData.vehicles[SelectedVehicle][CANDY['HighResolutionEngineTotalFuelUsed']]) || forceInitUpdate) { $('#sbi-' + candyKey).html(parseFloat(candyValue).toLocaleString('ro-RO', {maximumFractionDigits: 3}) + ' L'); //} } // EngineTotalFuelUsed candyKey = CANDY['EngineTotalFuelUsed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue + ' L'); } // LineName candyKey = CANDY['LineName']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue ); } // LineNumber candyKey = CANDY['LineNumber']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-'+candyKey).html(candyValue ); } candyKey = CANDY['D[006]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); $('#sbi-mvb').html(candyValue ); } candyKey = CANDY['D[100]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); if(candyValue == 1) { $('#sbi-door-1').html(TRANSLATE['sbi_door_closed'] ); } else if(candyValue == 0) { $('#sbi-door-1').html(TRANSLATE['sbi_door_open'] ); } } candyKey = CANDY['D[101]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); if(candyValue == 1) { $('#sbi-door-2').html(TRANSLATE['sbi_door_closed'] ); } else if(candyValue == 0) { $('#sbi-door-2').html(TRANSLATE['sbi_door_open'] ); } } candyKey = CANDY['D[103]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); if(candyValue == 1) { $('#sbi-door-3').html(TRANSLATE['sbi_door_closed'] ); } else if(candyValue == 0) { $('#sbi-door-3').html(TRANSLATE['sbi_door_open'] ); } } candyKey = CANDY['D[104]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); if(candyValue == 1) { $('#sbi-door-4').html(TRANSLATE['sbi_door_closed'] ); } else if(candyValue == 0) { $('#sbi-door-4').html(TRANSLATE['sbi_door_open'] ); } } candyKey = CANDY['D[082]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-door-free').html(TRANSLATE['sbi_activ'] ); } else if(candyValue == 0) { $('#sbi-door-free').html(TRANSLATE['sbi_inactiv'] ); } } candyKey = CANDY['D[020]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-door-loop').html(TRANSLATE['sbi_ok'] ); } else if(candyValue == 0) { $('#sbi-door-loop').html(TRANSLATE['sbi_not_ok'] ); } } $('#sbi-front-driving').html("0"); candyKey = CANDY['D[079]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-front-driving').html(TRANSLATE['sbi_front'] ); } } candyKey = CANDY['D[080]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-front-driving').html(TRANSLATE['sbi_back'] ); } } $('#sbi-move-direction').html("0"); candyKey = CANDY['D[029]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { //console.log("Dir deplasare " + parseInt(candyValue)); if(candyValue == 1) { //console.log(TRANSLATE['sbi_forward'] + "Dir deplasare " + parseInt(candyValue)); $('#sbi-move-direction').html(TRANSLATE['sbi_forward'] ); } } candyKey = CANDY['D[035]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-move-direction').html(TRANSLATE['sbi_backward'] ); } } $('#sbi-mansa').html("0"); candyKey = CANDY['D[013]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-mansa').html(TRANSLATE['sbi_accelerare'] ); } } candyKey = CANDY['D[012]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-mansa').html(TRANSLATE['sbi_franare'] ); } } candyKey = CANDY['D[015]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-mech-brake').html(TRANSLATE['sbi_activ'] ); }else if(candyValue == 0) { $('#sbi-mech-brake').html(TRANSLATE['sbi_inactiv'] ); } } candyKey = CANDY['D[025]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-pass-brake').html(TRANSLATE['sbi_activ'] ); }else if(candyValue == 0) { $('#sbi-pass-brake').html(TRANSLATE['sbi_inactiv'] ); } } candyKey = CANDY['D[052]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-patina').html(TRANSLATE['sbi_activ'] ); } else if(candyValue == 0) { $('#sbi-patina').html(TRANSLATE['sbi_inactiv'] ); } } candyKey = CANDY['D[025]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-emergency-open').html(TRANSLATE['sbi_activ'] ); } else if(candyValue == 0) { $('#sbi-emergency-open').html(TRANSLATE['sbi_inactiv'] ); } } candyKey = CANDY['D[009]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-door-open').html(TRANSLATE['sbi_door_open'] ); }else if(candyValue == 0) { $('#sbi-door-open').html(TRANSLATE['sbi_door_closed'] ); } } candyKey = CANDY['D[010]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-rampa').html(TRANSLATE['sbi_door_closed'] ); }else if(candyValue == 0) { $('#sbi-rampa').html(TRANSLATE['sbi_door_open'] ); } } candyKey = CANDY['D[051]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { if(candyValue == 1) { $('#sbi-ccf').html(TRANSLATE['sbi_fail'] ); } else if(candyValue == 0) { $('#sbi-ccf').html(TRANSLATE['sbi_succ'] ); } } candyKey = CANDY['A32[13]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log("energ rec " + candyValue); $('#sbi-energy-recovered').html( parseFloat(hexToDec(candyValue)).toLocaleString('ro-RO',{maximumFractionDigits:2}) + ' kW'); } let energy_traction = 0; candyKey = CANDY['A32[07]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log("energ tract "+candyValue); energy_traction = parseFloat(hexToDec(candyValue)); $('#sbi-energy-traction').html( energy_traction.toLocaleString('ro-RO',{maximumFractionDigits:2}) + ' kW'); } let energy_aux = 0; candyKey = CANDY['A32[08]']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log("energy aux " + candyValue); energy_aux = parseFloat(hexToDec(candyValue)); $('#sbi-energy-aux').html( energy_aux.toLocaleString('ro-RO',{maximumFractionDigits:2}) + ' kW'); } if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log("energy cons " +candyValue); $('#sbi-energy-cons').html((energy_traction + energy_aux).toFixed(0) + ' kW'); } candyKey = CANDY['AL[062]']; candyValue = details[candyKey]; let param_a16_62 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_62 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[063]']; candyValue = details[candyKey]; let param_a16_63 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_63 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[064]']; candyValue = details[candyKey]; let param_a16_64 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_64 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[065]']; candyValue = details[candyKey]; let param_a16_65 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_65 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[066]']; candyValue = details[candyKey]; let param_a16_66 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_66 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[067]']; candyValue = details[candyKey]; let param_a16_67 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_67 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[068]']; candyValue = details[candyKey]; let param_a16_68 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_68 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['AL[069]']; candyValue = details[candyKey]; let param_a16_69 = '-'; if (typeof candyValue !== 'undefined' && candyValue != '') { // console.log(candyValue); param_a16_69 = Math.round(hexToDec(candyValue)/100); } candyKey = CANDY['ZteBmsAccumulativeChargingEnergy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kWh'); } candyKey = CANDY['ZteBmsCellVoltageAverage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteBmsCellVoltageMax']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteBmsCellVoltageMin']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteBmsPackCurrent']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' A'); } candyKey = CANDY['ZteBmsPackVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteBmsResidualEnergy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kWh'); } candyKey = CANDY['ZteBmsSoc']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + '%'); } candyKey = CANDY['ZteBmsSoh']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + '%'); } candyKey = CANDY['ZteBmsResidualEnergy']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kWh'); } candyKey = CANDY['ZteBrakePedalPosition']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + '%'); } // ZteOutputShaftBasedVehicleSpeed candyKey = CANDY['ZteOutputShaftBasedVehicleSpeed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { let sbi = $('#sbi-' + candyKey); if (candyValue > 90) shadow = SHADOW_RED; else if (candyValue > 75) shadow = SHADOW_YELLOW; else shadow = ''; sbi.html(Math.round(candyValue) + ' km/h'); sbi.css('text-shadow', shadow); } candyKey = CANDY['ZteRegenerationInstantaneousPower']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kW'); } candyKey = CANDY['ZteDcDcOutputCurrent']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' A'); } candyKey = CANDY['ZteDcDcTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteFrontAirPressure']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kPa'); } candyKey = CANDY['ZteIcuFaultCode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteMotorControllerTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteMotorSpeed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' rpm'); } candyKey = CANDY['ZteMotorTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZtePowerBatteryVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteRcuFaultCode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteRearAirPressure']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kPa'); } candyKey = CANDY['ZteRemainTravelRange']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteTms1FaultCode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteTms1InletWaterTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteTms1OutletWaterTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteVcuFaultCode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteVehicleStatus']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteDcDcInputPower']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kW'); } candyKey = CANDY['ZteDcDcOutputVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteDriveSystemInstantaneousPower']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kW'); } candyKey = CANDY['ZteMotorControllerDCInputCurrent']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' A'); } candyKey = CANDY['ZteMotorControllerDCInputVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['ZteTms1OutputPower']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' kW'); } candyKey = CANDY['ZteTotalMileage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' km'); } candyKey = CANDY['ZteVehicleSpeed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' km/h'); } candyKey = CANDY['ZteBmsAccumulativeChargingTime']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' min'); } candyKey = CANDY['ZteBmsCellSamplingTmperatureMax']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteAirPumpTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteBmsCellTemperatureAverage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['ZteRcuDcInputVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } candyKey = CANDY['SolarisBatterySOC']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + '%'); } candyKey = CANDY['SolarisElectricMotor1Temperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['SolarisHeatingLiquidTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['SolarisBatteryTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['SolarisBatteryTemperatureMultiplexor']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongHighVoltageEmergencyStopSwitchStatus']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongOperatingMode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongSystemFailureLevel']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongVehicleStatus']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongCurrentGear']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['ZteAc1WorkMode']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongSOC']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' %'); } candyKey = CANDY['KingLongDcDcStatus']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongDcDcTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['KingLongMaximumTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['KingLongMinimumTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['KingLongMaximumTemperatureProbeSerialNumber']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongMinimumTemperatureProbeSerialNumber']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue); } candyKey = CANDY['KingLongMotor1ControllerTemperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['KingLongMotor1Temperature']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' ℃'); } candyKey = CANDY['KingLongMotor1Speed']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' rpm'); } candyKey = CANDY['KingLongTotalBatteryCurrent']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' A'); } candyKey = CANDY['KingLongTotalBatteryVoltage']; candyValue = details[candyKey]; if (typeof candyValue !== 'undefined' && candyValue != '') { $('#sbi-' + candyKey).html(candyValue + ' V'); } // Brake Wear $('#sbi-brakewear').html( getBrakeWear(details) ); // BrakeApplicationPressure $('#sbi-brakeapplpress').html( getBrakeApplicationPressure(details) ); // ServiceBrakeCircuitAirPressure $('#sbi-brakecircpress').html( getServiceBrakeCircuitAirPressure(details) ); //TellTaleZTE if (/SV\d{2}PMS/.test(SelectedVehicle) || /SV\d{2}TSV/.test(SelectedVehicle)) { $('#selected-bus-telltale > div.trouble-code').html(getTroubleCode(details, SelectedVehicle)); } } // ================================================================================================= function getTroubleCode(data, SelectedVehicle) { let html = ''; let code = ''; const alarms = [ { cod: 'ok', descript: "Zte24VBatteryLowVoltageFault", description: "24VBattLowVoltageFault" }, { cod: 'inactive', descript: "ZteAbsOffRoadSwitch", description: "AbsOffRoadSwitch" }, { cod: 'ok', descript: "ZteAc1CompressorDriveFault", description: "Ac1CompressorDriveFault" }, { cod: 'ok', descript: "ZteAc1InternalFanFault", description: "Ac1InternalFanFault" }, { cod: 'ok', descript: "ZteAc1LowPressure", description: "Ac1LowPressure" }, { cod: 'ok', descript: "ZteAc2CompressorDriveFault", description: "Ac2CompressorDriveFault" }, { cod: 'ok', descript: "ZteAc2IntakeTemperatureSensorFault", description: "Ac2IntakeTempSensorFault" }, { cod: 'ok', descript: "ZteAc2InternalFanFault", description: "Ac2InternalFanFault" }, { cod: 'normal', descript: "ZteAcceleratorPedalFault", description: "AcceleratorPedalFault" }, { cod: 'normal', descript: "ZteAirPressureLowFault", description: "AirPressureLowFault" }, //{ cod: 'inactive', descript: "ZteAsrOffRoadSwitch", description: "AsrOffRoadSwitch" }, { cod: 'ok', descript: "ZteBmsConsistencyFault", description: "BmsConsistencyFault" }, //{ cod: '0', descript: "ZteBmsFaultCodeLevel1", description: "BmsFaultCodeLevel1" }, //{ cod: '0', descript: "ZteBmsFaultCodeLevel2", description: "BmsFaultCodeLevel2" }, //{ cod: '0', descript: "ZteBmsFaultCodeLevel3", description: "BmsFaultCodeLevel3" }, { cod: 'ok', descript: "ZteBmsFaultLevel", description: "BmsFaultLevel" }, { cod: 'ok', descript: "ZteBmsTemperatureDifferenceFault", description: "BmsTemperatureDifferenceFault" }, { cod: 'ok', descript: "ZteCoolantLevelLowWarning", description: "CoolantLevelLowWarning" }, { cod: '0', descript: "ZteDcDcFaultCode", description: "DcDcFaultCode" }, { cod: 'ok', descript: "ZteDoorPumpEmergencyValveWarning", description: "DoorPumpEmgcyValveWarning" }, { cod: 'ok', descript: "ZteFrontAxleBrakeAirPressureWarning", description: "FAxleBrakeAirPressureWarning" }, { cod: '0', descript: "ZteIcuFaultCode", description: "IcuFaultCode" }, { cod: 'ok', descript: "ZteIcuFaultLevel", description: "IcuFaultLevel" }, { cod: 'ok', descript: "ZteInstrumentControlUnitFault", description: "InstrumControlUnitFault" }, { cod: 'valid', descript: "ZteKeyOnStatus", description: "KeyOnStatus" }, { cod: 'ok', descript: "ZteLeftFrontBrakeLiningWearWarning", description: "LFrontBrakeLiningWearWarning" }, { cod: 'ok', descript: "ZteLeftRearBrakeLiningWearWarning", description: "LRearBrakeLiningWearWarning" }, { cod: 'ok', descript: "ZteLeftSeatWarning", description: "LeftSeatWarning" }, { cod: 'off', descript: "ZteLeftTurnLampStatus", description: "LeftTurnLampStatus" }, { cod: 'off', descript: "ZteLowBeamStatus", description: "LowBeamStatus" }, { cod: 'closed', descript: "ZteMiddleDoorStatus", description: "MiddleDoorStatus" }, { cod: 'ok', descript: "ZteRightFrontBrakeLiningWearWarning", description: "RFrontBrakeLiningWearWarning" }, { cod: 'ok', descript: "ZteRightRearBrakeLiningWearWarning", description: "RRearBrakeLiningWearWarning" }, { cod: 'ok', descript: "ZteSafetyBeltWarning", description: "SafetyBeltWarning" }, ]; html += ''; let rows = [ [], [], [] ]; alarms.forEach((alarm, index) => { const sclass = (typeof data[CANDY[alarm.descript]] !== 'undefined' && data[CANDY[alarm.descript]] == alarm.cod) ? 'grey' : 'green'; const cell = ``; // Distribuie descrierile în 2 rânduri rows[Math.floor(index / 10)].push(cell); //console.log(rows); }); // Adaugă rândurile în tabel rows.forEach(row => { html += '' + row.join('') + ''; }); html += '
${alarm.description}
'; return html; } function formatGpsBearing(data) { if (parseInt(data) > 337.5) { return "N"; } if (parseInt(data) > 292.5) { return "NW"; } if (parseInt(data) > 247.5) { return "W"; } if (parseInt(data) > 202.5) { return "SW"; } if (parseInt(data) > 157.5) { return "S"; } if (parseInt(data) > 112.5) { return "SE"; } if (parseInt(data) > 67.5) { return "E"; } if (parseInt(data) > 22.5) { return "NE"; } return "N"; } function getBrakeWear(data) { var names = ['Fata stanga', 'Fata dreapta', 'Spate stanga', 'Spate dreapta']; var params = [ ['EvobusFrontAxleLeftBrakeLiningWear', 'BrakeLiningRemainingFrontAxleLeftWheel'], ['EvobusFrontAxleRightBrakeLiningWear', 'BrakeLiningRemainingFrontAxleRightWheel'], ['EvobusDriveAxleLeftBrakeLiningWear', 'BrakeLiningRemainingRearAxle1LeftWheel'], ['EvobusDriveAxleRightBrakeLiningWear', 'BrakeLiningRemainingRearAxle1RightWheel'], ['EvobusAuxiliaryAxleLeftBrakeLiningWear', 'BrakeLiningRemainingRearAxle2LeftWheel'], ['EvobusAuxiliaryAxleRightBrakeLiningWear', 'BrakeLiningRemainingRearAxle2RightWheel'] ]; var brakeWear; var html = '
'; params.forEach(function(param, key) { brakeWear = Math.round(data[CANDY[param[0]]] + data[CANDY[param[1]]]); if (brakeWear > 0) { html += ''; html += ''; html += ''; html += ''; } }); html += '
' + names[key] + '  ' + brakeWear + ' %
'; return html; } function getBrakeApplicationPressure(data) { var names = ['Fata stanga', 'Fata dreapta', 'Spate stanga', 'Spate dreapta']; var params = [ 'BrakeApplicationPressureHighRangeFrontAxleLeftWheel', 'BrakeApplicationPressureHighRangeFrontAxleRightWheel', 'BrakeApplicationPressureHighRangeRearAxle1LeftWheel', 'BrakeApplicationPressureHighRangeRearAxle1RightWheel', ]; var html = '
'; params.forEach(function(param, key) { html += ''; html += ''; html += ''; html += ''; }); html += '
' + names[key] + '  ' + data[CANDY[param]] + '
'; return html; } function getServiceBrakeCircuitAirPressure(data) { var names = ['Circuit 1', 'Circuit 2']; var params = [ 'ServiceBrakeCircuit1AirPressure', 'ServiceBrakeCircuit2AirPressure', ]; var html = '
'; params.forEach(function(param, key) { html += ''; html += ''; html += ''; html += ''; }); html += '
' + names[key] + '  ' + data[CANDY[param]] + '
'; return html; } function To_HH_MM(str) { let time = parseInt(str); let hh = (time / 3600).toFixed(0); let mm = (time % 3600 / 60).toFixed(0); return `${hh}h ${mm}m`; // 5h 4m } function hexToDec(hexString){ return parseInt(hexString, 16); }