﻿# SimPy numeric horizons: reaching the clock boundary does not process its events

Define whether a SimPy report includes events at its stopping horizon, and inspect pending events before interpreting the clock as completed work.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/simulation-simpy-numeric-horizon-exclusive-event-boundary/
Language: en

## A final clock reading can conceal unfinished boundary work

A factory twin reports completed jobs when the simulation clock reaches its reporting horizon. A job completion was scheduled exactly there, but the summary omits it. The model may be following its execution contract correctly while the report assumes an inclusive interval. Define the accounting boundary before comparing scenarios. Otherwise a change in scheduling can appear to improve throughput simply by moving completions across an undeclared endpoint convention.

## Numeric stopping has an exclusive event boundary

The [environment guide](https://simpy.readthedocs.io/en/stable/topical_guides/environments.html) explicitly says that a numeric until stops when the clock reaches that value without processing scheduled events at the same time. The [core API](https://simpy.readthedocs.io/en/stable/api_reference/simpy.core.html) distinguishes clock state from event processing. Therefore, an assertion that the clock equals the horizon does not prove that all completions through that horizon were counted. Preserve the stopping criterion in the experiment record rather than describing every run simply as ending at a timestamp.

## Choose a reporting convention before draining events

An exclusive interval can be a valid reporting choice. If the application instead needs all events at the boundary, define a deliberate stepping policy using pending-event inspection rather than adding an unexplained small time increment. Such an increment can admit events beyond the intended boundary and depends on the model’s time scale. Boundary events may also schedule further events at the same time, so specify whether the policy includes that resulting closure.

## Propose an exact-boundary accounting fixture

A proposed fixture should schedule completions before, exactly at and after the reporting boundary, with identities retained in the completion ledger. Compare the intended interval with the actual counted set and inspect the next pending event after stopping. Include a boundary completion that schedules another same-time accounting action. No SimPy experiment was executed here. The fixture is designed to distinguish the reporting convention from an apparent loss of jobs in the simulated process.

## Do not mistake a marker for a universal drain

Running until a designated event can express a useful completion condition, but the event must represent the intended work. An arbitrary marker at the same timestamp does not automatically prove all other work at that time has finished. Define the marker’s causal relationship to the accounted operations, or inspect the pending schedule under a documented boundary policy. Keep the event’s meaning separate from its timestamp when constructing a reporting barrier.

## Bound the interpretation of throughput summaries

The [simulation-validation study](/journal/cxl-pool-simulator-two-host-validation-optical-bandwidth-sweep/) covers a separate evidence boundary; [stack reproducibility](/journal/software-stack-reproducibility/) supports preserving execution policy. Here acceptance establishes which events enter a reporting interval. It does not validate arrival distributions, service models or real factory capacity. Those claims require independent evidence after horizon conventions stop changing the counted workload invisibly between runs or implementations.
