//returns unit hydrograph data public Dictionary <double, TR55> ExecuteHydro(double area, double precip, double crvnum, int dur, Dictionary <double, double> hyetograph) { double tempP = 0; double tempPe = 0; double tempT = 0; double tdiff = 0; Dictionary <double, TR55> hydrotable = new Dictionary <double, TR55>(); int count1 = hyetograph.Count; hyetograph = AddOne2Hyetograph(count1, hyetograph); for (int i = 0; i < hyetograph.Count; i++) { TR55 hydrodata = new TR55(precip, crvnum, dur); double d = hyetograph.ElementAt(i).Key; double p = hyetograph.ElementAt(i).Value * 0.01; double t; t = d * 60; //t = d * 0.01 * dur * 60; tdiff = t - tempT; hydrodata.DRNAREA = area; hydrodata.P = p * precip; hydrodata.dP = (p * precip) - tempP; hydrodata.PIa = hydrodata.P - hydrodata.Ia; if (hydrodata.PIa <= 0) { hydrodata.Pe = 0; hydrodata.dPe = 0; hydrodata.Pl = hydrodata.dP - hydrodata.dPe; } else { hydrodata.Pe = Math.Pow(hydrodata.P - 0.2 * hydrodata.S, 2) / (hydrodata.P + 0.8 * hydrodata.S); hydrodata.dPe = hydrodata.Pe - tempPe; hydrodata.Pl = hydrodata.dP - hydrodata.dPe; } if (hydrodata.dP <= 0) { hydrodata.Q = 0; } else { hydrodata.Q = CalcQ(hydrodata.DRNAREA, hydrodata.dPe, crvnum, tdiff, hydrodata.Ia); } hydrotable.Add(d, hydrodata); tempT = t; tempP = hydrodata.P; tempPe = hydrodata.Pe; } return(hydrotable); }
//retrieves Q public TR55 Execute(double precip, double crvnum, int dur) { try { TR55 Result = new TR55(precip, crvnum, dur); Result.Q = CalcQin(precip, crvnum, Result.Ia); return(Result); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(null); }