Intern Python-programma voor het automatisch analyseren van wissellogs binnen HTM Techniek. Het systeem decodeert hex-logs, converteert deze naar interpreteerbare statusinformatie en visualiseert alles via een webgebaseerde dashboard.
sudo apt update
sudo apt install python3-pip vim
pip install jupyterlab
# Jupyter configureren
jupyter-lab --generate-config
vim ~/.jupyter/jupyter_lab_config.py
c.ServerApp.allow_origin = '*'
c.ServerApp.ip = '*'
# Anaconda installeren
wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
bash Anaconda3-2021.11-Linux-x86_64.sh
source ~/.bashrc
# Streamlit installeren
conda install -c conda-forge streamlit
sudo vim /etc/systemd/system/jupyter-lab.service
[Unit]
Description=jupyter-lab
After=network.target
[Service]
Type=simple
User=sky
ExecStart=/home/sky/.local/bin/jupyter-lab
ExecStop=/usr/bin/pkill /home/sky/.local/bin/jupyter-lab
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable jupyter-lab
sudo systemctl start jupyter-labsqlalchemy– ORM-verbinding voor databaseopslagpandas– voor dataframe-verwerkingmultiprocessing– om parallelle verwerking te ondersteunencryptocode– voor versleuteling en decodingconfigparser– voor .ini-bestandsinvoerre– reguliere expressies voor loganalyse
streamlit– webgebaseerde dashboards en gebruikersinterfaceplotly– interactieve grafiekenfpdf– genereren van PDF-rapportentempfile– tijdelijke bestandsopslag tijdens exports
graph LR
log[Logbestand] --> rl[read_log]
rl --> conver_data
HkConfig --> conver_data
conver_data -->|Opslaan in SQL| DataBase
DataBase -->|GetData.py| Show
Show -->|streamlit| browser[Toon in browser]
-
Config.pyline_to_hex: leest logbestand en splitst hex-codes in een lijstlist_to_str: voegt lijst van hex-codes samen tot stringhex_to_bin: zet hexadecimale codes om naar binaire vormconvert_data: vertaalt binaire status naar wisselstatus op basis van configbestandwissel_version: laadt correct configuratiebestand op basis van wisselnummer
-
ImportIni.pybit_config: zet statusbits om volgens .ini-bestand, gebruikt doorconvert_databyte_config: zet bytegegevens van voertuigen om via .ini-logica
-
ImportLog.pyread_log: leest ruwe loggegevens uit bestandconver_data: converteert logregels via HkConfigmapping_df_types: zet kolomtypes correct in pandas DataFramelog_to_sql: slaat verwerkte data op in een SQLite3 databaseset_steps_denbdb3c: herkentdenbdb3ctype wissels en hun statusprocess_log_sql: volledige verwerking van één of meerdere logs
-
VerSelect.pyget_version: geeft versienaam van een wissel-ID terugget_wissel_type_nr: haalt alle wissels op die tot een bepaald type behoren
ConnectDB.pyconn_engine: maakt SQLAlchemy engine voor SQLite3 aan- Verantwoordelijk voor lezen en schrijven van gegevens naar de database
tram_speed.pyvoertuig_lent: invoer voor tramlengtes per typetram_speed_to_sql: berekent snelheid van trams en schrijft naar database
RunText.py: hoofduitvoerscript voor testomgevingRunVM.py: productie-uitvoering met logging en foutafhandeling
-
Get_data.pyget_tram_speed: leest tramsnelheid uit databasecreate_download_link: maakt downloadlink aan voor streamlit
-
index.py: startpunt voor het Streamlit-dashboard -
pages.py: paginaconfiguratie voor een meerbladige UI in Streamlit
+---DataBase
| +---db
| | 2022-06-16.db
| |
| +---norm
| | gps_info.csv
| | steps.db
| |
| +---snelheid
| | 2022-07-05.db
| |
| \---status
| wissel_status.db
|
+---log
| 20220616.log
|
+---Run
| +---bin
| | Rebuilt_dataBase.py
| | RunPupdate.py
| | RunPVM.py
| | RunP_concatDB.py
| | RunP_mergDB.py
| | RunP_mix_speed.py
| | RunP_mix_storing.py
| | RunRmDB.py
| | __init__.py
| |
| +---conf
| | | conf.py
| | | denAHA4C.ini
| |
| |
| | |
| | \---pipfiles
| | AI_storing_check.pkl
| | DTC_model.pkl
| | W003.pkl
| |
| |
| \---core
| +---Analyze
| | analyze_tool.py
| | check_storing_df.py
| | tram_speed.py
| | wissel_schakel.py
| | wissel_storing.py
| | wissel_vrij_list.py
| | __init__.py
| |
| +---ConvertData
| | Config.py
| | ConnectDB.py
| | ImportConf.py
| | ReadLogs.py
| | VerSelect.py
| |
| +---Integration
| | DataCalculator.py
| | DataInitialization.py
| | ProcessDataBase.py
| | __init__.py
| |
| +---LogFilter
| | MountDir.py
| | __init__.py
| |
| \---Tools
| VaribleTool.py
| __init__.py
|
\---Show
| index.py
| pages.py
| __init__.py
|
+---core
| GetData.py
| __init__.py
|
\---sub_pages
| alldata.py
| intro.py
| rapportage.py
| storing.py
| tramspeed.py
| tramspeed_boxplot.py
| Utils.py
| wisselschakel.py
| __init__.py
|
+---rapport_mode
| snelheid_rep.py
| storing_rep.py
|
+---storing_mode
| allstoring.py
| storingdata.py
| unknowstoring.py
|
\---tramspeed_mode
fig_lijn.py
fig_rit.py
fig_voertuig.py
fig_wagen.py
fig_wissel.py
max_waarde.py
waarschuwing.py
- Externe referentie: