refactor(model): polish the coffee and limits-to-growth samples
Rename the coffee outflow "heat loss" to "cooling" so the balancing loop reads more naturally, and stack carrying capacity above the source in limits to growth so its link to crowding is a clean horizontal hop.
This commit is contained in:
@@ -102,25 +102,20 @@ function savings(): Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coffee cooling — the simplest Balancing loop, plus a Converter. Heat leaves the
|
* Coffee cooling — the simplest Balancing loop, plus a Converter. The cup cools
|
||||||
* cup faster the hotter it is (Coffee → [+] → heat loss) but slower the warmer
|
* faster the hotter it is (Coffee → [+] → cooling) but slower the warmer the room
|
||||||
* the room (room temperature → [−] → heat loss). The loop Coffee → heat loss →
|
* (room temperature → [−] → cooling). The loop Coffee → cooling → (outflow) →
|
||||||
* (outflow) → Coffee has one `−` → Balancing: it settles toward room temperature.
|
* Coffee has one `−` → Balancing: it settles toward room temperature.
|
||||||
*/
|
*/
|
||||||
function coffee(): Model {
|
function coffee(): Model {
|
||||||
const coffee = makeStock({ x: -200, y: 0 }, "Coffee")
|
const coffee = makeStock({ x: -200, y: 0 }, "Coffee")
|
||||||
const sink = makeCloud({ x: 200, y: 0 })
|
const sink = makeCloud({ x: 200, y: 0 })
|
||||||
const heatLoss = makeFlow(
|
const cooling = makeFlow(midpoint(coffee.position, sink.position), "cooling", coffee.id, sink.id)
|
||||||
midpoint(coffee.position, sink.position),
|
|
||||||
"heat loss",
|
|
||||||
coffee.id,
|
|
||||||
sink.id,
|
|
||||||
)
|
|
||||||
const room = makeConverter({ x: 0, y: -160 }, "room temperature")
|
const room = makeConverter({ x: 0, y: -160 }, "room temperature")
|
||||||
return model(
|
return model(
|
||||||
"Coffee cooling",
|
"Coffee cooling",
|
||||||
[coffee, sink, heatLoss, room],
|
[coffee, sink, cooling, room],
|
||||||
[link(coffee, heatLoss, "+"), link(room, heatLoss, "-")],
|
[link(coffee, cooling, "+"), link(room, cooling, "-")],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,10 +161,10 @@ function limitsToGrowth(): Model {
|
|||||||
const source = makeCloud({ x: -280, y: 0 })
|
const source = makeCloud({ x: -280, y: 0 })
|
||||||
const yeast = makeStock({ x: 40, y: 0 }, "Yeast")
|
const yeast = makeStock({ x: 40, y: 0 }, "Yeast")
|
||||||
const growth = makeFlow(midpoint(source.position, yeast.position), "growth", source.id, yeast.id)
|
const growth = makeFlow(midpoint(source.position, yeast.position), "growth", source.id, yeast.id)
|
||||||
// crowding rides above the pipe; carrying capacity sits to its right so the
|
// crowding rides above the pipe; carrying capacity stacks above the Source on the
|
||||||
// `capacity → crowding` link is a short horizontal hop along the top.
|
// left, so the `capacity → crowding` link is a clean horizontal hop along the top.
|
||||||
|
const capacity = makeConverter({ x: -280, y: -160 }, "carrying capacity")
|
||||||
const crowding = makeConverter({ x: -40, y: -160 }, "crowding")
|
const crowding = makeConverter({ x: -40, y: -160 }, "crowding")
|
||||||
const capacity = makeConverter({ x: 160, y: -160 }, "carrying capacity")
|
|
||||||
return model(
|
return model(
|
||||||
"Limits to growth",
|
"Limits to growth",
|
||||||
[source, yeast, growth, crowding, capacity],
|
[source, yeast, growth, crowding, capacity],
|
||||||
|
|||||||
Reference in New Issue
Block a user