HOME Kühlmitteltemperatur [°C] Ladelufttemp. [°C] Drehzahl [U/min] Anhebung Leerlaufdrehzahl [u/min] Drehmoment [Nm]: Batteriespannung [V] Generatorlast [%] Zuheizer PWM [%] Ladedruck Ist [mbar] Ladedruck Soll [mbar] Luftdruck [mbar] Luftmasse [mg/Hub] Einspritzmenge [mg] Raildruck Ist [bar] Raildruck Soll [bar] Geschwindigkeit [km/h] Beschleunigung [m/s²] Kupplungsschalter Klimakompressor Klima Bereitschaft TÖNS Heizzeit [ms] TÖNS Kühlzeit [ms] HOME coolant [°C] charge air temperature [°C] engine speed [U/min] increase idle speed [rpm] torque [Nm]: voltage [V] alternator load [%] aux heater PWM [%] target boost pressure [mbar] act. boost pressure [mbar] air pressure [mbar] air mass [mg/stroke] Einspritzmenge [mg] act. rail pressure [bar] Raildruck Soll [bar] speed [km/h] acceleration [m/s²] Clutch switch AC compressor AC in standby TÖNS heating time [ms] TÖNS cooling time [ms] > resultSets_Abgleich; List> resultSets_JobSgbd2; public void ExecuteJob(EdiabasNet ediabas, ref MultiMap resultDict, bool firstCall) { List> resultSets; if(firstCall || currSgbd != 0) { currSgbd = 0; ediabas.ResolveSgbdFile(conf_sgbds[0]); //ediabas.ArgString = string.Empty; //ediabas.ArgBinaryStd = null; //ediabas.ResultsRequests = string.Empty; //ediabas.ExecuteJob("INITIALISIERUNG"); } // Job 1 - ständig zu aktualisierende Werte ediabas.ArgString = "JA;ILMMG;IPLAD;IPUMG;IUBAT;IMOAK;INMOT;SPLAD;ITKUM;ITLAL;IPRDR;IAFZG;IVKMH;ITZUH;IGENL;RSKUP;IKLIS;IBKLI;SPRDR;IMEIA"; ediabas.ArgBinaryStd = null; ediabas.ResultsRequests = string.Empty; ediabas.ExecuteJob("STATUS_MESSWERTBLOCK_LESEN"); resultSets = ediabas.ResultSets; if (resultSets != null && resultSets.Count >= 2) { EdiabasThread.MergeResultDictionarys(ref resultDict, resultSets[1]); } // Job 2 - wird nur bei jedem X-ten Durchlauf ausgeführt (definiert von [conf_counter_Job2_max]) // Ergebnisse werden in globaler Variable vorgehalten und die letzten Werte in jedem Durchlauf ausgegeben if(counter_Job2 == 0) { ediabas.ArgString = "lla"; ediabas.ArgBinaryStd = null; ediabas.ResultsRequests = string.Empty; ediabas.ExecuteJob("ABGLEICH_LESEN"); resultSets_Abgleich = ediabas.ResultSets; counter_Job2++; } else if(counter_Job2 >= conf_counter_Job2_max) { counter_Job2 = 0; } else { counter_Job2++; } // da diese Werte nicht in jedem Durchlauf vom Steuergerät gelesen werden sind die Ergebnisdaten in einer // globalen Variablen gespeichert und werden jedesmal übernommen, auch wenn nicht ganz aktuell if (resultSets_Abgleich != null && resultSets_Abgleich.Count >= 2) { EdiabasThread.MergeResultDictionarys(ref resultDict, resultSets_Abgleich[1], "LLA_"); } // Eingangswerte für automatische Leerlaufanhebung holen EdiabasNet.ResultData resultData; // Kupplungsschalter bool mom_Kupplung = false; if (resultSets[1].TryGetValue("STAT_KUPPLUNGSSCHALTER_ROH_WERT", out resultData)) { if (resultData.OpData is Double) { if(((Double)resultData.OpData) > 0.0) mom_Kupplung = true; } } // Klimakompressor bool mom_Klimakompressor = false; if (resultSets[1].TryGetValue("STAT_KLIMAKOMPRESSOR_STATUS_WERT", out resultData)) { if (resultData.OpData is Double) { if(((Double)resultData.OpData) > 0.0) mom_Klimakompressor = true; } } // Klima-Bereitschaft bool mom_KlimaBereitschaft = false; if (resultSets[1].TryGetValue("STAT_BEREITSCHAFT_KLIMA_WERT", out resultData)) { if (resultData.OpData is Double) { if(((Double)resultData.OpData) > 0.0) mom_KlimaBereitschaft = true; } } // Zuheizer-Ansteuerung Double mom_Zuheizer_PWM = 0; if (resultSets[1].TryGetValue("STAT_ZUHEIZER_ANSTEUERUNG_WERT", out resultData)) { if (resultData.OpData is Double) { mom_Zuheizer_PWM = ((Double)resultData.OpData); } } // Generatorlast Double mom_Generatorlast_PWM = 0; if (resultSets[1].TryGetValue("STAT_GENERATORLAST_WERT", out resultData)) { if (resultData.OpData is Double) { mom_Generatorlast_PWM = ((Double)resultData.OpData); } } // Motortemperatur Double mom_MotorTemp = 0; if (resultSets[1].TryGetValue("STAT_KUEHLMITTELTEMPERATUR_WERT", out resultData)) { if (resultData.OpData is Double) { mom_MotorTemp = ((Double)resultData.OpData); } } // Abgleichwert Leerlaufanhebung if (resultSets_Abgleich[1].TryGetValue("LLA_ABGLEICH_LESEN_WERT", out resultData)) { if (resultData.OpData is Double) { LLA_momentan = (int)((Double)resultData.OpData); } } // Automatische Leerlaufanhebung int LLA_neu = 0; // Kupplungsschalter // der countdown dient dazu dass die Leerlaufanhebung erst zurückgenommen wird, // wenn die Kupplung schon eine Zeit lang nicht betätigt ist if (mom_Kupplung || status_Kupplung) { if(mom_Kupplung) countdown_Kupplung = conf_countdown_Kupplung_max; if(!status_Kupplung) status_Kupplung = true; if(conf_LLA_Kupplung > LLA_neu) LLA_neu = conf_LLA_Kupplung; } if (countdown_Kupplung > 0){ countdown_Kupplung--; } else if (countdown_Kupplung == 0){ countdown_Kupplung = -1; status_Kupplung = false; if(conf_LLA_Basis > LLA_neu) LLA_neu = conf_LLA_Basis; } // Zuheizer // der countdown dient dazu dass die Leerlaufanhebung erst zurückgenommen wird, // wenn der Zuheizer schon eine Zeit lang inaktiv ist (also z.B. nicht nur kurz wegen zu hoher Generatorlast abgeschaltet wurde) if (mom_Zuheizer_PWM > conf_ZuheizerAnAb || status_Zuheizer) { if(mom_Zuheizer_PWM > conf_ZuheizerAnAb) countdown_ZuheizerAn = conf_countdown_ZuheizerAn_max; if(!status_Zuheizer) status_Zuheizer = true; if(conf_LLA_Zuheizer > LLA_neu) LLA_neu = conf_LLA_Zuheizer; } if (countdown_ZuheizerAn > 0) { countdown_ZuheizerAn--; } else if (countdown_ZuheizerAn == 0) { countdown_ZuheizerAn = -1; status_Zuheizer = false; if(conf_LLA_Basis > LLA_neu) LLA_neu = conf_LLA_Basis; } // Generatorlast if (mom_Generatorlast_PWM > conf_GeneratorlastSehrHochAb || status_GeneratorlastSehrHoch) { if(mom_Generatorlast_PWM > conf_GeneratorlastSehrHochAb) countdown_Generatorlast = conf_countdown_Generatorlast_max; if(!status_GeneratorlastSehrHoch) status_GeneratorlastSehrHoch = true; if(conf_LLA_GeneratorlastSehrHoch > LLA_neu) LLA_neu = conf_LLA_GeneratorlastSehrHoch; } else if (mom_Generatorlast_PWM > conf_GeneratorlastHochAb || status_GeneratorlastHoch) { if(mom_Generatorlast_PWM > conf_GeneratorlastHochAb) countdown_Generatorlast = conf_countdown_Generatorlast_max; if(!status_GeneratorlastHoch) status_GeneratorlastHoch = true; if(conf_LLA_GeneratorlastHoch > LLA_neu) LLA_neu = conf_LLA_GeneratorlastHoch; } if (countdown_Generatorlast > 0) { countdown_Generatorlast--; } else if (countdown_Generatorlast == 0) { countdown_Generatorlast = -1; status_GeneratorlastHoch = false; status_GeneratorlastSehrHoch = false; if(conf_LLA_Basis > LLA_neu) LLA_neu = conf_LLA_Basis; } // Klimakompressor und Klimabereitschaft if (mom_Klimakompressor) { if(conf_LLA_Klimakompressor > LLA_neu) LLA_neu = conf_LLA_Klimakompressor; } else if (mom_KlimaBereitschaft) { if(conf_LLA_KlimaBereitschaft > LLA_neu) LLA_neu = conf_LLA_KlimaBereitschaft; } // Drehzahlanhebung je nach Motortemperatur, if(mom_MotorTemp < conf_Temp_MotorSehrKaltBis) { // Motor ist sehr kalt status_MotorBetriebstemp = false; if(conf_LLA_MotorSehrKalt > LLA_neu) LLA_neu = conf_LLA_MotorSehrKalt; } else if(mom_MotorTemp < conf_Temp_MotorKaltBis) { // Motor ist kalt status_MotorBetriebstemp = false; if(conf_LLA_MotorKalt > LLA_neu) LLA_neu = conf_LLA_MotorKalt; } else if(mom_MotorTemp >= conf_Temp_MotorKaltBis && mom_MotorTemp < conf_Temp_MotorBetriebstempAb) { // Motor ist nicht mehr kalt, aber noch nicht auf Betriebstemperatur status_MotorBetriebstemp = false; if(conf_LLA_MotorVorBetriebstemp > LLA_neu) LLA_neu = conf_LLA_MotorVorBetriebstemp; } else if(mom_MotorTemp >= conf_Temp_MotorBetriebstempAb && mom_MotorTemp < conf_Temp_MotorHeissAb && !status_MotorHeiss) { // Motor ist auf Betriebstemperatur status_MotorBetriebstemp = true; if(conf_LLA_MotorBetriebstemp > LLA_neu) LLA_neu = conf_LLA_MotorBetriebstemp; } else if(mom_MotorTemp >= conf_Temp_MotorBetriebstempAb && mom_MotorTemp < conf_Temp_MotorBetriebstempBis && status_MotorHeiss) { // Temperatur ist nachdem Status HEISS wieder weit genug gefallen -> Betriebstemperatur status_MotorHeiss = false; status_MotorBetriebstemp = true; if(conf_LLA_MotorBetriebstemp > LLA_neu) LLA_neu = conf_LLA_MotorBetriebstemp; } else if(mom_MotorTemp >= conf_Temp_MotorHeissAb) { // Motor ist HEISS -> weitere LL Anhebung um die Kühlung zu verbessern aktivieren // deaktivierung sobald die Temperatur wieder unter [conf_Temp_MotorBetriebstempBis] gefallen ist status_MotorHeiss = true; status_MotorBetriebstemp = false; if(conf_LLA_MotorHeiss > LLA_neu) LLA_neu = conf_LLA_MotorHeiss; } // Motor auf Betriebstemperatur - reduziere LL auf minimum "conf_LLA_Basis" nach einiger Zeit if(status_MotorBetriebstemp && LLA_neu == conf_LLA_MotorBetriebstemp) { if(countdown_LLA_aus == 0) { LLA_neu = conf_LLA_Basis; } else if(countdown_LLA_aus > 0) { countdown_LLA_aus--; } } else { countdown_LLA_aus = conf_countdown_LLA_aus; } // wenn der Ziel-LLA-Wert sich vom aktuell eingestellten unterscheidet -> Abgleich verstellen if (LLA_momentan != LLA_neu) { ediabas.ArgString = "lla;" + LLA_neu; ediabas.ArgBinaryStd = null; ediabas.ResultsRequests = "JOB_STATUS"; ediabas.ExecuteJob("ABGLEICH_VERSTELLEN"); //resultSets = ediabas.ResultSets; //if (resultSets != null && resultSets.Count >= 2) //{ // EdiabasThread.MergeResultDictionarys(ref resultDict, resultSets[1]); //} // Ablaufvariable wieder zurücksetzen, sonst würde diese funktion nun bei jedem folgenden durchlauf ausgeführt werden... LLA_momentan = LLA_neu; conf_counter_Job2_max = 0; } // Job SGBD 2 if(counter_JobSgbd2 == 0) { counter_JobSgbd2++; try { // try/catch, damit nicht der ganze Durchlauf abgebrochen und // gar keine Daten zurückgeliefert werden, falls das Steuergerät nicht // antwortet. currSgbd = 1; ediabas.ResolveSgbdFile(conf_sgbds[currSgbd]); //ediabas.ArgString = string.Empty; //ediabas.ArgBinaryStd = null; //ediabas.ResultsRequests = string.Empty; //ediabas.ExecuteJob("INITIALISIERUNG"); ediabas.ArgString = string.Empty; ediabas.ArgBinaryStd = null; ediabas.ResultsRequests = string.Empty; ediabas.ExecuteJob("STATUS_TOENS_IO"); resultSets_JobSgbd2 = ediabas.ResultSets; } catch { // dann halt nicht } } else if (counter_JobSgbd2 >= conf_counter_JobSgbd2_max) { counter_JobSgbd2 = 0; } else { counter_JobSgbd2++; } if (resultSets_JobSgbd2 != null && resultSets_JobSgbd2.Count >= 2) { EdiabasThread.MergeResultDictionarys(ref resultDict, resultSets_JobSgbd2[1]); } } public string FormatResult(JobReader.PageInfo pageInfo, MultiMap resultDict, string resultName, ref Android.Graphics.Color? textColor) { string result = string.Empty; double value; bool found; switch (resultName) { case "STAT_MOTORDREHZAHL_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,4:0}", value); // Liste der möglichen Farbnamen: https://docs.microsoft.com/en-us/dotnet/api/android.graphics.color?view=xamarin-android-sdk-9 if (found && value <= 4000) textColor = Android.Graphics.Color.White; else if (found && value <= 4250) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 4500) textColor = Android.Graphics.Color.Orange; else if (found && value > 4500) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; case "STAT_UBATT_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,4:0.0}", value); if (found && value < 10.5) textColor = Android.Graphics.Color.Red; else if (found && value < 11.5) textColor = Android.Graphics.Color.Orange; else if (found && value <= 12.5) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 13.2) textColor = Android.Graphics.Color.Gray; else if (found && value <= 14.5) textColor = Android.Graphics.Color.White; else if (found && value > 14.5) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; case "STAT_GENERATORLAST_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,3:0}", value); if (found && value <= 60) textColor = Android.Graphics.Color.White; else if (found && value <= 70) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 80) textColor = Android.Graphics.Color.Orange; else if (found && value > 80) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; case "STAT_ZUHEIZER_ANSTEUERUNG_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); // result format: {0,[DIGITS TOTAL INCL COMMA],[0|0.0|0.00|0.000...]} result = string.Format(ActivityMain.Culture, "{0,3:0}", value); if (found && value <= 60) textColor = Android.Graphics.Color.White; else if (found && value <= 70) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 80) textColor = Android.Graphics.Color.Orange; else if (found && value > 80) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; case "STAT_KUEHLMITTELTEMPERATUR_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); result = string.Format(ActivityMain.Culture, "{0,3:0}", value); if (found && value < 75) textColor = Android.Graphics.Color.Blue; else if (found && value <= 105) textColor = Android.Graphics.Color.White; else if (found && value <= 110) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 115) textColor = Android.Graphics.Color.Orange; else if (found && value > 115) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; case "STAT_LADELUFTTEMPERATUR_WERT": value = ActivityMain.GetResultDouble(resultDict, resultName, 0, out found); result = string.Format(ActivityMain.Culture, "{0,3:0}", value); if (found && value <= 55) textColor = Android.Graphics.Color.White; else if (found && value <= 65) textColor = Android.Graphics.Color.Yellow; else if (found && value <= 75) textColor = Android.Graphics.Color.Orange; else if (found && value > 85) textColor = Android.Graphics.Color.Red; else textColor = Android.Graphics.Color.Gray; break; } return result; } } ]]>