//static void AddSpillRow() //{ // AddNewRow(false, modsimName, "Reservoir Spill", "Spill"); //} //static void AddPowerRows() //{ // PiscesFolder savedID = parent; // AddNewRow(true, "", "Power Output", ""); // AddNewRow(false, modsimName, "Average KW", "Powr_Avg", "Avg KW"); // AddNewRow(false, modsimName, "Average Head Feet", "Head_Avg", "Feet"); // parent = savedID; //} //static void AddEvapRow() //{ // AddNewRow(false, modsimName, "Evaporation Loss", "Evap_Loss"); //} static void DemandsTree() { List <string> demList = new List <string>(); List <string> ftList = new List <string>(); string[] demnodes; int i; string dfn = Path.Combine(dir, "Demands.txt"); if (File.Exists(dfn)) { StreamReader sr = new StreamReader(dfn); demnodes = sr.ReadToEnd().Replace("\r", "").Split('\n'); if (demnodes.Length == 1 && demnodes[0].Trim() == "") { demnodes = new string[] { } } ; } else { string sql = "SELECT NName from NodesInfo where Ntype='Demand' order by NName "; DataTable demTable = m_db.Table("NodesInfo", sql); demnodes = new string[demTable.Rows.Count]; for (i = 0; i < demTable.Rows.Count; i++) { demnodes[i] = Convert.ToString(demTable.Rows[i][0]); } } for (i = 0; i < demnodes.Length; i++) { Csu.Modsim.ModsimModel.Node node = mi.FindNode(demnodes[i]); if (node == null) { System.Windows.Forms.MessageBox.Show("Error: A node in the output file was not found in the xy file. (run the model?)"); Logger.WriteLine("Error: could not find node '" + demnodes[i] + "'"); } if (node != null && node.m.idstrmx[0] != null) { ftList.Add(demnodes[i]); } else { //if (demnodes[i].Substring(0, 3) != "neg" && demnodes[i].Substring(0, 3) != "nat") demList.Add(demnodes[i]); } } if (demList.Count > 0) { ComsumptiveDemandsTree(demList.ToArray()); } if (ftList.Count > 0) { FlowThruDemandsTree(ftList.ToArray()); } }
private Csu.Modsim.ModsimModel.TimeSeries FindModsimTimeSeries(string modsimName) { _isOutput = false; Csu.Modsim.ModsimModel.TimeSeries ts = null; Csu.Modsim.ModsimModel.Node n = m_mi.FindNode(modsimName); if (n == null) { string msg = "the node '" + modsimName + "' does not exist in " + m_mi.fname; Console.WriteLine(msg); Logger.WriteLine(msg); this.Appearance.LegendText = msg; return(ts); } switch (timeSeriesName) { case "adaDemandsM": ts = n.m.adaDemandsM; break; case "adaEvaporationsM": ts = n.m.adaEvaporationsM; _isReservoir = true; break; case "adaForecastsM": ts = n.m.adaForecastsM; _isReservoir = true; break; case "adaGeneratingHrsM": ts = n.m.adaGeneratingHrsM; _isReservoir = true; break; case "adaInfiltrationsM": ts = n.m.adaInfiltrationsM; break; case "adaInflowsM": ts = n.m.adaInflowsM; break; case "adaTargetsM": ts = n.m.adaTargetsM; _isReservoir = true; break; default: string msg = "the timeSeriesName '" + timeSeriesName + "' is not implemented"; Console.WriteLine(msg); Logger.WriteLine(msg); throw new NotImplementedException(msg); } return(ts); }