Jump to content

Language Reference 3: Difference between revisions

From SELESwiki
 
(13 intermediate revisions by the same user not shown)
Line 89: Line 89:


Example 1:
Example 1:
//Note this example is out of context. //See [[LSStats#centroid.lse|centroid.lse]] for the working example.
OUTPUT RECORD(ClassStatsFile)
    DECISION Area[currType] > 0
    LandscapeId: LandscapeId
    Replicate: Replicate
    pType: currType
    CCE: MeanCCE[currType]
    MaxCCE: MaxCCE[currType]
    CD: MeanCD[currType]
    ENDFN
Example 2:
//Note this example is out of context. //See [[LSStats#nn.lse|nn.lse]] for the working example.
//Note this example is out of context. //See [[LSStats#nn.lse|nn.lse]] for the working example.
  OUTPUT RECORD(ClassStatsFile)
  OUTPUT RECORD(ClassStatsFile)
Line 111: Line 123:
     nAW_MPG: nMPG[pType]
     nAW_MPG: nMPG[pType]
     ENDFN
     ENDFN
Example 2:
    
    
SAMPLE MODELS:  
SAMPLE MODELS:  
Line 191: Line 201:
Example 1:   
Example 1:   
//Note this example is out of context. It will not run in the value model.  
//Note this example is out of context. It will not run in the value model.  
//See [[LSStats#centroid.lse|centroid.lse]] for the working example.
//See [[LSStats#stats.lse|stats.lse]] for the working example.
  OVER INDEX SEQUENCE(0, NumPTypes-1)
  OVER INDEX SEQUENCE(pType + 1, NumPTypes - 1)
      i = Index + MinPType
            pType2 = Index
      pos1 = HEAD(patchList[i])
            x = IF (tTE > 0) THEN Eik[pType, pType2] / tTE ELSE 0
      WHILE (pos1)
             tIJI = tIJI + x * LOG(x)
        patchVar [=] GET(patchList[i], pos1)
        currType = patchVar[rType]
        id1 = patchVar[rId]
        patchArea1 = patchVar[rArea]
        centroid1 = patchVar[rCentroid]
        maxCCE1 = patchVar[rMaxCCE]
        nextPos = NEXT(patchList[i], pos1)
//        pos2 = HEAD(patchList[i])
        pos2 = nextPos
        WHILE (pos2)
             IF (currType EQ GET(patchList[i], pos2, rType))
              patchVar [=] GET(patchList[i], pos2)
              patchArea2 = patchVar[rArea]
              centroid2 = patchVar[rCentroid]
              maxCCE2 = patchVar[rMaxCCE]
              /* Determine the max patch CCE */
              d = DISTANCE(centroid1, centroid2)
              CCE = (patchArea1 * patchArea2) / d^2
              MeanCCE[currType] = MeanCCE[currType] + CCE
              maxCCE1 = MAX(CCE, maxCCE1)
              maxCCE2 = MAX(CCE, maxCCE2)
              MeanCD[currType] = MeanCD[currType] + d
              // Update maxCCE in patches
              SET(patchList[i], pos2, rMaxCCE, maxCCE2)
/*
              OUTPUT RECORD(EdgeStatsFile)
                  LandscapeId: LandscapeId
                  Replicate: Replicate
                  type: currType
                  patchId1: id1
                  patchId2: patchVar[rId]
                  d: d
              ENDFN
*/
            ENDFN
            pos2 = NEXT(patchList[i], pos2)
         ENDFN
         ENDFN
        /* At this point, the patch CCE for p1 will be known */
 
        SET(patchList[i], pos1, rMaxCCE, maxCCE1)
        MaxCCE[currType] = MaxCCE[currType] + maxCCE1
        pos1 = nextPos
      ENDFN
  ENDFN


