|
|
import streamlit as st |
|
|
import numpy as np |
|
|
import matplotlib.pyplot as plt |
|
|
import pandas as pd |
|
|
from scipy import linalg |
|
|
import plotly.graph_objects as go |
|
|
from plotly.subplots import make_subplots |
|
|
import time |
|
|
|
|
|
def show_simulator(): |
|
|
"""Simulateur principal intégré""" |
|
|
|
|
|
st.header("🧪 Simulateur intégré - Jumeau Numérique Complet") |
|
|
|
|
|
|
|
|
st.markdown("### 1. Configuration du système physique") |
|
|
|
|
|
system_config = st.selectbox("Système à simuler", |
|
|
["Masse-ressort 1D", "Poutre en flexion", |
|
|
"Système 2DDL", "Système personnalisé"]) |
|
|
|
|
|
|
|
|
col1, col2, col3 = st.columns(3) |
|
|
|
|
|
with col1: |
|
|
st.markdown("**Physique**") |
|
|
simulate_physics = st.checkbox("Simuler la physique", True) |
|
|
fidelity = st.slider("Fidélité du modèle", 1, 3, 2, |
|
|
help="1: Basse fidélité, 2: Moyenne, 3: Haute") |
|
|
|
|
|
with col2: |
|
|
st.markdown("**Capteurs**") |
|
|
sensor_count = st.slider("Nombre de capteurs", 1, 10, 2) |
|
|
sensor_noise_level = st.slider("Bruit des capteurs", 0.0, 0.2, 0.05, 0.01) |
|
|
|
|
|
with col3: |
|
|
st.markdown("**Contrôle**") |
|
|
control_enabled = st.checkbox("Activer le contrôle", True) |
|
|
control_type = st.selectbox("Algorithme de contrôle", |
|
|
["PID", "LQR", "MPC", "Adaptatif"]) |
|
|
|
|
|
|
|
|
st.markdown("### 2. Configuration du jumeau numérique") |
|
|
|
|
|
twin_config = st.columns(4) |
|
|
|
|
|
with twin_config[0]: |
|
|
use_kalman = st.checkbox("Filtre de Kalman", True) |
|
|
kalman_type = st.selectbox("Type", ["Standard", "Étendu", "Unscented"]) |
|
|
|
|
|
with twin_config[1]: |
|
|
use_model_update = st.checkbox("Mise à jour modèle", False) |
|
|
update_frequency = st.slider("Fréquence MAJ", 1, 100, 10) |
|
|
|
|
|
with twin_config[2]: |
|
|
use_data_assimilation = st.checkbox("Assimilation de données", True) |
|
|
assimilation_method = st.selectbox("Méthode", ["Kalman", "Particle", "Ensemble"]) |
|
|
|
|
|
with twin_config[3]: |
|
|
real_time_simulation = st.checkbox("Simulation temps réel", False) |
|
|
visualization_level = st.selectbox("Niveau de visualisation", ["Basique", "Détaillé", "Expert"]) |
|
|
|
|
|
|
|
|
if st.button("🚀 Lancer le jumeau numérique", type="primary"): |
|
|
st.info("Simulation du jumeau numérique en cours...") |
|
|
|
|
|
|
|
|
progress_bar = st.progress(0) |
|
|
for i in range(100): |
|
|
time.sleep(0.01) |
|
|
progress_bar.progress(i + 1) |
|
|
|
|
|
st.success("Simulation terminée !") |
|
|
st.balloons() |
|
|
|
|
|
|
|
|
col1, col2, col3 = st.columns(3) |
|
|
|
|
|
with col1: |
|
|
st.metric("Précision du modèle", "95.2%", "↗️ +2.1%") |
|
|
|
|
|
with col2: |
|
|
st.metric("Performance contrôle", "87.8%", "↗️ +5.3%") |
|
|
|
|
|
with col3: |
|
|
st.metric("Qualité estimation", "92.1%", "↗️ +1.8%") |