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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| class DynamicRangeCabinTest: """ 座舱动态范围测试 座舱光照范围: - 深夜无灯: 0.01 lux - 夜间IR补光: 1-10 lux - 隧道内: 50-200 lux - 阴天白天: 1,000-5,000 lux - 正午阳光直射: 50,000-100,000 lux 总动态范围需求: 0.01 - 100,000 lux = 100dB+ """ LIGHTING_SCENARIOS = { 'night_ir': {'lux': 1, 'source': '940nm LED', 'dynamic_range_req': '60dB'}, 'night_no_ir': {'lux': 0.01, 'source': 'ambient', 'dynamic_range_req': '80dB'}, 'tunnel_entry': {'lux': 100, 'source': 'mixed', 'dynamic_range_req': '80dB'}, 'tunnel_exit': {'lux': 10000, 'source': 'sunlight', 'dynamic_range_req': '100dB'}, 'day_cabin': {'lux': 5000, 'source': 'sunlight through window', 'dynamic_range_req': '80dB'}, 'sunlight_direct': {'lux': 100000, 'source': 'direct sun', 'dynamic_range_req': '120dB'}, } def test_hdr_performance(self, camera_config: dict) -> dict: """ 测试HDR摄像头在多场景下的表现 OX05C HDR: 120dB+ 传统卷帘: 60-80dB """ results = {} for scenario, params in self.LIGHTING_SCENARIOS.items(): dr_measured = camera_config.get('dynamic_range_db', 80) dr_required = int(params['dynamic_range_req'].replace('dB', '')) results[scenario] = { 'lux': params['lux'], 'dr_measured': dr_measured, 'dr_required': dr_required, 'passed': dr_measured >= dr_required, 'impact': self._assess_impact(scenario, dr_measured, dr_required), } return results def _assess_impact(self, scenario: str, measured: int, required: int) -> str: if measured >= required: return '✅ 正常工作' elif measured >= required - 20: return '⚠️ 性能下降,眨眼检测延迟增加' else: return '❌ 无法检测,DMS功能失效'
|