private void LogRelErr(int iter, double relerr) { if (iter == 0) { _logger.Warning(Text.FMT64, Htime.GetClockTime()); } else { _logger.Warning(Text.FMT65, iter, relerr); } }
private void LogHydErr(int order) { try { if (net.MessageFlag) { _logger.Warning( Text.FMT62, Htime.GetClockTime(), _nodes[order].Id); } } catch (ENException) {} LogHydStat(0, 0.0); }
/// <summary>Report hydraulic status.</summary> private void LogHydStat(int iter, double relerr) { try { string atime = Htime.GetClockTime(); if (iter > 0) { if (relerr <= net.HAcc) { _logger.Warning(Text.FMT58, atime, iter); } else { _logger.Warning(Text.FMT59, atime, iter, relerr); } } foreach (SimulationTank tank in _tanks) { StatType newstat; if (Math.Abs(tank.SimDemand) < 0.001) { newstat = StatType.CLOSED; } else if (tank.SimDemand > 0.0) { newstat = StatType.FILLING; } else if (tank.SimDemand < 0.0) { newstat = StatType.EMPTYING; } else { newstat = tank.OldStat; } if (newstat != tank.OldStat) { if (!tank.IsReservoir) { _logger.Warning( Text.FMT50, atime, tank.Id, newstat.ReportStr(), (tank.SimHead - tank.Elevation) * net.FieldsMap.GetUnits(FieldType.HEAD), net.FieldsMap.GetField(FieldType.HEAD).Units); } else { _logger.Warning( Text.FMT51, atime, tank.Id, newstat.ReportStr()); } tank.OldStat = newstat; } } foreach (SimulationLink link in _links) { if (link.SimStatus != link.SimOldStatus) { if (Htime == 0) { _logger.Warning( Text.FMT52, atime, link.Type.ParseStr(), link.Link.Name, link.SimStatus.ReportStr()); } else { _logger.Warning( Text.FMT53, atime, link.Type.ParseStr(), link.Link.Name, link.SimOldStatus.ReportStr(), link.SimStatus.ReportStr()); } link.SimOldStatus = link.SimStatus; } } } catch (ENException) {} }
/// <summary>Report hydraulic warning.</summary> /// <remarks> /// Note: Warning conditions checked in following order: /// <list type="number"> /// <item>1. System balanced but unstable</item> /// <item>2. Negative pressures</item> /// <item>3. FCV cannot supply flow or PRV/PSV cannot maintain pressure</item> /// <item>4. Pump out of range</item> /// <item>5. Network disconnected</item> /// <item>6. System unbalanced</item> /// </list> /// </remarks> private void LogHydWarn(int iter, double relerr) { try { int flag; string atime = Htime.GetClockTime(); if (iter > net.MaxIter && relerr <= net.HAcc) { if (net.MessageFlag) { _logger.Warning(Error.WARN02, atime); } flag = 2; } // Check for negative pressures foreach (SimulationNode node in _junctions) { if (node.SimHead < node.Elevation && node.SimDemand > 0.0) { if (net.MessageFlag) { _logger.Warning(Error.WARN06, atime); } flag = 6; break; } } // Check for abnormal valve condition foreach (SimulationValve valve in _valves) { int j = valve.Index; if (valve.SimStatus >= StatType.XFCV) { if (net.MessageFlag) { _logger.Warning( Error.WARN05, valve.Type.ParseStr(), valve.Link.Name, valve.SimStatus.ReportStr(), atime); } flag = 5; } } // Check for abnormal pump condition foreach (SimulationPump pump in _pumps) { StatType s = pump.SimStatus; if (pump.SimStatus >= StatType.OPEN) { if (pump.SimFlow > pump.SimSetting * pump.Qmax) { s = StatType.XFLOW; } if (pump.SimFlow < 0.0) { s = StatType.XHEAD; } } if (s == StatType.XHEAD || s == StatType.XFLOW) { if (net.MessageFlag) { _logger.Warning( Error.WARN04, pump.Link.Name, pump.SimStatus.ReportStr(), atime); } flag = 4; } } // Check if system is unbalanced if (iter > net.MaxIter && relerr > net.HAcc) { string str = string.Format(Error.WARN01, atime); if (net.ExtraIter == -1) { str += Keywords.t_HALTED; } if (net.MessageFlag) { _logger.Warning(str); } flag = 1; } } catch (ENException) {} }