EppalockSharing

The EppalockSharing plugin is a Custom Function (see User Guide/Expression Editor) that Calculates the Share of Eppalock Storage Capacity. This plugin is used by Yong Li in the Victorian Goulburn trial application. This plugin was provided by Tony Sheedy from SKM. 

General Info

LicenseAs-is, use at your own risk
Typefree, open-source
Current version1.0

Using the plugin

 Once you have loaded the plugin See User Guide/Expression Editor.

Source Code

Eppalock Sharing Capacity Share
using System;
using RiverSystem.TaskDefinitions;
using TIME.Core.Metadata;
namespace ExpressionEditorExample
{
    [CustomFunctionContainerAttribute, Author("Tony Sheedy from SKM")]
    public class EppalockSharing
    {
        [CustomFunction("CapacityShare", "Calculates the Share of Eppalock Storage Capacity. The argument orders are OwnerNumber (1 = G-MW, 2 = Coliban Water), eppInflow, gmwUse, colibanUse, sharedUse, netEvap, last timestep eppStorage, prevGmwShare, prevColibanShare, thisMonth")]
        public static double CapacityShare(double ownerNumber,double eppInflow, double gmwUse, double colibanUse, double sharedUse, double netEvap, 
            double eppStorage, double prevGmwShare, double prevColibanShare, double thisMonth   )
        {
            // Owner Number: 1 = G-MW, 2 = Coliban Water
            //  
            double gmwShare;
            double colibanShare;
            double thisOwnersShare;
            double gmwIntSpill;
            double colibanIntSpill;
            double eppCorrection;
            double gmwPercentShare = .82;
            double colibanPercentShare = .18;
            double maxEppStorage = 304800;
            //If July Calculate correction
            if (thisMonth == 7)
            {
                eppCorrection = eppStorage - prevGmwShare - prevColibanShare;
            }
            else
            {
                eppCorrection = 0;
            }
            
            //Calculate G-MW share excluding potential internal spill from Coliban
            gmwShare = prevGmwShare + ((eppInflow - netEvap - sharedUse + eppCorrection) * gmwPercentShare) - gmwUse;
            gmwIntSpill = Math.Max(0, gmwShare - (maxEppStorage*gmwPercentShare));
            gmwShare = Math.Min( gmwShare, (maxEppStorage * gmwPercentShare));
            //Calculate Coliban Share  excluding potential internal spill from g-mw
            colibanShare = prevColibanShare + ((eppInflow - netEvap - sharedUse + eppCorrection) * colibanPercentShare) - colibanUse;
            colibanIntSpill = Math.Max(0, colibanShare - (maxEppStorage * colibanPercentShare));
            colibanShare = Math.Min(colibanShare, (maxEppStorage * colibanPercentShare));
            //Adjust For internal Spills
            gmwShare = Math.Min((maxEppStorage*gmwPercentShare), (gmwShare + colibanIntSpill));
            colibanShare =Math.Min((maxEppStorage*colibanPercentShare), (colibanShare + gmwIntSpill));
            if (ownerNumber == 1)
            {
                thisOwnersShare = gmwShare;
            }
            else
            {
                 thisOwnersShare = colibanShare;
            }
    
            return thisOwnersShare;
        }
    }
}

Â