Skip to main content
Version: 1.9.3

Units and constants


This file is automatically generated from java files. Do Not Edit It.


Introductionโ€‹

Units can be used to qualify the values of numeric variables. By default, unqualified values are considered as:

  • meters for distances, lengths...
  • seconds for durations
  • cubic meters for volumes
  • kilograms for masses

So, an expression like:

float foo <- 1;

will be considered as 1 meter if foo is a distance, or 1 second if it is a duration, or 1 meter/second if it is a speed. If one wants to specify the unit, it can be done very simply by adding the unit symbol (ยฐ or #) followed by an unit name after the numeric value, like:

float foo <- 1 ยฐcentimeter;

or

float foo <- 1 #centimeter;

In that case, the numeric value of foo will be automatically translated to 0.01 (meter). It is recommended to always use float as the type of the variables that might be qualified by units (otherwise, for example in the previous case, they might be truncated to 0). Several units names are allowed as qualifiers of numeric variables. These units represent the basic metric and US units. Composed and derived units (like velocity, acceleration, special volumes or surfaces) can be obtained by combining these units using the * and / operators. For instance:

float one_kmh <- 1 ยฐkm / ยฐh const: true;
float one_millisecond <-1 ยฐsec / 1000;
float one_cubic_inch <- 1 ยฐsqin * 1 ยฐinch;
... etc ...

3Dโ€‹

  • #ambient, value= Ambient light, Comment: Represent the 'ambient' type of light
  • #direction, value= Directional light, Comment: Represent the 'direction' type of light
  • #from_above, value= From above, Comment: Represent the position of the camera, above the scene
  • #from_front, value= From front, Comment: Represent the position of the camera, in front of the scene
  • #from_left, value= From left, Comment: Represent the position of the camera, on the left of the scene
  • #from_right, value= From right, Comment: Represent the position of the camera, on the right of the scene
  • #from_up_front, value= From up front, Comment: Represent the position of the camera, in front and slightly above the scene
  • #from_up_left, value= From up left, Comment: Represent the position of the camera, on the left, slightly above the scene
  • #from_up_right, value= From up right, Comment: Represent the position of the camera on the right, slightly above the scene
  • #isometric, value= Isometric, Comment: Represent the position of the camera, on the left of the scene
  • #point, value= Point light, Comment: Represent the 'point' type of light
  • #spot, value= Spot light, Comment: Represent the 'spot' type of light

Constantsโ€‹

  • #AStar, value= AStar, Comment: AStar shortest path computation algorithm
  • #BellmannFord, value= BellmannFord, Comment: BellmannFord shortest path computation algorithm
  • #Bhandari, value= Bhandari, Comment: Bhandari K shortest paths computation algorithm
  • #BidirectionalDijkstra, value= BidirectionalDijkstra, Comment: BidirectionalDijkstra shortest path computation algorithm
  • #CHBidirectionalDijkstra, value= CHBidirectionalDijkstra, Comment: CHBidirectionalDijkstra shortest path computation algorithm
  • #current_error, value= , Comment: The text of the last error thrown during the current execution
  • #DeltaStepping, value= DeltaStepping, Comment: DeltaStepping shortest path computation algorithm
  • #Dijkstra, value= Dijkstra, Comment: Dijkstra shortest path computation algorithm
  • #e, value= 2.718281828459045, Comment: The e constant
  • #Eppstein, value= Eppstein, Comment: Eppstein K shortest paths computation algorithm
  • #FloydWarshall, value= FloydWarshall, Comment: FloydWarshall shortest path computation algorithm
  • #infinity, value= Infinity, Comment: A constant holding the positive infinity of type float (Java Double.POSITIVE_INFINITY)
  • #max_float, value= 1.7976931348623157E308, Comment: A constant holding the largest positive finite value of type float (Java Double.MAX_VALUE)
  • #max_int, value= 2147483647, Comment: A constant holding the maximum value an int can have (Java Integer.MAX_VALUE)
  • #min_float, value= 4.9E-324, Comment: A constant holding the smallest positive nonzero value of type float (Java Double.MIN_VALUE)
  • #min_int, value= -2147483648, Comment: A constant holding the minimum value an int can have (Java Integer.MIN_VALUE)
  • #nan, value= NaN, Comment: A constant holding a Not-a-Number (NaN) value of type float (Java Double.POSITIVE_INFINITY)
  • #NBAStar, value= NBAStar, Comment: NBAStar shortest path computation algorithm
  • #NBAStarApprox, value= NBAStarApprox, Comment: NBAStarApprox shortest path computation algorithm
  • #pi, value= 3.141592653589793, Comment: The PI constant
  • #Suurballe, value= Suurballe, Comment: Suurballe K shortest paths computation algorithm
  • #to_deg, value= 57.29577951308232, Comment: A constant holding the value to convert radians into degrees
  • #to_rad, value= 0.017453292519943295, Comment: A constant holding the value to convert degrees into radians
  • #TransitNodeRouting, value= TransitNodeRouting, Comment: TransitNodeRouting shortest path computation algorithm
  • #Yen, value= Yen, Comment: Yen K shortest paths computation algorithm

Graphics unitsโ€‹

  • #bold, value= 1, Comment: This constant allows to build a font with a bold face. Can be combined with #italic
  • #bottom_center, value= No Default Value, Comment: Represents an anchor situated at the center of the bottom side of the text to draw
  • #bottom_left, value= No Default Value, Comment: Represents an anchor situated at the bottom left corner of the text to draw
  • #bottom_right, value= No Default Value, Comment: Represents an anchor situated at the bottom right corner of the text to draw
  • #camera_location, value= No Default Value, Comment: This unit, only available when running aspects or declaring displays, returns the current position of the camera as a point
  • #camera_orientation, value= No Default Value, Comment: This unit, only available when running aspects or declaring displays, returns the current orientation of the camera as a point
  • #camera_target, value= No Default Value, Comment: This unit, only available when running aspects or declaring displays, returns the current target of the camera as a point
  • #center, value= No Default Value, Comment: Represents an anchor situated at the center of the text to draw
  • #display_height, value= 1.0, Comment: This constant is only accessible in a graphical context: display, graphics...
  • #display_width, value= 1.0, Comment: This constant is only accessible in a graphical context: display, graphics...
  • #flat, value= 2, Comment: This constant represents a flat line buffer end cap style
  • #fullscreen, value= false, Comment: This unit, only available when running aspects or declaring displays, returns whether the display is currently fullscreen or not
  • #hidpi, value= false, Comment: This unit, only available when running aspects or declaring displays, returns whether the display is currently in HiDPI mode or not
  • #horizontal, value= 3, Comment: This constant represents a layout where all display views are aligned horizontally
  • #italic, value= 2, Comment: This constant allows to build a font with an italic face. Can be combined with #bold
  • #left_center, value= No Default Value, Comment: Represents an anchor situated at the center of the left side of the text to draw
  • #none, value= 0, Comment: This constant represents the absence of a predefined layout
  • #pixels (#px), value= 1.0, Comment: This unit, only available when running aspects or declaring displays, returns a dynamic value instead of a fixed one. px (or pixels), returns the value of one pixel on the current view in terms of model units.
  • #plain, value= 0, Comment: This constant allows to build a font with a plain face
  • #right_center, value= No Default Value, Comment: Represents an anchor situated at the center of the right side of the text to draw
  • #round, value= 1, Comment: This constant represents a round line buffer end cap style
  • #split, value= 2, Comment: This constant represents a layout where all display views are split in a grid-like structure
  • #square, value= 3, Comment: This constant represents a square line buffer end cap style
  • #stack, value= 1, Comment: This constant represents a layout where all display views are stacked
  • #top_center, value= No Default Value, Comment: Represents an anchor situated at the center of the top side of the text to draw
  • #top_left, value= No Default Value, Comment: Represents an anchor situated at the top left corner of the text to draw
  • #top_right, value= No Default Value, Comment: Represents an anchor situated at the top right corner of the text to draw
  • #user_location (#user_location_in_world), value= No Default Value, Comment: This unit permanently holds the mouse's location in the world's coordinates. If it is outside a display window, its last position is used.
  • #user_location_in_display, value= No Default Value, Comment: This unit permanently holds the mouse's location in the display's coordinates. If it is outside a display window, its last position is used.
  • #vertical, value= 4, Comment: This constant represents a layout where all display views are aligned vertically
  • #zoom, value= 1.0, Comment: This unit, only available when running aspects or declaring displays, returns the current zoom level of the display as a positive float, where 1.0 represent the neutral zoom (100%)

Length unitsโ€‹

  • #ยตm (#micrometer,#micrometers), value= 1.0E-6, Comment: micrometer unit
  • #cm (#centimeter,#centimeters), value= 0.01, Comment: centimeter unit
  • #dm (#decimeter,#decimeters), value= 0.1, Comment: decimeter unit
  • #foot (#feet,#ft), value= 0.3048, Comment: foot unit
  • #inch (#inches), value= 0.025400000000000002, Comment: inch unit
  • #km (#kilometer,#kilometers), value= 1000.0, Comment: kilometer unit
  • #m (#meter,#meters), value= 1.0, Comment: meter: the length basic unit
  • #mile (#miles), value= 1609.344, Comment: mile unit
  • #mm (#milimeter,#milimeters), value= 0.001, Comment: millimeter unit
  • #nm (#nanometer,#nanometers), value= 9.999999999999999E-10, Comment: nanometer unit
  • #yard (#yards), value= 0.9144, Comment: yard unit

Math constantsโ€‹

  • #AdamsBashforth, value= AdamsBashforth, Comment: AdamsBashforth solver
  • #AdamsMoulton, value= AdamsMoulton, Comment: AdamsMoulton solver
  • #DormandPrince54, value= DormandPrince54, Comment: DormandPrince54 solver
  • #dp853, value= dp853, Comment: dp853 solver
  • #Euler, value= Euler, Comment: Euler solver
  • #Gill, value= Gill, Comment: Gill solver
  • #GraggBulirschStoer, value= GraggBulirschStoer, Comment: GraggBulirschStoer solver
  • #HighamHall54, value= HighamHall54, Comment: HighamHall54 solver
  • #Luther, value= Luther, Comment: Luther solver
  • #Midpoint, value= Midpoint, Comment: Midpoint solver
  • #rk4, value= rk4, Comment: rk4 solver
  • #ThreeEighthes, value= ThreeEighthes, Comment: ThreeEighthes solver

Surface unitsโ€‹

  • #m2, value= 1.0, Comment: square meter: the basic unit for surfaces
  • #sqft (#square_foot,#square_feet), value= 0.09290304, Comment: square foot unit
  • #sqin (#square_inch,#square_inches), value= 6.451600000000001E-4, Comment: square inch unit
  • #sqmi (#square_mile,#square_miles), value= 2589988.110336, Comment: square mile unit

Time unitsโ€‹

  • #custom, value= CUSTOM, Comment: custom: a custom date/time pattern that can be defined in the preferences of GAMA and reused in models
  • #cycle (#cycles), value= 1, Comment: cycle: the discrete measure of time in the simulation. Used to force a temporal expression to be expressed in terms of cycles rather than seconds
  • #day (#d,#days), value= 86400.0, Comment: day time unit: defines an exact duration of 24 hours
  • #epoch, value= No Default Value, Comment: The epoch default starting date as defined by the ISO format (1970-01-01T00:00Z)
  • #h (#hour,#hours), value= 3600.0, Comment: hour time unit: defines an exact duration of 60 minutes
  • #iso_local, value= ISO_LOCAL_DATE_TIME, Comment: iso_local: the standard ISO 8601 output / parsing format for local dates (i.e. with no time-zone information)
  • #iso_offset, value= ISO_OFFSET_DATE_TIME, Comment: iso_offset: the standard ISO 8601 output / parsing format for dates with a time offset
  • #iso_zoned, value= ISO_ZONED_DATE_TIME, Comment: iso_zoned: the standard ISO 8601 output / parsing format for dates with a time zone
  • #minute (#minutes,#mn), value= 60.0, Comment: minute time unit: defined an exact duration of 60 seconds
  • #month (#months), value= 2592000.0, Comment: month time unit: an approximate duration of 30 days. The number of days of each #month depend of course on the current_date of the model and cannot be constant
  • #msec (#millisecond,#milliseconds,#ms), value= 0.001, Comment: millisecond time unit: defines an exact duration of 0.001 second
  • #now, value= 1.0, Comment: This value represents the current date
  • #sec (#second,#seconds,#s), value= 1.0, Comment: second: the time basic unit, with a fixed value of 1. All other durations are expressed with respect to it
  • #week (#weeks), value= 604800.0, Comment: week time unit: defines an exact duration of 7 days
  • #year (#years,#y), value= 3.1536E7, Comment: year time unit: an approximate duration of 365 days. The value of #year in number of days varies depending on leap years, etc. and is dependend on the current_date of the model

User control operatorsโ€‹


Volume unitsโ€‹

  • #cl (#centiliter,#centiliters), value= 1.0E-5, Comment: centiliter unit
  • #dl (#deciliter,#deciliters), value= 1.0E-4, Comment: deciliter unit
  • #hl (#hectoliter,#hectoliters), value= 0.1, Comment: hectoliter unit
  • #l (#liter,#liters,#dm3), value= 0.001, Comment: liter unit
  • #m3, value= 1.0, Comment: cube meter: the basic unit for volumes

Weight unitsโ€‹

  • #gram (#grams), value= 0.001, Comment: gram unit
  • #kg (#kilo,#kilogram,#kilos), value= 1.0, Comment: second: the basic unit for weights
  • #longton (#lton), value= 1016.0469088000001, Comment: short ton unit
  • #ounce (#oz,#ounces), value= 0.028349523125, Comment: ounce unit
  • #pound (#lb,#pounds,#lbm), value= 0.45359237, Comment: pound unit
  • #shortton (#ston), value= 907.18474, Comment: short ton unit
  • #stone (#st), value= 6.35029318, Comment: stone unit
  • #ton (#tons), value= 1000.0, Comment: ton unit

Colorsโ€‹

In addition to the previous units, GAML provides a direct access to the 147 named colors defined in CSS (see http://www.cssportal.com/css3-color-names/). E.g,

rgb my_color <- ยฐteal;