-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86c69a2
commit 3c0c696
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using Ironbug.HVAC; | ||
using NUnit.Framework; | ||
|
||
namespace Ironbug.HVACTests | ||
{ | ||
|
||
public class RecreateFromTemplates | ||
{ | ||
[Test] | ||
public void UnitHeaterDuplicateTest() | ||
{ | ||
var coil = new IB_CoilHeatingElectric(); | ||
var unitHeater = new IB_ZoneHVACUnitHeater(); | ||
unitHeater.SetHeatingCoil(coil); | ||
|
||
var dupCount = 2; | ||
var dups = unitHeater.Duplicate(dupCount); | ||
Assert.AreEqual(dupCount, dups.Count); | ||
var dupIds = dups.Select(_=>_.GetTrackingID()).Distinct(); | ||
Assert.AreEqual(dupCount, dupIds.Count()); | ||
|
||
|
||
// ensure each unit heater has their own heating coil | ||
var dupCoils = dups.Select(_ => _.Children.FirstOrDefault()); | ||
Assert.AreEqual(dupCount, dupCoils.Count()); | ||
var dupCoilIds = dupCoils.Select(_ => _.GetTrackingID()).Distinct(); | ||
Assert.AreEqual(dupCount, dupCoilIds.Count()); | ||
|
||
} | ||
|
||
//[Test] | ||
//public void UnitHeaterHWTest() | ||
//{ | ||
// var folder = Path.Combine( TestHelper.TestSourceFolder, "Compiling templates"); | ||
// //var files = Directory.GetFiles(folder); | ||
// //var jsons = files.Where(_ => _.EndsWith(".json")); | ||
|
||
// //D:\Dev\Ironbug\src\Ironbug.HVAC_Tests\TestSource\Compiling templates | ||
// var jsonPath = Path.Combine(folder, "UnitHeaterHW.json"); | ||
// var sysJson = File.ReadAllText(jsonPath); | ||
// var system = IB_HVACSystem.FromJson(sysJson); | ||
|
||
|
||
// //foreach (var hvac in jsons) | ||
// //{ | ||
// // var fileName = Path.GetFileNameWithoutExtension(hvac); | ||
// // Console.WriteLine($"Testing {fileName}"); | ||
// // var saveAsOsm = Path.Combine(Path.GetTempPath(), $"{fileName}.osm"); | ||
// // File.Copy(osm, saveAsOsm, true); | ||
// // var done = IB_HVACSystem.SaveHVAC(saveAsOsm, hvac); | ||
// // if (!done) | ||
// // Console.WriteLine($"Failed to save {hvac}"); | ||
// // Assert.True(done); | ||
|
||
// //} | ||
|
||
//} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/Ironbug.HVAC_Tests/TestSource/Compiling templates/UnitHeaterHW.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"$type":"Ironbug.HVAC.IB_HVACSystem, Ironbug.HVAC","DisplayName":null,"AirLoops":[{"$type":"Ironbug.HVAC.IB_NoAirLoop, Ironbug.HVAC","ThermalZones":[{"$type":"Ironbug.HVAC.BaseClass.IB_ThermalZone, Ironbug.HVAC","AirTerminal":{"$type":"Ironbug.HVAC.IB_AirTerminalSingleDuctConstantVolumeNoReheat, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[cbb6bf09]"}]},"ZoneEquipments":[{"$type":"Ironbug.HVAC.IB_ZoneHVACUnitHeater, Ironbug.HVAC","Children":[{"$type":"Ironbug.HVAC.IB_CoilHeatingWater, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[a9bb1f11]"}]},{"$type":"Ironbug.HVAC.IB_FanConstantVolume, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[c5b9bbcd]"}]}],"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[d9a9cada]"}]}],"SizingZone":{"$type":"Ironbug.HVAC.IB_SizingZone, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[b8d90f24]"}]},"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[c522ccdd]"},{"Field":{"FullName":"Name","DataTypeName":"System.String"},"Value":"dummyZone"}],"IBProperties":{"$type":"Ironbug.HVAC.BaseClass.IB_PropArgumentSet, Ironbug.HVAC","IsAirTerminalBeforeZoneEquipments":true}}],"SizingSystem":{"$type":"Ironbug.HVAC.IB_SizingSystem, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[415621cd]"}]},"SupplyComponents":[],"DemandComponents":[],"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[5f256185]"}]}],"PlantLoops":[{"$type":"Ironbug.HVAC.IB_PlantLoop, Ironbug.HVAC","SizingPlant":{"$type":"Ironbug.HVAC.IB_SizingPlant, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[40e0a731]"},{"Field":{"FullName":"LoopType","DataTypeName":"System.String"},"Value":"Heating"}]},"OperationScheme":null,"SupplyComponents":[{"$type":"Ironbug.HVAC.IB_PlantLoopBranches, Ironbug.HVAC","Branches":[[{"$type":"Ironbug.HVAC.IB_BoilerHotWater, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[6aea06d2]"}]}]],"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[12765646]"}]}],"DemandComponents":[{"$type":"Ironbug.HVAC.IB_PlantLoopBranches, Ironbug.HVAC","Branches":[[{"$type":"Ironbug.HVAC.IB_CoilHeatingWater, Ironbug.HVAC","CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[a9bb1f11]"}]}]],"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[e45b347b]"}]}],"CustomAttributes":[{"Field":{"FullName":"Comment","DataTypeName":"System.String"},"Value":"TrackingID:#[864d736c]"},{"Field":{"FullName":"Name","DataTypeName":"System.String"},"Value":"Hot Water Loop"},{"Field":{"FullName":"FluidType","DataTypeName":"System.String"},"Value":"Water"}]}],"IBVersion":"1.12.2.0"} |