Trade Manager SRG

Introduction

The Trade Manager (TM) in Source replaces a plugin developed by the Murray Darling Basin Authority (MDBA). The TM is used to represent/model the trade of annual water allocations between the water entitlement holders in the Murray Darling Basin.

This document describes the underpinning concept and processes of the current trade manager (TM) functionality in Source. Setting up of Trade Manager in Source is described in the user guide Trade Manager

Trade Manager concept

The trade manager has been developed using an economic conceptualisation. This conceptualisation considers the value placed on water by water users based on the ability to put water to productive use. Water that is excess to their requirements is considered to hold no value.  The price of water is influenced by supply and demand factors, and it differs across regions, type of rights and with time. Water is generally traded first to water users with highest value for water. The ‘value of water’ is determined by the importance of a particular water demand. For example, a crop which generates higher revenue per unit volume of water would have higher value of water. In the TM, a water user may have a range of values and are considered to assign water to the highest value first. This pattern can be illustrated by a typical demand curve representing the total demand (TD) as shown in Figure 1.

image-20241016-045454.png
Figure 1. Relationship between the value of water and water demand

Water users with available water (AW) trade water to users with highest values of water.  The satisfied demand in turn becomes the supply. The AW assigned to the highest value use is the satisfied demand. Water users would be willing to trade this water if a higher value was offered, consequently this satisfied demand portion can be representing a supply, and the unsatisfied demand can be transformed into a demand.

image-20241016-045631.png
Figure 2. Satisfied demand (supply) versus unsatisfied demand (new demand)

This can be converted to a traditional demand and supply curves quantity (Q) and Value (V) with the transformations for Satisfied Demand (SD) to Supply (S):

 

Equation 1

                                                                        

 

Equation 2

where Vs is the value of supplied water, Vsd  is the value of satisfied demand, Qs  is the quantity of supplied water, QSD is the quantity of satisfied demand and QAW is the available water quantity.

Similarly, the relationship between unsatisfied demand, value of water and available water can be expressed as:

 

Equation 3

                                       

 

Equation 4

 

 

For each water user, water is distributed as efficiently as possible, consequently there is no overlap in the demand and supply curve in the idealised example as shown in Figure 3. When users have the same value and same demand, it is assumed that no trade occurs, with water users prioritising water they own for their own use.

This relationship when used for multiple water users allows the generation of a market demand and supply curve, which includes the equilibrium price, and the quantity of water traded. The equilibrium price dictates the flow of trade from water users. As shown above in Figure 3, there is no overlap between a water user’s demand and supply curve. Consequently, the trade will be into or out of a specific user (or they will not partake in trade).

When the available water (AW) of water users exceeds their total demand, the additional water has no value, and the water user has no unsatisfied demand/demand. If the available water is less than the total demand, then the unmet demands become the total unsatisfied demand as shown in Figure 4.

 

The aggregate demand (AD) and supply (AS) is calculated by aggregating the water quantity associated with each value for the demand and supply curves. Scenarios as in Figure 5 and 6 can be used to illustrate the calculation.

A similar procedure is applied to calculate the aggregate demand as shown in Figure 6.

For example, at the value of VS2max, the quantity of the aggerate supply QAS VS2max is:

 

Equation 5

The intersection of the curves is the equilibrium, setting the value and quantity traded. The value can be used for determining the quantity traded in or out using the individual water users demand and supply curves.

Trading Rules

Rules limit the volume traded between each pair of trading zones within the basin. The trade manager uses a simplified process by controlling trade into or out of each trading group. This is achieved by first calculating the aggregate demand for all water users within each trading group using the process above.

Once the trades within the group are resolved, a new demand and supply curve with an equilibrium quantity at 0 is generated as shown in Figure 7.

Limits to trading in and out can now be imposed on the demand and supply curves, so the maximum supply is less than or equal to the Trade Out Limit (TOL) and the maximum demand is less than or equal to the Trade In Limit (TIL), this process is illustrated in Figure 8.

 

Equation 6

 

Equation 7

Trade Resolution

The trade limit adjusted trade group demand and supply curves can now be amalgamated to generate system demand and supply, following the same process as generating the trade group from water user’s demand and supply. This provides the system equilibrium traded quantity and value.

Once the system equilibrium is known this information needs to be taken back to the trade groups and ultimately water users, to be able to make the water account transfers.

The trade group equilibrium value will be the same as the system equilibrium value when the trade group’s limits are not impacting trade.  While if the volume traded out is limited, then the equilibrium trade group value (VATGe) is less than system equilibrium value (Vse). This is because more would be traded out without a limit, a lower value decreases supply from water users in the trade group, ultimately the quantity traded needs to reflect the supply from the trade group. If the volume traded in is limited then VATGe is greater than Vse.

The adjustment is made by moving the supply curve of the trade group supply by the quantity traded by the trade group, which is either the demand or supply at the system equilibrium value. The adjusted supply (Sadj) trading out the original supply (Sorg) curve shifts to the right and trading in the Sorg moves to the right, as shown in Figure 9. The adjusted trade group equilibrium value (VATGe).

