-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Description
The systems format translator only creates dest_capacity aux variables for stocks that are destinations of flows. If a stock has an explicit max but is not a destination of any flow, the max value is silently dropped during translation and cannot be reconstructed by the writer.
Concrete example: A(10, 20) > B @ 1 round-trips as A(10) > B @ Rate(1), losing max=20 on stock A.
Why it matters
This is a round-trip fidelity bug. Users who write a stock with a max and later read it back will get different semantics. The max constraint disappears entirely, which changes model behavior if flows are later added targeting that stock.
Component(s) affected
src/simlin-engine-- systems format translator (builds the intermediate project)src/simlin-engine-- systems format writer (reconstructs text from the project)
Root cause
The translator creates dest_capacity aux variables by iterating over flows and looking at their destination stocks. Stocks that have a max but are never a flow destination are never visited, so their max is never stored in the translated project.
Possible approaches
- After processing flows, make a second pass over all stocks. For any stock with a max that did not get a
dest_capacityaux (i.e., it is not a flow destination), store the max directly on the stock's range or create a standalone capacity marker. - Have the writer check the original stock definitions for max values that are not represented by
dest_capacityauxes.
Context
Identified during code review of PR #398 (systems-format branch).