-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Description
In write_flow_pipe_connectors (src/simlin-engine/src/mdl/writer.rs), the pipe connector direction flag (field 4 in the pipe connector tuple) is set to 100 for cloud endpoints and 4 for stock endpoints. However, analysis of the mark2.mdl roundtrip test shows a mismatch between original and roundtripped values:
- Original file: flags
{4: 9, 100: 4}(i.e., some stock-connected pipes have flag 9, some have 4; cloud-connected pipes have 100) - Roundtripped file: flags
{4: 11}for stock-connected pipes
The flag semantics appear to involve more than just endpoint type. They may encode additional information such as:
- Flow direction (inflow vs. outflow)
- Source vs. sink role of the connected stock
- Pipe orientation or routing hints
Why It Matters
- Correctness: Roundtripped MDL files may produce visually different pipe/flow rendering in Vensim due to incorrect direction flags.
- MDL format fidelity: Achieving faithful MDL roundtrips is a goal of the current work on the
mdl-roundtrip-fidelitybranch. - Interoperability: Users who roundtrip models through Simlin and then open them in Vensim could see unexpected layout changes in flow arrows.
Component(s) Affected
simlin-engine-- specificallysrc/simlin-engine/src/mdl/writer.rs, functionwrite_flow_pipe_connectors
Possible Approaches
- Compare multiple Vensim-generated
.mdlfiles to catalog the full set of flag values and their correlation with flow direction, endpoint type, and pipe orientation. - Check Vensim documentation or SDeverywhere/PySD for any reverse-engineered documentation of the pipe connector format.
- Add test cases that cover inflow-to-stock, outflow-from-stock, and cloud-terminated flows to isolate the flag semantics.
Context
Identified during development on the mdl-roundtrip-fidelity branch, specifically when analyzing differences between the original test/mdl/mark2.mdl and its roundtripped output.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels