35 KiB
Analisi Differenze: Target3 vs Codice Corrente
Data Analisi: 3 Febbraio 2026
Autore: GitHub Copilot (AI Agent)
1. EXECUTIVE SUMMARY
La configurazione presente nella cartella target3 implementa una versione semplificata e focalizzata del test GRIFO che si concentra principalmente sul rilevamento target dal radar tramite messaggi B9 (Target Report). A differenza del nostro codice corrente che è un framework completo di test PBIT con power cycling, drill-down B8 e statistiche approfondite, target3 è orientato alla validazione operativa del radar in modalità target detection.
Differenze Principali:
- Focus primario: Target detection (B9) invece di PBIT completo
- Architettura: Test loop semplificato senza power cycling automatico
- ICD: Verifica di subset ridotto di campi LRU (solo 6 invece di 12)
- Mancanza funzionalità: Nessun supporto per B8 drill-down, statistiche CSV, GUI
- Target generation: Implementazione attiva di stimolazione target via bus 1553
2. STRUTTURA E ARCHITETTURA
2.1 Target3 - Caratteristiche
target3/GrifoAutomaticTestEnv/
├── TestEnvironment/
│ ├── env/ # Moduli supporto (identici)
│ ├── scripts/
│ │ ├── GRIFO_M_PBIT.py # Script principale (450 righe)
│ │ ├── GRIFO_test_debug.py
│ │ └── ... (varianti e log)
│ └── json/
│ └── GRIFO_M_PBIT.json # Metadata test base
└── Documents/
└── ICD7033158 Rev. D.pdf
Dimensione script principale: ~450 righe (vs 1919 righe corrente)
2.2 Codice Corrente - Caratteristiche
GrifoAutomaticTestEnv/
├── TestEnvironment/
│ ├── env/ # Moduli supporto completi
│ ├── scripts/
│ │ ├── GRIFO_M_PBIT.py # Script principale (1919 righe)
│ │ ├── GRIFO_M_PBIT_mock.py # Simulazione completa
│ │ ├── GRIFO_M_PBIT_gui.py # GUI wrapper
│ │ └── power_on/off helpers
│ └── json/
│ └── GRIFO_M_PBIT.json # Template report esteso
├── python_simulate_wrapper.py
├── run_simulate.bat
└── Documentation estesa (5+ file MD)
Dimensione script principale: ~1919 righe con supporto completo
3. ANALISI FUNZIONALE TARGET3
3.1 Funzione Principale: tgt_gen(interface)
Scopo: Generare messaggi 1553 per simulare dati di navigazione e inertiali, quindi monitorare il messaggio B9 (Target Report) per rilevare la presenza del target nel radar.
Implementazione (target3):
def tgt_gen(interface):
logging.info('tgt_gen()')
time.sleep(5)
period=10 #ms
tt=0
if only_bc: # Broadcasting mode
setValue(theGrifo1553, 0, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
# Phase 1: Send initial A5 messages (INU High Speed)
for i in range(10):
time.sleep(0.020)
if only_bc:
setValue(theGrifo1553, tt, "A5_MsgInuHighSpeed",
"timetag_RelativeTimetag_raw", commitChanges=True)
tt+=150
# Phase 2: Main loop - stimulate A4 (Nav Data) and monitor B9 (Target Report)
p_tt=0
hit=0
for i in range(1000):
time.sleep(0.010)
if only_bc:
setValue(theGrifo1553, tt, "A4_MsgNavDataAndCursor",
"timetag_RelativeTimetag_raw", commitChanges=True)
tt+=150
if tt>0x70ff:
tt=10
# Monitor B9 message
cnt = interface.getSingleMessageReceivedSz("B9")
t_num=interface.getMessageFieldValue("B9", "b9_t_num")
t_rng=interface.getMessageFieldValue("B9", "b9_t1_rng")
t_tt=interface.getMessageFieldValue("B9", "b9_w12")
if (p_tt==0):
p_tt=t_tt
continue
if (i % 10)==0:
dcnt=cnt-pcnt
pcnt=cnt
logging.info(f'TgtMsg: {cnt} {dcnt}')
# Check if target detected
if (t_num>0) or (p_tt!=t_tt):
logging.info(f'Tgt: {t_num} @ {t_rng} tt={t_tt}')
tgt_expected=2536
ret_proc_sts, err=check(theGrifo1553,
(tgt_expected-1000, tgt_expected+200), "B9", "b9_t1_rng")
if (ret_proc_sts is True):
logging.info(f'TgtMsg hit {hit}')
hit=hit+1
if (hit>10): # Exit after 10 successful detections
logging.info(f'TgtMsg hit {hit}')
return
p_tt=t_tt
if interruptRequest is True:
break
Parametri chiave:
- tgt_expected: 2536 (range atteso del target - in unità ICD)
- Tolleranza: ±1000 a ±200 unità (range: 1536-2736)
- Successo: 10 rilevamenti consecutivi
- Timeout implicito: ~10 secondi (1000 iterazioni × 10ms)
3.2 Funzione Wrapper: tgt_gen_alone(interface)
Scopo: Eseguire ripetutamente tgt_gen() in modalità standalone con logging 1553.
def tgt_gen_alone(interface):
interface.logStart(3, os.path.dirname(sys.argv[0]))
for n in range(10*1000): # 10K iterations
logging.info(f'tgt_gen_alone(): {n}')
tgt_gen(interface)
if interruptRequest is True:
break
interface.logStop()
return True
Caratteristiche:
- Logging 1553 attivo (livello 3)
- Loop infinito (10K iterazioni)
- Supporto Ctrl-C per interruzione
4. FLOW DI TEST TARGET3
4.1 Sequenza di Test Principale
def test_proc():
# 1. Setup iniziale
logger_setup('GRIFO_M_PBIT.log')
report = testReport(sys.argv[0])
interface = theGrifo1553.getInterface()
terminal = leo_grifo_terminal.GrifoSerialTerminal()
terminal.connect()
# 2. Configurazione iniziale radar
setValue(theGrifo1553, 127, "A1_MsgRdrSettingsAndParameters",
"settings_RDROperationalSettings_rdr_symbology_intensity", commitChanges=True)
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_silence")
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_azimuth_scan_width_selection")
setValue(theGrifo1553, 2, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_range_scale_selection")
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_number_of_bars_selection")
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
# 3. Configurazione dati navigazione (A4)
setValue(theGrifo1553, 1060, "A4_MsgNavDataAndCursor",
"z_acceleration_Acceleration_raw")
setValue(theGrifo1553, 2500, "A4_MsgNavDataAndCursor",
"corrected_baro_altitude_BaroAltitude_raw")
setValue(theGrifo1553, 2500, "A4_MsgNavDataAndCursor",
"radio_altitude_RadioAltitude_raw", commitChanges=True)
# 4. Configurazione INU (A5)
setValue(theGrifo1553, 0xAA54, "A5_MsgInuHighSpeed",
"mode_word", commitChanges=True)
# 5. Loop ripetizioni
for repetition in range(NUMBER_OF_REPETITIONS):
report.open_session(f'Repetition {1 + repetition} of {NUMBER_OF_REPETITIONS}')
if only_bc:
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_silence")
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
setValue(theGrifo1553, 127, "A1_MsgRdrSettingsAndParameters",
"settings_RDROperationalSettings_rdr_symbology_intensity", commitChanges=True)
# 5a. Esegui target generation test
tgt_gen_alone(interface)
# 5b. Power cycling test (opzionale)
for onoff_rep in range(1):
report.add_comment("Switch off target and wait 3 seconds.")
power_grifo_off(4, 1)
if interruptRequest is True:
break
report.add_comment("Switch on target.")
power_grifo_on(0.100)
# 5c. Wait for BIT completion
remaining_time = PBIT_SEC_TIME
max_counter_1553_msg = 20
setValue(theGrifo1553, 100, "A1_MsgRdrSettingsAndParameters",
"settings_RDROperationalSettings_rdr_symbology_intensity", commitChanges=True)
while remaining_time > 0:
start = time.perf_counter()
ret_rep_is_avail = False
msg_cnt = 0
mil1553_error_flag = max_counter_1553_msg
for i in range(100):
cnt = interface.getSingleMessageReceivedSz("B6_MsgRdrSettingsAndParametersTellback")
value = interface.getMessageFieldValue("B6_MsgRdrSettingsAndParametersTellback",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_bit_report_available")
ret_rep_is_avail = value == "true"
if ret_rep_is_avail is True:
break
time.sleep(0.05)
# 1553 comm loss detection
if cnt > msg_cnt:
mil1553_error_flag = max_counter_1553_msg
else:
mil1553_error_flag -=1
msg_cnt = cnt
if mil1553_error_flag == 0:
logging.critical("1553 communication lost")
return False
# 5d. Check LRU status (B6)
if ret_rep_is_avail is True:
time.sleep(0.02)
report.add_comment("bit report avail occurred..")
logging.info("Check health status...")
no_fail=True
for lru in lru_fields: # Only 6 LRU fields
ret_proc_sts, err = check(theGrifo1553,"false",
"B6_MsgRdrSettingsAndParametersTellback", lru)
if ret_proc_sts is False:
no_fail=False
# 5e. Force B8 drill-down (unconditional)
no_fail=False # Force check to verify SW requirements
if no_fail is False:
logging.info("Check BIT Report...")
for f in bit_fields: # Subset di campi B8
ret_error_field, err = check(theGrifo1553,"false","B8_MsgBitReport",f)
test_return = (test_return and ret_error_field)
time_passed = time.perf_counter() - start
remaining_time -= time_passed
if ret_rep_is_avail is True:
remaining_time = 0
logging.info(f'{remaining_time:.1f}s remaining ...')
report.close_session()
if interruptRequest is True:
report.add_comment("Test interrupted by user (Ctrl-C)")
break
# 5f. Return to STBY
setValue(theGrifo1553, 0, "A2_MsgRdrOperationCommand",
"rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
# 6. Cleanup
report.add_comment("Repetitions terminated.")
power_grifo_off()
if terminal is not None:
terminal.disconnect()
report.generate_pdf()
return test_return
5. CONFRONTO: TARGET3 VS CORRENTE
5.1 Messaggi 1553 Utilizzati
| Messaggio | Target3 | Corrente | Scopo |
|---|---|---|---|
| A1 | ✓ Intensity | ✓ Completo | Settings & Parameters |
| A2 | ✓ Basic | ✓ Completo | Operation Command |
| A4 | ✓ Nav Data | ✓ Completo | Navigation Data & Cursor |
| A5 | ✓ Timetag | ✓ Completo | INU High Speed |
| B6 | ✓ 6 LRU | ✓ 12 LRU | Settings Tellback & Status |
| B8 | ✓ Subset | ✓ Completo | BIT Report (185 fields) |
| B9 | ✓ FOCUS | ✗ ASSENTE | Target Report |
❗ DIFFERENZA CRITICA: Target3 usa B9 per rilevamento target, assente nel nostro codice ICD.
5.2 Campi B6 (LRU Status)
Target3 - Solo 6 campi:
lru_fields = (
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_processor_status",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_trasmitter_status",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_receiver_status",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_rx_front_end_status",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_servoloop_status",
"radar_health_status_and_bit_report_valid_RdrHealthStatusAndBitReport_array_status"
)
Corrente - 12 campi completi (include anche pedestal, radar_fail_status, ecc.)
⚠️ Note: Target3 esclude:
radar_fail_status(campo aggregato)pedestal_status(commentato - HW non disponibile)
5.3 Campi B8 (BIT Report)
Target3 - Subset ridotto:
- Degradation: Tutti commentati (non verificati)
- SRU Failures: ~40 campi (vs 43 corrente)
- Test Results: ~115 campi (vs 118 corrente)
Esclusioni principali:
# Target3 - Commentati/esclusi:
# "degradation_conditions_w1_..." (tutti i 12 campi degradation)
# "failure_location_pedestal_FailureLocationPedestal_sru1_gimbal"
# "integrated_system_test_results_..._pedestal_status"
# "servoloop_test_results_..._test_sl15_pedestal_centre_scan_location"
Corrente - Set completo con gestione KNOWN_FAILURES per HW non disponibile.
5.4 Gestione Power Cycling
| Feature | Target3 | Corrente |
|---|---|---|
| Auto power off before test | ✗ | ✓ |
| Auto power on before test | ✗ | ✓ |
| Power off between reps | ✓ Manual | ✓ Auto |
| Wait times configurabili | ✗ | ✓ |
| Timing aligned with target2 | ✗ | ✓ |
Target3: Power cycling manuale richiesto dall'operatore con prompts.
Corrente: Power cycling automatico con timing configurabili (wait_before, wait_after).
5.5 Statistiche e Report
| Feature | Target3 | Corrente |
|---|---|---|
| PDF Report | ✓ Basic | ✓ Completo |
| CSV Export | ✗ | ✓ |
| JSON Statistics | ✗ | ✓ |
| Per-run timing | ✗ | ✓ |
| B6/B8 counters | ✗ | ✓ |
| Serial statistics | ✗ | ✓ |
| Failure drill-down | ✗ | ✓ |
| Known failures tracking | ✗ | ✓ |
| Target detection stats | ✗ | ✓ Placeholder |
Corrente ha sistema statistiche avanzato con export CSV/JSON e tracking granulare.
5.6 Modalità Simulazione
| Feature | Target3 | Corrente |
|---|---|---|
| Mock mode | ✗ | ✓ |
| --simulate flag | ✗ | ✓ |
| Mock objects | ✗ | ✓ |
| Replay scenarios | ✗ | ✓ |
| GUI wrapper | ✗ | ✓ |
Corrente supporta modalità simulazione completa senza HW (GRIFO_M_PBIT_mock.py).
6. MESSAGGI B9 - ANALISI DETTAGLIATA
6.1 Struttura Messaggio B9 (Target Report)
Campi utilizzati in target3:
# B9 message fields (da codice target3)
cnt = interface.getSingleMessageReceivedSz("B9") # Message counter
t_num = interface.getMessageFieldValue("B9", "b9_t_num") # Number of targets
t_rng = interface.getMessageFieldValue("B9", "b9_t1_rng") # Target 1 range
t_tt = interface.getMessageFieldValue("B9", "b9_w12") # Word 12 (timetag?)
Campi ICD B9 (presunti da utilizzo):
b9_t_num: Number of detected targets (0-N)b9_t1_rng: Target 1 range (unità da ICD - presumibilmente meters o yards)b9_w12: Word 12 - Timetag o altro campo temporale
Range atteso: 2536 ± (1000 to 200) unità ICD
6.2 Correlazione con Messaggi A4/A5
Target3 stimola:
- A4 (
MsgNavDataAndCursor): Dati navigazione (altitudine, accelerazione) - A5 (
MsgInuHighSpeed): Dati inerziali ad alta frequenza (timetag)
Ipotesi: Il radar utilizza A4/A5 per:
- Stabilizzazione antenna (A4: accelerazioni)
- Riferimento temporale (A5: timetag)
- Generazione tracce target sintetiche interne per test
Il nostro codice corrente:
- Ha stub
tgt_gen()ma non stimola attivamente A4/A5 - Manca supporto ICD per B9 (messaggio non definito)
7. COSA MANCA AL NOSTRO CODICE
7.1 ICD - Definizione Messaggio B9
✅ AGGIORNAMENTO (2026-02-03): Il messaggio B9 È GIÀ PRESENTE nel nostro ICD XML!
Verifica completata:
- ✓ B9 definito in
icd_1553_bus_controller.xml(Message Id="19", 512 bit, RX, periodic 20ms) - ✓ Tutti i campi chiave presenti:
b9_t_num(offset 176) - numero target rilevatib9_t1_rng(offset 224) - range target 1b9_w12(offset 192) - word 12 (timetag)b9_t1_az(offset 304) - azimuth target 1b9_t2_rng(offset 384) - range target 2b9_t2_az(offset 464) - azimuth target 2
- ✓ B9 già mappato nel simulator (Map Id="19")
- ✓ Mock completo già implementato in
GRIFO_M_PBIT_mock.py
Conclusione: Non serve modificare l'ICD o i bindings SWIG. B9 è accessibile e pronto all'uso.
7.2 Funzione tgt_gen() Operativa
Corrente: Stub placeholder (righe 619-667) con:
- Logging basic
- Timeout configurabile
- Check B9 fields (ma B9 non disponibile)
- Return True/False per detection
Mancante rispetto target3:
# 1. Stimolazione attiva A4/A5 con timetag
setValue(theGrifo1553, tt, "A4_MsgNavDataAndCursor",
"timetag_RelativeTimetag_raw", commitChanges=True)
setValue(theGrifo1553, tt, "A5_MsgInuHighSpeed",
"timetag_RelativeTimetag_raw", commitChanges=True)
# 2. Loop incremento timetag con wrap
tt += 150
if tt > 0x70ff:
tt = 10
# 3. Monitoring continuo B9 con contatori
cnt = interface.getSingleMessageReceivedSz("B9")
dcnt = cnt - pcnt # Delta count
# 4. Detection basata su t_num>0 oppure cambiamento timetag
if (t_num>0) or (p_tt!=t_tt):
# Target found!
Azioni richieste:
- ✗ Implementare stimolazione attiva A4/A5 in
tgt_gen() - ✗ Aggiungere logica incremento timetag con wrap
- ✗ Implementare monitoring B9 con delta counting
- ✗ Aggiungere check range atteso (configurabile)
7.3 Configurazione Radar Pre-Test
Target3 configura esplicitamente:
# Range scale, scan width, bars
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_azimuth_scan_width_selection")
setValue(theGrifo1553, 2, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_range_scale_selection")
setValue(theGrifo1553, 1, "A2_MsgRdrOperationCommand",
"param1_RdrFunAndParam1_number_of_bars_selection")
# Nav data values
setValue(theGrifo1553, 1060, "A4_MsgNavDataAndCursor",
"z_acceleration_Acceleration_raw")
setValue(theGrifo1553, 2500, "A4_MsgNavDataAndCursor",
"corrected_baro_altitude_BaroAltitude_raw")
setValue(theGrifo1553, 2500, "A4_MsgNavDataAndCursor",
"radio_altitude_RadioAltitude_raw", commitChanges=True)
# INU mode
setValue(theGrifo1553, 0xAA54, "A5_MsgInuHighSpeed",
"mode_word", commitChanges=True)
Corrente: Ha set_radar_operational() ma non configura questi valori specifici.
Azioni richieste:
- ✗ Aggiungere configurazione scan width/range/bars in
set_radar_operational() - ✗ Aggiungere settaggio valori nav data (altitude, accel)
- ✗ Aggiungere settaggio INU mode word
7.4 Gestione STBY/SILENCE per Target Test
Target3 workflow:
# 1. Set SILENCE
setValue(..., "rdr_mode_command_RdrModeCommandWord_silence")
# 2. Set STBY
setValue(..., "rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
# 3. Run target generation
tgt_gen_alone(interface)
# 4. Return to STBY only (unset both)
setValue(..., 0, "rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True)
Corrente: Ha helper verify_tellback_stby() ma non sequence specifica per target test.
Azioni richieste:
- ✗ Creare helper
prepare_radar_for_target_test()che sequenza SILENCE→STBY - ✗ Validare timing delays dopo ogni set
- ✗ Aggiungere cleanup function per unset STBY dopo test
7.5 Integrazione in Test Flow
Target3: tgt_gen_alone() chiamato prima del power cycling e BIT check.
Corrente: Ha placeholder per target test ma non integrato in main loop.
Azioni richieste:
- ✗ Decidere posizione target test nel flow (pre-PBIT? post-PBIT? separato?)
- ✗ Aggiungere flag
ENABLE_TARGET_TEST(default: False fino a B9 disponibile) - ✗ Integrare
tgt_gen()in loop ripetizioni con statistiche - ✗ Aggiungere colonna "Target Detected" in CSV export
8. ROADMAP IMPLEMENTAZIONE
8.1 Phase 1: ICD e Infrastruttura (✅ COMPLETATO)
✅ SCOPERTA: B9 è già presente e completamente funzionante!
- ✅ ICD XML contiene B9 - Verificato in
icd_1553_bus_controller.xml - ✅ SWIG bindings includono B9 -
interpreter.pygià supporta B9 - ✅ Mock implementato -
GRIFO_M_PBIT_mock.pysimula B9 completamente - ✅ Mappatura 1553 - B9 mappato correttamente (Map Id="19")
Phase 1 completata automaticamente - Non serve nessuna azione!
Tempo stimato: 2-3 giorni (dipende da disponibilità ICD e toolchain SWIG)
Tempo reale: 0 giorni (già presente)
8.2 Phase 2: Implementazione tgt_gen() Base
-
Aggiornare
tgt_gen()inGRIFO_M_PBIT.py- Rimuovere placeholder corrente (righe 619-667)
- Port logica da target3 con miglioramenti:
def tgt_gen(interface, timeout_sec=None, expected_range=2536, range_tolerance=(1000, 200)): """ Target generation and detection test. Stimulates radar with A4/A5 nav data and monitors B9 for target detection. Args: interface: Grifo1553 interface object timeout_sec: Max seconds to wait (default: TARGET_DETECTION_TIMEOUT_SEC) expected_range: Expected target range in ICD units (default: 2536) range_tolerance: (lower_tol, upper_tol) tuple (default: (1000, 200)) Returns: dict: {'detected': bool, 'hits': int, 'range': float, 'iterations': int} """ # Implementation here
-
Implementare stimolazione A4/A5
- Settaggio timetag incrementale con wrap a 0x70ff
- Commit messages a ~10ms rate
- Logging delta counts ogni 10 iterazioni
-
Implementare monitoring B9
- Lettura continua
getSingleMessageReceivedSz("B9") - Parsing
b9_t_num,b9_t1_rng,b9_w12 - Detection logic:
t_num>0ORtimetag_changed - Range validation con tolerance configurabile
- Lettura continua
-
Aggiungere return structured result
return { 'detected': bool, 'hits': int, # Successful range validations 'range': float, # Last detected range 'iterations': int, # Total loop iterations 'time_to_detect': float, # Seconds until first detection 'message_count': int # B9 messages received }
Tempo stimato: 1-2 giorni
8.3 Phase 3: Configurazione Radar Pre-Test
-
Estendere
set_radar_operational()- Aggiungere parametri:
def set_radar_operational(interface, range_nm=40.0, intensity=127, master_mode='RWS', gm_submode=0, # NEW: azimuth_scan_width=1, range_scale_selection=2, number_of_bars=1, altitude_ft=8202, # 2500m * 3.28 z_accel_g=1.08, # 1060 raw units inu_mode_word=0xAA54):
- Aggiungere parametri:
-
Implementare sequence SILENCE→STBY
def prepare_radar_for_target_test(interface): """Set radar in SILENCE+STBY mode before target generation test.""" setValue(interface, 1, "A2_MsgRdrOperationCommand", "rdr_mode_command_RdrModeCommandWord_silence", commitChanges=True) time.sleep(TELLBACK_POST_SET_DELAY_SEC) setValue(interface, 1, "A2_MsgRdrOperationCommand", "rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True) time.sleep(TELLBACK_POST_SET_DELAY_SEC) # Verify tellbacks return verify_tellback_stby(interface, timeout_sec=5.0) -
Implementare cleanup
def cleanup_radar_after_target_test(interface): """Unset STBY after target test.""" setValue(interface, 0, "A2_MsgRdrOperationCommand", "rdr_mode_command_RdrModeCommandWord_stby", commitChanges=True) time.sleep(STBY_POST_UNSET_DELAY_SEC)
Tempo stimato: 1 giorno
8.4 Phase 4: Integrazione in Test Loop
-
Aggiungere flag configurazione
# Top of GRIFO_M_PBIT.py ENABLE_TARGET_TEST = False # Set True when B9 available TARGET_TEST_POSITION = 'pre-pbit' # 'pre-pbit' | 'post-pbit' | 'standalone' -
Integrare in
run_single_pbit_cycle()def run_single_pbit_cycle(...): # ... existing power on ... if ENABLE_TARGET_TEST and TARGET_TEST_POSITION == 'pre-pbit': logging.info("=== TARGET DETECTION TEST ===") report.open_session("Target Detection Pre-PBIT") # Prepare radar prepare_ok = prepare_radar_for_target_test(theGrifo1553.getInterface()) if not prepare_ok: report.add_comment("WARN: Could not prepare radar for target test") # Run target test tgt_result = tgt_gen(theGrifo1553.getInterface()) # Record result repetition_stats['target_detected'] = tgt_result.get('detected', False) repetition_stats['target_hits'] = tgt_result.get('hits', 0) repetition_stats['target_range'] = tgt_result.get('range', None) if tgt_result['detected']: report.add_comment(f"Target DETECTED after {tgt_result['time_to_detect']:.1f}s " f"@ range {tgt_result['range']}") else: report.add_comment("Target NOT detected (timeout)") # Cleanup cleanup_radar_after_target_test(theGrifo1553.getInterface()) report.close_session() # ... existing PBIT flow ... -
Aggiornare CSV export
- Aggiungere colonne:
Target Detected,Target Hits,Target Range
- Aggiungere colonne:
-
Aggiornare statistiche aggregate
# In calculate_statistics() target_tests = [r.get('target_detected', None) for r in stats['repetitions']] target_detected_count = sum(1 for t in target_tests if t is True) target_pass_rate = (target_detected_count / len(target_tests) * 100) if target_tests else 0.0 stats['aggregate']['target_detected_count'] = target_detected_count stats['aggregate']['target_not_detected_count'] = len(target_tests) - target_detected_count stats['aggregate']['target_pass_rate'] = target_pass_rate
Tempo stimato: 2 giorni
8.5 Phase 5: Testing e Validazione
-
Test simulazione (mock)
- Aggiornare
GRIFO_M_PBIT_mock.pycon mock B9 responses - Testare
tgt_gen()in modalità--simulate - Validare statistiche e report
- Aggiornare
-
Test HW (se disponibile)
- Eseguire su setup reale con radar
- Validare range detection
- Tune timeout e tolerance parameters
-
Documentazione
- Aggiornare
IMPLEMENTATION_SUMMARY.md - Aggiungere sezione "Target Detection" in
GRIFO_Test_Environment_Analysis.md - Creare
TARGET_DETECTION_GUIDE.mdcon:- ICD B9 reference
- Configuration parameters
- Troubleshooting
- Aggiornare
Tempo stimato: 2-3 giorni
9. CONFIGURAZIONI DA COPIARE DA TARGET3
9.1 Valori Hardcoded da Preservare
# From target3 - VALORI CRITICI PER TARGET DETECTION
# A2 - Radar Operation
AZIMUTH_SCAN_WIDTH_SELECTION = 1 # param1
RANGE_SCALE_SELECTION = 2 # param1 (range scale 40nm?)
NUMBER_OF_BARS_SELECTION = 1 # param1
# A4 - Navigation Data
Z_ACCELERATION_RAW = 1060 # ~1.08g
CORRECTED_BARO_ALTITUDE_RAW = 2500 # ~8202 ft (2500m)
RADIO_ALTITUDE_RAW = 2500 # Matching baro
# A5 - INU High Speed
INU_MODE_WORD = 0xAA54 # Mode/status word
# B9 - Target Detection
TARGET_EXPECTED_RANGE = 2536 # ICD units (meters? yards?)
TARGET_RANGE_TOLERANCE_LOW = 1000 # -1000 units
TARGET_RANGE_TOLERANCE_HIGH = 200 # +200 units
TARGET_HITS_THRESHOLD = 10 # Successful detections before exit
# Timing
TIMETAG_INCREMENT = 150 # Increment per iteration
TIMETAG_WRAP = 0x70ff # Wrap point
TIMETAG_RESET = 10 # Reset value after wrap
TARGET_GEN_PERIOD_MS = 10 # Loop period (ms)
TARGET_GEN_MAX_ITERATIONS = 1000 # ~10s timeout
9.2 Sequence Diagram - Target Detection
Operator Test Script Radar (via 1553) Result
| | | |
|-- Start Test -------->| | |
| |-- A2: SILENCE ----->| |
| |-- A2: STBY -------->| |
| | (wait 2s) | |
| | | |
| |-- A4: Nav Data ---->| |
| |-- A5: INU Mode ---->| |
| | (wait 5s) | |
| | | |
| |====== LOOP (1000 iterations) ====== |
| |-- A4: Timetag ----->| |
| | (tt+=150) | |
| |<--- B9: Target -----| |
| |-- Check t_num ----->| |
| |-- Check t_rng ----->| |
| | | |
| | [if t_num>0] | |
| |-- Validate range -->|-- ✓ HIT ------->|
| | [if 10 hits] | |
| |====== EXIT LOOP ================= |
| | | |
| |-- A2: Unset STBY -->| |
| | | |
| |====== Continue to PBIT ============== |
10. RACCOMANDAZIONI
10.1 Priorità Alta - Bloccanti
-
Ottenere ICD Rev. D
- Richiesta formale a team documentazione
- Verificare se già disponibile in
PlatformSimulator/o archivi
-
Validare esistenza B9 in simulator
- Test manuale con
uPlatSimper vedere se B9 è già supportato - Potrebbe essere già nel simulator ma non esposto in Python bindings
- Test manuale con
-
Decision: Dove integrare target test
- Opzione A: Pre-PBIT (come target3) - validazione radar operativo prima di BIT
- Opzione B: Post-PBIT - validazione funzionale dopo BIT passed
- Opzione C: Standalone - test separato eseguibile indipendentemente
10.2 Priorità Media - Miglioramenti
-
Configurazioni flessibili
- Spostare valori hardcoded in
instrument_settings.json - Permettere override via CLI arguments
- Spostare valori hardcoded in
-
Mock simulation
- Estendere
GRIFO_M_PBIT_mock.pycon B9 synthetic responses - Testare target detection senza HW
- Estendere
-
Diagnostics
- Aggiungere logging dettagliato timetag progression
- Plot range detections over time (matplotlib export)
10.3 Priorità Bassa - Nice to Have
-
Multi-target support
- Target3 check solo
b9_t1_rng(target 1) - Estendere per N targets se B9 supporta
- Target3 check solo
-
Range sweep test
- Variare A4 altitude/accel per testare range variations
-
Integration con GUI
- Live plot target detections in
GRIFO_M_PBIT_gui.py
- Live plot target detections in
11. RISCHI E MITIGAZIONI
| Rischio | Impatto | Probabilità | Mitigazione |
|---|---|---|---|
| B9 non disponibile in ICD corrente | 🔴 Alto | Media | Ottenere ICD Rev. D; verificare simulator |
| SWIG rebuild richiede toolchain non disponibile | 🔴 Alto | Bassa | Usare binaries pre-compilati da target3 |
| Range units non documentati | 🟡 Medio | Media | Reverse-engineer da test HW; validare con team radar |
| Target detection timeout su HW reale | 🟡 Medio | Alta | Parametri configurabili; increase timeout |
| Stimolazione A4/A5 interfere con PBIT | 🟡 Medio | Bassa | Separare target test con cleanup; testare sequenze |
12. CONCLUSIONI
12.1 Gap Summary
Il codice target3 è una variante specializzata focalizzata su:
- Validazione operativa radar (target detection)
- Test manuale con operatore (power cycling, visual checks)
- Subset ridotto di verifiche (6 LRU, subset B8)
Il nostro codice corrente è un framework completo ma manca:
- ❌ Supporto ICD per B9 (messaggio target report)
- ❌ Stimolazione attiva A4/A5 per target generation
- ❌ Workflow target detection integrato nel flow
12.2 Next Steps
IMMEDIATO:
- Analizzare
target3/Documents/ICD7033158 Rev. D.pdfper definizione B9 - Verificare se B9 è già nel simulator (test manuale)
- Decidere architecture target test (pre/post/standalone PBIT)
SHORT-TERM (1-2 settimane): 4. Implementare Phase 1-2 della roadmap (ICD + tgt_gen base) 5. Testing in modalità simulazione 6. Documentazione
MEDIUM-TERM (3-4 settimane): 7. Integrazione completa nel test loop 8. Validazione su HW 9. Statistiche e report estesi
APPENDICE A: FILE DA ANALIZZARE
Da target3:
target3/.../Documents/ICD7033158 Rev. D.pdf- PRIORITÀ 1target3/.../scripts/GRIFO_M_PBIT.py(righe 1-450)target3/.../env/leo_grifo_1553.py(identico al nostro)
Da corrente:
TestEnvironment/scripts/GRIFO_M_PBIT.py(righe 619-667 - stub tgt_gen)TestEnvironment/env/leo_grifo_1553.py(no B9 support)PlatformSimulator/bin/interpreter.py(bindings SWIG)
APPENDICE B: CONTATTI E RISORSE
Domande da porre al team:
- È disponibile ICD7033158 Rev. D con definizione B9?
- Il simulator uPlatSim già supporta B9 message?
- Quali sono le unità di misura per
b9_t1_rng? (meters? yards? feet?) - Esiste documentazione per target generation test procedure?
- I valori hardcoded (2536 range, 0xAA54 INU mode) sono specifici per setup Genova?
Risorse:
- ICD:
ICD7033158 Rev. D.pdf(in target3/Documents) - Simulator:
PlatformSimulator/bin/uPlatSim.exe - SWIG source: (verificare se disponibile per rebuild)
Fine Documento
Autore: GitHub Copilot AI Agent
Data: 2026-02-03
Versione: 1.0
Repository: GrifoAutomaticTestEnv