Caution -- no auto-updating from text attributes

Revision as of 22:20, 1 February 2020 by Max (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Analytica uses a "flow architecture", based on influence diagrams, to track how each variable depends on others -- e.g. other variables in its Definition. Any change to the value of a variable automatically sends a message to any dependent variables (its Outputs and their Outputs, and so on) to invalidate their current values (both Mid and Prob values) so that they will recompute their values using the changed value when needed. This automatic updating works for the Check, and OnChange attributes, as well as Definition. But, it does not apply to other user-modifiable Attributes, such as Identifier, Units, or Description. It is unusual that the Definition of a Variable depends on one of these other Attributes, but it can happen. So it's important to be aware of this when writing calculations based on these other attributes:

Here's an example where TempC depends on the Units of variable T:

Variable T 
    Definition: 20
    Units: degrees F
Variable TempC 
    Definition IF Units OF T  = 'degrees C' THEN T
        ELSE IF Units OF T  = 'degrees F' THEN (T - 32)*(100/180)
        ELSE 'Variable T has unknown Units'
    Units: degrees C

TempC will calculate the temperature in degrees Celsius (Centigrade) whether the Units of T are in 'degrees C' or 'degrees F'. However, if the user modifies the Units of T:

 Variable T 
    Units: degrees C

it will not trigger recalculation of TempC, which may then be incorrect. This is because the dependency network does not apply to the Units attribute.

Comments


You are not allowed to post comments.