Example 2:   
Example 2:   
//Note this example is out of context. It will not run in the value model.
//See [[LSStats#stats.lse|stats.lse]] for the working example.
OVER INDEX SEQUENCE(0, NumPTypes-1)
            pType2 = Index + MinPType
            AMik = IF (TotalEdge[pType] > 0) THEN Eik[pType, pType2] / TotalEdge[pType] ELSE 0
            IJI[pType] = IJI[pType] + AMik * LOG(AMik)
            x = IF ((TotalEdge[pType] > 0) AND (Pi > 0)) THEN Pi * Eik[pType, pType2] / TotalEdge[pType] ELSE 0
            tContag = tContag + x * LOG(x)
            measuredDiversity  = measuredDiversity - AMik * LOG(AMik)
            measuredDiversity2  = IF(pType NEQ pType2) THEN  measuredDiversity2 - AMik * LOG(AMik) ELSE measuredDiversity2
            asm = asm + AMik^2
        ENDFN


SAMPLE MODELS:  
SAMPLE MODELS:  
Line 426: Line 407:
Example 3:
Example 3:
//Note This exacmple is out of context. It will not run in the value model
//Note This exacmple is out of context. It will not run in the value model
//See [[Producer Consumer#producer.lse|producer.lse]] for the working example   
//See [[The process model#producer.lse|producer.lse]] for the working example   
  REGION CENTRED(0, 1, WRAPPED)
  REGION CENTRED(0, 1, WRAPPED)
  DECISION notEaten // don't spread if eaten (i.e. stop process)
  DECISION notEaten // don't spread if eaten (i.e. stop process)
Line 637: Line 618:


Example 1:   
Example 1:   
 
//Note this example is out of context. //See [[Spreading1#Spreading.lse|Spreading.lse]] for the working example.
REGION LOCATION(LOCATION(NUMROWS/2, NUMCOLS/2))
Example 2:   
Example 2:   


Line 710: Line 692:
SEE ALSO:  
SEE ALSO:  


Example 1:  
Example 1:
//Note this example is out of context. It will not run in the value model.
//See [[LSStats#nn.lse|nn.lse]] for the working example.
OVER REGION VECTOR(startLocation,NNLoc)
            PatchLinks = edgeVar[rEdgeType]+1
        ENDFN
 
Example 2:  
//Note this example is out of context. It will not run in the value model.  
//Note this example is out of context. It will not run in the value model.  
//See [[Convex Hull#ConvexHull.lse|ConvexHull.lse]] for the working example.
//See [[Convex Hull#ConvexHull.lse|ConvexHull.lse]] for the working example.
Line 958: Line 947:


Example 1:   
Example 1:   
//Note this example is out of context. //See [[LSStats#centroid.lse|centroid.lse]] for the working example.
SET(patchList[i], pos1, rMaxCCE, maxCCE1)
        MaxCCE[currType] = MaxCCE[currType] + maxCCE1
        pos1 = nextPos
      ENDFN


Example 2:   
Example 2:   
Line 1,338: Line 1,332:


Example 1:   
Example 1:   
//Note this example is out of context. //See [[The CA model#consumeCA.lse|consumeCA.lse]] for the working example.
IF UNIFORM(0,1) < pDeathConsumer
    LSState = Uncolonised
ENDFN


Example 2:   
Example 2:   

Latest revision as of 22:09, 15 November 2006

ONE

return 1.0

  1. Number return value of the number specified

<Constant> return value of a named constant <Constant>[Expr] return value of a named vector constant <Constant>[Expr, Expr] return value of a named array constant <Macro>[Expr] return value of expression at specified index in macro


(Expr, Expr) draw a value from a normal distribution, where the first expression specifies the mean and the second specifies the standard deviation

(Expr, Expr, Expr) draw a value from a skewed normal distribution, where the first expression specifies the mode and the second and third specify the standard deviations to the left and right of the mode (Expr, Expr) draw a value from a log normal distribution, where the first expression specifies the mean and the second specifies the standard deviation of the underlying normal distribution

(Expr, Expr) draw a value from a Weibull distribution, where the first expression specifies the beta and the second specifies alpha (Note:terminology varies between sources. The version here is equivalent to that in Excel, with reversal of parameters). DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Constants