In the final step, the VATGe is applied to the water user demand and supply curves. The demand or supply curve which intersects the trade group equilibrium value then dictates the quantity traded (QT) from each water user and the adjustment made to a water users’ portfolio, shown in Figure 10. Where the demand curve is intersected with this value, the quantity traded represents water traded in and a positive adjustment. When a supply curve is intersected, the quantity traded represents the water traded out.

Trade Manager processing steps in Source

 The TM does it processing for each time step. A flow chart explaining the basic processes in each time step of TM is illustrated below. It starts with the resetting of recorders and variables associated with Resource Assessment (RA) system in Source and TM itself. Then the expected use of all water users and trade groups is calculated followed by the performance of trade. The trade of water in TM occurs based on the water availability, surplus, deficit and value of water of each water user and trade group. After the trade is performed, the accounts of water users and recorders are updated.

 

Each of the above steps is explained in detail in the following sections.

1.     Resetting the variables and recorders

1.1 Resetting the Resource Assessment (RA) recorders

The TM is linked to RA for The TM starts with resetting the RA recorders and TM variables. Firstly, the net trade recorder of accounts in the accounting system is reset by resetting the account net trade of trading water users. The TM checks whether the account host is null and if it is not, converts accounts to virtual accounts and then reset net trade to zero. The algorithm for resetting the net trade of accounts for trading water users is as shown in Figure 12 below.

 

1.2 Resetting the TM variables and recorders

As a part of this step, TM initialises the state of the model before starting the processing. Thereafter, it re-determines the value tiers as ‘Value Of Water’ for a water user can vary. In this step, TM looks for the ‘Value of Water’ for each water user and determines value tiers, in which water users with higher ‘Value of Water’ gets higher priority. For example, if water users WU1, WU2, WU3, WU4, WU5 have ‘Value of Water’ of 1, 2, 3, 1 and 2 respectively, the value tiers will be 1, 2 and 3 and WU3 will have the highest priority. The steps involved in resetting the TM recorders and variables are depicted in Figure 13.

 

1.2.1 Determining the value tiers using the ‘Value Of Water’ of water user

The TM evaluates the number of distinct ‘Value Of Water’ values across the water users and creates a lookup from the ‘Value Of Water’ to an index into a ‘Value Tier’. This allows TM to consider all water users with the same ‘Value Of Water’ together. The index for the lowest ‘Value Of Water’ tier is 0, and increments by 1 for each tier. Once the value tiers are established, the subsequent step is to initialise the expected use at value tiers. For this, TM creates an array of expected use at value tiers that has the size of number of value tiers. The next step is to determine the start of the water year. Firstly, the start of the month in a water year is determined followed by the start date of the water year.

1.2.2 Resetting variables for Trade Groups

For each group in the TM, the group ID, group trade volume and available water are reset to zero. If it’s the start of the water year, the trade year-to-date variables of all trade groups is reset to zero. Subsequently, the group expected use at different value tiers are initialised based on the group ID.

1.2.3 Resetting variables for each Water User

Once the variables for trade groups are reset, the variables pertaining to each water user are reset. Firstly, the group ID of each water user is determined and if the water user is trading, the active trader count is incremented. The remaining steps are similar to that of variable resetting for trade groups. The TM resets the year-to-date trade volume of water users (if it is the start of water year) followed by initialising the expected use of water users at various value tiers. Then the water year-to-date group trade volumes and system trade volumes are reset. The minimum group trade value associated with the ‘GroupTradeValue’ recorder is also reset to null. When there is a trade, the GroupTradeValue recorder gets updated and if there is no trade happening at a particular time step, it remains null.

2.     Calculate the expected use of water users and groups

After calculating the expected use at different value tiers, the expected use of each water user (which is taking part in trade) is calculated. Each water user may use either ‘Antecedent Values’ or ‘Expression Value’ for calculating their expected use.

The underlying steps for this process is as given below.

The tiers are cumulative and therefore lower value tiers will include the expected use of higher value tiers.

2.1 Calculating the Expected Use of a water user using the ‘Antecedent Values’ method

In this step, a buffer of historical expected use values is used to determine an average expected use. As this method updates the buffer, it is expected to be called only once in a timestep.  The sum of expected uses of the previous ten days is used as the expected use of the current time step.

2.2 Calculating the Expected Use of a water user using the ‘Expression Value’ method

Using the ‘Expression Value’ method, the user can input custom expected use using the many options available for data input in Source.

2.3 Calculating the Expected Use of Trade Groups

In this process, the expected use values of water users are aggregated to the group level and retains the expected use at different value tiers. If a group is trading, it creates an array of group expected water use of size equals to the number of value tiers. And for water users that are trading in that group, the expected use is calculated by aggregating the expected use of water users starting from the highest value tier.

