Skip to content

Commit 438a7e0

Browse files
authored
Merge pull request #146 from HyperloopUPV-H8/control-station/battery-pack-component
2 parents 871e14a + 34db23a commit 438a7e0

26 files changed

Lines changed: 1208 additions & 790 deletions

common-front/lib/selectors/BMSL.ts

Lines changed: 25 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,26 @@
1-
import {
2-
BooleanMeasurement,
3-
Measurements,
4-
NumericMeasurement,
5-
useMeasurementsStore
6-
} from "..";
71

8-
export type BmslMeasurements = {
9-
av_current: NumericMeasurement;
10-
11-
low_cell1: NumericMeasurement;
12-
low_cell2: NumericMeasurement;
13-
low_cell3: NumericMeasurement;
14-
low_cell4: NumericMeasurement;
15-
low_cell5: NumericMeasurement;
16-
low_cell6: NumericMeasurement;
17-
18-
low_SOC1: NumericMeasurement;
19-
low_is_balancing1: NumericMeasurement;
20-
low_maximum_cell: NumericMeasurement;
21-
low_minimum_cell: NumericMeasurement;
22-
low_battery_temperature_1: NumericMeasurement;
23-
low_battery_temperature_2: NumericMeasurement;
24-
25-
total_voltage_low: NumericMeasurement;
26-
27-
input_charging_current: NumericMeasurement;
28-
output_charging_current: NumericMeasurement;
29-
input_charging_voltage: NumericMeasurement;
30-
output_charging_voltage: NumericMeasurement;
31-
pwm_frequency: NumericMeasurement;
32-
33-
conditions_ready: BooleanMeasurement;
34-
conditions_want_to_charge: BooleanMeasurement;
35-
conditions_charging: BooleanMeasurement;
36-
conditions_fault: BooleanMeasurement;
37-
};
38-
39-
export function selectBmslMeasurements(
40-
measurements: Measurements
41-
): BmslMeasurements {
42-
43-
const getMeasurementFallback = useMeasurementsStore(state => state.getMeasurementFallback);
44-
45-
return {
46-
av_current: getMeasurementFallback("BMSL/av_current"),
47-
48-
low_cell1: getMeasurementFallback("BMSL/low_cell1"),
49-
low_cell2: getMeasurementFallback("BMSL/low_cell2"),
50-
low_cell3: getMeasurementFallback("BMSL/low_cell3"),
51-
low_cell4: getMeasurementFallback("BMSL/low_cell4"),
52-
low_cell5: getMeasurementFallback("BMSL/low_cell5"),
53-
low_cell6: getMeasurementFallback("BMSL/low_cell6"),
54-
55-
low_SOC1: getMeasurementFallback("BMSL/low_SOC1"),
56-
low_is_balancing1: getMeasurementFallback("BMSL/low_is_balancing1"),
57-
low_maximum_cell: getMeasurementFallback(
58-
"BMSL/low_maximum_cell"
59-
),
60-
low_minimum_cell: getMeasurementFallback(
61-
"BMSL/low_minimum_cell"
62-
),
63-
low_battery_temperature_1: getMeasurementFallback(
64-
"BMSL/low_battery_temperature_1"
65-
),
66-
low_battery_temperature_2: getMeasurementFallback(
67-
"BMSL/low_battery_temperature_2"
68-
),
69-
total_voltage_low: getMeasurementFallback(
70-
"BMSL/total_voltage_low"
71-
),
72-
input_charging_current: getMeasurementFallback(
73-
"BMSL/input_charging_current"
74-
),
75-
output_charging_current: getMeasurementFallback(
76-
"BMSL/output_charging_current"
77-
),
78-
input_charging_voltage: getMeasurementFallback(
79-
"BMSL/output_charging_current"
80-
),
81-
82-
output_charging_voltage: getMeasurementFallback(
83-
"BMSL/output_charging_voltage"
84-
),
85-
86-
pwm_frequency: getMeasurementFallback(
87-
"BMSL/pwm_frequency"
88-
),
89-
90-
conditions_ready: getMeasurementFallback(
91-
"BMSL/conditions_ready"
92-
),
93-
conditions_want_to_charge: getMeasurementFallback(
94-
"BMSL/conditions_want_to_charge"
95-
),
96-
conditions_charging: getMeasurementFallback(
97-
"BMSL/conditions_charging"
98-
),
99-
conditions_fault: getMeasurementFallback(
100-
"BMSL/conditions_fault"
101-
),
102-
} as BmslMeasurements;
103-
}
2+
export enum BmslMeasurements {
3+
avCurrent = "BMSL/AV_current",
4+
lowCell1 = "BMSL/low_cell1",
5+
lowCell2 = "BMSL/low_cell2",
6+
lowCell3 = "BMSL/low_cell3",
7+
lowCell4 = "BMSL/low_cell4",
8+
lowCell5 = "BMSL/low_cell5",
9+
lowCell6 = "BMSL/low_cell6",
10+
lowSOC1 = "BMSL/low_SOC1",
11+
lowIsBalancing1 = "BMSL/low_is_balancing1",
12+
lowMaximumCell = "BMSL/low_maximum_cell",
13+
lowMinimumCell = "BMSL/low_minimum_cell",
14+
lowBatteryTemperature1 = "BMSL/low_battery_temperature_1",
15+
lowBatteryTemperature2 = "BMSL/low_battery_temperature_2",
16+
totalVoltageLow = "BMSL/total_voltage_low",
17+
inputChargingCurrent = "BMSL/input_charging_current",
18+
outputChargingCurrent = "BMSL/output_charging_current",
19+
inputChargingVoltage = "BMSL/input_charging_voltage",
20+
outputChargingVoltage = "BMSL/output_charging_voltage",
21+
pwmFrequency = "BMSL/pwm_frequency",
22+
conditionsReady = "BMSL/conditions_ready",
23+
conditionsWantToCharge = "BMSL/conditions_want_to_charge",
24+
conditionsCharging = "BMSL/conditions_charging",
25+
conditionsFault = "BMSL/conditions_fault"
26+
}

common-front/lib/selectors/VCU.ts

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,19 @@
1-
import {
2-
BooleanMeasurement,
3-
EnumMeasurement,
4-
Measurements,
5-
NumericMeasurement,
6-
useMeasurementsStore,
7-
} from "..";
81

9-
export type VcuMeasurements = {
10-
general_state: EnumMeasurement;
11-
specific_state: EnumMeasurement;
12-
voltage_state: EnumMeasurement;
13-
reference_pressure: NumericMeasurement;
14-
actual_pressure: NumericMeasurement;
15-
valve_state: BooleanMeasurement;
16-
reed1: EnumMeasurement;
17-
reed2: EnumMeasurement;
18-
bottle_temp_1: NumericMeasurement;
19-
bottle_temp_2: NumericMeasurement;
20-
high_pressure: NumericMeasurement;
21-
position: NumericMeasurement;
22-
speed: NumericMeasurement;
2+
export enum VcuMeasurements {
3+
generalState = "VCU/general_state",
4+
specificState = "VCU/specific_state",
5+
voltageState = "VCU/voltage_state",
6+
referencePressure = "VCU/reference_pressure",
7+
actualPressure = "VCU/actual_pressure",
8+
valveState = "VCU/valve_state",
9+
reed1 = "VCU/reed1",
10+
reed2 = "VCU/reed2",
11+
reed3 = "VCU/reed3",
12+
reed4 = "VCU/reed4",
13+
bottleTemp1 = "VCU/bottle_temp_1",
14+
bottleTemp2 = "VCU/bottle_temp_2",
15+
highPressure = "VCU/high_pressure",
16+
position = "VCU/position",
17+
speed = "VCU/speed",
18+
acceleration = "VCU/acceleration",
2319
};
24-
25-
export function selectVcuMeasurements(
26-
measurements: Measurements
27-
): VcuMeasurements {
28-
const getMeasurementFallback = useMeasurementsStore(
29-
(state) => state.getMeasurementFallback
30-
);
31-
32-
return {
33-
general_state: getMeasurementFallback("VCU/general_state"),
34-
35-
specific_state: getMeasurementFallback("VCU/specific_state"),
36-
voltage_state: getMeasurementFallback("VCU/voltage_state"),
37-
reference_pressure: getMeasurementFallback("VCU/reference_pressure"),
38-
actual_pressure: getMeasurementFallback("VCU/actual_pressure"),
39-
valve_state: getMeasurementFallback("VCU/valve_state"),
40-
reed1: getMeasurementFallback("VCU/reed1"),
41-
reed2: getMeasurementFallback("VCU/reed2"),
42-
bottle_temp_1: getMeasurementFallback("VCU/bottle_temp_1"),
43-
bottle_temp_2: getMeasurementFallback("VCU/bottle_temp_2"),
44-
high_pressure: getMeasurementFallback("VCU/high_pressure"),
45-
position: getMeasurementFallback("VCU/position"),
46-
speed: getMeasurementFallback("VCU/speed"),
47-
} as VcuMeasurements;
48-
}

0 commit comments

Comments
 (0)