sync sample package
Browse files
record_99396479-7c0b-4eee-bd30-e81fbdb22752.json
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_code": "typedef enum { IDLE, LEFT_ON, LEFT_OFF, RIGHT_ON, RIGHT_OFF, HAZARD_ON, HAZARD_OFF } SignalState;\ntypedef enum { TURN_NONE, TURN_LEFT, TURN_RIGHT } TurnRequest;\ntypedef struct { bool hazard_enabled; TurnRequest turn_request; bool phase_expired; } Inputs;\ntypedef struct { bool left_indicator; bool right_indicator; } Outputs;\nvoid update_state(SignalState *state, const Inputs *in) {\n switch (*state) {\n case IDLE:\n if (in->hazard_enabled) *state = HAZARD_ON;\n else if (in->turn_request == TURN_LEFT) *state = LEFT_ON;\n else if (in->turn_request == TURN_RIGHT) *state = RIGHT_ON;\n break;\n case LEFT_ON:\n if (in->hazard_enabled) *state = HAZARD_ON;\n else if (in->turn_request != TURN_LEFT) *state = IDLE;\n else if (in->phase_expired) *state = LEFT_OFF;\n break;\n case LEFT_OFF:\n if (in->hazard_enabled) *state = HAZARD_ON;\n else if (in->turn_request != TURN_LEFT) *state = IDLE;\n else if (in->phase_expired) *state = LEFT_ON;\n break;\n case RIGHT_ON:\n if (in->hazard_enabled) *state = HAZARD_ON;\n else if (in->turn_request != TURN_RIGHT) *state = IDLE;\n else if (in->phase_expired) *state = RIGHT_OFF;\n break;\n case RIGHT_OFF:\n if (in->hazard_enabled) *state = HAZARD_ON;\n else if (in->turn_request != TURN_RIGHT) *state = IDLE;\n else if (in->phase_expired) *state = RIGHT_ON;\n break;\n case HAZARD_ON:\n if (!in->hazard_enabled) {\n if (in->turn_request == TURN_LEFT) *state = LEFT_ON;\n else if (in->turn_request == TURN_RIGHT) *state = RIGHT_ON;\n else *state = IDLE;\n } else if (in->phase_expired) *state = HAZARD_OFF;\n break;\n case HAZARD_OFF:\n if (!in->hazard_enabled) {\n if (in->turn_request == TURN_LEFT) *state = LEFT_ON;\n else if (in->turn_request == TURN_RIGHT) *state = RIGHT_ON;\n else *state = IDLE;\n } else if (in->phase_expired) *state = HAZARD_ON;\n break;\n }\n}\nOutputs outputs_for(SignalState state) {\n Outputs out = { false, false };\n if (state == LEFT_ON) out.left_indicator = true;\n if (state == RIGHT_ON) out.right_indicator = true;\n if (state == HAZARD_ON) { out.left_indicator = true; out.right_indicator = true; }\n return out;\n}",
|
| 3 |
+
"state_names": [
|
| 4 |
+
"IDLE",
|
| 5 |
+
"LEFT_ON",
|
| 6 |
+
"LEFT_OFF",
|
| 7 |
+
"RIGHT_ON",
|
| 8 |
+
"RIGHT_OFF",
|
| 9 |
+
"HAZARD_ON",
|
| 10 |
+
"HAZARD_OFF"
|
| 11 |
+
],
|
| 12 |
+
"transitions": [
|
| 13 |
+
{
|
| 14 |
+
"source_state": "IDLE",
|
| 15 |
+
"target_state": "HAZARD_ON",
|
| 16 |
+
"trigger_event": "hazard_enabled becomes true",
|
| 17 |
+
"condition": "hazard_enabled is true; this branch takes priority over turn requests."
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"source_state": "IDLE",
|
| 21 |
+
"target_state": "LEFT_ON",
|
| 22 |
+
"trigger_event": "turn_request becomes TURN_LEFT",
|
| 23 |
+
"condition": "hazard_enabled is false and turn_request is TURN_LEFT."
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"source_state": "IDLE",
|
| 27 |
+
"target_state": "RIGHT_ON",
|
| 28 |
+
"trigger_event": "turn_request becomes TURN_RIGHT",
|
| 29 |
+
"condition": "hazard_enabled is false and turn_request is TURN_RIGHT, after the left-turn branch is checked."
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"source_state": "LEFT_ON",
|
| 33 |
+
"target_state": "HAZARD_ON",
|
| 34 |
+
"trigger_event": "hazard_enabled becomes true",
|
| 35 |
+
"condition": "hazard_enabled is true."
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"source_state": "LEFT_ON",
|
| 39 |
+
"target_state": "IDLE",
|
| 40 |
+
"trigger_event": "turn request changes",
|
| 41 |
+
"condition": "hazard_enabled is false and turn_request is not TURN_LEFT."
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"source_state": "LEFT_ON",
|
| 45 |
+
"target_state": "LEFT_OFF",
|
| 46 |
+
"trigger_event": "phase timer expires",
|
| 47 |
+
"condition": "hazard_enabled is false, turn_request is TURN_LEFT, and phase_expired is true."
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"source_state": "LEFT_OFF",
|
| 51 |
+
"target_state": "HAZARD_ON",
|
| 52 |
+
"trigger_event": "hazard_enabled becomes true",
|
| 53 |
+
"condition": "hazard_enabled is true."
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"source_state": "LEFT_OFF",
|
| 57 |
+
"target_state": "IDLE",
|
| 58 |
+
"trigger_event": "turn request changes",
|
| 59 |
+
"condition": "hazard_enabled is false and turn_request is not TURN_LEFT."
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"source_state": "LEFT_OFF",
|
| 63 |
+
"target_state": "LEFT_ON",
|
| 64 |
+
"trigger_event": "phase timer expires",
|
| 65 |
+
"condition": "hazard_enabled is false, turn_request is TURN_LEFT, and phase_expired is true."
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"source_state": "RIGHT_ON",
|
| 69 |
+
"target_state": "HAZARD_ON",
|
| 70 |
+
"trigger_event": "hazard_enabled becomes true",
|
| 71 |
+
"condition": "hazard_enabled is true."
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"source_state": "RIGHT_ON",
|
| 75 |
+
"target_state": "IDLE",
|
| 76 |
+
"trigger_event": "turn request changes",
|
| 77 |
+
"condition": "hazard_enabled is false and turn_request is not TURN_RIGHT."
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"source_state": "RIGHT_ON",
|
| 81 |
+
"target_state": "RIGHT_OFF",
|
| 82 |
+
"trigger_event": "phase timer expires",
|
| 83 |
+
"condition": "hazard_enabled is false, turn_request is TURN_RIGHT, and phase_expired is true."
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"source_state": "RIGHT_OFF",
|
| 87 |
+
"target_state": "HAZARD_ON",
|
| 88 |
+
"trigger_event": "hazard_enabled becomes true",
|
| 89 |
+
"condition": "hazard_enabled is true."
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"source_state": "RIGHT_OFF",
|
| 93 |
+
"target_state": "IDLE",
|
| 94 |
+
"trigger_event": "turn request changes",
|
| 95 |
+
"condition": "hazard_enabled is false and turn_request is not TURN_RIGHT."
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"source_state": "RIGHT_OFF",
|
| 99 |
+
"target_state": "RIGHT_ON",
|
| 100 |
+
"trigger_event": "phase timer expires",
|
| 101 |
+
"condition": "hazard_enabled is false, turn_request is TURN_RIGHT, and phase_expired is true."
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"source_state": "HAZARD_ON",
|
| 105 |
+
"target_state": "LEFT_ON",
|
| 106 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 107 |
+
"condition": "hazard_enabled is false and turn_request is TURN_LEFT."
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"source_state": "HAZARD_ON",
|
| 111 |
+
"target_state": "RIGHT_ON",
|
| 112 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 113 |
+
"condition": "hazard_enabled is false and turn_request is TURN_RIGHT, after the left-turn branch is checked."
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"source_state": "HAZARD_ON",
|
| 117 |
+
"target_state": "IDLE",
|
| 118 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 119 |
+
"condition": "hazard_enabled is false and turn_request is TURN_NONE."
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"source_state": "HAZARD_ON",
|
| 123 |
+
"target_state": "HAZARD_OFF",
|
| 124 |
+
"trigger_event": "phase timer expires",
|
| 125 |
+
"condition": "hazard_enabled remains true and phase_expired is true."
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"source_state": "HAZARD_OFF",
|
| 129 |
+
"target_state": "LEFT_ON",
|
| 130 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 131 |
+
"condition": "hazard_enabled is false and turn_request is TURN_LEFT."
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"source_state": "HAZARD_OFF",
|
| 135 |
+
"target_state": "RIGHT_ON",
|
| 136 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 137 |
+
"condition": "hazard_enabled is false and turn_request is TURN_RIGHT, after the left-turn branch is checked."
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"source_state": "HAZARD_OFF",
|
| 141 |
+
"target_state": "IDLE",
|
| 142 |
+
"trigger_event": "hazard_enabled becomes false",
|
| 143 |
+
"condition": "hazard_enabled is false and turn_request is TURN_NONE."
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"source_state": "HAZARD_OFF",
|
| 147 |
+
"target_state": "HAZARD_ON",
|
| 148 |
+
"trigger_event": "phase timer expires",
|
| 149 |
+
"condition": "hazard_enabled remains true and phase_expired is true."
|
| 150 |
+
}
|
| 151 |
+
],
|
| 152 |
+
"state_outputs": [
|
| 153 |
+
{
|
| 154 |
+
"state_name": "IDLE",
|
| 155 |
+
"output_behavior": "Both left_indicator and right_indicator are false."
|
| 156 |
+
},
|
| 157 |
+
{
|
| 158 |
+
"state_name": "LEFT_ON",
|
| 159 |
+
"output_behavior": "left_indicator is true and right_indicator is false."
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"state_name": "LEFT_OFF",
|
| 163 |
+
"output_behavior": "Both indicators are false."
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"state_name": "RIGHT_ON",
|
| 167 |
+
"output_behavior": "left_indicator is false and right_indicator is true."
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"state_name": "RIGHT_OFF",
|
| 171 |
+
"output_behavior": "Both indicators are false."
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"state_name": "HAZARD_ON",
|
| 175 |
+
"output_behavior": "Both left_indicator and right_indicator are true."
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"state_name": "HAZARD_OFF",
|
| 179 |
+
"output_behavior": "Both indicators are false."
|
| 180 |
+
}
|
| 181 |
+
],
|
| 182 |
+
"behavior_summary": "IDLE selects hazard flashing before either turn signal. Each turn signal alternates between its ON and OFF states when phase_expired is true, while a canceled request returns to IDLE and an enabled hazard request takes priority. In either hazard phase, disabling hazards selects a requested left or right signal, or IDLE when no turn is requested. While hazards remain enabled, timer expiration alternates HAZARD_ON and HAZARD_OFF. Only the ON states drive their corresponding indicator outputs."
|
| 183 |
+
}
|
record_b076799c-cf24-4356-9d6b-bec4161082a9.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_code": "typedef enum { LIGHTS_OFF, LOW_BEAM, HIGH_BEAM, HIGH_BEAM_BLOCKED } BeamState;\ntypedef struct { bool low_beam_request; bool high_beam_request; bool auto_high_beam_enabled; bool oncoming_vehicle_detected; } Inputs;\ntypedef struct { bool low_beam; bool high_beam; } Outputs;\nvoid update_state(BeamState *state, const Inputs *in) {\n switch (*state) {\n case LIGHTS_OFF:\n if (in->low_beam_request) *state = LOW_BEAM;\n break;\n case LOW_BEAM:\n if (!in->low_beam_request) *state = LIGHTS_OFF;\n else if (in->auto_high_beam_enabled && in->high_beam_request && in->oncoming_vehicle_detected) *state = HIGH_BEAM_BLOCKED;\n else if (in->auto_high_beam_enabled && in->high_beam_request) *state = HIGH_BEAM;\n break;\n case HIGH_BEAM:\n if (!in->low_beam_request) *state = LIGHTS_OFF;\n else if (!in->high_beam_request || !in->auto_high_beam_enabled) *state = LOW_BEAM;\n else if (in->oncoming_vehicle_detected) *state = HIGH_BEAM_BLOCKED;\n break;\n case HIGH_BEAM_BLOCKED:\n if (!in->low_beam_request) *state = LIGHTS_OFF;\n else if (!in->high_beam_request || !in->auto_high_beam_enabled) *state = LOW_BEAM;\n else if (!in->oncoming_vehicle_detected) *state = HIGH_BEAM;\n break;\n }\n}\nOutputs outputs_for(BeamState state) {\n Outputs out = { false, false };\n if (state == LOW_BEAM || state == HIGH_BEAM || state == HIGH_BEAM_BLOCKED) out.low_beam = true;\n if (state == HIGH_BEAM) out.high_beam = true;\n return out;\n}",
|
| 3 |
+
"state_names": [
|
| 4 |
+
"LIGHTS_OFF",
|
| 5 |
+
"LOW_BEAM",
|
| 6 |
+
"HIGH_BEAM",
|
| 7 |
+
"HIGH_BEAM_BLOCKED"
|
| 8 |
+
],
|
| 9 |
+
"transitions": [
|
| 10 |
+
{
|
| 11 |
+
"source_state": "LIGHTS_OFF",
|
| 12 |
+
"target_state": "LOW_BEAM",
|
| 13 |
+
"trigger_event": "low_beam_request becomes true",
|
| 14 |
+
"condition": "low_beam_request is true."
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"source_state": "LOW_BEAM",
|
| 18 |
+
"target_state": "LIGHTS_OFF",
|
| 19 |
+
"trigger_event": "low_beam_request becomes false",
|
| 20 |
+
"condition": "low_beam_request is false."
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"source_state": "LOW_BEAM",
|
| 24 |
+
"target_state": "HIGH_BEAM_BLOCKED",
|
| 25 |
+
"trigger_event": "high-beam request or oncoming-vehicle input changes",
|
| 26 |
+
"condition": "low_beam_request, auto_high_beam_enabled, high_beam_request, and oncoming_vehicle_detected are all true; the low-beam-off branch is checked first."
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"source_state": "LOW_BEAM",
|
| 30 |
+
"target_state": "HIGH_BEAM",
|
| 31 |
+
"trigger_event": "high-beam request or assist-enable input changes",
|
| 32 |
+
"condition": "low_beam_request, auto_high_beam_enabled, and high_beam_request are true, and the blocked-state condition did not match."
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"source_state": "HIGH_BEAM",
|
| 36 |
+
"target_state": "LIGHTS_OFF",
|
| 37 |
+
"trigger_event": "low_beam_request becomes false",
|
| 38 |
+
"condition": "low_beam_request is false; this branch has priority over the other high-beam exit conditions."
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"source_state": "HIGH_BEAM",
|
| 42 |
+
"target_state": "LOW_BEAM",
|
| 43 |
+
"trigger_event": "high-beam request or assist-enable input changes",
|
| 44 |
+
"condition": "low_beam_request is true and either high_beam_request or auto_high_beam_enabled is false."
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"source_state": "HIGH_BEAM",
|
| 48 |
+
"target_state": "HIGH_BEAM_BLOCKED",
|
| 49 |
+
"trigger_event": "oncoming_vehicle_detected becomes true",
|
| 50 |
+
"condition": "low_beam_request, high_beam_request, and auto_high_beam_enabled are true, and oncoming_vehicle_detected is true."
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"source_state": "HIGH_BEAM_BLOCKED",
|
| 54 |
+
"target_state": "LIGHTS_OFF",
|
| 55 |
+
"trigger_event": "low_beam_request becomes false",
|
| 56 |
+
"condition": "low_beam_request is false; this branch has priority over the other blocked-state exit conditions."
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"source_state": "HIGH_BEAM_BLOCKED",
|
| 60 |
+
"target_state": "LOW_BEAM",
|
| 61 |
+
"trigger_event": "high-beam request or assist-enable input changes",
|
| 62 |
+
"condition": "low_beam_request is true and either high_beam_request or auto_high_beam_enabled is false."
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"source_state": "HIGH_BEAM_BLOCKED",
|
| 66 |
+
"target_state": "HIGH_BEAM",
|
| 67 |
+
"trigger_event": "oncoming_vehicle_detected becomes false",
|
| 68 |
+
"condition": "low_beam_request, high_beam_request, and auto_high_beam_enabled are true, and oncoming_vehicle_detected is false."
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"state_outputs": [
|
| 72 |
+
{
|
| 73 |
+
"state_name": "LIGHTS_OFF",
|
| 74 |
+
"output_behavior": "Both low_beam and high_beam are false."
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"state_name": "LOW_BEAM",
|
| 78 |
+
"output_behavior": "low_beam is true and high_beam is false."
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"state_name": "HIGH_BEAM",
|
| 82 |
+
"output_behavior": "Both low_beam and high_beam are true."
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"state_name": "HIGH_BEAM_BLOCKED",
|
| 86 |
+
"output_behavior": "low_beam is true and high_beam is false."
|
| 87 |
+
}
|
| 88 |
+
],
|
| 89 |
+
"behavior_summary": "A low-beam request moves the controller from LIGHTS_OFF to LOW_BEAM. Automatic high beam is entered only when assist is enabled and a high-beam request is active. If an oncoming vehicle is detected under those conditions, the controller uses HIGH_BEAM_BLOCKED, which keeps the low beam on and the high beam off. Removing the low-beam request turns both outputs off; disabling assist or removing the high-beam request returns an active or blocked high-beam state to LOW_BEAM. When the oncoming-vehicle indication clears, HIGH_BEAM_BLOCKED returns to HIGH_BEAM if the requests and assist enable remain active."
|
| 90 |
+
}
|
record_be5d6485-f74d-479a-9225-543f3f711be6.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"behavior_summary": "The controller remains in LIGHTS_OFF unless a welcome request with a healthy battery or an applicable ignition condition is present. A welcome request takes priority and enters COURTESY. Manual mode with ignition on selects POSITION; automatic mode selects LOW_BEAM at or below 40 lux. POSITION changes to LOW_BEAM when the automatic dark-light condition becomes true. LOW_BEAM returns to POSITION in manual mode, or to LIGHTS_OFF when ignition is off or automatic mode detects more than 40 lux. COURTESY keeps the low beam on until the battery is not OK or 30,000 ms have elapsed.",
|
| 3 |
+
"source_code": "typedef enum { LIGHTS_OFF, POSITION, LOW_BEAM, COURTESY } LampState;\ntypedef struct { bool ignition_on; bool auto_mode; unsigned ambient_lux; bool welcome_request; bool battery_ok; unsigned courtesy_elapsed_ms; } Inputs;\ntypedef struct { bool position_lamps; bool low_beam; } Outputs;\nvoid update_state(LampState *state, const Inputs *in) {\n switch (*state) {\n case LIGHTS_OFF:\n if (in->welcome_request && in->battery_ok) *state = COURTESY;\n else if (in->ignition_on && !in->auto_mode) *state = POSITION;\n else if (in->ignition_on && in->auto_mode && in->ambient_lux <= 40) *state = LOW_BEAM;\n break;\n case POSITION:\n if (!in->ignition_on) *state = LIGHTS_OFF;\n else if (in->auto_mode && in->ambient_lux <= 40) *state = LOW_BEAM;\n break;\n case LOW_BEAM:\n if (!in->ignition_on) *state = LIGHTS_OFF;\n else if (!in->auto_mode) *state = POSITION;\n else if (in->ambient_lux > 40) *state = LIGHTS_OFF;\n break;\n case COURTESY:\n if (!in->battery_ok || in->courtesy_elapsed_ms >= 30000) *state = LIGHTS_OFF;\n break;\n }\n}\nOutputs outputs_for(LampState state) {\n Outputs out = { false, false };\n if (state == POSITION) out.position_lamps = true;\n if (state == LOW_BEAM) { out.position_lamps = true; out.low_beam = true; }\n if (state == COURTESY) out.low_beam = true;\n return out;\n}",
|
| 4 |
+
"state_names": [
|
| 5 |
+
"LIGHTS_OFF",
|
| 6 |
+
"POSITION",
|
| 7 |
+
"LOW_BEAM",
|
| 8 |
+
"COURTESY"
|
| 9 |
+
],
|
| 10 |
+
"transitions": [
|
| 11 |
+
{
|
| 12 |
+
"source_state": "LIGHTS_OFF",
|
| 13 |
+
"target_state": "COURTESY",
|
| 14 |
+
"trigger_event": "welcome_request",
|
| 15 |
+
"condition": "welcome_request is true and battery_ok is true; this branch has priority over the ignition branches."
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"source_state": "LIGHTS_OFF",
|
| 19 |
+
"target_state": "POSITION",
|
| 20 |
+
"trigger_event": "ignition_on",
|
| 21 |
+
"condition": "ignition_on is true and auto_mode is false, provided the welcome-request branch did not match."
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"source_state": "LIGHTS_OFF",
|
| 25 |
+
"target_state": "LOW_BEAM",
|
| 26 |
+
"trigger_event": "ignition_on or ambient-light input change",
|
| 27 |
+
"condition": "ignition_on is true, auto_mode is true, and ambient_lux is at most 40, provided earlier branches did not match."
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"source_state": "POSITION",
|
| 31 |
+
"target_state": "LIGHTS_OFF",
|
| 32 |
+
"trigger_event": "ignition_off",
|
| 33 |
+
"condition": "ignition_on is false."
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"source_state": "POSITION",
|
| 37 |
+
"target_state": "LOW_BEAM",
|
| 38 |
+
"trigger_event": "ambient-light input change",
|
| 39 |
+
"condition": "ignition_on is true, auto_mode is true, and ambient_lux is at most 40."
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"source_state": "LOW_BEAM",
|
| 43 |
+
"target_state": "LIGHTS_OFF",
|
| 44 |
+
"trigger_event": "ignition_off or ambient-light input change",
|
| 45 |
+
"condition": "ignition_on is false, or ignition_on is true and auto_mode is true with ambient_lux greater than 40; ignition-off is checked first."
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"source_state": "LOW_BEAM",
|
| 49 |
+
"target_state": "POSITION",
|
| 50 |
+
"trigger_event": "auto_mode change",
|
| 51 |
+
"condition": "ignition_on is true and auto_mode is false, provided the ignition-off branch did not match."
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"source_state": "COURTESY",
|
| 55 |
+
"target_state": "LIGHTS_OFF",
|
| 56 |
+
"trigger_event": "battery status change or courtesy timer expiration",
|
| 57 |
+
"condition": "battery_ok is false or courtesy_elapsed_ms is at least 30000."
|
| 58 |
+
}
|
| 59 |
+
],
|
| 60 |
+
"state_outputs": [
|
| 61 |
+
{
|
| 62 |
+
"state_name": "LIGHTS_OFF",
|
| 63 |
+
"output_behavior": "Both position_lamps and low_beam are false."
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"state_name": "POSITION",
|
| 67 |
+
"output_behavior": "position_lamps is true; low_beam is false."
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"state_name": "LOW_BEAM",
|
| 71 |
+
"output_behavior": "Both position_lamps and low_beam are true."
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"state_name": "COURTESY",
|
| 75 |
+
"output_behavior": "low_beam is true; position_lamps is false."
|
| 76 |
+
}
|
| 77 |
+
]
|
| 78 |
+
}
|