2.4 Calculating Available Water of all the water users

Once the expected use is determined, the available water for each water user is calculated. Initially, the available water of each trade group and water user is set to zero. Subsequently, the number of active traders in the water group is determined. If a water user and its trade group are trading and number of active traders is greater than zero, then an adjustment will be made to the available water for the group. This adjustment is evenly distributed amongst all the trading water users.  For example, if water is being traded into a group, then all water users in the group will have a portion of that additional water available to them.

3.     Trading

3.1 Trading between trade groups

This step determines the amount of water which will be traded between the groups. The TM aggregates the available water and expected use of each water user. The value tiers of expected use are used to prioritise the trade. It is to be noted that the trade from and to each group is restricted by the annual trade limits input by the user.

The effective limit on trade in or out of a group is determined by the amount traded so far in the current water year and annual limits.

 

The ‘Group trade year to date’ array considers ‘trade in’ volumes as negative and ‘trade out’ volumes as positive. The next step is to perform the trade for each value tier. For this, TM finds which groups have surpluses and which have shortfalls across all groups and record the total surpluses and shortfalls separately. Net surplus is calculated by     

 

Equation 8

 

Net Surplus = Available water - Expected use

The following pseudocode demonstrates the calculation of total shortfall and total surplus.

If netSurplus < 0 Then                      netSurplus = Max (netSurplus, -maxTradeInForTimeStep[groupId] - _groupTradeVolume[groupId])                 Else                     netSurplus = Min (netSurplus, maxTradeOutForTimeStep[groupId] - _groupTradeVolume[groupId])                 End If                  netSurplusPerGroup[groupId] = netSurplus                 totalShortfall += Max (0, -netSurplusPerGroup[groupId])                 totalSurplus += Max (0, netSurplusPerGroup[groupId])             End If         End For

       

The trade will occur if there are groups with surplus and shortfall. The proportion of trade from each group is determined by a factor which considers the size of surplus with respect to shortfall. For example, if the surplus is twice the size of the shortfalls, then each group would trade half of their surplus to meet the shortfalls. The trade in factor and trade out factor are determined by:

 

Equation 9

 

Trade In Factor = Min(1, totalSurplus/totalShortfall)

 

Equation 10

 

Trade Out Factor = Min(1, totalShortfall/totalSurplus)

For each group in trade groups, if the group can trade and the net surplus per group is greater than zero, then

                          

 

Equation 11

 

  Group trade volume = net surplus per group * Trade In Factor   

Else,

 

Equation 12

 

     Group trade volume = net surplus per group * Trade Out Factor

The next step is to save the trade value tier in which trade happened last, which is used to update the ‘Group Trade Value’ recorder.

The final step in trade between groups is to track the total trade per group for the water year to update the group trade year to date recorder.

3.2 Trading within groups

Once the processing of trade between groups is complete, the next step is to determine the amount of water to be traded between each water user. The trade within group is based on the value tier and trade performed for each value tier. TM creates a dictionary to record net surplus and shortfall per water user. For all water users in the group, TM determines the water users with surpluses and shortfalls and record the surpluses and shortfalls separately.

For each water user, TM assesses the available water and expected use at each value tier. Then the net surplus per water user is calculated by:

                       

 

Equation 13

 

    Net surplus = Available water – expected use

  Then the total shortfall and surplus for each water user is found by:

                             

 

Equation 14

 

   Total shortfall += Max (0, -Net surplus)

 

Equation 15

 

    Total surplus += Max (0, Net surplus) 

Within a group, trade will occur if there are water users with surpluses and shortfalls within that group. If both the total surplus and total shortfall are greater than zero, then TM determines the factors to trade water among the water users similar to that of trade between groups. For example, if shortfall is four times the amount of surplus, then each water user with a shortfall will have 25% of the total shortfall that is met during the internal trade. The Trade In and Trade Out factor are determined using:

 

Equation 16

 

  TradeInFactor = Min(1.0, totalSurplus / totalShortfall)        

 

Equation 17

 

  TradeOutFactor = Min(1.0, totalShortfall / totalSurplus)        

Once the trade in and out factors are calculated, the next step is to perform the trade for each water user within the group. If the net surplus of a water user in a group is greater than zero, the trade volume of that water user is:

 

Equation 18

 

  Trade volume += Net surplus * TradeOutFactor      

Or if the net surplus is smaller than zero, then the trade volume is:

 

Equation 19

 

 Trade volume += Net surplus * TradeInFactor    

After the trade is performed, the available water for each water user is updated and furthermore, the water volume traded year to date for each water user is tracked.

4.     Updating the accounts of water users and TM recorders

In the last step, the TM updates the account balances of water users associated with trade. If a water user is trading and its trade volume is greater than zero, then the account balances for both trade out and trade in are adjusted. In other words, if a trade has occurred, TM passes the traded volume to the resource assessment system to deduct that water from the corresponding account.

 

 

 

 

 

Â