Skip to content

Add UTR221_ML_previsao_falha_com.py – 6h pressure prediction during communication failure - #6

Draft
LEUDOLOIOLA with Copilot wants to merge 6 commits into
mainfrom
copilot/previsao-falha-comunicacao
Draft

LEUDOLOIOLA with Copilot wants to merge 6 commits into
mainfrom
copilot/previsao-falha-comunicacao

Conversation

Copilot AI commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Operators need to predict UTR221 pressure behavior for up to 6 hours when communication with the UTR is lost. Previously no script existed for this scenario; the only prediction scripts required live or historical timestamped data from the sensor.

New script: ML APP/UTR221_ML_previsao_falha_com.py

  • Model training: same RandomForest pipeline as UTR221_ML_validacao.py (fit on urt220.xlsx / urt221.xlsx, ~99.62% accuracy)
  • Terminal input: collects all required lag features interactively at runtime
    • Failure timestamp (flexible format: DD/MM/YYYY HH:MM or ISO)
    • B1/B2 pump status from UTR220 (CMB_220_S2A_EST, CMB_220_S2B_EST) — lag 1
    • Level from UTR220 (LIT_220_RA2_000) — lag 1
    • Pressure from UTR221 (PIT_221_S01_000) — lag 1, lag 2, lag 60, and 1-hour rolling mean
  • Recursive prediction: 360 steps (6 h) from the failure timestamp, with pump on/off control logic based on setpoints (1.55 / 1.68 bar)
  • Outputs (named by failure timestamp):
    • previsao_falha_DDMM_HHMM.png — pressure curve + dual-axis pump state + setpoint lines
    • previsao_falha_DDMM_HHMM.xlsx — minute-by-minute predictions
Horário da falha de comunicação (DD/MM/AAAA HH:MM): 11/04/2026 14:35
Status B1 (CMB_220_S2A_EST) [0=desligado / 1=ligado]: 1
Status B2 (CMB_220_S2B_EST) [0=desligado / 1=ligado]: 0
Último nível UTR220 [m]: 1.72
Pressão mais recente       (lag 1, há  1 min) [bar]: 1.65
Pressão anterior            (lag 2, há  2 min) [bar]: 1.64
Pressão há 60 min           (lag 60, há 1 hora) [bar]: 1.60
Média de pressão última hora (60 min)           [bar]: 1.63

Naming fix: feature previously called nivel_221_lag1 (misleading — it carries pressure, not level) renamed to pressao_221_lag1 throughout.

Add dataset inputs, images, documentation and two ML scripts for UTR221 forecasting. Files added under "ML APP - INPUT": raw Excel data (urt220.xlsx, urt221.xlsx), several processed Excel outputs (DF1/DF2/DF3/DF6, previsao_falha_*.xlsx), plot PNGs, and a "Passos" text describing the processing pipeline. Two new Python scripts: UTR221_ML_validacao.py (data loading, feature engineering, RandomForest training, validation, feature importance, and 7‑hour recursive forecasting/exporting) and UTR221_ML_previsao_falha_com.py (interactive terminal input for a communication-failure scenario, trains model and produces a 6‑hour recursive forecast with pump control logic, exporting Excel and PNG results). This commit provides the full inputs and tooling to train, validate and simulate UTR221 pressure forecasts including failure-mode predictions.
A
A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants