diff --git a/docs/mesures/batteries/202609051807-console.txt b/docs/mesures/batteries/202609051807-console.txt new file mode 100644 index 0000000..e6ae03c --- /dev/null +++ b/docs/mesures/batteries/202609051807-console.txt @@ -0,0 +1,45 @@ + +===== 05/09/2026 18:07:51 ===== +data 2 event 1 +data 2 event 1 + @ +----------------------------------------------- + Item Index : 1 +Time : 25-05-23 18:53:44 +Voltage : 53993 mV +Current : 7089 mA +Temperature : 25700 mC +Percent : 100 % +Total Coulomb : 50000 mAH +Max Voltage : 54000 mV +Base State : Charge +Volt. State : High +Curr. State : Normal +Tempr. State : Normal +Coul. Status : Full +Power Events : 0x0 +Bat Events : 0x2 BHV + Bat Protect ENA : BOV BHV BLV BUV BSLP CBOT CBHT CBLT CBUT DBOT DBHT DBLT DBUT + Pwr Protect ENA : POV PHV PLV PUV PSLP POT PHT COC2 COC COCA DOCA DOC DOC2 SC LCOUL +System Fault : 0x0 +----------------------------------------------- + +Battery Volt Curr Tempr Base State Volt. State Curr. State Temp. State Coulomb +0 3589 7089 24600 Charge Normal Normal Normal 100% +1 3604 7089 24600 Charge High Normal Normal 100% +2 3608 7089 24600 Charge High Normal Normal 100% +3 3606 7089 24600 Charge High Normal Normal 100% +4 3559 7089 24600 Charge Normal Normal Normal 100% +5 3607 7089 24800 Charge High Normal Normal 100% +6 3606 7089 24800 Charge High Normal Normal 100% +7 3607 7089 24800 Charge High Normal Normal 100% +8 3603 7089 24800 Charge High Normal Normal 100% +9 3570 7089 24800 Charge Normal Normal Normal 100% +10 3607 7089 24400 Charge High Normal Normal 100% +11 3607 7089 24400 Charge High Normal Normal 100% +12 3604 7089 24400 Charge High Normal Normal 100% +13 3609 7089 24400 Charge High Normal Normal 100% +14 3607 7089 24400 Charge High Normal Normal 100% + Command completed successfully + $$ + pylon_debug> diff --git a/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371425.csv b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371425.csv new file mode 100644 index 0000000..c94421d --- /dev/null +++ b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371425.csv @@ -0,0 +1,13 @@ +heure_reelle,module,etat,courant_mA,soc,c1_mV,c2_mV,c3_mV,c4_mV,c5_mV,c6_mV,c7_mV,c8_mV,c9_mV,c10_mV,c11_mV,c12_mV,c13_mV,c14_mV,c15_mV,ecart_mV +2025-05-23T16:53:42.990Z,Y230202C30371425,Charge,7089,100,3589,3604,3608,3606,3559,3607,3606,3607,3603,3570,3607,3607,3604,3609,3607,50 +2025-05-23T16:53:44.990Z,Y230202C30371425,Charge,13619,100,3640,3655,3660,3658,3606,3660,3657,3658,3654,3618,3661,3658,3654,3661,3660,55 +2025-05-23T17:05:08.990Z,Y230202C30371425,Charge,0,100,3499,3501,3502,3501,3490,3501,3501,3501,3501,3496,3501,3501,3501,3500,3501,12 +2025-05-23T17:05:12.990Z,Y230202C30371425,Charge,0,100,3499,3501,3501,3501,3490,3501,3501,3501,3500,3496,3501,3501,3501,3500,3501,11 +2025-05-23T17:05:14.990Z,Y230202C30371425,Charge,0,100,3499,3501,3501,3501,3490,3501,3500,3501,3500,3496,3501,3501,3501,3500,3501,11 +2025-05-23T17:05:16.990Z,Y230202C30371425,Charge,0,100,3499,3501,3501,3501,3490,3500,3500,3501,3500,3496,3500,3501,3501,3500,3501,11 +2025-05-23T17:05:18.990Z,Y230202C30371425,Charge,0,100,3499,3501,3501,3501,3490,3500,3500,3500,3500,3496,3500,3500,3501,3500,3501,11 +2025-05-23T17:05:20.990Z,Y230202C30371425,Charge,0,100,3499,3501,3501,3500,3490,3500,3500,3500,3500,3495,3500,3501,3501,3500,3501,11 +2025-05-23T17:05:22.990Z,Y230202C30371425,Charge,0,100,3498,3501,3501,3500,3490,3500,3500,3500,3500,3495,3500,3500,3501,3500,3500,11 +2025-05-23T17:05:24.990Z,Y230202C30371425,Charge,0,100,3498,3500,3501,3500,3490,3500,3500,3500,3500,3495,3500,3500,3501,3500,3500,11 +2025-05-23T17:05:26.990Z,Y230202C30371425,Charge,0,100,3498,3500,3501,3500,3489,3500,3500,3500,3500,3495,3500,3500,3500,3500,3500,12 +2025-05-23T17:05:38.990Z,Y230202C30371425,Charge,0,100,3498,3500,3500,3500,3489,3500,3500,3500,3499,3495,3499,3500,3500,3499,3500,11 diff --git a/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371426.csv b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371426.csv new file mode 100644 index 0000000..5968aac --- /dev/null +++ b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371426.csv @@ -0,0 +1,20 @@ +heure_reelle,module,etat,courant_mA,soc,c1_mV,c2_mV,c3_mV,c4_mV,c5_mV,c6_mV,c7_mV,c8_mV,c9_mV,c10_mV,c11_mV,c12_mV,c13_mV,c14_mV,c15_mV,ecart_mV +2025-05-19T22:17:58.857Z,Y230202C30371426,Idle,0,89,3364,3365,3368,3368,3364,3364,3368,3365,3368,3368,3364,3368,3360,3368,3365,8 +2025-05-19T22:55:29.857Z,Y230202C30371426,Idle,-729,89,3375,3375,3375,3376,3374,3375,3376,3375,3376,3375,3375,3376,3370,3376,3374,6 +2025-05-23T16:53:40.857Z,Y230202C30371426,Charge,7205,100,3589,3590,3588,3590,3588,3592,3592,3590,3593,3591,3593,3590,3550,3589,3588,43 +2025-05-23T16:53:42.857Z,Y230202C30371426,Charge,7092,100,3601,3602,3600,3602,3600,3605,3605,3603,3606,3603,3605,3603,3561,3601,3601,45 +2025-05-23T16:53:44.857Z,Y230202C30371426,Charge,14243,100,3653,3653,3650,3653,3652,3657,3655,3653,3657,3655,3658,3654,3606,3652,3653,52 +2025-05-23T17:04:56.857Z,Y230202C30371426,Charge,0,100,3501,3502,3501,3502,3500,3501,3502,3501,3502,3501,3501,3501,3491,3502,3501,11 +2025-05-23T17:05:00.857Z,Y230202C30371426,Charge,0,100,3501,3501,3501,3502,3500,3500,3502,3501,3502,3501,3501,3501,3491,3501,3501,11 +2025-05-23T17:05:02.857Z,Y230202C30371426,Charge,0,100,3501,3501,3501,3502,3500,3500,3502,3501,3501,3501,3501,3501,3491,3501,3500,11 +2025-05-23T17:05:06.857Z,Y230202C30371426,Charge,0,100,3500,3501,3501,3501,3500,3500,3501,3501,3501,3501,3501,3501,3491,3501,3500,10 +2025-05-23T17:05:08.857Z,Y230202C30371426,Charge,0,100,3500,3501,3501,3501,3500,3500,3501,3501,3501,3501,3500,3501,3491,3501,3500,10 +2025-05-23T17:05:10.857Z,Y230202C30371426,Charge,0,100,3500,3501,3501,3501,3500,3500,3501,3500,3501,3500,3500,3501,3491,3501,3500,10 +2025-05-23T17:05:18.857Z,Y230202C30371426,Charge,0,100,3500,3501,3500,3501,3500,3500,3501,3500,3501,3500,3500,3501,3491,3501,3500,10 +2025-05-23T17:05:20.857Z,Y230202C30371426,Charge,0,100,3500,3501,3500,3501,3499,3500,3501,3500,3501,3500,3500,3500,3490,3501,3500,11 +2025-05-23T17:05:22.857Z,Y230202C30371426,Charge,0,100,3500,3500,3500,3501,3499,3500,3501,3500,3501,3500,3500,3500,3490,3501,3500,11 +2025-05-23T17:05:24.857Z,Y230202C30371426,Charge,0,100,3500,3500,3500,3501,3499,3500,3501,3500,3501,3500,3500,3500,3490,3500,3500,11 +2025-05-23T17:05:28.857Z,Y230202C30371426,Charge,0,100,3500,3500,3500,3501,3499,3499,3501,3500,3500,3500,3500,3500,3490,3500,3499,11 +2025-05-23T17:05:30.857Z,Y230202C30371426,Charge,0,100,3499,3500,3500,3500,3499,3499,3501,3500,3500,3500,3500,3500,3490,3500,3499,11 +2025-05-23T17:05:32.857Z,Y230202C30371426,Charge,0,100,3499,3500,3500,3500,3499,3499,3500,3500,3500,3500,3500,3500,3490,3500,3499,10 +2025-05-24T18:44:09.857Z,Y230202C30371426,Idle,17099,92,3378,3377,3376,3377,3376,3376,3376,3375,3375,3376,3378,3377,3377,3377,3377,3 diff --git a/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371431.csv b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371431.csv new file mode 100644 index 0000000..b8987fa --- /dev/null +++ b/docs/mesures/batteries/202609051808-evenements-distant-Y230202C30371431.csv @@ -0,0 +1,7 @@ +heure_reelle,module,etat,courant_mA,soc,c1_mV,c2_mV,c3_mV,c4_mV,c5_mV,c6_mV,c7_mV,c8_mV,c9_mV,c10_mV,c11_mV,c12_mV,c13_mV,c14_mV,c15_mV,ecart_mV +2025-05-23T16:53:42.271Z,Y230202C30371431,Charge,6812,100,3609,3608,3609,3602,3602,3582,3602,3559,3607,3603,3599,3604,3607,3598,3596,50 +2025-05-23T16:53:44.271Z,Y230202C30371431,Charge,13009,100,3654,3652,3652,3644,3646,3623,3644,3597,3650,3646,3643,3647,3650,3640,3639,57 +2025-05-23T17:05:01.271Z,Y230202C30371431,Charge,0,100,3500,3500,3501,3502,3500,3503,3501,3490,3501,3501,3501,3501,3501,3501,3499,13 +2025-05-23T17:05:21.271Z,Y230202C30371431,Charge,0,100,3500,3500,3500,3501,3499,3502,3500,3489,3501,3500,3500,3501,3501,3501,3499,13 +2025-05-23T17:05:25.271Z,Y230202C30371431,Charge,0,100,3499,3499,3500,3501,3499,3501,3500,3489,3500,3500,3500,3500,3501,3500,3498,12 +2025-05-23T17:05:27.271Z,Y230202C30371431,Charge,0,100,3499,3499,3500,3501,3499,3501,3500,3489,3500,3500,3500,3500,3500,3500,3498,12 diff --git a/docs/mesures/batteries/202609051809-evenements-distant-Y230202C30371427.csv b/docs/mesures/batteries/202609051809-evenements-distant-Y230202C30371427.csv new file mode 100644 index 0000000..c4e6ceb --- /dev/null +++ b/docs/mesures/batteries/202609051809-evenements-distant-Y230202C30371427.csv @@ -0,0 +1,2 @@ +heure_reelle,module,etat,courant_mA,soc,c1_mV,c2_mV,c3_mV,c4_mV,c5_mV,c6_mV,c7_mV,c8_mV,c9_mV,c10_mV,c11_mV,c12_mV,c13_mV,c14_mV,c15_mV,ecart_mV +2025-05-23T16:53:43.363Z,Y230202C30371427,Charge,6591,100,3606,3602,3601,3599,3600,3601,3602,3599,3573,3601,3605,3603,3601,3604,3603,33 diff --git a/tools/pylontech-console.mjs b/tools/pylontech-console.mjs index 33e5863..eb334eb 100644 --- a/tools/pylontech-console.mjs +++ b/tools/pylontech-console.mjs @@ -147,7 +147,7 @@ function journal(nom, texte) { return f; } const horodate = () => new Date().toLocaleString('fr-FR', { timeZone: 'Europe/Paris' }); -const tampon = () => new Date().toLocaleString('sv-SE', { timeZone: 'Europe/Paris' }).replace(/[-: ]/g, '').slice(0, 12); +const horodateFichier = () => new Date().toLocaleString('sv-SE', { timeZone: 'Europe/Paris' }).replace(/[-: ]/g, '').slice(0, 12); // -------------------------------------------------------------------- main async function main() { @@ -205,14 +205,14 @@ async function main() { const cmd = arg('commande'); const txt = await commande(l, String(cmd)); console.log(txt); - console.log('--- journalise dans ' + journal(`${tampon()}-console.txt`, + console.log('--- journalise dans ' + journal(`${horodateFichier()}-console.txt`, `\n===== ${horodate()} =====\n${cmd}\n${txt}\n`)); return; } if (arg('historique')) { const depuis = +(arg('depuis', '1')) || 1; - const nom = `${tampon()}-historique.txt`; + const nom = `${horodateFichier()}-historique.txt`; console.log(`Extraction de l'historique a partir de l'enregistrement ${depuis}.`); console.log('Le module en garde 1798, un toutes les 30 minutes : comptez plusieurs minutes.'); const f = journal(nom, `# releve du ${horodate()} sur ${dev}\n`); @@ -252,6 +252,12 @@ async function main() { // Un seul branchement par chaine suffit donc pour tout son historique. if (arg('historique-distant')) { const ad = parseInt(String(arg('historique-distant')), 10); + // Deux tampons distincts vivent dans le BMS. `history` echantillonne + // toutes les 30 minutes sur cinq semaines ; `event` n'enregistre QUE les + // declenchements, a la seconde, et remonte bien plus loin — jusqu'a mai + // 2025 sur ces modules. C'est le second que lit un fabricant. + const tampon = arg('tampon', 'history') === 'event' ? 'event' : 'history'; + const MAX = tampon === 'event' ? 900 : 1800; if (!(ad >= 1 && ad <= 16)) { console.log('Adresse invalide.'); process.exit(1); } // Le decalage se mesure AVANT, car les enregistrements stockes portent @@ -278,15 +284,16 @@ async function main() { console.log('Relancer la commande — la ligne aura eu le temps de se vider.'); process.exit(1); } - const f = path.join(DOSSIER, `${tampon()}-histo-distant-${bc}.csv`); + const f = path.join(DOSSIER, + `${horodateFichier()}-${tampon === 'event' ? 'evenements' : 'histo'}-distant-${bc}.csv`); fs.mkdirSync(DOSSIER, { recursive: true }); fs.writeFileSync(f, 'heure_reelle,module,etat,courant_mA,soc,' + Array.from({ length: 15 }, (_, i) => `c${i + 1}_mV`).join(',') + ',ecart_mV\n'); - console.log(`Module ${bc} (adresse ${ad}) -> ${f}`); + console.log(`Module ${bc} (adresse ${ad}), tampon ${tampon} -> ${f}`); let ecrits = 0, vides = 0; - for (let n = 1; n <= 1800; n++) { - const t = await commande(l, `data ${ad} history ${n}`, 8000); + for (let n = 1; n <= MAX; n++) { + const t = await commande(l, `data ${ad} ${tampon} ${n}`, 8000); const mt = t.match(/Time\s*:\s*(\d\d-\d\d-\d\d \d\d:\d\d:\d\d)/); const cel = cellules(t); if (!mt || !cel || cel.length < 15) { @@ -310,7 +317,7 @@ async function main() { if (arg('suivi')) { const pas = Math.max(10, +(arg('suivi', '30')) || 30); - const nom = `${tampon()}-suivi.csv`; + const nom = `${horodateFichier()}-suivi.csv`; const f = path.join(DOSSIER, nom); fs.mkdirSync(DOSSIER, { recursive: true }); if (!fs.existsSync(f)) { @@ -369,7 +376,7 @@ async function main() { } // Par defaut : un instantane complet. - const nom = `${tampon()}-instantane.txt`; + const nom = `${horodateFichier()}-instantane.txt`; let tout = `# releve du ${horodate()} sur ${dev} a ${VITESSE} bauds\n`; for (const c of ['info', 'stat', 'data']) { const txt = await commande(l, c, 12000);