Global: Difference between revisions

From Tygron Preview Support Wiki
Jump to navigation Jump to search
(Created page with "{{learned|what a global is|how to create Globals|what type of globals you can create|where globals currently applied for}} ==Global== A globals ia a number that is intecrated...")
 
No edit summary
 
(91 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{learned|what a global is|how to create Globals|what type of globals you can create|where globals currently applied for}}
[[File:Api_current_situation_calculation.png|thumb|right|400px|[[Global]]s in comparison to [[Overlay]]s, [[Indicator]]s and [[Panel]]s]]
A global is a value that exists in the project but is not necessarily connected to a specific component. The global can be used, for example in Excel calculations and influence the calculation of an Excel indicator. A global is similar to an [[attribute]] but for the entire project rather than for a specific component. The name of the global is also the global [[ID]] that can be used in queries.


==Global==
==Global uses==
A globals ia a number that is intecrated in the project but is not nessccarelay assinged to a specifiche object. The global can be used for Excel calculations and therefor influence the projects outcome.


==Type of globals==
Globals can be used, broadly speaking, to store and recall values. The most common application of this is in combination with [[excel]] sheets. Using [[TQL]], the value of a global can be loaded into an excel sheet and used in calculations. The values of globals can also be [[TQL#Numeric_values|set using TQL]] from excels. Globals can also be used to directly influence the budget of a specific [[Stakeholder|stakeholder]]. Lastly, globals can be made visible in the [[3D Visualization]].
The main operation used in TQL is the query, which is performed with the declarative <code>SELECT</code> statement or <code>UPDATE</code> statement. A '''declarative''' statement tells the system which data is specifically required, after which the system will retrieve the data on it's 'own'. This is contrary to an '''imperative''' statement, where the system is told 'how' to obtain said data. A <code>SELECT</code> statement retrieves data from a running Tygron project session. A <code>UPDATE</code> statement changes data from a running Tygron project session. Queries using <code>SELECT</code> statements have no persistent effect on the project session itself. Queries using the <code>UPDATE</code> statement do have an effect om the project session itself. The <code>UPDATE</code> statement is used in the Excel indicator calculations and the outcome of the calculation is redirected as output to update the key figures in the project.


Queries in TQL using the <code>SELECT</code> statement allow the user to describe the desired data, leaving the Tygron Engine responsible for planning, optimizing, and performing the physical operations necessary to produce the desired result as output.
==Properties of globals==
Queries using the <code>UPDATE</code> statement allow the user to make use of the results of Excel calculations as an output in the Engine and in this way adapt the data in a project session.
A global is always made up of a name and a number. Based on the purpose of the global the number represents an amount or a value which is specified by the name.


When starting a query with the <code>SELECT</code> statement, a result parameter must follow after the <code>SELECT</code> keyword. Currently, one of the following result parameters can be selected:
===Output===
{| class="wikitable"
By using a <code>SELECT_GLOBAL_WHERE_NAME_IS_GLOBALID</code> query you can obtain the value of a global. This global's value can then be used in [[Excel|Excel]] calculations.  
|-
It is also possible to connect the global to the budget of a specific stakeholder to directly influence the budget during a session. When the given value is a positive number it will increase the budget. When the given value is a negative number it will decrease the budget.
! Result Parameter
! Description
! Example
|-
| <code>FLOORSIZE</code>
| Floor size of buildings.
| <code>SELECT_FLOORSIZE_WHERE_CATEGORY_IS_OFFICES</code>
|-
| <code>LOTSIZE</code>
| Lot size of buildings.
| <code>SELECT_LOTSIZE_WHERE_CATEGORY_IS_OFFICES</code>
|-
| <code>UNITS</code>
| Amount of housing units.
| <code>SELECT_UNITS_WHERE_CATEGORY_IS_SOCIAL</code>
|-
| <code>LANDSIZE</code>
| Amount of surface area.
| <code>SELECT_LANDSIZE_WHERE_BEHAVIOR_IS_GRASSLAND</code>
|-
| <code>DIKES</code>
| Surface space of constructed dikes or levees.
| <code>SELECT_DIKES_WHERE_ZONE_IS_1</code>
|-
| <code>ACTIVE</code>
| whether something is relevant in the project.
| <code>SELECT_ACTIVE_WHERE_ZONE_IS_1</code>
|-
| <code>NAME</code>*
| Name of selection as query result
| <code>SELECT_NAME_WHERE_CATEGORYMULT_IS_SELL_PRICE_M2</code>
|-
| <code>COLOR</code>*
| Color of selection as query result
| <code>SELECT_COLOR_WHERE_FUNCTION_IS_816</code>
|-
| <code>GRID_AVG</code>
| Average grid value per grid point
| <code>SELECT_GRIDAVG_WHERE_GRIDTYPE_IS_TRAFFIC_NOISE</code>
|}
''* can be followed by one clause maximum''


===Input===
There are 4 ways that a global's value can be set:
* Each global has a starting value. At the start of a session, the global is set to this value.
* A global can be updated using a TQL update statement, of the form <code>UPDATE_GLOBAL_WHERE_NAME_IS_X</code>.
* A global's value can be changed by making use of a SET_GLOBAL_VALUE [[event]].
* A global can be directly linked to a TQL select statement, by setting the TQL property to a valid query.


===Comparison Predicate===
With the exception of linking a global directly to a TQL select statement, each method is a singular action to alter the global's value at one specific moment. Linking a global directly to a TQL select query will cause the global to be updated accordingly with every [[calculation cycle]]. This will easily overwrite any singular action such as an [[event]]. When using a TQL update statement in an excel to update a global, the effect will be similarly continuous, causing the global's value to update each calculation cycle.
The <code>SELECT</code> and result parameter are followed by a <code>WHERE</code> statement. The <code>WHERE</code> statements contains a comparison predicate, which are logical propositions that restrict the information retrieved by the query. In other words, the <code>WHERE</code> clause eliminates all information from the result set where the comparison predicate does not evaluate as being valid (Boolean = True).


Take for instance the following statement as example of a logical proposition:
{{article end
|howtos=
* [[How to add and remove Globals]]
* [[How to edit Global properties]]
|seealso=
[[File:YoutubeLogo1.jpg|link=https://youtu.be/IpQxzjzi1d0|thumb|left|200px|Panels en Globals (Dutch only)]]
}}


: ''The Student is a Senior.''
{{Editor current situation nav}}


This statement excludes all students that are Junior, Sophomore or Freshman, as the outcome of the logical proposition would be 'False' in these cases.
[[Category:Items]][[Category:Global]]
 
The comparison predicate consists of 0 or more clauses, which consist of three parts;
* Clause Type
* Operator
* Value
 
 
==Create a Global==
In order to make it easier to construct queries, a tool has been developed to create queries in the editor, which can then be copied and used elsewhere. This tool is known as the [[Query Tool]] and more information can be found on its own page.
 
==Global Uses==
Globals are currently used to communicate with a Microsoft Excel spreadsheet, when using such a spreadsheet for a (custom) [[Excel (Indicator)|Excel Indicator]].

Latest revision as of 10:22, 1 March 2023

Globals in comparison to Overlays, Indicators and Panels

A global is a value that exists in the project but is not necessarily connected to a specific component. The global can be used, for example in Excel calculations and influence the calculation of an Excel indicator. A global is similar to an attribute but for the entire project rather than for a specific component. The name of the global is also the global ID that can be used in queries.

Global uses

Globals can be used, broadly speaking, to store and recall values. The most common application of this is in combination with excel sheets. Using TQL, the value of a global can be loaded into an excel sheet and used in calculations. The values of globals can also be set using TQL from excels. Globals can also be used to directly influence the budget of a specific stakeholder. Lastly, globals can be made visible in the 3D Visualization.

Properties of globals

A global is always made up of a name and a number. Based on the purpose of the global the number represents an amount or a value which is specified by the name.

Output

By using a SELECT_GLOBAL_WHERE_NAME_IS_GLOBALID query you can obtain the value of a global. This global's value can then be used in Excel calculations. It is also possible to connect the global to the budget of a specific stakeholder to directly influence the budget during a session. When the given value is a positive number it will increase the budget. When the given value is a negative number it will decrease the budget.

Input

There are 4 ways that a global's value can be set:

  • Each global has a starting value. At the start of a session, the global is set to this value.
  • A global can be updated using a TQL update statement, of the form UPDATE_GLOBAL_WHERE_NAME_IS_X.
  • A global's value can be changed by making use of a SET_GLOBAL_VALUE event.
  • A global can be directly linked to a TQL select statement, by setting the TQL property to a valid query.

With the exception of linking a global directly to a TQL select statement, each method is a singular action to alter the global's value at one specific moment. Linking a global directly to a TQL select query will cause the global to be updated accordingly with every calculation cycle. This will easily overwrite any singular action such as an event. When using a TQL update statement in an excel to update a global, the effect will be similarly continuous, causing the global's value to update each calculation cycle.

How-to's

See also

Panels en Globals (Dutch only)