Chronaxis用户手册English
本页目录

chronaxis.planning.legacy_execution

源码基线:8904c2f744951857659abd40aaa3535d57faf53c

1"""在读取前校验逐消息计划的时间域与CAN读取策略;不选择历史兼容路径。"""23from ..core.models import Interval4from ..sources.can_spec import LegacyCANSpec5from .checks import PlanValidationError678def require_can_decode_scope(plan) -> None:9    """在资源创建前检查请求时间域及CAN策略,不自动更换执行方式。1011    参数: plan为完整AnalysisPlan;直接构造或replace的typed声明同样接受检查。12    返回: None;requested按统一需求接普通、消息和原帧消费者,all保留显式完整诊断。13    异常: PlanValidationError定位时间域、陈旧绑定或来源策略错误;其他属性错误原样传播。14    边界: 不读文件、DBC或信号值;纯参数指标和空signals仍可请求其指标报文。15    """16    # typed replace不重新绑定表达式;不能借改dataset静默增删原声明的时间筛选。17    domain = plan.dataset.domain18    if domain is not None and not isinstance(domain, Interval):19        raise PlanValidationError('$.dataset.domain', '请求时间域需要Interval或整文件None声明')20    if type(plan.dataset.domain_explicit) is not bool:21        raise PlanValidationError('$.dataset.domain', 'domain_explicit需要原生bool')22    if plan.dataset.domain_explicit != (domain is not None):23        raise PlanValidationError('$.dataset.domain', 'domain_explicit必须与实际domain声明一致')24    if plan.bindings.domain != domain:25        raise PlanValidationError('$.dataset.domain', '请求时间域与原声明绑定不一致,需重新构建计划')26    # 先核有限静态选项;需要真实来源类型的其他约束仍由原计划校验承担。27    for index, source in enumerate(plan.sources):28        if source.source_type != 'can_blf' or not isinstance(source.config, LegacyCANSpec):29            continue30        scope = source.config.decode_scope31        path = f'$.sources[{index}].decode_scope'32        if type(scope) is not str or scope not in ('all', 'requested'):33            raise PlanValidationError(path, '需要all或requested')34        # 同一前置门禁也拒绝绕过dataclass构造器的typed检查范围替换。35        check = source.config.input_check36        if type(check) is not str or check not in ('auto', 'full'):37            raise PlanValidationError(f'$.sources[{index}].input_check', '需要auto或full')38        # 实际字段、普通样本、消息触发和原帧导出分别规划;不得因混合任务静默退回all。39
Chronaxis 用户手册 · 离线阅读