public void UpdatePostHDValues() { { double sum = 0; EngineNet engineNet = _engineNet; for (int i = 0; i < engineNet.Nodes.Count; i++) { //if (NodesData[i] == null) continue; var engineNodeSewer = engineNet.Nodes[i] as EngineNodeVolume; if (engineNodeSewer == null) { continue; } IHDNode hdNode = _hdModule.GetNode(engineNodeSewer); if (hdNode == null) { continue; } double volume = engineNodeSewer.GetVolume(hdNode.WaterLevelNp1); _volPostHd.NodesData[i].Value = volume; sum += volume; } for (int i = 0; i < engineNet.Reaches.Count; i++) { IEngineDataReach <double> reachData = _volPostHd.ReachesData[i]; if (reachData == null) { continue; } IHDReach hdReach = _hdModule.GetReach(engineNet.Reaches[i]); if (hdReach == null) { continue; } for (int j = 0; j < reachData.IndexList.Length; j++) { int jgp = reachData.IndexList[j]; IHDHGridPoint hgp = hdReach.GridPoints[jgp] as IHDHGridPoint; if (hgp == null) { reachData[j] = 0; } else { reachData[j] = hgp.WaterVolumeNp1; sum += hgp.WaterLevelNp1; } } } // Store total GenericData[0] = sum; } }
/// <inheritdoc /> public override void UpdateValues() { // if pull version, values are extracted when requested, and no action is required here. // If not pull, this needs to update the data and store it. { double sum = 0; EngineNet engineNet = _engineNet; for (int i = 0; i < engineNet.Nodes.Count; i++) { //if (NodesData[i] == null) continue; var engineNodeSewer = engineNet.Nodes[i] as EngineNodeVolume; if (engineNodeSewer == null) { continue; } IHDNode hdNode = _hdModule.GetNode(engineNodeSewer); if (hdNode == null) { continue; } double volumeN = _volPostHd.NodesData[i].Value; double volumeNp1 = engineNodeSewer.GetVolume(hdNode.WaterLevelNp1); double volumechange = volumeNp1 - volumeN; sum += volumechange; NodesData[i] = volumechange; _volAccumulated.NodesData[i].Value += volumechange; } for (int i = 0; i < engineNet.Reaches.Count; i++) { IEngineDataReach <double> reachDataPostHD = _volPostHd.ReachesData[i]; IEngineDataReach <double> reachDataAcc = _volAccumulated.ReachesData[i]; IEngineDataReach <double> reachData = ReachesData[i]; if (reachData == null) { continue; } IHDReach hdReach = _hdModule.GetReach(engineNet.Reaches[i]); if (hdReach == null) { continue; } for (int j = 0; j < reachData.IndexList.Length; j++) { int jgp = reachData.IndexList[j]; IHDHGridPoint hgp = hdReach.GridPoints[jgp] as IHDHGridPoint; if (hgp == null) { reachData[j] = 0; } else { double volumeN = reachDataPostHD[j]; double volumeNp1 = hgp.WaterVolumeNp1; double volumeChange = volumeNp1 - volumeN; sum += volumeChange; reachData[j] = volumeChange; reachDataAcc[j] += volumeChange; } } } // Store total GenericData[0] = sum; _volAccumulated.GenericData[0] += sum; } }