Documentation Tutorials Download Contribute



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 ...

Table of Contents


Constants

  • #current_error, value= , Comment: The text of the last error thrown during the current execution
  • #e, value= 2.718281828459045, Comment: The e constant
  • #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= 2.147483647E9, 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= -2.147483648E9, 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)
  • #pi, value= 3.141592653589793, Comment: The PI constant
  • #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

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
  • #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, value= No Default Value, Comment: This unit contains in permanence the location of the mouse on the display in which it is situated. The latest location is provided when it is out of a display
  • #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

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 (#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: does not define an exact duration. The duration will depend on the step/date at which this unit is computed.
  • #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.1104E7, Comment: year time unit: does not define an exact duration. The duration will depend on the step/date at which this unit is computed.

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;
  • #aliceblue, value= r=240, g=248, b=255, alpha=1
  • #antiquewhite, value= r=250, g=235, b=215, alpha=1
  • #aqua, value= r=0, g=255, b=255, alpha=1
  • #aquamarine, value= r=127, g=255, b=212, alpha=1
  • #azure, value= r=240, g=255, b=255, alpha=1
  • #beige, value= r=245, g=245, b=220, alpha=1
  • #bisque, value= r=255, g=228, b=196, alpha=1
  • #black, value= r=0, g=0, b=0, alpha=1
  • #blanchedalmond, value= r=255, g=235, b=205, alpha=1
  • #blue, value= r=0, g=0, b=255, alpha=1
  • #blueviolet, value= r=138, g=43, b=226, alpha=1
  • #brown, value= r=165, g=42, b=42, alpha=1
  • #burlywood, value= r=222, g=184, b=135, alpha=1
  • #cadetblue, value= r=95, g=158, b=160, alpha=1
  • #chartreuse, value= r=127, g=255, b=0, alpha=1
  • #chocolate, value= r=210, g=105, b=30, alpha=1
  • #coral, value= r=255, g=127, b=80, alpha=1
  • #cornflowerblue, value= r=100, g=149, b=237, alpha=1
  • #cornsilk, value= r=255, g=248, b=220, alpha=1
  • #crimson, value= r=220, g=20, b=60, alpha=1
  • #cyan, value= r=0, g=255, b=255, alpha=1
  • #darkblue, value= r=0, g=0, b=139, alpha=1
  • #darkcyan, value= r=0, g=139, b=139, alpha=1
  • #darkgoldenrod, value= r=184, g=134, b=11, alpha=1
  • #darkgray, value= r=169, g=169, b=169, alpha=1
  • #darkgreen, value= r=0, g=100, b=0, alpha=1
  • #darkgrey, value= r=169, g=169, b=169, alpha=1
  • #darkkhaki, value= r=189, g=183, b=107, alpha=1
  • #darkmagenta, value= r=139, g=0, b=139, alpha=1
  • #darkolivegreen, value= r=85, g=107, b=47, alpha=1
  • #darkorange, value= r=255, g=140, b=0, alpha=1
  • #darkorchid, value= r=153, g=50, b=204, alpha=1
  • #darkred, value= r=139, g=0, b=0, alpha=1
  • #darksalmon, value= r=233, g=150, b=122, alpha=1
  • #darkseagreen, value= r=143, g=188, b=143, alpha=1
  • #darkslateblue, value= r=72, g=61, b=139, alpha=1
  • #darkslategray, value= r=47, g=79, b=79, alpha=1
  • #darkslategrey, value= r=47, g=79, b=79, alpha=1
  • #darkturquoise, value= r=0, g=206, b=209, alpha=1
  • #darkviolet, value= r=148, g=0, b=211, alpha=1
  • #deeppink, value= r=255, g=20, b=147, alpha=1
  • #deepskyblue, value= r=0, g=191, b=255, alpha=1
  • #dimgray, value= r=105, g=105, b=105, alpha=1
  • #dimgrey, value= r=105, g=105, b=105, alpha=1
  • #dodgerblue, value= r=30, g=144, b=255, alpha=1
  • #firebrick, value= r=178, g=34, b=34, alpha=1
  • #floralwhite, value= r=255, g=250, b=240, alpha=1
  • #forestgreen, value= r=34, g=139, b=34, alpha=1
  • #fuchsia, value= r=255, g=0, b=255, alpha=1
  • #gainsboro, value= r=220, g=220, b=220, alpha=1
  • #ghostwhite, value= r=248, g=248, b=255, alpha=1
  • #gold, value= r=255, g=215, b=0, alpha=1
  • #goldenrod, value= r=218, g=165, b=32, alpha=1
  • #gray, value= r=128, g=128, b=128, alpha=1
  • #green, value= r=0, g=128, b=0, alpha=1
  • #greenyellow, value= r=173, g=255, b=47, alpha=1
  • #grey, value= r=128, g=128, b=128, alpha=1
  • #honeydew, value= r=240, g=255, b=240, alpha=1
  • #hotpink, value= r=255, g=105, b=180, alpha=1
  • #indianred, value= r=205, g=92, b=92, alpha=1
  • #indigo, value= r=75, g=0, b=130, alpha=1
  • #ivory, value= r=255, g=255, b=240, alpha=1
  • #khaki, value= r=240, g=230, b=140, alpha=1
  • #lavender, value= r=230, g=230, b=250, alpha=1
  • #lavenderblush, value= r=255, g=240, b=245, alpha=1
  • #lawngreen, value= r=124, g=252, b=0, alpha=1
  • #lemonchiffon, value= r=255, g=250, b=205, alpha=1
  • #lightblue, value= r=173, g=216, b=230, alpha=1
  • #lightcoral, value= r=240, g=128, b=128, alpha=1
  • #lightcyan, value= r=224, g=255, b=255, alpha=1
  • #lightgoldenrodyellow, value= r=250, g=250, b=210, alpha=1
  • #lightgray, value= r=211, g=211, b=211, alpha=1
  • #lightgreen, value= r=144, g=238, b=144, alpha=1
  • #lightgrey, value= r=211, g=211, b=211, alpha=1
  • #lightpink, value= r=255, g=182, b=193, alpha=1
  • #lightsalmon, value= r=255, g=160, b=122, alpha=1
  • #lightseagreen, value= r=32, g=178, b=170, alpha=1
  • #lightskyblue, value= r=135, g=206, b=250, alpha=1
  • #lightslategray, value= r=119, g=136, b=153, alpha=1
  • #lightslategrey, value= r=119, g=136, b=153, alpha=1
  • #lightsteelblue, value= r=176, g=196, b=222, alpha=1
  • #lightyellow, value= r=255, g=255, b=224, alpha=1
  • #lime, value= r=0, g=255, b=0, alpha=1
  • #limegreen, value= r=50, g=205, b=50, alpha=1
  • #linen, value= r=250, g=240, b=230, alpha=1
  • #magenta, value= r=255, g=0, b=255, alpha=1
  • #maroon, value= r=128, g=0, b=0, alpha=1
  • #mediumaquamarine, value= r=102, g=205, b=170, alpha=1
  • #mediumblue, value= r=0, g=0, b=205, alpha=1
  • #mediumorchid, value= r=186, g=85, b=211, alpha=1
  • #mediumpurple, value= r=147, g=112, b=219, alpha=1
  • #mediumseagreen, value= r=60, g=179, b=113, alpha=1
  • #mediumslateblue, value= r=123, g=104, b=238, alpha=1
  • #mediumspringgreen, value= r=0, g=250, b=154, alpha=1
  • #mediumturquoise, value= r=72, g=209, b=204, alpha=1
  • #mediumvioletred, value= r=199, g=21, b=133, alpha=1
  • #midnightblue, value= r=25, g=25, b=112, alpha=1
  • #mintcream, value= r=245, g=255, b=250, alpha=1
  • #mistyrose, value= r=255, g=228, b=225, alpha=1
  • #moccasin, value= r=255, g=228, b=181, alpha=1
  • #navajowhite, value= r=255, g=222, b=173, alpha=1
  • #navy, value= r=0, g=0, b=128, alpha=1
  • #oldlace, value= r=253, g=245, b=230, alpha=1
  • #olive, value= r=128, g=128, b=0, alpha=1
  • #olivedrab, value= r=107, g=142, b=35, alpha=1
  • #orange, value= r=255, g=165, b=0, alpha=1
  • #orangered, value= r=255, g=69, b=0, alpha=1
  • #orchid, value= r=218, g=112, b=214, alpha=1
  • #palegoldenrod, value= r=238, g=232, b=170, alpha=1
  • #palegreen, value= r=152, g=251, b=152, alpha=1
  • #paleturquoise, value= r=175, g=238, b=238, alpha=1
  • #palevioletred, value= r=219, g=112, b=147, alpha=1
  • #papayawhip, value= r=255, g=239, b=213, alpha=1
  • #peachpuff, value= r=255, g=218, b=185, alpha=1
  • #peru, value= r=205, g=133, b=63, alpha=1
  • #pink, value= r=255, g=192, b=203, alpha=1
  • #plum, value= r=221, g=160, b=221, alpha=1
  • #powderblue, value= r=176, g=224, b=230, alpha=1
  • #purple, value= r=128, g=0, b=128, alpha=1
  • #red, value= r=255, g=0, b=0, alpha=1
  • #rosybrown, value= r=188, g=143, b=143, alpha=1
  • #royalblue, value= r=65, g=105, b=225, alpha=1
  • #saddlebrown, value= r=139, g=69, b=19, alpha=1
  • #salmon, value= r=250, g=128, b=114, alpha=1
  • #sandybrown, value= r=244, g=164, b=96, alpha=1
  • #seagreen, value= r=46, g=139, b=87, alpha=1
  • #seashell, value= r=255, g=245, b=238, alpha=1
  • #sienna, value= r=160, g=82, b=45, alpha=1
  • #silver, value= r=192, g=192, b=192, alpha=1
  • #skyblue, value= r=135, g=206, b=235, alpha=1
  • #slateblue, value= r=106, g=90, b=205, alpha=1
  • #slategray, value= r=112, g=128, b=144, alpha=1
  • #slategrey, value= r=112, g=128, b=144, alpha=1
  • #snow, value= r=255, g=250, b=250, alpha=1
  • #springgreen, value= r=0, g=255, b=127, alpha=1
  • #steelblue, value= r=70, g=130, b=180, alpha=1
  • #tan, value= r=210, g=180, b=140, alpha=1
  • #teal, value= r=0, g=128, b=128, alpha=1
  • #thistle, value= r=216, g=191, b=216, alpha=1
  • #tomato, value= r=255, g=99, b=71, alpha=1
  • #transparent, value= r=0, g=0, b=0, alpha=0
  • #turquoise, value= r=64, g=224, b=208, alpha=1
  • #violet, value= r=238, g=130, b=238, alpha=1
  • #wheat, value= r=245, g=222, b=179, alpha=1
  • #white, value= r=255, g=255, b=255, alpha=1
  • #whitesmoke, value= r=245, g=245, b=245, alpha=1
  • #yellow, value= r=255, g=255, b=0, alpha=1
  • #yellowgreen, value= r=154, g=205, b=50, alpha=1