Since the initial release of Advanced Constraints, one of limitations was that formulas had to be recalculated manually. This recalculation could be done on an individual basis or for the entire design with the Calculate All command. The Online Formula Calculation feature addresses these limitations by tracking the dependencies that formulas have on design objects and updating the formula automatically.
The SPB16.3 release of Allegro PCB Editor Constraint Manager (CM) has been enhanced to determine and store dependency information for all Advanced Constraints formulas as they are created or loaded for the first time. The dependency information is stored with the formulas so that it does not have to be recreated each time the design is closed and reopened.
Dependency information is used to update the status of calculated values and indicate when they have become stale. Some cases where calculated values can become stale are:
- A formula on a cell that references the value in another cell.
- A formula that calls a predicate that returns some information about a database object.
When values are changed in CM, or if database objects are updated in Allegro, CM determines which values are out of date, and recalculates them when necessary. Another use for the dependency information is during the calculation of a formula. Using the dependency information, CM is able to determine which other formulas need to be calculated first so that the requested calculation will be accurate when it is performed. It is possible to create formulas with cyclic dependencies that can make it impossible for a value to ever be considered up to date. Detection of these cycles has also been implemented.
Read on for more details …
Types of Dependencies
There are two types of dependencies that can affect the status of a calculation: cell values and database objects. Cell value dependencies arise when a formula makes a specific reference to a cell, using both the object name and column name. These values go stale when the value in the cell they are referencing changes.
Database object dependencies occur when a calculation depends on a physical attribute of an object in the design. The most common occurrence of this type of dependency is in a predicate. When a formula needs this type of information, it will call a predicate to access that information.
Controlling Formula Calculation
The calculation of formulas is controlled by a setting in the Tools > Options dialog:
When the Automatic formula calculation setting is On, formulas will use the dependency information to trigger recalculation automatically when they are known to be stale.
When set to Off, formulas are not recalculated automatically. Dependency information is used to mark formulas stale but does not trigger recalculation. When a formula is calculated, it still uses the dependency information to determine if any other formulas need to be recalculated first, and it still checks for cyclic dependencies.
When Automatic formula calculation is set from Off to On, a message is displayed that informs you that all formulas must be recalculated so that they will be up to date before Automatic formula calculation is enabled. If you agree, the Calculate All function is performed. Otherwise the Automatic formula calculation setting remains Off.
Formulas may have dependencies on measurement values that have not yet been analyzed. Always triggering the analysis could be too time consuming when the results are not currently needed. A global Run measurement setting will be used to indicate whether these analyses should be performed or not.
When the setting is Off, analysis will not be run, and any formula values that depend on unanalyzed measurement values will be left empty. When it is On, any Actual cells that use a measurement will be analyzed when a formula is calculated, regardless of whether the calculation was triggered automatically or by using the Calculate command.
The behavior when changing the Run measurement setting from Off to On depends on the value of the Automatic formula calculation setting. If it is On when Run measurement is turned On, it will cause any empty formulas to try calculating again, this time forcing any required analysis to run. If Automatic formula calculation is Off, changing Run measurement to On will have no immediate effect, but it will force the required analysis to be run when a formula is manually Calculated.
Updating Dependency Information
While each formula is examined to automatically determine its dependencies, it is still possible that other more subtle dependencies could exist but be missed by the algorithm. For example, a formula could call a predicate that indirectly references some other objects. To provide you with a mechanism for updating the dependencies, a GUI has been provided that not only lists the dependencies, but allows dependencies to be removed, or new ones to be added.
To access this dialog, RMB on a cell that contains a formula, and select Dependencies:
The header contains a description of the current cell, using object and attribute names. The dialog also contains a list of dependencies that lists both the cell dependencies and the object dependencies. Cell dependencies are described using the object/attribute name format while the object dependencies leave the Attribute field empty.
The Status column displays Auto for dependencies that CM has determined, and User for dependencies created by the UI. The Dependencies list also indicates if a cyclic dependency exists. Any dependency that is part of a cycle will display Cycle as its Status.
New dependencies can be added to the list either by selecting from the grid or pressing the Add button. Selecting an object from the Objects column on the grid will add an object dependency to the list, while selecting a cell in an attribute column will add a cell dependency for that cell to the list. Pressing the Add button will bring up a selection dialog where an object can be specified, and if accepted, it will be added to the dependencies list.
A dependency can be removed by double-clicking on it in the dependencies list, or by highlighting the dependencies to be removed and pressing the Remove button. Note that both automatic and user defined dependencies can be removed this way.
If errors are made while adding and removing dependencies from the list, the original list of automatic dependencies can be restored by pressing the Reset button. This will remove all current dependencies from the list, and then recreate the list by running the automatic dependencies algorithm.
Please share your experiences with this new feature!
Jerry "GenPart" Grzenia