///<inheritdoc/> public override int GetHashCode() { int hash = 17; // Overflow is fine, just wrap unchecked { hash = (hash * 29) + PaintScheme.GetHashCode(); hash = (hash * 29) + Propulsion.GetHashCode(); hash = (hash * 29) + Damage.GetHashCode(); hash = (hash * 29) + Smoke.GetHashCode(); hash = (hash * 29) + TrailingEffects.GetHashCode(); hash = (hash * 29) + Canopy.GetHashCode(); hash = (hash * 29) + LandingLights.GetHashCode(); hash = (hash * 29) + NavigationLights.GetHashCode(); hash = (hash * 29) + AntiCollisionLights.GetHashCode(); hash = (hash * 29) + Flaming.GetHashCode(); hash = (hash * 29) + Afterburner.GetHashCode(); hash = (hash * 29) + FrozenStatus.GetHashCode(); hash = (hash * 29) + PowerPlantStatus.GetHashCode(); hash = (hash * 29) + State.GetHashCode(); hash = (hash * 29) + FormationLights.GetHashCode(); hash = (hash * 29) + SpotLights.GetHashCode(); hash = (hash * 29) + InteriorLights.GetHashCode(); } return(hash); }
IEnumerator ExitShip() { busy = true; Canopy canopy = GetComponentInChildren <Canopy>(); if (!canopy.IsOpen()) { canopy.Use(); } if (fuelPack) { PlayerHUD.instance.DisableFuelPackHUD(); } if (PlayerCamera.instance.IsThirdPerson()) { PlayerCamera.instance.FirstPerson(); } freeLook = false; yield return(new WaitForSeconds(0.75f)); SceneManager.instance.SpawnPlayer(playerExit, rb.velocity); spaceParticles.Stop(); spaceParticles.Clear(); busy = false; }
public FighterGeometry() { var nose = new Nose(0.5f, 0.6f, 26, 0.4f); var cockpitFuselage = new CockpitFuselage(nose, 1.2f, 1.2f, 3f); var mainFuselage = new MainFuselage(cockpitFuselage); var intake = new EngineIntake(cockpitFuselage); var underside = new Underside(intake); var canopy = new Canopy(0.65f, 0.5f, 3f, 16); var wing = new Wing(4.5f, 4.5f); var rear = new Rear(mainFuselage, underside); var tailFin = new TailFin(); var stabilizer = new Stabilizer(); var exhaust = new Exhaust(rear, 0.6f); var bottomFin = new BottomFin(); var path = exhaust.FlangeEndXSection; var graySlide = new Vec3(1f).Interpolate(new Vec3(0f), path.Vertices.Length); path.Vertices.Color(graySlide); Paths = EnumerableExt.Enumerate(path); Fighter = Composite.Create(Stacking.StackBackward(cockpitFuselage.Fuselage, mainFuselage.Fuselage) .Concat(EnumerableExt.Enumerate(intake.Intake, intake.Belly, underside.Geometry, canopy.Geometry, wing.Geometry, wing.Geometry.ReflectX(), rear.Geometry, exhaust.Geometry, exhaust.StabilizerFlange, exhaust.StabilizerFlange.ReflectX(), tailFin.Geometry, stabilizer.Geometry, stabilizer.Geometry.ReflectX(), bottomFin.Geometry, bottomFin.Geometry.ReflectX()))) .Smoothen(0.85f) .Center(); }
public async Task <ActionResult> DeleteConfirmed(int id) { Canopy canopy = await db.Canopy.FindAsync(id); db.Canopy.Remove(canopy); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "CanopyID,Name,ItemPrice,ShortDesc,ThumbnailURL")] Canopy canopy) { if (ModelState.IsValid) { db.Entry(canopy).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(canopy)); }
public async Task <ActionResult> Create([Bind(Include = "CanopyID,Name,ItemPrice,ShortDesc,ThumbnailURL")] Canopy canopy) { if (ModelState.IsValid) { db.Canopy.Add(canopy); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(canopy)); }
// GET: Canopies/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Canopy canopy = await db.Canopy.FindAsync(id); if (canopy == null) { return(HttpNotFound()); } return(View(canopy)); }
/// <summary> /// Updates the model to a new timestep /// </summary> public void DoTimestepUpdate(IntervalValues interval, double sunFraction = 0, double shadeFraction = 0) { Canopy.DoTimestepAdjustment(Radiation); var totalHeat = Canopy.CalcBoundaryHeatConductance(); var sunlitHeat = Canopy.CalcSunlitBoundaryHeatConductance(); var shadedHeat = (totalHeat == sunlitHeat) ? double.Epsilon : totalHeat - sunlitHeat; PerformPhotosynthesis(Canopy.Sunlit, sunlitHeat, sunFraction); interval.Sunlit = Canopy.Sunlit.GetAreaValues(); PerformPhotosynthesis(Canopy.Shaded, shadedHeat, shadeFraction); interval.Shaded = Canopy.Shaded.GetAreaValues(); }
/// <summary> /// Determine the total potential biomass for the day under ideal conditions /// </summary> public double CalculatePotential() { foreach (var I in Intervals) { if (!TryInitiliase(I)) { continue; } InterceptedRadiation += Radiation.Total * Canopy.GetInterceptedRadiation() * 3600; DoTimestepUpdate(I); } return(Intervals.Select(i => i.Sunlit.A + i.Shaded.A).Sum()); }
/// <summary> /// Attempt to initialise models based on the current time, and test if they are sensible /// </summary> private bool TryInitiliase(IntervalValues I) { Temperature.UpdateAirTemperature(I.Time); Radiation.UpdateRadiationValues(I.Time); var sunAngle = Solar.SunAngle(I.Time); Canopy.DoSolarAdjustment(sunAngle); if (IsSensible()) { return(true); } else { I.Sunlit = new AreaValues(); I.Shaded = new AreaValues(); return(false); } }
IEnumerator EnterShip() { busy = true; spaceParticles.Play(); yield return(new WaitForSeconds(0.75f)); Canopy canopy = GetComponentInChildren <Canopy>(); if (canopy.IsOpen()) { canopy.Use(); } if (fuelPack) { PlayerHUD.instance.EnableFuelPackHUD(fuelPack); } busy = false; }
public override void OnInspectorGUI() { Canopy canopy = target as Canopy; if (DrawDefaultInspector()) { //Something changed! } if (GUILayout.Button("Generate Strips")) { canopy.GenerateStrips(); } if (GUILayout.Button("Clear Strips")) { canopy.ClearStrips(); } if (GUILayout.Button("Rotate pixel base")) { canopy.RotatePixelBase(); } }
public override void Run(bool sendNotification, double swAvail = 0, double maxHourlyT = -1, double sunlitFraction = 0, double shadedFraction = 0) { if (!Initialised) { return; } if (sendNotification && NotifyStart != null) { NotifyStart(false); } // Sets the environment EnvModel.Run(this.Time); Canopy.CalcCanopyStructure(this.EnvModel.SunAngle.Rad); // Sets the canopy status SunlitAc1 = new SunlitCanopy(Canopy.NLayers, SSType.Ac1); SunlitAj = new SunlitCanopy(Canopy.NLayers, SSType.Aj); ShadedAc1 = new ShadedCanopy(Canopy.NLayers, SSType.Ac1); ShadedAj = new ShadedCanopy(Canopy.NLayers, SSType.Aj); double temp = EnvModel.GetTemp(Time); // Don't perform photosynthesis beyond temperature boundaries if (temp > Canopy.CPath.JTMax || temp < Canopy.CPath.JTMin || temp > Canopy.CPath.GmTMax || temp < Canopy.CPath.GmTMin) { ZeroVariables(); return; } // Don't perform photosynthesis if the sun isn't up if (EnvModel.Ios.Value(this.Time) <= (0 + double.Epsilon)) { ZeroVariables(); return; } // Calculate the leaf area index SunlitAc1.CalcLAI(this.Canopy, ShadedAc1); SunlitAj.CalcLAI(this.Canopy, ShadedAj); ShadedAc1.CalcLAI(this.Canopy, SunlitAc1); ShadedAj.CalcLAI(this.Canopy, SunlitAj); // Run the canopy model Canopy.Run(this, EnvModel); SunlitAc1.Run(Canopy.NLayers, this, ShadedAc1); SunlitAj.Run(Canopy.NLayers, this, ShadedAj); ShadedAc1.Run(Canopy.NLayers, this, SunlitAc1); ShadedAj.Run(Canopy.NLayers, this, SunlitAj); // Set the transpirtation mode TranspirationMode mode = TranspirationMode.unlimited; if (maxHourlyT != -1) { mode = TranspirationMode.limited; } // For the initial photosynthesis calculation each hour we use air temperature bool useAirTemp = true; var results = new bool[4]; // Initial calculation results[0] = (SunlitAc1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, sunlitFraction)); results[1] = (SunlitAj.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, sunlitFraction)); results[2] = (ShadedAc1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, shadedFraction)); results[3] = (ShadedAj.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, shadedFraction)); // After initialisation we use new leaf temperature useAirTemp = false; // SUNLIT CALCULATIONS double defaultAC1A = 0.0; double defaultAC1Water = 0.0; double defaultAJA = 0.0; double defaultAJWater = 0.0; // If the initial calculation fails, set values to 0 if (results[0] || results[1]) { SunlitAc1.A[0] = 0.0; SunlitAc1.WaterUse[0] = 0.0; SunlitAj.A[0] = 0.0; SunlitAj.WaterUse[0] = 0.0; } else { defaultAC1A = SunlitAc1.A[0]; defaultAC1Water = SunlitAc1.WaterUse[0]; defaultAJA = SunlitAj.A[0]; defaultAJWater = SunlitAj.WaterUse[0]; } // Ben Ababaei (2019.10.14): If NONE of the As is > 0.5, don't get inside the following loop. // If there is sufficient photosynthetic rate if (SunlitAc1.A[0] > 0.5 && SunlitAj.A[0] > 0.5) { for (int n = 0; n < 3; n++) { results[0] = SunlitAc1.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAc1.LeafTemp[0], mode, maxHourlyT, sunlitFraction); results[1] = SunlitAj.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAj.LeafTemp[0], mode, maxHourlyT, sunlitFraction); // If any of the above is < 0, set both values zero (for each type of leaf separately). if (results[0] || results[1]) { SunlitAc1.A[0] = defaultAC1A; SunlitAc1.WaterUse[0] = defaultAC1Water; SunlitAj.A[0] = defaultAJA; SunlitAj.WaterUse[0] = defaultAC1Water; break; } } } // SHADED CALCULATIONS if (results[2] || results[3]) { ShadedAc1.A[0] = 0.0; ShadedAc1.WaterUse[0] = 0.0; ShadedAj.A[0] = 0.0; ShadedAj.WaterUse[0] = 0.0; } else { defaultAC1A = ShadedAc1.A[0]; defaultAC1Water = ShadedAc1.WaterUse[0]; defaultAJA = ShadedAj.A[0]; defaultAJWater = ShadedAj.WaterUse[0]; } // If there is sufficient photosynthetic rate if (ShadedAc1.A[0] > 0.5 && ShadedAj.A[0] > 0.5) { for (int n = 0; n < 3; n++) { results[2] = ShadedAc1.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAc1.LeafTemp[0], mode, maxHourlyT, shadedFraction); results[3] = ShadedAj.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAj.LeafTemp[0], mode, maxHourlyT, shadedFraction); // If any of the above is < 0, set both values zero (for each type of leaf separately). if (results[2] || results[3]) { ShadedAc1.A[0] = defaultAC1A; ShadedAc1.WaterUse[0] = defaultAC1Water; ShadedAj.A[0] = defaultAJA; ShadedAj.WaterUse[0] = defaultAJWater; } } } if (sendNotification && NotifyFinish != null) { NotifyFinish(); } }
/// <summary> /// Calculates the potential and actual biomass growth of a canopy across the span of a day, /// as well as the water requirements for both cases. /// </summary> public void DailyRun( double lai, double SLN, double soilWater, double RootShootRatio ) { for (double x = start; x <= end; x += timestep) { Intervals.Add(new IntervalValues() { Time = x }); } Solar.Initialise(); Canopy.InitialiseDay(lai, SLN); // UNLIMITED POTENTIAL CALCULATIONS // Note: In the potential case, we assume unlimited water and therefore supply = demand transpiration.Limited = false; var potential = CalculatePotential(); var waterDemands = Intervals.Select(i => i.Sunlit.E + i.Shaded.E).ToList(); // BIO-LIMITED CALCULATIONS transpiration.Limited = true; // Check if the plant is biologically self-limiting if (Biolimit > 0) { // Percentile reduction if (Reduction > 0) { waterDemands = waterDemands.Select(w => ReductionFunction(w, Biolimit, Reduction)).ToList(); } // Truncation else { // Reduce to the flat biological limit waterDemands = waterDemands.Select(w => Math.Min(w, Biolimit)).ToList(); } potential = CalculateLimited(waterDemands); } if (PrintIntervalValues) { IntervalResults = Solar.DayOfYear.ToString() + ","; IntervalResults += string.Join(",", Intervals.Select(i => i.ToString())); } // ACTUAL CALCULATIONS var totalDemand = waterDemands.Sum(); var limitedSupply = CalculateWaterSupplyLimits(soilWater, waterDemands); var actual = (soilWater > totalDemand) ? potential : CalculateActual(limitedSupply.ToArray()); var hrs_to_seconds = 3600; // 1,000,000 mmol to mol // 44 mol wt CO2 var mmolToMol = 1000000; var molWtCO2 = 44; ActualBiomass = actual * hrs_to_seconds / mmolToMol * molWtCO2 * B / (1 + RootShootRatio); PotentialBiomass = potential * hrs_to_seconds / mmolToMol * molWtCO2 * B / (1 + RootShootRatio); WaterDemanded = totalDemand; WaterSupplied = (soilWater < totalDemand) ? limitedSupply.Sum() : waterDemands.Sum(); if (PrintIntervalValues) { IntervalResults += "," + string.Join(",", Intervals.Select(i => i.ToString())); } }
/// <summary> /// Calculates the potential and actual biomass growth of a canopy across the span of a day, /// as well as the water requirements for both cases. /// </summary> public void DailyRun( double lai, double sln, double soilWater, double RootShootRatio ) { var steps = (end - start) / timestep; if (steps % 1 == 0) { steps++; } Intervals = Enumerable.Range(0, (int)Math.Ceiling(steps)) .Select(i => new IntervalValues() { Time = start + i * timestep }) .ToArray(); Solar.Initialise(); Canopy.InitialiseDay(lai, sln); // UNLIMITED POTENTIAL CALCULATIONS // Note: In the potential case, we assume unlimited water and therefore supply = demand transpiration.Limited = false; var potential = CalculatePotential(); var waterDemands = Intervals.Select(i => i.Sunlit.Water + i.Shaded.Water).ToList(); // BIO-LIMITED CALCULATIONS transpiration.Limited = true; // Check if the plant is biologically self-limiting if (Biolimit > 0) { // Percentile reduction if (Reduction > 0) { waterDemands = waterDemands.Select(w => ReductionFunction(w, Biolimit, Reduction)).ToList(); } // Truncation else { // Reduce to the flat biological limit waterDemands = waterDemands.Select(w => Math.Min(w, Biolimit)).ToList(); } potential = CalculateLimited(waterDemands); } // ACTUAL CALCULATIONS var totalDemand = waterDemands.Sum(); var limitedSupply = CalculateWaterSupplyLimits(soilWater, waterDemands); var actual = (soilWater > totalDemand) ? potential : CalculateActual(limitedSupply.ToArray()); var hrs_to_seconds = 3600; // 1,000,000 mmol to mol // 44 mol wt CO2 var mmolToMol = 1000000; var molWtCO2 = 44; ActualBiomass = actual * hrs_to_seconds / mmolToMol * molWtCO2 * B / (1 + RootShootRatio); PotentialBiomass = potential * hrs_to_seconds / mmolToMol * molWtCO2 * B / (1 + RootShootRatio); WaterDemanded = totalDemand; WaterSupplied = (soilWater < totalDemand) ? limitedSupply.Sum() : waterDemands.Sum(); }
// // GET: /Store/Details/5 public ActionResult Details(int id = 1) { var canopy = new Canopy("Manufacturer " + id); return(View(canopy)); }
// // GET: /Store/Browse?canopies=AeroDyne public ActionResult Browse(string canopy) { var canopyModel = new Canopy(canopy); return(View(canopyModel)); }
//--------------------------------------------------------------------------- public override void Run(bool sendNotification, double swAvail = 0, double maxHourlyT = -1, double sunlitFraction = 0, double shadedFraction = 0) { if (!Initialised) { return; } if (sendNotification && NotifyStart != null) { NotifyStart(false); } EnvModel.Run(this.Time); Canopy.CalcCanopyStructure(this.EnvModel.SunAngle.Rad); SunlitAC1 = new SunlitCanopy(Canopy.NLayers, SSType.AC1); sunlitAC2 = new SunlitCanopy(Canopy.NLayers, SSType.AC2); SunlitAJ = new SunlitCanopy(Canopy.NLayers, SSType.AJ); ShadedAC1 = new ShadedCanopy(Canopy.NLayers, SSType.AC1); shadedAC2 = new ShadedCanopy(Canopy.NLayers, SSType.AC2); ShadedAJ = new ShadedCanopy(Canopy.NLayers, SSType.AJ); double temp = EnvModel.GetTemp(Time); if (temp > Canopy.CPath.JTMax || temp < Canopy.CPath.JTMin || temp > Canopy.CPath.GmTMax || temp < Canopy.CPath.GmTMin) { ZeroVariables(); return; } if (EnvModel.Ios.Value(this.Time) <= (0 + double.Epsilon)) { ZeroVariables(); return; } SunlitAC1.CalcLAI(this.Canopy, ShadedAC1); sunlitAC2.CalcLAI(this.Canopy, shadedAC2); SunlitAJ.CalcLAI(this.Canopy, ShadedAJ); ShadedAC1.CalcLAI(this.Canopy, SunlitAC1); shadedAC2.CalcLAI(this.Canopy, sunlitAC2); ShadedAJ.CalcLAI(this.Canopy, SunlitAJ); Canopy.Run(this, EnvModel); SunlitAC1.Run(Canopy.NLayers, this, ShadedAC1); sunlitAC2.Run(Canopy.NLayers, this, shadedAC2); SunlitAJ.Run(Canopy.NLayers, this, ShadedAJ); ShadedAC1.Run(Canopy.NLayers, this, SunlitAC1); shadedAC2.Run(Canopy.NLayers, this, sunlitAC2); ShadedAJ.Run(Canopy.NLayers, this, SunlitAJ); TranspirationMode mode = TranspirationMode.unlimited; if (maxHourlyT != -1) { mode = TranspirationMode.limited; } bool useAirTemp = false; double defaultCm = 160; List <bool> results = new List <bool>(); results.Add(SunlitAC1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, sunlitFraction)); results.Add(sunlitAC2.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, sunlitFraction)); results.Add(SunlitAJ.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, sunlitFraction)); results.Add(ShadedAC1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, shadedFraction)); results.Add(shadedAC2.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, shadedFraction)); results.Add(ShadedAJ.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), defaultCm, mode, maxHourlyT, shadedFraction)); Count = 1; bool caughtError = false; while (results.Contains(false) && !caughtError) { results.Clear(); results.Add(SunlitAC1.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAC1.LeafTemp[0], SunlitAC1.Cm[0], mode, maxHourlyT, sunlitFraction)); results.Add(sunlitAC2.CalcPhotosynthesis(this, useAirTemp, 0, sunlitAC2.LeafTemp[0], sunlitAC2.Cm[0], mode, maxHourlyT, sunlitFraction)); results.Add(SunlitAJ.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAJ.LeafTemp[0], SunlitAJ.Cm[0], mode, maxHourlyT, sunlitFraction)); results.Add(ShadedAC1.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAC1.LeafTemp[0], ShadedAC1.Cm[0], mode, maxHourlyT, shadedFraction)); results.Add(shadedAC2.CalcPhotosynthesis(this, useAirTemp, 0, shadedAC2.LeafTemp[0], shadedAC2.Cm[0], mode, maxHourlyT, shadedFraction)); results.Add(ShadedAJ.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAJ.LeafTemp[0], ShadedAJ.Cm[0], mode, maxHourlyT, shadedFraction)); if (double.IsNaN(SunlitAC1.Cm[0]) || double.IsNaN(sunlitAC2.Cm[0]) || double.IsNaN(SunlitAJ.Cm[0]) || double.IsNaN(ShadedAC1.Cm[0]) || double.IsNaN(shadedAC2.Cm[0]) || double.IsNaN(ShadedAJ.Cm[0]) || Count == 30) { SunlitAC1.Cm[0] = defaultCm; sunlitAC2.Cm[0] = defaultCm; SunlitAJ.Cm[0] = defaultCm; ShadedAC1.Cm[0] = defaultCm; shadedAC2.Cm[0] = defaultCm; ShadedAJ.Cm[0] = defaultCm; useAirTemp = true; } if (Count > 100) { ZeroVariables(); return; } Count++; if (Count > 100 && !caughtError) { StreamWriter sr = new StreamWriter("scenario.csv"); sr.WriteLine("Lat," + EnvModel.LatitudeD); sr.WriteLine("DOY," + EnvModel.DOY); sr.WriteLine("Maxt," + EnvModel.MaxT); sr.WriteLine("AvailableWater," + swAvail); sr.WriteLine("Mint," + EnvModel.MinT); sr.WriteLine("Radn," + EnvModel.Radn); sr.WriteLine("Ratio," + EnvModel.AtmTransmissionRatio); sr.WriteLine("LAI," + Canopy.LAI); sr.WriteLine("SLN," + Canopy.CPath.SLNAv); List <double> temps = new List <double>(); for (int i = 0; i <= 12; i++) { temps.Add(EnvModel.GetTemp(i + 5)); } sr.WriteLine("Temps," + String.Join(",", temps.ToArray())); sr.Flush(); sr.Close(); caughtError = true; } } if (sendNotification && NotifyFinish != null) { NotifyFinish(); } }
private void Awake() { originalRotation = Quaternion.identity; instance = this; }
public override void Run(bool sendNotification, double swAvail = 0, double maxHourlyT = -1, double sunlitFraction = 0, double shadedFraction = 0) { if (!Initialised) { return; } if (sendNotification && NotifyStart != null) { NotifyStart(false); } EnvModel.Run(this.Time); Canopy.CalcCanopyStructure(this.EnvModel.SunAngle.Rad); SunlitAC1 = new SunlitCanopy(Canopy.NLayers, SSType.AC1); SunlitAJ = new SunlitCanopy(Canopy.NLayers, SSType.AJ); ShadedAC1 = new ShadedCanopy(Canopy.NLayers, SSType.AC1); ShadedAJ = new ShadedCanopy(Canopy.NLayers, SSType.AJ); double temp = EnvModel.GetTemp(Time); if (temp > Canopy.CPath.JTMax || temp < Canopy.CPath.JTMin || temp > Canopy.CPath.GmTMax || temp < Canopy.CPath.GmTMin) { ZeroVariables(); return; } if (EnvModel.Ios.Value(this.Time) <= (0 + double.Epsilon)) { ZeroVariables(); return; } SunlitAC1.CalcLAI(this.Canopy, ShadedAC1); SunlitAJ.CalcLAI(this.Canopy, ShadedAJ); ShadedAC1.CalcLAI(this.Canopy, SunlitAC1); ShadedAJ.CalcLAI(this.Canopy, SunlitAJ); Canopy.Run(this, EnvModel); SunlitAC1.Run(Canopy.NLayers, this, ShadedAC1); SunlitAJ.Run(Canopy.NLayers, this, ShadedAJ); ShadedAC1.Run(Canopy.NLayers, this, SunlitAC1); ShadedAJ.Run(Canopy.NLayers, this, SunlitAJ); TranspirationMode mode = TranspirationMode.unlimited; if (maxHourlyT != -1) { mode = TranspirationMode.limited; } bool useAirTemp = false; List <bool> results = new List <bool>(); results.Add(SunlitAC1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, sunlitFraction)); results.Add(SunlitAJ.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, sunlitFraction)); results.Add(ShadedAC1.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, shadedFraction)); results.Add(ShadedAJ.CalcPhotosynthesis(this, useAirTemp, 0, EnvModel.GetTemp(Time), mode, maxHourlyT, shadedFraction)); Count = 1; bool caughtError = false; while (results.Contains(false) && !caughtError) { results.Clear(); results.Add(SunlitAC1.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAC1.LeafTemp[0], mode, maxHourlyT, sunlitFraction)); results.Add(SunlitAJ.CalcPhotosynthesis(this, useAirTemp, 0, SunlitAJ.LeafTemp[0], mode, maxHourlyT, sunlitFraction)); results.Add(ShadedAC1.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAC1.LeafTemp[0], mode, maxHourlyT, shadedFraction)); results.Add(ShadedAJ.CalcPhotosynthesis(this, useAirTemp, 0, ShadedAJ.LeafTemp[0], mode, maxHourlyT, shadedFraction)); Count++; if (Count > 50 && !caughtError) { ZeroVariables(); //writeScenario(swAvail); caughtError = true; return; } } // canopy.calcCanopyBiomassAccumulation(this); if (sendNotification && NotifyFinish != null) { NotifyFinish(); } // writeScenario(swAvail); }