How to create an Excel background calculation model

From Tygron Support wiki
Jump to navigation Jump to search

Panels form a (custom) interface element for the end-user. When backed by an Excel, a Panel can perform calculations and change the state of Items in your project, such as Buildings, even when the Panel is not actually accessible to an end-user.

The instructions below will create a Panel which changes the traffic on all roads in a Project based on the amount of houses added during a Session.

Editor → Current Situation (Ribbon tab) → Panels (Ribbon bar)
How to add a Panel:
  1. Create a new Excel file.
  2. Add a "SELECT_UNITS_WHERE_MAP_IS_CURRENT" cell to the Excel file.
  3. Add a "SELECT_UNITS_WHERE_MAP_IS_MAQUETTE" cell to the Excel file.
  4. Add an "UPDATE_BUILDING_TRAFFIC_FLOW_WHERE_CATEGORY_IS_ROAD" cell to the Excel file.
  5. Add an "EXPLANATION" cell to the Excel file.
  6. Set the formula of the "UPDATE" cell to "=MAX(0;SELECT_UNITS_WHERE_MAP_IS_MAQUETTE - SELECT_UNITS_WHERE_MAP_IS_CURRENT)".
  7. In the Editor, add a new Excel Panel.
  8. Upload the created Excel file for the added Panel.
  9. Now the amount of traffic on all roads in the Session starts as 0, but increases as the amount of housing in the project is added during a Session.

Notes

  • If the Project is set to automatically recalculate, the Panel's will immediately set the traffic in the Project to 0. Otherwise, traffic will change when a calculation has been run.
  • The described formula may differ based on language settings for your particular version of Excel.

How-to's

See also