summaryrefslogtreecommitdiff
path: root/definitions/derived.yaml
blob: 13b7946080fe4f3414b5e5703e5503996888bbbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Derived values in Canopied are constructed by means of the raw ECU values
# generated from raw.yaml and the derived units in units.yaml
#
# Each derived value can depend only on raw values and units, and derived values
# from earlier in this file.  This means the result is acyclic.
#
# Each derived value has a name, an expression, and a display unit.
# It is critical that the expression's quantifier and the display unit's
# quantifier are conformable.  E.g. it's acceptable for an expression in mi/hr
# to be displayed in m/s, but not in Wh/mi.  The display unit must be from the
# units.yaml list and cannot be an expression.  If you want a compound unit,
# then you should add it to units.yaml and use it here.

- id: main_voltage
  display: volt
  expr: bms1.battery_voltage * volt

- id: main_current
  display: amp
  expr: bms1.battery_current * amp

- id: main_power
  display: kw
  expr: main_voltage * main_current

- id: speed
  display: mph
  expr: (vmcu1.vehicle_speed / 100) * mph

- id: consumption
  display: watthourspermile
  expr: main_power / speed

- id: efficiency
  display: milesperkwh
  expr: speed / main_power