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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
| import numpy as np from dataclasses import dataclass from typing import Optional
@dataclass class OccupantProfile: """乘员分类结果""" category: str weight_est: float height_est: float posture: str confidence: float seat_position: float belt_status: str
class ZFOccupantClassifier: """ ZF LIFETEC 乘员分类算法(推理重建) 融合多传感器数据确定乘员分类 """ def __init__(self): self.weight_thresholds = { 'empty': 5.0, 'infant': 13.0, 'child': 36.0, 'adult': 999.0 } def classify(self, camera_data: dict, seat_load: float, belt_latch: dict, seat_pos: float) -> OccupantProfile: """ 多传感器融合分类 Args: camera_data: 相机提取的特征 - estimated_height: 估计身高(cm) - head_position: 头部位置(x,y) - shoulder_position: 肩部位置 - posture_label: 姿态标签 seat_load: 座椅载荷(kg) belt_latch: 锁扣数据 - buckled: bool - displacement: 位移(mm) seat_pos: 座椅位置 0-1 """ if seat_load < self.weight_thresholds['empty']: category = 'empty' elif seat_load < self.weight_thresholds['infant']: category = 'infant' elif seat_load < self.weight_thresholds['child']: category = 'child' else: category = 'adult' camera_height = camera_data.get('estimated_height', 0) if category == 'adult' and camera_height < 140: if seat_load < 25: category = 'child' posture = camera_data.get('posture_label', 'normal') if belt_latch['buckled']: if belt_latch['displacement'] > 50: belt_status = 'misused' else: belt_status = 'buckled' else: belt_status = 'unbuckled' confidence = self._calc_confidence( camera_data, seat_load, category ) return OccupantProfile( category=category, weight_est=seat_load, height_est=camera_height, posture=posture, confidence=confidence, seat_position=seat_pos, belt_status=belt_status ) def _calc_confidence(self, camera_data, seat_load, category): """简单置信度估计""" conf = 0.5 if camera_data.get('estimated_height', 0) > 0: conf += 0.2 if seat_load > 5: conf += 0.2 if category != 'empty': conf += 0.1 return min(conf, 1.0)
class AdaptiveRestraintController: """ ZF LIFETEC 自适应约束参数计算器 根据乘员分类动态调整安全气囊和安全带参数 """ def __init__(self): self.acr8_params = { 'pretension_force_max': 300, 'load_limiting_stages': [ {'force': 250, 'duration_ms': 10}, {'force': 350, 'duration_ms': 20}, {'force': 450, 'duration_ms': 30}, {'force': 550, 'duration_ms': 40}, ], 'motor_response_time': 100, 'pyro_response_time': 5, } self.dca_params = { 'small_volume': 60, 'large_volume': 90, 'venting_stages': [ {'diameter_mm': 15, 'open_delay_ms': 5}, {'diameter_mm': 25, 'open_delay_ms': 15}, {'diameter_mm': 35, 'open_delay_ms': 25}, ], 'inflation_time': 25, 'internal_tether_stages': 2, } def compute_restraint_params(self, occupant: OccupantProfile, crash_severity: float) -> dict: """ 计算自适应约束参数 Args: occupant: 乘员分类 crash_severity: 碰撞严重度 0-1 Returns: params: 安全气囊和安全带参数 """ params = {} if occupant.category == 'adult': if occupant.weight_est > 80: params['airbag_volume'] = self.dca_params['large_volume'] params['venting'] = self.dca_params['venting_stages'][0] else: params['airbag_volume'] = 75 params['venting'] = self.dca_params['venting_stages'][1] elif occupant.category == 'child': params['airbag_volume'] = self.dca_params['small_volume'] params['venting'] = self.dca_params['venting_stages'][2] params['airbag_deactivate'] = occupant.posture == 'oop' elif occupant.category == 'infant': params['airbag_deactivate'] = True else: params['airbag_deactivate'] = True weight = occupant.weight_est if weight < 20: stage_idx = 0 elif weight < 50: stage_idx = 1 elif weight < 80: stage_idx = 2 else: stage_idx = 3 params['belt_stage'] = self.acr8_params['load_limiting_stages'][stage_idx] params['pretension'] = min( crash_severity * self.acr8_params['pretension_force_max'], self.acr8_params['pretension_force_max'] ) if occupant.posture == 'reclined': params['airbag_volume'] *= 1.15 params['belt_stage']['force'] *= 0.85 elif occupant.posture == 'oop': params['airbag_deactivate'] = True params['pretension'] = 0 return params
if __name__ == "__main__": print("=" * 60) print("ZF LIFETEC 自适应约束系统模拟") print("InCabin Europe 2026 展示方案") print("=" * 60) classifier = ZFOccupantClassifier() controller = AdaptiveRestraintController() scenarios = [ { 'name': '成年男性 (85kg, 正常坐姿)', 'camera': {'estimated_height': 178, 'posture_label': 'normal'}, 'seat_load': 85, 'belt': {'buckled': True, 'displacement': 10}, 'seat_pos': 0.3, 'crash': 0.8 }, { 'name': '6岁儿童 (22kg, 正常坐姿)', 'camera': {'estimated_height': 115, 'posture_label': 'normal'}, 'seat_load': 22, 'belt': {'buckled': True, 'displacement': 15}, 'seat_pos': 0.5, 'crash': 0.8 }, { 'name': '婴儿 (8kg, 后向座椅)', 'camera': {'estimated_height': 65, 'posture_label': 'normal'}, 'seat_load': 8, 'belt': {'buckled': True, 'displacement': 5}, 'seat_pos': 0.1, 'crash': 0.8 }, { 'name': '成人前倾 (75kg, OOP)', 'camera': {'estimated_height': 170, 'posture_label': 'oop'}, 'seat_load': 75, 'belt': {'buckled': True, 'displacement': 60}, 'seat_pos': 0.4, 'crash': 0.8 }, ] for s in scenarios: print(f"\n--- {s['name']} ---") occ = classifier.classify( s['camera'], s['seat_load'], s['belt'], s['seat_pos'] ) params = controller.compute_restraint_params(occ, s['crash']) print(f" 分类: {occ.category} | 置信度: {occ.confidence:.0%}") print(f" 体重: {occ.weight_est}kg | 身高: {occ.height_est}cm") print(f" 姿态: {occ.posture} | 安全带: {occ.belt_status}") print(f" 气囊: {'关闭' if params.get('airbag_deactivate') else f'{params.get(\"airbag_volume\", 0):.0f}L'}") if 'belt_stage' in params: print(f" 安全带: {params['belt_stage']['force']}N / {params['belt_stage']['duration_ms']}ms") print(f" 预紧力: {params.get('pretension', 0):.0f}N")
|