OR

DESCRIPTION: A Boolean function operator that returns TRUE(1) if value of at least one expression is TRUE(1) and FALSE(0) otherwise.

USAGE:

  x=Expr OR Expr
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Either TRUE(1) or FALSE(0)

NOTES: The OR operator is equivalent to the addition operator. For example: if A is TRUE(1) and B FALSE(0), then A OR B means that A+B, which is 1+0 and is equal to 1(TRUE). If both A and B are TRUE(1), then A OR B becomes 1+1, the result will be greater than 0 and 1. In this case, the result for x will still be evaluated to 1(TRUE)

SEE ALSO: Model Builder's Guide Chapter 9#Composite Functions

Example 1:

   x=(2*8==16) OR (2>5) //(TRUE)
   (the result for x will be 1)

Example 2:

  x=(2*8!=4*4) OR (2>5) //(FALSE)
   (the result for x will be 0)

SAMPLE MODELS: <links to sample models where this function is used>

OUTPUT RECORD

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE:

NOTES:

SEE ALSO: Model Builder's Guide Chapter 9#Composite Functions

Example 1: //Note this example is out of context. //See centroid.lse for the working example.

OUTPUT RECORD(ClassStatsFile)
   DECISION Area[currType] > 0
   LandscapeId: LandscapeId
   Replicate: Replicate
   pType: currType
   CCE: MeanCCE[currType]
   MaxCCE: MaxCCE[currType]
   CD: MeanCD[currType]
   ENDFN

Example 2: //Note this example is out of context. //See nn.lse for the working example.

OUTPUT RECORD(ClassStatsFile)
 DECISION Area[pType] > 0
   LandscapeId: LandscapeId
   Replicate: Replicate
   pType: pType
   MNN: CellWidth * MeanNN[pType]
   MNN2: CellWidth * MeanNN2[pType]
   MinNN: CellWidth * MinNN[pType]
   MaxNN: CellWidth * MaxNN[pType]
   NNSD: CellWidth * NNSD[pType]
   NNCV: 100 * NNSD[pType] / MeanNN[pType]
   Dispersion: 2 * (NumPatches[pType] / Area[pType])^(1/2) * MeanNN[pType]
   meanMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * meanMST[pType]
   tMST: IF (NNType EQ rNN) THEN 0 ELSE CellWidth * MST[pType]
   meanMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanMPG[pType]
   tMPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * MPG[pType]
   nMPG: nMPG[pType]
   meanAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * meanAW_MPG[pType]
   tAW_MPG: IF (NNType EQ rNN) OR (NNType EQ rMST) THEN 0 ELSE CellWidth * AW_MPG[pType]
   nAW_MPG: nMPG[pType]
   ENDFN
  

SAMPLE MODELS: <links to sample models where this function is used>

OVER INDEX SEQUENCE

(Expr, Expr) defines linear sequence of location indices. DECISION Expr If there is a decision expression, then only those cells for which this expression returns TRUE will be included. The system variable Index holds the value of the index at each value in the sequence

Over region expressions are very frequently used to visit all cells in a landscape that meet some condition (e.g. to compute the size of the forest at initiation). Model Builder's Guide Chapter 9#Region Functions OVER RegionFunction Apply a set of sub-expressions at all spatial

  Expression	locations specified by a region function

 : ENDFN Model Builder's Guide Chapter 9#Region Functions AT LOCATION #Expr Apply a set of state-changes at a specified

  Expression	location

: ENDFN Model Builder's Guide Chapter 9#Region Functions

Matrix assignment is indicated using “[=]” instead of “=”. The proper dimensions of the component arrays must be met.

Variable [=] Variable assign variable of same dimension, or a single value to all entries Variable [=] Variable + Variable sum variables of same dimension (or with a constant) Variable [=] Variable - Variable subtract variables of same dimension (or with a constant) Variable [=] Variable * Variable matrix or scalar multiplication.

