emulator: sweep all 4 instruments to full scale maximums (120C, 6000RPM, 180km/h, 16.0V)
This commit is contained in:
parent
8887ab4265
commit
2f58b502ed
1 changed files with 21 additions and 16 deletions
|
|
@ -37,37 +37,42 @@ class VehicleState:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
if self.auto_simulate:
|
if self.auto_simulate:
|
||||||
# 24-second cycle:
|
# 24-second cycle:
|
||||||
# 0 - 8s: Ramp up 800 -> 6000 RPM (Verde -> Amarillo -> Rojo)
|
# 0 - 8s: Ramp up to maximums
|
||||||
# 8 - 12s: Hold at MAX (6000 RPM, redline/escala máxima) for 4s
|
# 8 - 12s: Hold at absolute MAXIMUM on all instruments for 4s
|
||||||
# 12 - 20s: Ramp down 6000 -> 800 RPM (Rojo -> Amarillo -> Verde)
|
# 12 - 20s: Ramp down to idle
|
||||||
# 20 - 24s: Hold at IDLE (800 RPM) for 4s
|
# 20 - 24s: Hold at IDLE for 4s
|
||||||
cycle_period = 24.0
|
cycle_period = 24.0
|
||||||
phase = t % cycle_period
|
phase = t % cycle_period
|
||||||
|
|
||||||
if phase < 8.0:
|
if phase < 8.0:
|
||||||
p = phase / 8.0
|
p = phase / 8.0
|
||||||
self.rpm = 800.0 + p * (6000.0 - 800.0)
|
self.rpm = 800.0 + p * (6000.0 - 800.0)
|
||||||
|
self.speed = p * 180.0
|
||||||
|
self.coolant_temp = 85.0 + p * (120.0 - 85.0)
|
||||||
|
self.pcm_volt = 13.2 + p * (16.0 - 13.2)
|
||||||
elif phase < 12.0:
|
elif phase < 12.0:
|
||||||
|
# MAX SCALE ON ALL INSTRUMENTS
|
||||||
self.rpm = 6000.0
|
self.rpm = 6000.0
|
||||||
|
self.speed = 180.0
|
||||||
|
self.coolant_temp = 120.0
|
||||||
|
self.pcm_volt = 16.0
|
||||||
elif phase < 20.0:
|
elif phase < 20.0:
|
||||||
p = (phase - 12.0) / 8.0
|
p = (phase - 12.0) / 8.0
|
||||||
self.rpm = 6000.0 - p * (6000.0 - 800.0)
|
self.rpm = 6000.0 - p * (6000.0 - 800.0)
|
||||||
|
self.speed = 180.0 - p * 180.0
|
||||||
|
self.coolant_temp = 120.0 - p * (120.0 - 85.0)
|
||||||
|
self.pcm_volt = 16.0 - p * (16.0 - 13.2)
|
||||||
else:
|
else:
|
||||||
self.rpm = 800.0
|
self.rpm = 800.0
|
||||||
|
|
||||||
# MAP pressure correlates with RPM
|
|
||||||
self.map_psi = 10.0 + 16.0 * ((self.rpm - 800.0) / 5200.0)
|
|
||||||
# Engine load correlates with RPM
|
|
||||||
self.load = 15.0 + 75.0 * ((self.rpm - 800.0) / 5200.0)
|
|
||||||
# Vehicle speed correlates with RPM (up to 175 km/h, turning RED past 130 km/h)
|
|
||||||
self.speed = 15.0 + 160.0 * ((self.rpm - 800.0) / 5200.0)
|
|
||||||
if self.speed < 0:
|
|
||||||
self.speed = 0.0
|
self.speed = 0.0
|
||||||
# Coolant temp rises with engine load (88°C -> 108°C: Green <98, Yellow 98-105, Red >=106)
|
self.coolant_temp = 88.0
|
||||||
self.coolant_temp = 88.0 + 20.0 * ((self.rpm - 800.0) / 5200.0)
|
self.pcm_volt = 13.8
|
||||||
self.oil_temp = 90.0 + 12.0 * ((self.rpm - 800.0) / 5200.0)
|
|
||||||
|
# Correlated auxiliary telemetry
|
||||||
|
self.map_psi = 10.0 + 16.0 * ((self.rpm - 800.0) / 5200.0)
|
||||||
|
self.load = 15.0 + 75.0 * ((self.rpm - 800.0) / 5200.0)
|
||||||
|
self.oil_temp = self.coolant_temp + 3.0
|
||||||
self.trans_temp = 82.0 + 1.0 * math.cos(t * 0.09)
|
self.trans_temp = 82.0 + 1.0 * math.cos(t * 0.09)
|
||||||
self.pcm_volt = 14.2 + 0.15 * math.sin(t * 0.5)
|
|
||||||
|
|
||||||
state = VehicleState()
|
state = VehicleState()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue