Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
basic_data_flow [2026/07/21 22:11]
hermann
basic_data_flow [2026/07/21 22:38] (current)
hermann
Line 3: Line 3:
 ===== Description ===== ===== Description =====
  
-A Dinamica EGO model is, at its core, a graph: **functors** connected through their input and output ports. This is true no matter how the model was authored — built visually in the GUI, or written by hand in [[ego_script|EGO Script]]. ​Both are just different notations for describing ​the same underlying graph, and the execution engine schedules functors from that graph, not from the notation used to write it. This page describes how that scheduling works, independently of any particular notation.+A Dinamica EGO model is, at its core, a graph: **functors** connected through their input and output ports. This is true no matter how the model was authored — built visually in the GUI, saved as [[xml_script|XML Script]], or written by hand in [[ego_script|EGO Script]]. ​Either notation ​just describes ​the same underlying graph, and the execution engine schedules functors from that graph, not from the notation used to write it. This page describes how that scheduling works, independently of any particular notation.
  
 ===== Functors and connections ===== ===== Functors and connections =====
Line 39: Line 39:
 This exemption is what makes loops possible at all. Without it, the functor that computes a loop's next state and the mux that carries it forward would depend on each other in a cycle, and neither could ever be scheduled. By treating the feedback connection as "last iteration'​s value" rather than "this iteration'​s value,"​ the engine breaks the cycle — the same trick a register or flip-flop uses in a clocked circuit to let a signal feed back into its own computation. This exemption is what makes loops possible at all. Without it, the functor that computes a loop's next state and the mux that carries it forward would depend on each other in a cycle, and neither could ever be scheduled. By treating the feedback connection as "last iteration'​s value" rather than "this iteration'​s value,"​ the engine breaks the cycle — the same trick a register or flip-flop uses in a clocked circuit to let a signal feed back into its own computation.
  
-The converse also holds. ​If a loop has no mux, and nothing produced ​by a functor ​inside ​it is consumed by anything outside it, then its iterations carry no state forward ​and depend on nothing but themselves — the same as any other pair of independent ​functors. In that case there is nothing forcing them to run one after another, and the engine is free to run several ​iterations ​at the same time.+The converse also holds. ​loop's iterations can run simultaneously as long as three conditions are met: no mux is used directly inside the loop, nothing produced inside ​the loop is consumed by anything outside it, and no member of the loop is used as a submodel'​s output port. Without a mux, an iteration carries ​no state forward ​to the next one — so, exactly ​as with any other pair of functors, iterations ​that share no connection have no dependency on each other, and the engine is free to run several ​of them at once. 
 + 
 +This also means a mux can be used deliberately to force sequential execution, even when a loop would otherwise qualify for parallel execution — any mux inside the loop disqualifies it, since it's the presence of a mux itself, not what it carries, that creates the dependency between iterations. ''​MuxValue 0 0''​ is simply the simplest way to add one: a mux whose initial and feedback inputs are both just the constant ''​0'',​ carrying no real state, added purely to force the ordering.