1. Sort the OWRD POD data input file from Senior to Junior (WaterMaster::Init) 2. For Each Envision time step A. Optional Annual Calculation for demand for a particular Water Right (WR) Use (Envision::WW2100AP) i. Using Place of Use (POU) data input file, and the Point of Diversion (POD) data input file determine IDU(s) ii. Each water right will have beginning Day of Year (DOY) and end DOY iii. For all IDUs associated with WR estimate demand over number of allowable DsOY B. For each Flow time step i. Optional Daily Calculation for demand for a particular Water Right (WR) Use a. Populate IDU demand arrays (Envision::Flow::WaterDemand) ii. loop through the POD input file (from senior to junior) a. For the current record in the POD input file retrieve “non-canceled” Water Right ID (WRID) b. Using the POUID from the POD input data file and the POU data input file, return an array of associated IDU index(s) c. Begin looping through IDU(s) associated with POUID 1. If use is irrigation, retrieve econ irrigation (yea or nay) from IDU layer. Log consecutive days-not-used i. If consecutive days-not-used exceeds user defined threshold in .xml file cancel WR d. If Flow’s Day of Year (DOY) is between the start and end of POUID DOY then continue with possible diversion e. Check to see if POUID’s permit is for Ground Water or Surface Water. 1. Surface water a. In the POD data input file, based on WRID get the associated stream reach in the Stream Layer b. Retrieve the Stream Reach Minimum flow level (if not attribute in stream layer, then zero) c. Retrieve the Stream Reach Discharge d. For the WRID determine legal Use i. Irrigation (derived daily) a. Retrieve water demand for the IDU b. Based on Minimum flow requirements, available source flow, and demand in the IDU, divert water from stream reach. Log any conflicts (Envision::AddOutputVar) 1. If water right is shut off, user defined in .xml, time(s) per week, conflict is Level 1 a. Log number of IDUs, OWRD POU area, and IDU area 2. If water right is shut off, user defined in .xml, time(s) per week in 2 consecutive weeks, conflict is Level 2 a. Log number of IDUs, OWRD POU area, and IDU area 3. If water right is shut off, user defined in .xml, time(s) per week, conflict is Level 2 a. Log number of IDUs, OWRD POU area, and IDU area ii. In-stream a. Add to stream reach, in-stream water use b. Log any conflicts iii. Municipality a. Under development 1. If derived annually; retrieve from IDU layer. Demand should be spread out over IDUs and allowable time period. 2. Based on Minimum flow requirements, available source flow, and demand in the IDU, divert water from stream reach 3. Log any conflict 2. Ground Water a. Under development (similar in some ways to Surface Water). iii. Aggregate water diverted from Stream Layer to HRUs