I told the valve to close at 5 seconds. Did it listen?
Kay and Jo drain a tank through a valve that closes at 5 seconds. The strip is below, and the steps to build it in Konjugate are under it.
Transcript
Four panels. Kay, a round teal character, and Jo, a dry blue one, are joined by a dotted line. Step 1, the tank. A tank is full to 10. Kay says: A tank at 10. A valve drains it. Jo says: It should shut at 5 seconds. Step 2, the equation. A card reads: drain is drainRate while t is less than closeTime, otherwise 0. Kay says: I never wrote "stop". Jo says: You wrote a condition. That is enough. Step 3, the result. A chart of the tank level falls from 10 to 5 at 5 seconds, then stays flat to 10 seconds. Kay says: It stopped at 5. Jo says: Down 5, then flat. The equation chose. The level was 6 at 4 seconds and 5 from 5 seconds on. Kay asks: Does it check the clock? Jo says: Every step. Time is a reference.
Image for sharing
What just happened
A tank holds 10 units and drains at 1 unit a second while its valve is open. The valve closes at 5 seconds. The run says the level was 6 at 4 seconds and 5 from 5 seconds to the end at 10 seconds, which is what the equation says and nothing more. Nobody told the level to stop. The drain is a conditional equation on simulation time, so after 5 seconds its value is 0 and the level has nothing left to fall by.
Build it in Konjugate
- Add a node called Tank with one state, Level, starting at 10. Open the node and add a source term.
- Give the source term two parameters: Drain rate (
drainRate, 1) and Valve closes at (closeTime, 5 seconds). - Switch the equation to LaTeX and write it as a
casesblock:
-\begin{cases}
\mathrm{drainRate} & t < \mathrm{closeTime} \\
0 & \text{otherwise}
\end{cases}

- Run the model for 10 seconds and open the tank's Results tab.

What this does and does not say
The model is invented and small so that the answer can be checked by hand: 10 minus 1 times 5 is 5. The figures above were read from a run on 2026-10-16. The point is the mechanism. An equation can read the simulation time and choose between formulas, and the first condition that is true wins.
Go deeper
- "Conditional equations and simulation time" covers every rule for conditions, and conditions that read states instead of time.
- "Forking a run to try a what-if" turns "what if the valve closed earlier?" into a one-step experiment.
Follow Konjugate on LinkedIn for updates, or subscribe via RSS.
Comments
Post a Comment