Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions .github/workflows/scripts/adj-tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ADJ Validator

Version: 1.1.0
Version: 11.1.2

JavierRibaldelRio

Expand Down Expand Up @@ -381,7 +381,9 @@ def check_measurement_json(path: str, previous_ids=None):
return is_valid


def check_packet_json(path: str, sockets: set, measurement_ids=None):
def check_packet_json(
path: str, sockets: set, measurement_ids=None, used_measurement_ids=None
):
"""Validate a packet JSON file.

Ensures schema conformance, global uniqueness of packet IDs
Expand Down Expand Up @@ -429,6 +431,10 @@ def check_packet_json(path: str, sockets: set, measurement_ids=None):
)
)
is_valid = False
else:
# Track that this measurement is being used
if used_measurement_ids is not None:
used_measurement_ids.add(meas_id)

# Ensure that socket is defined in the sockets
socket_name = pkt.get("socket", "")
Expand Down Expand Up @@ -494,7 +500,13 @@ def check_socket_json(path: str, sockets_name: set):

else:
socket_ip = socket.get("remote_ip", "")
if socket_ip != "" and not is_valid_ipv4(socket_ip):

# Remote ip might also be backend
if (
socket_ip != ""
and not is_valid_ipv4(socket_ip)
and socket_ip.lower() != "backend"
):
error_list.append(
logError(
path,
Expand Down Expand Up @@ -591,6 +603,7 @@ def main():

# measurements are unique within a board
measurement_ids = set()
used_measurement_ids = set()

# sockets are unique
sockets_name = set()
Expand Down Expand Up @@ -621,9 +634,33 @@ def main():
f"boards/{board_name}/{packets_path}",
sockets_name,
measurement_ids,
used_measurement_ids,
)
and valid
)

# Check for measurements that are defined but not used
unused_measurements = measurement_ids - used_measurement_ids
unused_error_list = []
if unused_measurements:
for measurement_id in sorted(unused_measurements):
unused_error_list.append(
logError(
f"{board_name} - GENERAL INFO",
f"measurement id '{measurement_id}'",
f"Measurement id '{measurement_id}' is defined but never used in any packet or order",
)
)
valid = False

if unused_error_list:
print_results(
f"boards/{board_name}",
False,
unused_error_list,
type="(Unused Measurements)",
prefix="\t",
)
else:
log_message(
f"Skipping measurements and packets validation for board {board_name} due to previous errors",
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/scripts/adj-tester/schema/packet.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,21 @@
},
"description": "Measurement IDs included in this packet"
},
"period_ms": {
"period": {
"type": [
"integer",
"number"
],
"description": "Packet transmission period in milliseconds"
},
"period_type": {
"type": "string",
"enum": [
"us",
"ms"
],
"description": "Unit type for period (microseconds or milliseconds)"
},
"socket": {
"type": "string",
"description": "Name of the socket used for this packet"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
},
"remote_ip": {
"type": "string",
"format": "ipv4",
"description": "Remote IPv4 address"
},
"remote_port": {
Expand Down
102 changes: 0 additions & 102 deletions boards/BCU/measurements.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
[
{
"id": "output_duty_cycle_u",
"name": "Duty Cycle U",
"type": "float32",
"podUnits": "%",
"displayUnits": "%"
},
{
"id": "output_duty_cycle_v",
"name": "Duty Cycle V",
"type": "float32",
"podUnits": "%",
"displayUnits": "%"
},
{
"id": "output_duty_cycle_w",
"name": "Duty Cycle W",
"type": "float32",
"podUnits": "%",
"displayUnits": "%"
},
{
"id": "output_commutation_frequency_hz",
"name": "Commutation Frequency",
"type": "uint32",
"podUnits": "Hz",
"displayUnits": "Hz"
},
{
"id": "output_dead_time_ns",
"name": "Dead Time",
"type": "uint32",
"podUnits": "ns",
"displayUnits": "ns"
},
{
"id": "bcu_general_state",
"name": "General State",
Expand Down Expand Up @@ -306,66 +271,6 @@
"name": "Direction Speetec 1",
"type": "bool"
},
{
"id": "position_speetec_2",
"name": "Position Speetec 2",
"type": "float64",
"podUnits": "m",
"displayUnits": "m"
},
{
"id": "speed_speetec_2",
"name": "Speed Speetec 2",
"type": "float64",
"podUnits": "m/s",
"displayUnits": "m/s"
},
{
"id": "acceleration_speetec_2",
"name": "Acceleration Speetec 2",
"type": "float64",
"podUnits": "m/ss",
"displayUnits": "m/ss"
},
{
"id": "direction_speetec_2",
"name": "Direction Speetec 2",
"type": "enum",
"enumValues": [
"Forward",
"Backward"
]
},
{
"id": "position_speetec_3",
"name": "Position Speetec 3",
"type": "float64",
"podUnits": "m",
"displayUnits": "m"
},
{
"id": "speed_speetec_3",
"name": "Speed Speetec 3",
"type": "float64",
"podUnits": "m/s",
"displayUnits": "m/s"
},
{
"id": "acceleration_speetec_3",
"name": "Acceleration Speetec 3",
"type": "float64",
"podUnits": "m/ss",
"displayUnits": "m/ss"
},
{
"id": "direction_speetec_3",
"name": "Direction Speetec 3",
"type": "enum",
"enumValues": [
"Forward",
"Backward"
]
},
{
"id": "d_current_reference",
"name": "D Current Reference",
Expand Down Expand Up @@ -449,12 +354,5 @@
"type": "float64",
"podUnits": "rad",
"displayUnits": "rad"
},
{
"id": "target_linear_speed",
"name": "Target Linear Speed (m/s)",
"type": "float32",
"podUnits": "m/s",
"displayUnits": "m/s"
}
]
26 changes: 0 additions & 26 deletions boards/BCU/order_measurements.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,32 +101,6 @@
"warning": 0.0
}
},
{
"id": "requested_d_current_reference",
"name": "D Current Reference (A)",
"type": "float32",
"podUnits": "A",
"displayUnits": "A",
"out_of_range": {
"warning": [
0.0,
80.0
]
}
},
{
"id": "requested_q_current_reference",
"name": "Q Current Reference (A)",
"type": "float32",
"podUnits": "A",
"displayUnits": "A",
"out_of_range": {
"warning": [
0.0,
80.0
]
}
},
{
"id": "requested_d_current_reference_2",
"name": "D Current Reference(A)",
Expand Down
Loading