public async Task <IActionResult> Edit(int id, [Bind("ID,Manufacturer,Model,DateLastServiced")] Turbine turbine) { if (id != turbine.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(turbine); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TurbineExists(turbine.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(turbine)); }
public void DoTurbineCalcs_Test() { Continuum thisInst = new Continuum(""); string Filename = testingFolder + "\\Turbine testing.cfm"; thisInst.Open(Filename); thisInst.turbineList.ClearAllWSEsts(); Model[] models = thisInst.modelList.GetModels(thisInst, thisInst.metList.GetMetsUsed(), Met.TOD.All, Met.Season.All, thisInst.modeledHeight, false); for (int i = 0; i < thisInst.turbineList.TurbineCount; i++) { thisInst.turbineList.turbineEsts[i].DoTurbineCalcs(thisInst, models); } for (int i = 0; i < thisInst.turbineList.TurbineCount; i++) { Turbine thisTurb = thisInst.turbineList.turbineEsts[i]; Assert.AreNotSame(thisTurb.WS_Estimate, null, "Didn't calculate wind speed estimates"); Assert.AreNotSame(thisTurb.gridStats, null, "Didn't calculate grid stats"); Assert.AreEqual(thisTurb.WSEst_Count, 12, 0, "Didn't calculate 12 wind speed estimates (3 mets, 4 radii"); for (int j = 0; j < thisTurb.WSEst_Count; j++) { Assert.AreNotSame(thisTurb.WS_Estimate[j].predictorMetName, "", "Didn't save pred met name"); Assert.AreNotSame(thisTurb.WS_Estimate[j].sectorWS, null, "Didn't save sectorwise wind speeds"); Assert.AreNotSame(thisTurb.WS_Estimate[j].model, null, "Didn't save model"); Assert.AreNotEqual(thisTurb.WS_Estimate[j].WS, 0, 0, "Didn't save wind speed"); } } thisInst.Close(); }
public void GenerateAvgWSFromTABs_Test() { Continuum thisInst = new Continuum(""); string Filename = testingFolder + "\\Turbine testing.cfm"; string WSFile = testingFolder + "\\W1 Avg WS and Sect WS Ests.csv"; thisInst.Open(Filename); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; int numWD = thisInst.metList.numWD; StreamReader sr = new StreamReader(WSFile); double thisWS = Convert.ToDouble(sr.ReadLine()); Assert.AreEqual(thisInst.turbineList.turbineEsts[0].avgWS_Est[0].freeStream.WS, thisWS, 0.001, "Wrong average wind speed"); for (int i = 0; i < numWD; i++) { thisWS = Convert.ToDouble(sr.ReadLine()); Assert.AreEqual(thisInst.turbineList.turbineEsts[0].avgWS_Est[0].freeStream.sectorWS[i], thisWS, 0.001, "Wrong average wind speed"); } sr.Close(); thisInst.Close(); }
private void LoadPlatformerObjects() { //Load in some sprites to the world that are not included in the imported Tiled map, but could be in future Turbine t = new Turbine(this, Turbine, new Vector2(544, 768), new Vector2(32, 32), 1.5f, 100); Turbine t2 = new Turbine(this, Turbine, new Vector2(512, 768), new Vector2(32, 32), 1.5f, 100); Turbine t3 = new Turbine(this, Turbine, new Vector2(480, 768), new Vector2(32, 32), 1.5f, 100); Sprites.AddRange(new List <Turbine>() { t, t2, t3 }); Cannon c = new Cannon(this, Cannon, new Vector2(350, 160), new Vector2(48, 32)); Sprites.Add(c); //MissileLauncher ml = new MissileLauncher(this, Cannon, new Vector2(571, 35), new Vector2(32, 32)); //Sprites.Add(ml); Lever l = new Lever(this, SpriteSheet1, new Rectangle(576, 640, 64, 64), new Rectangle(704, 640, 64, 64), new Vector2(300, 176), new Vector2(32, 32), c); Sprites.Add(l); Box b = new Box(this, BoxTex, new Vector2(384, 410), 16, new Vector2(0.2f), 0.2f); Box b2 = new Box(this, BoxTex, new Vector2(1120, 736), 16, new Vector2(0.2f), 0.2f); Box b3 = new Box(this, BoxTex, new Vector2(1056, 192), 16, new Vector2(0.2f), 0.2f); Sprites.Add(b); Portal p = new Portal(this, SpriteSheet1, new Rectangle(1216, 384, 64, 64), new Vector2(1216, 64), new Vector2(32, 32)); Sprites.Add(p); //Platform pl = new Platform(this, new Vector2(768, 480), new Vector2(32 * 6, 32), 6, SpriteSheet1, new Vector2(900, 480)); //Sprites.Add(pl); }
public void CalcProbOfWakeForEffectiveTI_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\CalcProbOfWakeForEffectiveTI\\Turbine Marion TI testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[1]; double[,] probWakes = thisInst.turbineList.CalcProbOfWakeForEffectiveTI(thisInst, thisTurb.UTMX, thisTurb.UTMY, thisInst.turbineList.powerCurves[0]); Assert.AreEqual(probWakes[0, 12], 0.426, 0.01, "Wrong Wake Prob Test 1"); Assert.AreEqual(probWakes[0, 13], 0.288, 0.01, "Wrong Wake Prob Test 2"); Assert.AreEqual(probWakes[2, 4], 0.449, 0.01, "Wrong Wake Prob Test 3"); Assert.AreEqual(probWakes[2, 5], 0.276, 0.01, "Wrong Wake Prob Test 4"); thisInst.Close(); thisInst = new Continuum(""); fileName = testingFolder + "\\CalcProbOfWakeForEffectiveTI\\Turbine Findlay TI testing.cfm"; thisInst.Open(fileName); thisTurb = thisInst.turbineList.turbineEsts[4]; probWakes = thisInst.turbineList.CalcProbOfWakeForEffectiveTI(thisInst, thisTurb.UTMX, thisTurb.UTMY, thisInst.turbineList.powerCurves[0]); Assert.AreEqual(probWakes[5, 7], 0.46, 0.01, "Wrong Wake Prob Test 5"); Assert.AreEqual(probWakes[1, 15], 0.22, 0.01, "Wrong Wake Prob Test 6"); Assert.AreEqual(probWakes[3, 14], 0.82, 0.01, "Wrong Wake Prob Test 7"); thisInst.Close(); }
public void CalcMonthlyWS_Values_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; NodeCollection nodeList = new NodeCollection(); Nodes targetNode = nodeList.GetTurbNode(thisTurb); string MCP_Method = thisInst.Get_MCP_Method(); TurbineCollection.PowerCurve powerCurve = thisInst.turbineList.powerCurves[0];; Wake_Model wakeModel = new Wake_Model(); ModelCollection.TimeSeries[] thisTS = thisInst.modelList.GenerateTimeSeries(thisInst, thisInst.metList.GetMetsUsed(), targetNode, powerCurve, wakeModel, null, MCP_Method); Turbine.MonthlyWS_Vals[] monthlyWS = thisTurb.CalcMonthlyWS_Values(thisTS, thisInst, "Freestream"); Assert.AreEqual(monthlyWS[0].avgWS, 6.489662634, 0.01, "Wrong monthly WS Jan 2005 Test 1"); Assert.AreEqual(monthlyWS[15].avgWS, 6.580793056, 0.01, "Wrong monthly WS Apr 2006 Test 2"); Assert.AreEqual(monthlyWS[45].avgWS, 6.133737903, 0.01, "Wrong monthly WS Oct 2008 Test 3"); Assert.AreEqual(monthlyWS[71].avgWS, 6.169447581, 0.01, "Wrong monthly WS Dec 2010 Test 4"); thisInst.Close(); }
public void GenerateAvgWSTimeSeries_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; NodeCollection nodeList = new NodeCollection(); Nodes targetNode = nodeList.GetTurbNode(thisTurb); string MCP_Method = thisInst.Get_MCP_Method(); TurbineCollection.PowerCurve powerCurve = new TurbineCollection.PowerCurve(); Wake_Model wakeModel = new Wake_Model(); ModelCollection.TimeSeries[] thisTS = thisInst.modelList.GenerateTimeSeries(thisInst, thisInst.metList.GetMetsUsed(), targetNode, powerCurve, wakeModel, null, MCP_Method); thisTurb.GenerateAvgWSTimeSeries(thisTS, thisInst, wakeModel, false, MCP_Method, false, powerCurve); Assert.AreEqual(thisTurb.avgWS_Est[0].freeStream.WS, 5.81393758, 0.01, "Wrong WS Test 1"); Assert.AreEqual(thisTurb.avgWS_Est[0].freeStream.sectorWS[8], 4.78742580, 0.02, "Wrong WS Test 2"); Assert.AreEqual(thisTurb.avgWS_Est[0].freeStream.sectorWS[10], 5.43308824, 0.02, "Wrong WS Test 3"); Assert.AreEqual(thisTurb.avgWS_Est[0].freeStream.sectorWS[15], 5.9455375, 0.02, "Wrong WS Test 4"); thisInst.Close(); }
public void CalcLT_MonthlyValue_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; Wake_Model wakeModel = thisInst.wakeModelList.wakeModels[0]; // Test 1 Waked WS double thisVal = thisTurb.CalcLT_MonthlyValue("Avg WS", 1, wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 6.47765367, 0.01, "Wrong Avg WS Test 1"); // Test 2 Freestream WS thisVal = thisTurb.CalcLT_MonthlyValue("Avg WS", 4, null, new TurbineCollection.PowerCurve()); Assert.AreEqual(thisVal, 6.8392918, 0.01, "Wrong Avg WS Test 2"); // Test 3 thisVal = thisTurb.CalcLT_MonthlyValue("Gross AEP", 3, wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 420.44058, 0.1, "Wrong Gross Energy Test 3"); // Test 4 thisVal = thisTurb.CalcLT_MonthlyValue("Net AEP", 12, wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 367.22712, 0.1, "Wrong Net Energy Test 4"); thisInst.Close(); }
public void CalcYearlyValue_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; Wake_Model wakeModel = thisInst.wakeModelList.wakeModels[0]; double thisVal = thisTurb.CalcYearlyValue(2005, "Avg WS", null, new TurbineCollection.PowerCurve()); Assert.AreEqual(thisVal, 5.73003025, 0.01, "Wrong Avg WS Test 1"); thisVal = thisTurb.CalcYearlyValue(2007, "Gross AEP", wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 3820.63630, 0.01, "Wrong Gross AEP Test 2"); thisVal = thisTurb.CalcYearlyValue(2008, "Net AEP", wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 3894.20687, 0.01, "Wrong Net AEP Test 3"); thisVal = thisTurb.CalcYearlyValue(2010, "Net AEP", wakeModel, wakeModel.powerCurve); Assert.AreEqual(thisVal, 3573.25519, 0.01, "Wrong Net AEP Test 4"); thisInst.Close(); }
public void CalcWakedStDev_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine testing.cfm"; thisInst.Open(fileName); Turbine turbine = new Turbine(); turbine.UTMX = 704907; turbine.UTMY = 4532165; double utmX = 705207; double utmY = 4531965; double thisWS = 6; double thisP90SD = 0.2; double thisWakeP90SD = turbine.CalcWakedStDev(utmX, utmY, thisInst.turbineList.powerCurves[0], thisP90SD, thisWS, thisInst); Assert.AreEqual(thisWakeP90SD, 1.169216, 0.001, "Wrong waked SD for effective TI"); thisInst.Close(); }
public void ExportMetWeights() { // Used in GenerateAvgWSFromTABs Continuum thisInst = new Continuum(""); string exportName = testingFolder + "\\Met Weights and WS Ests.csv"; StreamWriter sw = new StreamWriter(exportName); string Filename = testingFolder + "\\Turbine testing.cfm"; thisInst.Open(Filename); NodeCollection nodeList = new NodeCollection(); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; // W1 Turbine.WS_Ests[] wsEsts = thisTurb.WS_Estimate; int numWD = thisInst.metList.numWD; for (int i = 0; i < wsEsts.Length; i++) { sw.WriteLine(wsEsts[i].predictorMetName + "," + wsEsts[i].WS + "," + wsEsts[i].WS_weight); for (int j = 0; j < numWD; j++) { sw.WriteLine(j.ToString() + "," + wsEsts[i].sectorWS[j].ToString()); } sw.WriteLine(); } sw.Close(); thisInst.Close(); }
private void GetTurbineData() { _depthText.text = $"{Mathf.Round(Turbine.GetDepth())}M"; _speedText.text = $"{Turbine.GetSpeed()}rpm"; UpdateData(); }
public TurbojetEngine(int power, int fuelConsumption) { Power = power; FuelConsumption = fuelConsumption; Turbine = new Turbine() { Pressure = 100 }; }
public PocSingleton() { Ds1 = DefaultSingleton.Instance; Ds2 = DefaultSingleton.Instance; Engine1 = GenericsSingleton <Engine> .Instance; Turbine1 = GenericsSingleton <Turbine> .Instance; Engine2 = GenericsSingleton <Engine> .Instance; Turbine2 = GenericsSingleton <Turbine> .Instance; }
public async Task <IActionResult> Create([Bind("ID,Manufacturer,Model,DateLastServiced")] Turbine turbine) { if (ModelState.IsValid) { _context.Add(turbine); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(turbine)); }
public TurbopropEngine(int power, int fuelConsumption) { Power = power; FuelConsumption = fuelConsumption; Screw = new Screw() { PaddlesCount = 4 }; Turbine = new Turbine() { Pressure = 100 }; }
private void GetTurbineData() { if (Turbine == null || !Turbine.IsConstructed || !Turbine.IsInitialized) { return; } _depthText.text = $"{Mathf.Round(Turbine.GetDepth())}M"; _speedText.text = $"{Turbine.GetSpeed()}{LanguageHelpers.GetLanguage(DisplayLanguagePatching.RPMKey)}"; UpdateData(); }
protected override void Start() { turbine = Instantiate(turbinePrefab).GetComponent <Turbine>(); Collider2D[] turbineColliders = turbine.GetComponentsInChildren <Collider2D>(true); foreach (Transform ally in _allies) { foreach (IIgnoreSpawnedColliders i in ally.GetComponentsInChildren <IIgnoreSpawnedColliders>()) { i.ignoreColliders(turbineColliders); } } base.Start(); //ready = true; //for easy testing turbine.active = false; }
public void CalcNetEnergyTimeSeries_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\WakeCollection TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; NodeCollection nodeList = new NodeCollection(); Nodes targetNode = nodeList.GetTurbNode(thisTurb); string MCP_Method = thisInst.Get_MCP_Method(); TurbineCollection.PowerCurve powerCurve = thisInst.turbineList.powerCurves[0];; Wake_Model wakeModel = thisInst.wakeModelList.wakeModels[0]; // Find wake loss coeffs WakeCollection.WakeLossCoeffs[] wakeCoeffs = null; int minDistance = 10000000; int maxDistance = 0; for (int i = 0; i < thisInst.turbineList.TurbineCount; i++) { int[] Min_Max_Dist = thisInst.turbineList.CalcMinMaxDistanceToTurbines(thisInst.turbineList.turbineEsts[i].UTMX, thisInst.turbineList.turbineEsts[i].UTMY); if (Min_Max_Dist[0] < minDistance) { minDistance = Min_Max_Dist[0]; // this is min distance to turbine but when WD is at a different angle (not in line with turbines) the X dist is less than this value so making this always equal to 2*RD } if (Min_Max_Dist[1] > maxDistance) { maxDistance = Min_Max_Dist[1]; } } minDistance = (int)(2 * wakeModel.powerCurve.RD); if (maxDistance == 0) { maxDistance = 15000; // maxDistance will be zero when there is only one turbine. Might be good to make this value constant } wakeCoeffs = thisInst.wakeModelList.GetWakeLossesCoeffs(minDistance, maxDistance, wakeModel, thisInst.metList); Turbine wakedTurb = thisInst.turbineList.turbineEsts[2]; double[] netEsts = thisInst.wakeModelList.CalcNetEnergyTimeSeries(wakeCoeffs, wakedTurb.UTMX, wakedTurb.UTMY, 6, thisInst, wakeModel, 270, 3000, 1); Assert.AreEqual(netEsts[0], 4.75284, 0.001, "Wrong waked WS Test 1"); thisInst.Close(); }
public void CalcDAWM_Deficit_Test() { WakeCollection WakeModList = new WakeCollection(); TurbineCollection turbineList = new TurbineCollection(); double[] power = new double[23]; string Power_file = testingFolder + "\\CalcDAWM_Deficit\\Power.txt"; StreamReader sr = new StreamReader(Power_file); for (int i = 0; i <= 22; i++) { power[i] = Convert.ToSingle(sr.ReadLine()); } double[] Thrust = new double[23]; string Thrust_file = testingFolder + "\\CalcDAWM_Deficit\\Thrust.txt"; sr = new StreamReader(Thrust_file); for (int i = 0; i <= 22; i++) { Thrust[i] = Convert.ToSingle(sr.ReadLine()); } turbineList.AddPowerCurve("GW 1500/87", 3, 22, 1500, power, Thrust, 87, 16, 10, 1, 0); Turbine[] UW_Turbs = new Turbine[1]; UW_Turbs[0] = new Turbine(); UW_Turbs[0].UTMX = 283000; UW_Turbs[0].UTMY = 4553300; MetCollection metList = new MetCollection(); metList.metItem = new Met[1]; metList.metItem[0] = new Met(); metList.WS_FirstInt = 0.5f; metList.WS_IntSize = 1; metList.numWS = 30; WakeModList.AddWakeModel(1, 5, 10, turbineList.powerCurves[0], 10, 3.5f, 0.03f, "Linear"); double This_Def = WakeModList.Calc_DAWM_Deficit(UW_Turbs, 280000, 4553500, 90, 8, WakeModList.wakeModels[0], metList, 80.0); Assert.AreEqual(This_Def, 0.04742, 1, "Wrong wind speed deficit in DAWM"); }
public void CalcDownwindAndLateralDistanceFromUW_Turb_Test() { WakeCollection wakeList = new WakeCollection(); Turbine UW_Turb = new Turbine(); UW_Turb.UTMX = 277930; UW_Turb.UTMY = 4553361; Turbine DW_Turb = new Turbine(); DW_Turb.UTMX = 277998; DW_Turb.UTMY = 4553199; // Test 1 double thisWD = 350; double[] DWandLatDists = wakeList.CalcDownwindAndLateralDistanceFromUW_Turb(UW_Turb.UTMX, UW_Turb.UTMY, DW_Turb.UTMX, DW_Turb.UTMY, 87, thisWD); Assert.AreEqual(DWandLatDists[0], 1.969505, 0.001, "Wrong DW Dist Test 1"); Assert.AreEqual(DWandLatDists[1], 0.44639, 0.001, "Wrong Lat Dist Test 1"); // Test 2 thisWD = 20; DWandLatDists = wakeList.CalcDownwindAndLateralDistanceFromUW_Turb(UW_Turb.UTMX, UW_Turb.UTMY, DW_Turb.UTMX, DW_Turb.UTMY, 87, thisWD); Assert.AreEqual(DWandLatDists[0], 1.4824463, 0.001, "Wrong DW Dist Test 2"); Assert.AreEqual(DWandLatDists[1], 1.371337, 0.001, "Wrong Lat Dist Test 2"); // Test 3 thisWD = 90; DWandLatDists = wakeList.CalcDownwindAndLateralDistanceFromUW_Turb(UW_Turb.UTMX, UW_Turb.UTMY, DW_Turb.UTMX, DW_Turb.UTMY, 87, thisWD); Assert.AreEqual(DWandLatDists[0], -0.781609, 0.001, "Wrong DW Dist Test 3"); Assert.AreEqual(DWandLatDists[1], 1.8620689, 0.001, "Wrong Lat Dist Test 3"); // Test 4 thisWD = 170; DWandLatDists = wakeList.CalcDownwindAndLateralDistanceFromUW_Turb(UW_Turb.UTMX, UW_Turb.UTMY, DW_Turb.UTMX, DW_Turb.UTMY, 87, thisWD); Assert.AreEqual(DWandLatDists[0], -1.9695049, 0.001, "Wrong DW Dist Test 4"); Assert.AreEqual(DWandLatDists[1], 0.4463899, 0.001, "Wrong Lat Dist Test 4"); // Test 5 thisWD = 220; DWandLatDists = wakeList.CalcDownwindAndLateralDistanceFromUW_Turb(UW_Turb.UTMX, UW_Turb.UTMY, DW_Turb.UTMX, DW_Turb.UTMY, 87, thisWD); Assert.AreEqual(DWandLatDists[0], -0.9240188, 0.001, "Wrong DW Dist Test 5"); Assert.AreEqual(DWandLatDists[1], 1.7956622, 0.001, "Wrong Lat Dist Test 5"); }
public void CalcIBL_H1_Test() { WakeCollection WakeModList = new WakeCollection(); TurbineCollection turbineList = new TurbineCollection(); double[] power = new double[23]; string Power_file = testingFolder + "\\Calc_IBL_H1\\Power.txt"; StreamReader sr = new StreamReader(Power_file); for (int i = 0; i <= 22; i++) { power[i] = Convert.ToSingle(sr.ReadLine()); } double[] Thrust = new double[23]; string Thrust_file = testingFolder + "\\Calc_IBL_H1\\Thrust.txt"; sr = new StreamReader(Thrust_file); for (int i = 0; i <= 22; i++) { Thrust[i] = Convert.ToSingle(sr.ReadLine()); } turbineList.AddPowerCurve("GW 1500/87", 3, 22, 1500, power, Thrust, 87, 16, 10, 1, 0); Turbine[] UW_Turbs = new Turbine[1]; UW_Turbs[0] = new Turbine(); UW_Turbs[0].UTMX = 283000; UW_Turbs[0].UTMY = 4553300; MetCollection metList = new MetCollection(); metList.metItem = new Met[1]; metList.metItem[0] = new Met(); WakeModList.AddWakeModel(1, 5, 10, turbineList.powerCurves[0], 10, 3.5f, 0.03f, "Linear"); double This_IBL_H1 = WakeModList.Calc_IBL_H1(UW_Turbs[0], 280000, 4553500, WakeModList.wakeModels[0], 90f, 1.9316f, 80.0); Assert.AreEqual(This_IBL_H1, 750.4, 1, "Wrong IBL H1"); }
public override void DoPostConfigureComplete(GameObject go) { GeneratedBuildings.RegisterLogicPorts(go, MiniSteamTurbineConfig.INPUT_PORTS); go.AddOrGet <Storage>().SetDefaultStoredItemModifiers(MiniSteamTurbineConfig.StoredItemModifiers); Turbine turbine = go.AddOrGet <Turbine>(); turbine.srcElem = SimHashes.Steam; turbine.pumpKGRate = 1f; turbine.requiredMassFlowDifferential = 0.01f; turbine.minEmitMass = 1f; turbine.maxRPM = 4000f; turbine.rpmAcceleration = turbine.maxRPM / 30f; turbine.rpmDeceleration = turbine.maxRPM / 20f; turbine.minGenerationRPM = 3000f; turbine.minActiveTemperature = 352.15f; turbine.emitTemperature = 252.15f; go.AddOrGet <Generator>(); go.AddOrGet <LogicOperationalController>(); Prioritizable.AddRef(go); KPrefabID component = go.GetComponent <KPrefabID>(); }
private void UpdateData() { _damaged.SetActive(Turbine.GetHealth() <= 0); _health.SetActive(Turbine.GetHealth() > 0); _healthText.text = $"{LoadItems.MarineMonitorModStrings.Health} - {Turbine.GetHealth()}%"; if (Turbine.GetHealth() <= 100 && Turbine.GetHealth() > 50) { _healthText.color = new Color(0f, 0.99609375f, 0.25390625f); } else if (Turbine.GetHealth() <= 50 && Turbine.GetHealth() > 25) { _healthText.color = new Color(0.99609375f, 0.765625f, 0f); } else { _healthText.color = new Color(0.99609375f, 0, 0); } _powerBTNText.text = Turbine.HasBreakerTripped ? LoadItems.MarineMonitorModStrings.OFF : LoadItems.MarineMonitorModStrings.ON; _pingBTNText.text = Turbine.IsBeingPinged ? LoadItems.MarineMonitorModStrings.PINGING : LoadItems.MarineMonitorModStrings.PING; }
private static void CreateTurbines(ApplicationDbContext dbContext) { var turbineV = new Turbine() { SerialNumber = "V52/850/2014-dk/kol-863", TurbineTypeId = 1 }; var turbineSG = new Turbine() { SerialNumber = "SG2.1-114/2013-dk/kol-605", TurbineTypeId = 2 }; var turbineN = new Turbine() { SerialNumber = "N43/2011-dk/kol-536", TurbineTypeId = 3 }; var turbineE = new Turbine() { SerialNumber = "E-44/2016-dk/kol-221", TurbineTypeId = 4 }; // Insert turbines into the Database dbContext.Turbines.AddRange(turbineV, turbineSG, turbineN, turbineE); dbContext.SaveChanges(); }
/// <summary> Finds Min/Max XY that contain all turbine sites and updates textboxes. </summary> public void GetCoordsAroundTurbs() { double turbMinX = 0; double turbMinY = 0; double turbMaxX = 0; double turbMaxY = 0; int numTurbines = thisInst.turbineList.TurbineCount; if (numTurbines == 0) { MessageBox.Show("No Turbine sites have been loaded.", "Continuum 3"); return; } for (int i = 0; i < numTurbines; i++) { Turbine thisTurb = thisInst.turbineList.turbineEsts[i]; if (i == 0) { turbMinX = thisTurb.UTMX; turbMinY = thisTurb.UTMY; turbMaxX = thisTurb.UTMX; turbMaxY = thisTurb.UTMY; } if (thisTurb.UTMX < turbMinX) { turbMinX = thisTurb.UTMX; } if (thisTurb.UTMY < turbMinY) { turbMinY = thisTurb.UTMY; } if (thisTurb.UTMX > turbMaxX) { turbMaxX = thisTurb.UTMX; } if (thisTurb.UTMY > turbMaxY) { turbMaxY = thisTurb.UTMY; } } // Make a buffer around turbines (maximum of 500 m or grid resolution turbMinX = turbMinX - Math.Max(500, gridReso); turbMinY = turbMinY - Math.Max(500, gridReso); turbMaxX = turbMaxX + Math.Max(500, gridReso); turbMaxY = turbMaxY + Math.Max(500, gridReso); minUTMX = (int)Math.Round(turbMinX, 0); minUTMY = (int)Math.Round(turbMinY, 0); maxUTMX = (int)Math.Round(turbMaxX, 0); maxUTMY = (int)Math.Round(turbMaxY, 0); if (minUTMX < minUTMX_Limit) { minUTMX = minUTMX_Limit; } if (minUTMY < minUTMY_Limit) { minUTMY = minUTMY_Limit; } if (maxUTMX > maxUTMX_Limit) { maxUTMX = maxUTMX_Limit; } if (maxUTMY > maxUTMY_Limit) { maxUTMY = maxUTMY_Limit; } UpdateNumPoints(); UpdateTextboxes(); }
public void GetFlickerAngles_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Shadow Flicker\\Flicker testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[0]; // turbine W1 TurbineCollection.PowerCurve powerCurve = thisInst.GetSelectedPowerCurve("Site Suitability"); SiteSuitability.Zone[] zones = thisInst.siteSuitability.zones; double delta = 0.1; // Test 1 SiteSuitability.FlickerAngles flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[0].latitude, zones[0].longitude, zones[0].xSize, zones[0].ySize, zones[0].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, 63.08305, delta, "Wrong Azimuth Angle 1"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 10.312314, delta, "Wrong Altitude Angle 1"); Assert.AreEqual(flickerAngles.angleVariance, 11.98010, delta, "Wrong Angle Variance Angle 1"); // Test 2 flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[13].latitude, zones[13].longitude, zones[13].xSize, zones[13].ySize, zones[13].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, -45.82536, delta, "Wrong Azimuth Angle 2"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 2.0928330, delta, "Wrong Altitude Angle 2"); Assert.AreEqual(flickerAngles.angleVariance, 2.3516538, delta, "Wrong Angle Variance Angle 2"); // Test 3 thisTurb = thisInst.turbineList.turbineEsts[1]; flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[7].latitude, zones[7].longitude, zones[7].xSize, zones[7].ySize, zones[7].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, -76.17705, delta, "Wrong Azimuth Angle 3"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 4.5205311, delta, "Wrong Altitude Angle 3"); Assert.AreEqual(flickerAngles.angleVariance, 4.425766, delta, "Wrong Angle Variance Angle 3"); // Test 4 thisTurb = thisInst.turbineList.turbineEsts[9]; flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[19].latitude, zones[19].longitude, zones[19].xSize, zones[19].ySize, zones[19].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, -142.61909, delta, "Wrong Azimuth Angle 4"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 9.6506959, delta, "Wrong Altitude Angle 4"); Assert.AreEqual(flickerAngles.angleVariance, 9.9490992, delta, "Wrong Angle Variance Angle 4"); // Test 5 thisTurb = thisInst.turbineList.turbineEsts[5]; flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[19].latitude, zones[19].longitude, zones[19].xSize, zones[19].ySize, zones[19].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, 29.920478, delta, "Wrong Azimuth Angle 5"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 7.4365520, delta, "Wrong Altitude Angle 5"); Assert.AreEqual(flickerAngles.angleVariance, 7.6212801, delta, "Wrong Angle Variance Angle 5"); // Test 6 thisTurb = thisInst.turbineList.turbineEsts[7]; flickerAngles = thisInst.siteSuitability.GetFlickerAngles(thisInst, thisTurb, zones[17].latitude, zones[17].longitude, zones[17].xSize, zones[17].ySize, zones[17].elev, thisInst.modeledHeight, powerCurve); Assert.AreEqual(flickerAngles.targetAzimuthAngle, 105.7185, delta, "Wrong Azimuth Angle 5"); Assert.AreEqual(flickerAngles.targetAltitudeAngle, 29.4846112, delta, "Wrong Altitude Angle 5"); Assert.AreEqual(flickerAngles.angleVariance, 24.1787613, delta, "Wrong Angle Variance Angle 5"); thisInst.Close(); }
public void LCKeyOK_Test() { // Tests changing LC key after a met has been imported and a map has been created string DB_Change_LC_Before_Met = "Test_Change_LCKey_Before_Met.cfm"; string DB_Change_LC_After_Met = "Test_Change_LCKey_After_Met.cfm"; NodeCollection nodeList = new NodeCollection(); BinaryFormatter bin = new BinaryFormatter(); string connBefore = nodeList.GetDB_ConnectionString(testingFolder + "\\" + DB_Change_LC_Before_Met); string connAfter = nodeList.GetDB_ConnectionString(testingFolder + "\\" + DB_Change_LC_After_Met); Nodes[] LC_Change_Before_Met = new Nodes[0]; // array of Nodes with SRDH calcs from model where Land Cover key was changed before the met import and map generation Nodes[] LC_Change_After_Met = new Nodes[0]; // same as above but from model where Land Cover key was changed after the met import and map generation // Grab all Nodes with SRDH calcs from 'LC Key Change Before' model using (var context = new Continuum_EDMContainer(connBefore)) { var node_db = from N in context.Node_table.Include("expo") select N; foreach (var N in node_db) { int numRadii = N.expo.Count; for (int i = 0; i < numRadii; i++) { if (N.expo.ElementAt(i).SR_Array != null) { int numNodes = LC_Change_Before_Met.Length; Array.Resize(ref LC_Change_Before_Met, numNodes + 1); LC_Change_Before_Met[numNodes] = new Nodes(); LC_Change_Before_Met[numNodes].UTMX = N.UTMX; LC_Change_Before_Met[numNodes].UTMY = N.UTMY; LC_Change_Before_Met[numNodes].elev = N.elev; MemoryStream MS3 = new MemoryStream(N.expo.ElementAt(i).SR_Array); LC_Change_Before_Met[numNodes].AddExposure(N.expo.ElementAt(i).radius, N.expo.ElementAt(i).exponent, 1, 24); LC_Change_Before_Met[numNodes].expo[0].SR = new double[24]; LC_Change_Before_Met[numNodes].expo[0].SR = (double[])bin.Deserialize(MS3); MS3 = new MemoryStream(N.expo.ElementAt(i).DH_Array); LC_Change_Before_Met[numNodes].expo[0].dispH = new double[24]; LC_Change_Before_Met[numNodes].expo[0].dispH = (double[])bin.Deserialize(MS3); } } } } // Grab all Nodes with SRDH calcs from 'LC Key Change After' model using (var context = new Continuum_EDMContainer(connAfter)) { var node_db = from N in context.Node_table.Include("expo") select N; foreach (var N in node_db) { int numRadii = N.expo.Count; for (int i = 0; i < numRadii; i++) { if (N.expo.ElementAt(i).SR_Array != null) { int numNodes = LC_Change_After_Met.Length; Array.Resize(ref LC_Change_After_Met, numNodes + 1); LC_Change_After_Met[numNodes] = new Nodes(); LC_Change_After_Met[numNodes].UTMX = N.UTMX; LC_Change_After_Met[numNodes].UTMY = N.UTMY; LC_Change_After_Met[numNodes].elev = N.elev; MemoryStream MS3 = new MemoryStream(N.expo.ElementAt(i).SR_Array); LC_Change_After_Met[numNodes].AddExposure(N.expo.ElementAt(i).radius, N.expo.ElementAt(i).exponent, 1, 24); LC_Change_After_Met[numNodes].expo[0].SR = new double[24]; LC_Change_After_Met[numNodes].expo[0].SR = (double[])bin.Deserialize(MS3); MS3 = new MemoryStream(N.expo.ElementAt(i).DH_Array); LC_Change_After_Met[numNodes].expo[0].dispH = new double[24]; LC_Change_After_Met[numNodes].expo[0].dispH = (double[])bin.Deserialize(MS3); } } } } // Loop through nodes LC_Change_Before_Met and find same coords in LC_Change_After_Met and compare SR/DH for (int i = 0; i < LC_Change_Before_Met.Length; i++) { for (int j = 0; j < LC_Change_After_Met.Length; j++) { if (LC_Change_Before_Met[i].UTMX == LC_Change_After_Met[j].UTMX && LC_Change_Before_Met[i].UTMY == LC_Change_After_Met[j].UTMY && LC_Change_Before_Met[i].expo[0].radius == LC_Change_After_Met[j].expo[0].radius) { for (int k = 0; k < 24; k++) { Assert.AreEqual(LC_Change_Before_Met[i].expo[0].SR[k], LC_Change_After_Met[j].expo[0].SR[k], 0.00001, "Different SR" + LC_Change_Before_Met[i].UTMX.ToString() + "," + LC_Change_Before_Met[i].UTMY.ToString()); Assert.AreEqual(LC_Change_Before_Met[i].expo[0].dispH[k], LC_Change_After_Met[j].expo[0].dispH[k], 0.00001, "Different SR" + LC_Change_Before_Met[i].UTMX.ToString() + "," + LC_Change_Before_Met[i].UTMY.ToString()); } break; } } } string filename_before = testingFolder + "\\Test_Change_LCKey_Before_Met.cfm"; string filename_after = testingFolder + "\\Test_Change_LCKey_After_Met.cfm"; Continuum thisInstBefore = new Continuum(""); Continuum thisInstAfter = new Continuum(""); thisInstBefore.Open(filename_before); thisInstAfter.Open(filename_after); // Loop through met and turbine sites and compare SR/DH Met metBefore = thisInstBefore.metList.metItem[0]; Met metAfter = thisInstAfter.metList.metItem[0]; for (int k = 0; k < 24; k++) { Assert.AreEqual(metBefore.expo[0].SR[k], metAfter.expo[0].SR[k], 0.00001, "Different SR"); Assert.AreEqual(metBefore.expo[0].dispH[k], metAfter.expo[0].dispH[k], 0.00001, "Different displacement height"); } for (int i = 0; i < thisInstAfter.turbineList.TurbineCount; i++) { Turbine turbineBefore = thisInstBefore.turbineList.turbineEsts[i]; Turbine turbineAfter = thisInstAfter.turbineList.turbineEsts[i]; for (int k = 0; k < 24; k++) { Assert.AreEqual(turbineBefore.expo[0].SR[k], turbineAfter.expo[0].SR[k], 0.00001, "Different SR"); Assert.AreEqual(turbineBefore.expo[0].dispH[k], turbineAfter.expo[0].dispH[k], 0.00001, "Different displacement height"); } } }
public void CalcEffectiveTI_Test() { Continuum thisInst = new Continuum(""); string fileName = testingFolder + "\\Turbine TS testing.cfm"; thisInst.Open(fileName); Turbine thisTurb = thisInst.turbineList.turbineEsts[1]; Met thisMet = thisInst.metList.metItem[0]; // Test 1 WD = 4 Wohler = 1 string tiFile = testingFolder + "\\CalcEffectiveTI\\WD 4 TI Wohler 1.csv"; StreamReader sr = new StreamReader(tiFile); double[] effectiveTI = thisTurb.CalcEffectiveTI(thisMet, 1.0, thisInst, thisInst.turbineList.powerCurves[0], 4); for (int i = 0; i < effectiveTI.Length; i++) { double thisTI = 0; try { thisTI = Convert.ToDouble(sr.ReadLine()); double thisDiff = thisTI - effectiveTI[i]; Assert.AreEqual(effectiveTI[i], thisTI, 0.001, "Wrong Effective TI Test 1 WD ind:" + i.ToString()); } catch (Exception ex) { Assert.AreEqual(effectiveTI[i], thisTI, 0.001, "Wrong Effective TI Test 1 WD ind:" + i.ToString()); } } sr.Close(); // Test 2 WD = 13 Wohler = 10 tiFile = testingFolder + "\\CalcEffectiveTI\\WD 13 TI Wohler 10.csv"; sr = new StreamReader(tiFile); effectiveTI = thisTurb.CalcEffectiveTI(thisMet, 10, thisInst, thisInst.turbineList.powerCurves[0], 13); for (int i = 0; i < effectiveTI.Length; i++) { double thisTI = 0; try { thisTI = Convert.ToDouble(sr.ReadLine()); if (i >= 10) // Reducing required difference. In Continuum, now using GetInterpPowerOrThrust to find Ct for Waked SD calcs. This isn't done in Excel so answers are slightly different in bins with low counts and avg WS that are off-center { Assert.AreEqual(effectiveTI[i], thisTI, 0.01, "Wrong Effective TI Test 2 WD ind:" + i.ToString()); } else { Assert.AreEqual(effectiveTI[i], thisTI, 0.001, "Wrong Effective TI Test 2 WD ind:" + i.ToString()); } } catch (Exception ex) { Assert.AreEqual(effectiveTI[i], thisTI, 0.001, "Wrong Effective TI Test 2 WD ind:" + i.ToString()); } } sr.Close(); thisInst.Close(); }
public TurbineBreadcrumbDto GetTurbineBreadcrumb(Guid turbineId) { Turbine turbine = _turbineService.GetById(turbineId); return(_mapper.Map <TurbineBreadcrumbDto>(turbine)); }