step-examples/12-8-mixed/M095.stp
Sources
- deduced from ISO 10303-238 §5.6 time_measure non-negativity
Sender
deduced — STEP-NC publisher with timestamp-arithmetic bug computing end_time minus start_time with arguments swapped
Description
A `MACHINING_OPERATION`'s associated `EXECUTION_TIME` (a `TIME_MEASURE_WITH_UNIT`) carries a negative numeric value, e.g. `-12.5` seconds. STEP-NC consumers using execution time for cycle-time estimation produce nonsensical totals; some implementations roll the value modulo zero and report a one-pass cycle as multi-hour. Bug-reporter language: "STEP-NC cycle time negative", "AP238 operation duration wrong sign", "negative time in NC file".
Reproducer recipe
`MEASURE_WITH_UNIT(TIME_MEASURE(-12.5), seconds_unit)` attached to a `MACHINING_OPERATION` as its execution time.
Expected kernel behavior
reject negative time values; or take absolute value and warn.
Notes
Synonyms: "negative duration", "AP238 time goes backwards", "machining operation negative time", "execution_time below zero", "STEP-NC negative duration".
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
contains(b'AP238_STEP_NC_MIM')contains(b'TIME_MEASURE')contains(b'MACHINING_OPERATION')
Tier-3 assertions
shape_null == True
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* M095: AP238 machining_operation declares negative execution time */ 3/* DEFECT: EXECUTION_TIME = TIME_MEASURE(-12.5) seconds â negative duration */ 4/* ISO 10303-238 §5.6 requires non-negative time_measure values */ 5/* Arises from timestamp arithmetic bug: end_time - start_time with args swapped */ 6/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */ 7/* Byte assertion: contains(b'TIME_MEASURE') */ 8/* Byte assertion: contains(b'MACHINING_OPERATION') */ 9HEADER; 10FILE_DESCRIPTION(('M095: AP238 MACHINING_OPERATION with negative execution time'),'2;1'); 11FILE_NAME('M095.stp','2026-06-21T00:00:00',(''),(''),'cad-research-suite','',''); 12/* Byte assertion: contains(b'AP238_STEP_NC_MIM') */ 13FILE_SCHEMA(('AP238_STEP_NC_MIM { 1 0 10303 238 1 0 0 }')); 14ENDSEC; 15DATA; 16#1=APPLICATION_CONTEXT('step_nc_mim'); 17#2=APPLICATION_PROTOCOL_DEFINITION('international standard', 18 'ap238_step_nc_mim',2007,#1); 19/* Standard unit context â mm */ 20#10=(LENGTH_UNIT()NAMED_UNIT(*)SI_UNIT(.MILLI.,.METRE.)); 21#11=(NAMED_UNIT(*)PLANE_ANGLE_UNIT()SI_UNIT($,.RADIAN.)); 22#12=(NAMED_UNIT(*)SI_UNIT($,.STERADIAN.)SOLID_ANGLE_UNIT()); 23#13=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(0.001),#10, 24 'distance_accuracy_value','maximum model space distance between geometric entities'); 25#14=(GEOMETRIC_REPRESENTATION_CONTEXT(3) 26 GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#13)) 27 GLOBAL_UNIT_ASSIGNED_CONTEXT((#10,#11,#12)) 28 REPRESENTATION_CONTEXT('nc','3D')); 29/* Seconds unit for EXECUTION_TIME */ 30#20=(NAMED_UNIT(*)SI_UNIT($,.SECOND.)TIME_UNIT()); 31/* Byte assertion: contains(b'TIME_MEASURE') */ 32/* DEFECT: TIME_MEASURE(-12.5) â negative duration violates §5.6 non-negativity */ 33/* Correct value would be a positive number of seconds, e.g. TIME_MEASURE(45.0) */ 34#21=TIME_MEASURE_WITH_UNIT(TIME_MEASURE(-12.5),#20); 35/* Target machined feature */ 36#50=MACHINED_FEATURE('pocket_b',$,$,$,$,$); 37/* Byte assertion: contains(b'MACHINING_OPERATION') */ 38/* Machining tool for the operation */ 39#60=MACHINING_TOOL('endmill_8mm',$,$,$); 40/* DEFECT: MACHINING_OPERATION references #21 (negative TIME_MEASURE) as execution time */ 41/* The -12.5 s duration causes cycle-time totals to go negative in downstream tooling */ 42#70=MACHINING_OPERATION('mill_pocket',#60,$,#21,$,$,$,$,#50,$,$); 43/* Workingstep and workplan */ 44#80=MACHINING_WORKINGSTEP('pocket_step',#50,#70,$); 45#90=WORKPLAN('main',(#80),$,$,$); 46/* GEOMETRIC_CURVE_SET IS the model entity â OCC yields empty */ 47#300=GEOMETRIC_CURVE_SET('ap238-machining-operation-negative-execution-time', 48 (#21,#50,#60,#70,#80,#90)); 49/* Product chain */ 50#400=APPLICATION_CONTEXT('mechanical design'); 51#401=PRODUCT_CONTEXT('',#400,'mechanical'); 52#402=PRODUCT('M095','M095','M095',(#401)); 53#403=PRODUCT_DEFINITION_FORMATION('','',#402); 54#404=PRODUCT_DEFINITION_CONTEXT(#400,'design'); 55#405=PRODUCT_DEFINITION('','',#403,#404); 56#406=PRODUCT_DEFINITION_SHAPE('','',#405); 57#407=SHAPE_REPRESENTATION('',(#300),#14); 58#408=SHAPE_DEFINITION_REPRESENTATION(#406,#407); 59ENDSEC; 60END-ISO-10303-21;