public override int GetHashCode() { int hash = 1; if (RootDepth != 0) { hash ^= RootDepth.GetHashCode(); } if (RootSizeMm != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(RootSizeMm); } if (RootCenterX != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(RootCenterX); } if (RootCenterY != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(RootCenterY); } if (RootCenterZ != 0F) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(RootCenterZ); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
// update public override void Update() { // send off detached roots before root structure is updated by plant death DisposeDetachedMaterial(Detaching, RootLength); Live = Live + Growth - Senescing; Dead = Dead - Detaching + Senescing; Live = Live + Retranslocation; Live.StructuralN = Live.N + dlt_n_senesced_retrans; Biomass dying = Live * Population.DyingFractionPlants; Live = Live - dying; Dead = Dead + dying; Senescing = Senescing + dying; Util.Debug("Root.Green.Wt=%f", Live.Wt); Util.Debug("Root.Green.N=%f", Live.N); Util.Debug("Root.Senesced.Wt=%f", Dead.Wt); Util.Debug("Root.Senesced.N=%f", Dead.N); Util.Debug("Root.Senescing.Wt=%f", Senescing.Wt); Util.Debug("Root.Senescing.N=%f", Senescing.N); RootDepth += dltRootDepth; for (int layer = 0; layer < dlayer.Length; layer++) { RootLength[layer] += dltRootLength[layer]; } for (int layer = 0; layer < dlayer.Length; layer++) { RootLength[layer] -= dltRootLengthSenesced[layer]; RootLengthSenesced[layer] += dltRootLengthSenesced[layer]; } // Note that movement and detachment of C is already done, just // need to maintain relationship between length and mass // Note that this is not entirely accurate. It links live root // weight with root length and so thereafter dead(and detaching) // root is assumed to have the same distribution as live roots. for (int layer = 0; layer < dlayer.Length; layer++) { dltRootLengthDead[layer] = RootLength[layer] * Population.DyingFractionPlants; RootLength[layer] -= dltRootLengthDead[layer]; RootLengthSenesced[layer] += dltRootLengthDead[layer]; } double CumDepth = MathUtility.Sum(dlayer); if (RootDepth < 0 || RootDepth > CumDepth) { throw new Exception("Invalid root depth: " + RootDepth.ToString()); } Util.Debug("root.RootDepth=%f", RootDepth); Util.Debug("root.RootLength=%f", MathUtility.Sum(RootLength)); Util.Debug("root.RootLengthSenesced=%f", MathUtility.Sum(RootLengthSenesced)); UpdateWaterAndNBalance(); }
public static BreadcrumbModel ConvertTo(KeyValuePair <string, string> keyValuePair) { BreadcrumbModel model = new BreadcrumbModel(); SubjectManager subjectManager = new SubjectManager(); switch (keyValuePair.Key) { case "FREETEXT_SEARCH_KEY": { model.DisplayName = "Sucheingabe"; model.DisplayValue = keyValuePair.Value; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "NutrientClaim": { NutrientClaim nc = (NutrientClaim)Convert.ToInt32(keyValuePair.Value); model.DisplayName = "Nährstoffanspruch"; model.DisplayValue = nc.GetAttribute <DisplayAttribute>().Name; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "RootDepths": { RootDepth rd = (RootDepth)Convert.ToInt32(keyValuePair.Value); model.DisplayName = "Wurzel-Tiefe"; model.DisplayValue = rd.GetAttribute <DisplayAttribute>().Name; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "Sowing": { model.DisplayName = "Aussaat"; model.DisplayValue = ((TimePeriodMonth)Convert.ToInt32(keyValuePair.Value)).ToString(); model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "Harvest": { model.DisplayName = "Ernten"; model.DisplayValue = ((TimePeriodMonth)Convert.ToInt32(keyValuePair.Value)).ToString(); model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "Bloom": { model.DisplayName = "Blütezeit"; model.DisplayValue = ((TimePeriodMonth)Convert.ToInt32(keyValuePair.Value)).ToString(); model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "SeedMaturity": { model.DisplayName = "Samenreife"; model.DisplayValue = ((TimePeriodMonth)Convert.ToInt32(keyValuePair.Value)).ToString(); model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "PositivInteractionOn": { string plantName = subjectManager.Get(Convert.ToInt64(keyValuePair.Value))?.Name; model.DisplayName = "Positiven Effekt auf"; model.DisplayValue = plantName; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "NegativInteractionOn": { string plantName = subjectManager.Get(Convert.ToInt64(keyValuePair.Value))?.Name; model.DisplayName = "Negativen Effekt auf"; model.DisplayValue = plantName; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "DoNegativInteraction": { string plantName = subjectManager.Get(Convert.ToInt64(keyValuePair.Value))?.Name; model.DisplayName = "beeinflusst negativ"; model.DisplayValue = plantName; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } case "DoPositivInteraction": { string plantName = subjectManager.Get(Convert.ToInt64(keyValuePair.Value))?.Name; model.DisplayName = "beeinflusst positiv"; model.DisplayValue = plantName; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } default: { model.DisplayName = keyValuePair.Key; model.DisplayValue = keyValuePair.Value; model.Key = keyValuePair.Key; model.Value = keyValuePair.Value; break; } } return(model); }