Getting Started with WRESL+

Prerequisites

  • Download and install the WRIMS GUI from the official source.

  • Familiarize yourself with the WRIMS IDE.

Your First Model

This tutorial walks through a simple study adapted from the WRESL+ Language Reference (2018) Quick Start example.

  1. Create a main file main.wresl with sequences, models, variables, goals, and an objective:

 1sequence CYCLE1 {
 2   model First
 3   order 1
 4}
 5
 6sequence CYCLE2 {
 7   model Second
 8   order 2
 9}
10
11model First {
12   define I01 {
13      timeseries
14      kind 'FLOW-INFLOW'
15      units 'TAF'
16   }
17
18   dvar X1 {
19      std
20      kind 'FLOW-CHANNEL'
21      units 'CFS'
22   }
23   dvar X2 {
24      std
25      kind 'FLOW-CHANNEL'
26      units 'CFS'
27   }
28   svar C { value I02 * 5 }
29
30   goal Test { X1 + X2 < C }
31
32   include 'allocation\test1.wresl'
33
34   objective XGroup {
35      [ X1, 10 ]
36      [ X2, 20 ]
37   }
38}
39
40model Second {
41   define I02 {
42      timeseries
43      kind 'FLOW-INFLOW'
44      units 'TAF'
45   }
46   dvar Y1 {
47      std
48      kind 'FLOW-CHANNEL'
49      units 'CFS'
50   }
51   dvar Y2 {
52      std
53      kind 'FLOW-CHANNEL'
54      units 'CFS'
55   }
56   svar X1_Upstream {
57      value X1[First]
58   }
59
60   goal Test2 { Y1 + Y2 < I02 + X1_Upstream }
61
62   include 'allocation\test2.wresl'
63
64   objective YGroup {
65      [ Y1, 10 ]
66      [ Y2, 20 ]
67   }
68}
  1. Run the model using the WRIMS GUI. (Check out the WRIMS GUI docs)

  2. Examine the output: the solver determines X1, X2, Y1, and Y2 values that satisfy the constraints while optimizing the weighted objectives.

What Just Happened?

First, the sequence / model / include structure told WRIMS which files to load and in what order.

Within the First model, you defined 4 different variables.

Two of them were State Variables

  1. define I01 { timeseries kind 'FLOW-INFLOW' units 'TAF' }

  2. svar C { value I02*5 }

Two of them were Decision Variables

  1. dvar X1 { std kind 'FLOW-CHANNEL' units 'CFS' }

  2. dvar X2 { std kind 'FLOW-CHANNEL' units 'CFS' }

You also created a constraint (in the MILP sense of the word), that the solver will satisfy when it optimizes the objective function.

goal Test { X1 + X2 < C }

Speaking of the objective function, you also created that within the First model.

objective XGroup { [X1, 10] [X2, 20] }

Within the Second model, you did pretty much the same thing as in the First model, except…

svar X1_Upstream { value X1[First] }

You referenced the result of X1 from the First sequence, demonstrating cross-cycle variable access.