Variable [=] TRANSPOSE(Variable) matrix transposition Variable [=] Variable^-1 invert a matrix Variable = SUM(Variable) sum all entries in a matrix Variable [=] SUM ROWS (Variable) sum all rows of a matrix (result has one value per column) Variable [=] SUM COLS(Variable) sum all columns of a matrix

Variables [=] SORT(Variable, Expr) sort rows of an input matrix where rank is given by Expr. The system variable “Index” can appear in the expression and will take on the range of indices in the input array. The resulting sorted matrix will be assigned.

Variable [=] MPM_MULT(Variable, Variable) Performs a “matrix population model” (MPM) integer-based multiplication. Assumes that first matrix is two-dimensional and that second is a vector. The result is two-dimensional, where entries above diagonal represent "offspring", entries on the diagonal represent "survivors" and entries below the diagonal represent "succeeders"

Variable [=] CONTAG(Variable, Variable) Creates a “temporal contagion” matrix. Given probabilities (first parameter) for a set of states and a two-dimensional contagion array (values –1 to 1 indicating affinity), generates a matrix where each row is a prob. dist. For transitions given the row value, and the overall target dist. will be met. Model Builder's Guide Chapter 9#Matrix Functions DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See stats.lse for the working example.

OVER INDEX SEQUENCE(pType + 1, NumPTypes - 1)
           pType2 = Index
           x = IF (tTE > 0) THEN Eik[pType, pType2] / tTE ELSE 0
           tIJI = tIJI + x * LOG(x)
        ENDFN


Example 2: //Note this example is out of context. It will not run in the value model. //See stats.lse for the working example.

OVER INDEX SEQUENCE(0, NumPTypes-1)
           pType2 = Index + MinPType
           AMik = IF (TotalEdge[pType] > 0) THEN Eik[pType, pType2] / TotalEdge[pType] ELSE 0
           IJI[pType] = IJI[pType] + AMik * LOG(AMik)
           x = IF ((TotalEdge[pType] > 0) AND (Pi > 0)) THEN Pi * Eik[pType, pType2] / TotalEdge[pType] ELSE 0
           tContag = tContag + x * LOG(x)
           measuredDiversity  = measuredDiversity - AMik * LOG(AMik)
           measuredDiversity2  = IF(pType NEQ pType2) THEN  measuredDiversity2 - AMik * LOG(AMik) ELSE measuredDiversity2
           asm = asm + AMik^2
        ENDFN

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE

