相较上一版 Jacobian 确定性复用更新,本次补齐事件边界一致性、结果两侧采样及接触事件定位;保留已有物性复用和组件力学公式。 - 统一 UD00 信号求值与下一事件查询的绝对时间边界,修复循环边界浮点舍入导致的阶段错位、重复或漏报,并覆盖零时长、多阶段及长周期场景。 - 引入原生输出语义 v2:保留规则网格真实时间,补充内部时间事件和状态事件的左邻及事件后采样,按保存时间、状态和离散模式重放结果。 - 两条代码生成路径均发出 LSTP 接触描述,默认定位间隙过零及非负力模式的力截断;仅在接受事件时更新防重复记录,增加 contactEvents 诊断计数。 - 补充 MASS/LSTP 独立事件实验、八路全曲线与驱动阶段配对评估,以及 Amesim 不连续点输出对照和力差定位报告;MASS 新增释放机制仍保留为独立实验。 - 保存局部 probe、context 访问与回退、shadow replay、R288 real skip/typed replay 及阀门数值尾部诊断工具和报告;未证明净收益的实验不启用为生产默认优化。 - 更新原生运行说明和元件建模规范,补充信号边界、输出语义、接触事件和实验依赖回归测试。 验证:五组专项回归共 34 项全部通过;37 个待提交 Python 文件语法检查通过;git diff --cached --check 通过。
52 lines
1.9 KiB
Python
52 lines
1.9 KiB
Python
"""Read-only numerical probe of current UD00 event/evaluation consistency."""
|
|
import argparse
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT))
|
|
from app.simulation.native_codegen.build import _command, toolchain
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--output', type=Path, required=True)
|
|
args = parser.parse_args()
|
|
out = args.output.resolve()
|
|
out.mkdir(parents=True, exist_ok=True)
|
|
source = out / 'signal-boundary-probe.c'
|
|
code = r'''
|
|
#include "SIGNAL_SOURCE"
|
|
#include <stdio.h>
|
|
int main(void) {
|
|
double d[24]={0};
|
|
d[0]=1e17; d[8]=1e17; d[1]=49000; d[9]=49000; d[16]=.8; d[17]=10;
|
|
double t=0;
|
|
puts("boundary,left,at,right,expected_after,at_matches_after");
|
|
for(int i=0;i<10;i++) {
|
|
t=native_signal_break(t,60,0,2,1,d);
|
|
double expected=i%2==0?49000:1e17;
|
|
printf("%.17g,%.17g,%.17g,%.17g,%.17g,%d\n",t,
|
|
native_signal(nextafter(t,-INFINITY),0,2,1,d),native_signal(t,0,2,1,d),
|
|
native_signal(nextafter(t,INFINITY),0,2,1,d),expected,
|
|
native_signal(t,0,2,1,d)==expected);
|
|
}
|
|
return 0;
|
|
}
|
|
'''
|
|
source.write_text(code.replace('SIGNAL_SOURCE', (ROOT / 'native/components/modules/signal.c').as_posix()), encoding='ascii')
|
|
compiler, _, version = toolchain()
|
|
exe = out / ('signal-boundary-probe.exe' if sys.platform == 'win32' else 'signal-boundary-probe')
|
|
command = [compiler, '-std=c11', '-O2', '-ffp-contract=off', '-fno-fast-math',
|
|
'-I' + str(ROOT / 'native/include'), str(source), '-lm', '-o', str(exe)]
|
|
_command(command, log=[], timeout=60)
|
|
data = subprocess.check_output([str(exe)], timeout=10)
|
|
(out / 'signal-boundaries.csv').write_bytes(data)
|
|
print(version)
|
|
print(data.decode('ascii'))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|