creata timeline con tempi in decimi

This commit is contained in:
andrea
2026-05-02 13:05:31 +02:00
parent a9e6c6c640
commit 18437a0c9c
120 changed files with 234587 additions and 64394 deletions

View File

@@ -35,30 +35,40 @@ m2pwmMan= 70
m3pwmMan= 40
m4pwmMan= 40
trampman= 50
tramp= 100
tramp= 10
apM1start= 310
apM1stop= 450
apM2start= 30
apM2stop= 310
apM3start= 350
apM3stop= 450
apM4start= 450
apM4stop= 850
# Ogni fase è:
# (tempo_inizio, tempo_fine, velocita_iniziale, velocita_finale)
motori = {
"Motore1": [
(0, 300, 0, 80), # rampa salita
(300, 700, 80, 80), # mantenimento
(700, 900, 80, 0) # rampa discesa
(apM1start, apM1start+tramp, m1rampstart, m1pwmap),
(apM1start+tramp, apM1stop, m1pwmap, m1pwmap),
(apM1stop, apM1stop+tramp, m1pwmap, 0)
],
"Motore2": [
(20, 20+tramp, m2rampstart, m2pwmap),
(20+tramp, 20+tramp+t1ap, m2pwmap, m2pwmap),
(20+tramp+t1ap, 20+tramp+t1ap+tramp, m2pwmap, 0)
(apM2start, apM2start+tramp, m2rampstart, m2pwmap),
(apM2start+tramp, apM2stop, m2pwmap, m2pwmap),
(apM2stop, apM2stop+tramp, m2pwmap, 0)
],
"Motore3": [
(1800, 2100, 0, 100),
(2100, 2600, 100, 100),
(2600, 2900, 100, 0)
(apM3start, apM3start+tramp, m3rampstart, m3pwmap),
(apM3start+tramp, apM3stop, m3pwmap, m3pwmap),
(apM3stop, apM3stop+tramp, m3pwmap, 0)
],
"Motore4": [
(2900, 3200, 0, 50),
(3200, 3600, 50, 50),
(3600, 3900, 50, 0)
(apM4start, apM4start+tramp, m4rampstart, m4pwmap),
(apM4start+tramp, apM4stop, m4pwmap, m4pwmap),
(apM4stop, apM4stop+tramp, m4pwmap, 0)
]
}
@@ -187,6 +197,12 @@ tasto = [
fig, ax = plt.subplots(figsize=(13, 6))
colori = {
"Motore1": "blue",
"Motore2": "lightgreen",
"Motore3": "orange",
"Motore4": "purple"
}
# Motori: linee di velocità
for nome, fasi in motori.items():
tempi = []
@@ -199,10 +215,10 @@ for nome, fasi in motori.items():
tempi.extend(t)
velocita.extend(v)
ax.plot(tempi, velocita, marker="o", markersize=2, label=nome)
ax.plot(tempi, velocita, marker="o", markersize=2, label=nome, color=colori[nome])
# Buzzer: riga separata in basso
y_buzzer = -15
y_buzzer = -10
for start, end in buzzer:
ax.broken_barh(
@@ -222,7 +238,7 @@ ax.text(
)
# tasto: riga separata in basso
y_tasto = -35
y_tasto = -20
for start, end in tasto:
ax.broken_barh(
@@ -245,11 +261,11 @@ ax.text(
# FORMATTAZIONE
# =========================
ax.set_xlabel("Tempo (ms)")
ax.set_xlabel("Tempo (decimi di secondo)")
ax.set_ylabel("Velocità motore (%)")
ax.set_title("Timeline motori con rampe + buzzer")
ax.set_title("Timeline APERTURA motori con rampe + buzzer")
ax.set_ylim(-50, 110)
ax.set_ylim(-20, 110)
ax.grid(True)
ax.legend()