Halts the simulation and displays a dialog box to which the user must respond to continueModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(#Value) Pauses the simulation for the specified number of milliseconds and then continuesModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE IF

Expr If the expression evaluates to TRUE, halts the simulation and displays a dialog box to which the user must respond to continueModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PAUSE (#Value)IF

Expr If the expression evaluates to TRUE, Pauses the simulation for the specified number of milliseconds and then continuesModel Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

PREV

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions


RECOMPUTE

Only valid in consequent expressions of ProbInit and also when ProbInit recompute flag has been set. Causes prob. surface to be recomputed before next selection Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION CENTRED

(Expr, Expr [,DistanceType][,WRAPPED]) DECISION Expr defines a region centred on the current cell. If there is a decision expression, then only those cells for which this expression returns TRUE will be included.

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note This exacmple is out of context. It will not run in the value model //See Distance.lse for the working example

REGION CENTRED(1, 1)
DECISION (StudyArea > 0) AND (SrcLayer <= 0) AND (DistanceFromSrc > (CellWidth *   DISTANCE(StartLocation, Location)))
ENDSL

Example 2: //Note This exacmple is out of context. It will not run in the value model //See FilterSmall.lse for the working example

REGION CENTRED(1, 1.5)
DECISION (Visited EQ 0) AND (FilteredPatchLayer EQ 1)
ENDSL

Example 3: //Note This exacmple is out of context. It will not run in the value model //See producer.lse for the working example

REGION CENTRED(0, 1, WRAPPED)
DECISION notEaten // don't spread if eaten (i.e. stop process)
ENDSL

Example 4: //Note This exacmple is out of context. It will not run in the value model //See GameOfLife.lse for the working example

OVER REGION CENTRED(1,1.5)
    DECISION PrevCellState EQ 1
    numNeighbs = numNeighbs + 1
 ENDFN


SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

REGION COST SURFACE

(EndLocation, MaxCost, CostSurface) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)

       DECISION Expr	
       COST Expr

Defines a region surrounding a cell with cumulative costs less than MaxCost. Stops growing when EndLocation is reached or all costs are greater than MaxCost. Second form also records gradient and anchor location layers. The CostSurface layer records the cumulative cost from the cost function Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(EndLocation, MaxCost, CostSurface, LeastCostNeighbs, AnchorLoc)

       DECISION Expr	
       COST Expr

Defines a region surrounding a cell with cumulative costs less than MaxCost. Stops growing when EndLocation is reached or all costs are greater than MaxCost. Second form also records gradient and anchor location layers. The CostSurface layer records the cumulative cost from the cost function Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(StartLocation, EndLocation) DECISION Expr COST ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LEAST COST PATH

(StartLocation, EndLocation, LeastCostNeighbs) DECISION ExprModel Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(StartLocation, EndLocation, LeastCostNeighbs, AnchorLoc) DECISION Expr Defines a region with cells that approximate the least-cost path between two cells. The first generates the cost function internally. The latter two use input information from a pre-computed cost surface region. Providing both the gradient and anchor location layers provides the most accurate approximation.

Iteration is a common aspect of models (even if it is very procedural). Most programming languages offer a “for-loop” of some kind. SELES presently provides “over index sequence” expressions as a slightly more declarative (although also more cumbersome) expression for iterating. While-loops can also be used. Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LOCATION

(Expr) DECISION Expr

                             defines the region consisting of a of a single
                             location index. If there is a decision 
                             expression, then only those cells for which 
                             this expression returns TRUE will be    
                             included.

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See Spreading.lse for the working example.

REGION LOCATION(LOCATION(NUMROWS/2, NUMCOLS/2))

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION LOCATION LIST

(Number+) DECISION Expr

                            defines the region consisting of a set of  a set 
                            of known location indices. If there is a 
                            decision expression, then only those cells for
                            which this expression returns TRUE will be
                            included. 

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

(X,n) defines the region consisting of a set of n location indices stored in one-dimensional X.

REGION RECT

(Expr, Expr, Expr, Expr) defines a rectangular region. If there is a DECISION Expr decision expression defined, then only those cells for which this expression returns TRUE will be included Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REGION VECTOR

(StartLocation, EndLocation) defines region consisting of cells along an

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See nn.lse for the working example.

OVER REGION VECTOR(startLocation,NNLoc)
           PatchLinks = edgeVar[rEdgeType]+1
        ENDFN

Example 2: //Note this example is out of context. It will not run in the value model. //See ConvexHull.lse for the working example.

OVER REGION VECTOR(EdgeLocation, PivotLocation)
    DECISION !hitPivot
    IF (StudyArea > 0) // hit new vertex
       hitPivot = TRUE
       IF (EndingPivotLoc EQ -1) AND (Location NEQ PivotLocation)
          EndingPivotLoc = PivotLocation
       ENDFN
       PivotLocation = Location
    ELSE
       ConvexHull = 0 // erase
    ENDFN
 ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Region Functions

REGION WHOLE MAP

DECISION Expr

                       defines the region consisting of the entire
                       landscape. If there is a decision expression, 

then only those cells for which this expression returns TRUE will be included. Model Builder's Guide Chapter 9#Region Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. It will not run in the value model. //See Distance.lse for the working example.

REGION WHOLE MAP
DECISION (StudyArea > 0) AND (SrcLayer > 0)
ENDEL

Example 2: //Note this example is out of context. It will not run in the value model. //See ConvexHull.lse for the working example.

  OVER REGION WHOLE MAP
    DECISION StudyArea > 0
    TRLoc = MAX(TRLoc, Location)
 ENDFN

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

REMOVE

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

RESIZE

(Variable, Expr) Changes size (number of entries) in a global variable. Values are not maintained. Useful for when size is not known prior to simulation. Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See nn.lse for the working example.

RESIZE(effectivePatchId, NP+1)
     

Example 2: //Note this example is out of context. //See nn.lse for the working example.

RESIZE(PosList, NP+1)

SAMPLE MODELS: <links to sample models where this function is used>

RESPONSE

(Expr, #A, #B, #C) two-sided version of a standard response function for the value X of the first expression: if (X < A) return e^(-(X-A)^2/(2*(C^2)) else if (X > B) return e^(-(X-B)^2/(2*(C^2)) else return 1 Model Builder's Guide Chapter 9#Continuous Functions (Miscellaneous)

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

ROUND(Expr)

DESCRIPTION: The rounding operator

USAGE:

  x=ROUND(Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Expression value rounded to the nearest integer

SEE ALSO: Model Builder's Guide Chapter 9#Continuous Functions (Arithmetic Functions)

Example 1:

  x=ROUND(0.773)
   =1

SAMPLE MODELS: <links to sample models where this function is used>

SEED

(Expr) Sets the random number seed. Value returned is next seed.Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SELECTAT

DESCRIPTION: A Bit-Vector function that returns FALSE(0) if none of the bits in PositionList are set in the specified expression value and TRUE(1) otherwise

USAGE:

  (Expr,PositionList)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Either FALSE(0) or TRUE(1)

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   yet to be determined

SAMPLE MODELS: <links to sample models where this function is used>

SET

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See centroid.lse for the working example.

SET(patchList[i], pos1, rMaxCCE, maxCCE1)
        MaxCCE[currType] = MaxCCE[currType] + maxCCE1
        pos1 = nextPos
     ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

SETAT

(Expr,PositionList,#Type) DESCRIPTION: A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1, and flip the bits if Type=2.

USAGE:

  (Expr,PositionList,#Type)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   The PositionList 1;4-6;27 indicates bits at positions 1,4,5,6 and 27.

SAMPLE MODELS: <links to sample models where this function is used>

(Expr,PositionList,#Type,#Prob) (Expr, PositionList,#Type,#Prob) Same as above, except each position is set with probability #Prob Model Builder's Guide Chapter 9#Bit-Vector Functions DESCRIPTION: A Bit-Vector function that sets the value specified by the expression, at the positions in PositionList to: FALSE(0) if Type is 0, TRUE(1) if Type is 1; flip the bits if Type=2; note that each position is set with probability #Prob.

USAGE:

  (Expr,PositionList,#Type,#Prob)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value PositionList is a semi-colon separated sequence of integer or ranges (lower-upper) indicating positions in the integer (0-31).

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   The PositionList 1;4-6;27;30 indicates bits at positions 1,4,5,6 and 27, each associated with probability 30%.

SAMPLE MODELS: <links to sample models where this function is used>


SHIFT LEFT

DESCRIPTION: A Bit-Vector function that shifts value of first expression to the left by number of bits specified by second expression

USAGE:

  SHIFT LEFT(Expr,Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   SHIFT LEFT(7,5) means that position 7 will be shifted to position 2

SAMPLE MODELS: <links to sample models where this function is used>

SHIFT RIGHT

DESCRIPTION: A Bit-Vector function that shifts value of first expression to the right by number of bits specified by second expression

USAGE:

  SHIFT RIGHT(Expr,Expr)
      

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value

VALUE: Any integer value

SEE ALSO: Model Builder's Guide Chapter 9#Bit-Vector Functions

Example 1:

   SHIFT RIGHT(7,5) means that position 7 will be shifted to position 12

SAMPLE MODELS: <links to sample models where this function is used>

SIN

(Expr) interpret the value of the expression as an angle theta in degrees, and return sin(theta) Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>


DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Graph Functions

SKEWED NORMAL

(CDF)(Expr, Expr, Expr, Expr) skewed normal cumulative density function, where the first expression specifies the value, the second is the mode, and the third and fourth are the left and right standard deviations Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

(PDF)(Expr, Expr, Expr, Expr) skewed normal probability density function, where the first expression specifies the value, the second is the mode and the third and fourth are the standard deviations to the left and right of the mode. Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SKEWED NORMAL TEMPORAL PDF

(Expr, Expr, Expr, Expr) temporal skewed normal probability density function Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>


SORT

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#General Set, List and Graph Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

STRICT ORDERED

same as LESS THAN Model Builder's Guide Chapter 9#Composite Functions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

SUM

DESCRIPTION: Returns the number that is the sum of all the expressions.

USAGE:

  x=SUM 
      Expr
      ...  
    ENDFN

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value.

VALUE: the sum of all the arguments.

SEE ALSO: <a link to the composite functions section of seles modellers guide>

EXAMPLES: <add carriage return here> Example 1:

  y = 3
  x = SUM  
        y  
        y+2  
        5  
      ENDFN 

SAMPLE MODELS: <links to sample models where this function is used> Model Builder's Guide Chapter 9#Composite Functions

DIVIDE successive division of the sub-expressions

Model Builder's Guide Chapter 9#Composite Functions

TAIL

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

TAN

DESCRIPTION: The tan function operator

USAGE:

  x=TAN(Expr)

REQUIRED ARGUMENTS: Expr is any expression that evaluates to single numeric value.

VALUE: Interpret the value of the expression as an angle theta in degrees, and return cos(theta)

SEE ALSO: <a link to the composite functions section of seles modellers guide>

Example 1:

  x=TAN(90)
   =-286411217403671.25

SAMPLE MODELS: <links to sample models where this function is used> Model Builder's Guide Chapter 9#Continuous Functions (Trigonometric Functions)

UNIFORM

(Expr, Expr) draw a value from a uniform distribution, where the first expression determines the minimum value and the second determines the maximum

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See consumeCA.lse for the working example.

IF UNIFORM(0,1) < pDeathConsumer
   LSState = Uncolonised
ENDFN

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

UNIFORM TEMPORAL PDF

(Expr, Expr, Expr) temporal uniform probability density expression Model Builder's Guide Chapter 9#Probability Density and Cumulative Density Functions

<Variable> value of an independent variable <Variable>[Expr] value of a vector global variable <Variable>[Expr, Expr] value of an array global variable


(Expr) value of the expression Expr + Expr sum of two expressions Expr - Expr value of the first expression minus the value of the second expression Expr * Expr product of two expressions Expr / Expr value of the first expression divided by value of the second expression Expr ^ Expr value of the first expression to the power of the value of the second expression. An nth root can be computed with1/n as the power. | Expr | absolute value of the expression

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

WAIT UNTIL

Expr Suspend execution until the expression returns TRUE (1). This is intended for controlling communication and synchronization with an external application. Model Builder's Guide Chapter 9#Control Expressions

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: <links to sample models where this function is used>

WHILE

Expr While loop: process sub-expressions denoted by “…” while the expression evaluates to TRUE ENDFN

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1: //Note this example is out of context. //See stats.lse

WHILE (pos)
           patchVar [=] GET(coreAreaList[i], pos)
           pos = NEXT(coreAreaList[i], pos)
           // i = patchVar[rType]
           patchSize = patchVar[rArea]
           patchCoreSize = patchVar[rCoreArea]
           patchPerim = patchVar[rPerim]
           CASD2[i] = CASD2[i] + (patchCoreSize - MCA2[i])^2
           tCASD2 = tCASD2 + (patchCoreSize - tMCA2)^2
        ENDFN

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Control Expressions

ZERO

return 0.0

DESCRIPTION:

USAGE:

REQUIRED ARGUMENTS:

VALUE:

SEE ALSO:

Example 1:

Example 2:

SAMPLE MODELS: Model Builder's Guide Chapter 9#Constants