Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
ports [2026/07/09 05:10] hermann created |
ports [2026/07/09 07:16] (current) hermann |
||
|---|---|---|---|
| Line 20: | Line 20: | ||
| An **editable** port can receive a constant value typed directly into the GUI or written as a constant in an EGO Script call. Non-editable ports must be connected to an output from another functor; they cannot be supplied with a constant. | An **editable** port can receive a constant value typed directly into the GUI or written as a constant in an EGO Script call. Non-editable ports must be connected to an output from another functor; they cannot be supplied with a constant. | ||
| - | ==== Auto-bound inputs ==== | + | ==== Auto-bound inputs and outputs ==== |
| - | Some input ports inside a container functor can be **auto-bound** — they automatically link to a matching internal output produced by the container itself (for example, the current iteration value in a loop). Auto-bound ports do not need to be explicitly connected; the container wires them automatically when the model is executed. | + | Some ports are **auto-bound** — when the functor is placed inside a compatible container, the port automatically connects to the relevant internal port of that container without needing an explicit connection. Auto-binding applies to both input and output ports. |
| + | |||
| + | **Auto-bound input ports** connect automatically to an internal output of the enclosing container: | ||
| + | |||
| + | * **''step''** — on [[Step]], all ''Load*'' and ''Save*'' file I/O functors, and all ''Select*'' functors. Auto-binds to the ''step'' internal output of the enclosing loop container ([[Repeat]], [[For]], [[For Each]], [[For Each Category]], [[For Each Region]], [[While]], [[Do While]]). | ||
| + | * **''workdir''** — on all ''Load*'' and ''Save*'' file I/O functors. Auto-binds to the ''workdir'' internal output of the enclosing [[Workdir]] container. | ||
| + | * **''regionManager''** — on [[Get All Regions Info]], [[Get Region Info]], [[Region]], [[Region Manager Value]], [[Regional Map]], [[Regional Categorical Map]], [[Regionalize Map]], [[Regionalize Categorical Map]], [[Merge Regional Maps]], [[Merge Regional Categorical Maps]]. Auto-binds to the ''regionManager'' internal output of the enclosing [[Region Manager]], [[Region]], or [[For Each Region]] container. | ||
| + | * **''regionId''** — on [[Get Region Info]], [[Region]], [[Regional Map]], [[Regional Categorical Map]], [[Regionalize Map]], [[Regionalize Categorical Map]]. Auto-binds to the ''regionId'' internal output of the enclosing [[Region]] container. | ||
| + | * **''tableManager''** — on [[Merge Sub Tables]], [[Sub Table]], [[Table Manager Value]]. Auto-binds to the ''tableManager'' internal output of the enclosing [[Table Manager]] container. | ||
| + | * **''currentIndividual''** — on [[Get Current Individual]]. Auto-binds to the ''currentIndividual'' internal output of the enclosing [[Genetic Algorithm Tool]] container. | ||
| + | |||
| + | **Auto-bound output ports** connect automatically to an internal input of the enclosing container: | ||
| + | |||
| + | * **''condition''** — on [[Set While Condition]]. Auto-binds to the ''condition'' internal input of the enclosing [[While]] or [[Do While]] container. | ||
| + | * **''fitness''** — on [[Set Fitness]]. Auto-binds to the ''fitness'' internal input of the enclosing [[Genetic Algorithm Tool]] container. | ||
| ===== Output Ports ===== | ===== Output Ports ===== | ||
| - | A functor may produce one or more outputs. In EGO Script, outputs are bound to variables using the '':='' operator. When a functor produces multiple outputs and only some are needed, the underscore ''_'' discards unwanted ones: | + | A functor may produce one or more outputs. In EGO Script, outputs are bound to variables using the '':='' operator (see [[ego_script#functor_calls|Functor calls]]). When a functor produces multiple outputs and only some are needed, the underscore ''_'' discards unwanted ones: |
| <code> | <code> | ||
| Line 43: | Line 57: | ||
| Port names follow different conventions depending on context: | Port names follow different conventions depending on context: | ||
| - | * **In EGO Script**, port names are written in camelCase with a lowercase first letter: ''cellType'', ''resultIsSparse'', ''nullValue''. | + | * **In EGO Script**, port names are written in camelCase with a lowercase first letter: ''cellType'', ''resultIsSparse'', ''nullValue''. See [[ego_script#nominal_syntax|Nominal syntax]] for how port names appear in functor calls. |
| * **In the GUI**, the same ports are displayed with spaces between words and all words capitalised: "Cell Type", "Result Is Sparse", "Null Value". | * **In the GUI**, the same ports are displayed with spaces between words and all words capitalised: "Cell Type", "Result Is Sparse", "Null Value". | ||
| Line 52: | Line 66: | ||
| Every port has a **type** that determines what data it can carry. A port accepts data of its exact type or any type that can be automatically converted to it. See the [[type_system|type system]] documentation for the full list of types and their conversions. | Every port has a **type** that determines what data it can carry. A port accepts data of its exact type or any type that can be automatically converted to it. See the [[type_system|type system]] documentation for the full list of types and their conversions. | ||
| - | Two special constants are available for any input port regardless of type: | + | Two special constants are available for any input port regardless of type (see [[ego_script#constants|Constants]]): |
| * ''.UNBOUND'' — the port is not connected, or its connection is deliberately being ignored. Used especially when copying a fragment of a model to a text editor, where some connections may not be part of the selection. | * ''.UNBOUND'' — the port is not connected, or its connection is deliberately being ignored. Used especially when copying a fragment of a model to a text editor, where some connections may not be part of the selection. | ||
| Line 70: | Line 84: | ||
| Container functors communicate with the functors inside them through **internal ports**: | Container functors communicate with the functors inside them through **internal ports**: | ||
| - | * **Internal output ports** carry values from the container into the block — for example, the current iteration value in a loop or a region object from a region manager. In EGO Script these are bound as the first declarations inside the container block using the ''{ variable = portName }'' form. | + | * **Internal output ports** carry values FROM the container INTO the contained functors. In EGO Script these are bound as the first declarations inside the container block using the ''{ variable = portName }'' form. |
| - | * **Internal input ports** carry values from inside the block back out of the container — for example, the accumulated result of a loop. These are bound at the end of the block. | + | * **Internal input ports** carry values FROM the contained functors BACK TO the container. These are set by dedicated functors placed inside the block (such as [[Set While Condition]] for the ''condition'' port of a loop). |
| + | |||
| + | ==== Internal outputs by container ==== | ||
| + | |||
| + | ^ Container ^ Internal output port ^ Type ^ Description ^ | ||
| + | | [[Do While]] | ''step'' | NonNegativeIntegerValue | Current iteration index, starting at 0. | | ||
| + | | [[For]] | ''step'' | RealValue | Current value in the numeric range being iterated. | | ||
| + | | [[For Each]] | ''step'' | RealValue | Current row value from the table being iterated. | | ||
| + | | [[For Each Category]] | ''step'' | IntegerValue | Current category code from the categorical map. | | ||
| + | | [[For Each Region]] | ''step'' | IntegerValue | Current region identifier. | | ||
| + | | [[For Each Region]] | ''regionManager'' | RegionManager | The region manager for the current region. | | ||
| + | | [[Repeat]] | ''step'' | NonNegativeIntegerValue | Current iteration index, starting at 0. | | ||
| + | | [[While]] | ''step'' | NonNegativeIntegerValue | Current iteration index, starting at 0. | | ||
| + | | [[Region Manager]] | ''regionManager'' | RegionManager | The region manager for the current region context. | | ||
| + | | [[Region]] | ''regionManager'' | RegionManager | The region manager. | | ||
| + | | [[Region]] | ''regionId'' | IntegerValue | The current region identifier. | | ||
| + | | [[Workdir]] | ''workdir'' | Workdir | The working directory defined by the container. | | ||
| + | | [[Table Manager]] | ''tableManager'' | TableManager | The table manager defined by the container. | | ||
| + | | [[Genetic Algorithm Tool]] | ''currentIndividual'' | LookupTableGroup | The current individual in the genetic algorithm population. | | ||
| + | |||
| + | ==== Internal inputs by container ==== | ||
| + | |||
| + | ^ Container ^ Internal input port ^ Type ^ Set by ^ | ||
| + | | [[While]] | ''condition'' | BooleanValue | [[Set While Condition]] — the ''condition'' output port is **auto-bound** to this internal input. | | ||
| + | | [[Do While]] | ''condition'' | BooleanValue | [[Set While Condition]] — the ''condition'' output port is **auto-bound** to this internal input. | | ||
| + | | [[Genetic Algorithm Tool]] | ''fitness'' | RealValue | [[Set Fitness]] — the ''fitness'' output port is **auto-bound** to this internal input. | | ||
| - | See [[ego_script#internal_output_ports|Internal output ports]] and [[ego_script#internal_input_ports|Internal input ports]] for syntax details and examples. | + | See [[ego_script#internal_output_ports|Internal output ports]] and [[ego_script#internal_input_ports|Internal input ports]] for EGO Script syntax details and examples. |
| ===== Hook Ports (Calculator Functors) ===== | ===== Hook Ports (Calculator Functors) ===== | ||