private static void windowTest() { //パソコンによる空気調和計算法。pp.117 //設計用気象データ double[] wdIdn = new double[] { 0, 0, 0, 0, 0, 244, 517, 679, 774, 829, 856, 862, 847, 809, 739, 619, 415, 97, 0, 0, 0, 0, 0, 0 }; double[] wdIsky = new double[] { 0, 0, 0, 0, 21, 85, 109, 116, 116, 113, 110, 109, 111, 114, 116, 114, 102, 63, 0, 0, 0, 0, 0, 0 }; double[] wdDbt = new double[] { 27.4, 27.1, 26.8, 26.5, 26.9, 27.7, 28.8, 29.8, 30.8, 31.5, 32.1, 32.6, 32.9, 33.2, 33.5, 33.1, 32.4, 31.5, 30.6, 29.8, 29.1, 28.5, 28.1, 27.7 }; double[] wdAhd = new double[] { 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018, 0.018 }; double[] wdRN = new double[] { 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24 }; GlassPanes wPropS = new GlassPanes(0.85, 0.02, 6.4); GlassPanes wPropE = new GlassPanes(0.85, 0.02, 6.4); Window winS = new Window(wPropS); WindowSurface ws = winS.GetSurface(true); winS.SurfaceArea = 1; ws.Albedo = 0.2; winS.OutSideIncline = new Incline(Incline.Orientation.S, Math.PI * 0.5); Window winE = new Window(wPropE); ws = winE.GetSurface(true); winE.SurfaceArea = 1; winE.OutSideIncline = new Incline(Incline.Orientation.E, Math.PI * 0.5); ws.Albedo = 0.2; SunShade ss1 = SunShade.MakeHorizontalSunShade(2, 1.8, 0.6, 0.25, 0.25, 0, winS.OutSideIncline); SunShade ss2 = SunShade.MakeVerticalSunShade(2, 1.8, 0.6, 0.5, winS.OutSideIncline); SunShade ss3 = SunShade.MakeGridSunShade(3, 2, 1.3, 0.6, 0.6, 0.3, -0.9, winE.OutSideIncline); Sun sun = new Sun(Sun.City.Tokyo); DateTime dTime = new DateTime(2001, 7, 21, 5, 0, 0); sun.Update(dTime); winS.Sun = sun; winE.Sun = sun; for (int i = 4; i < 18; i++) { sun.SetGlobalHorizontalRadiation(wdIsky[i], wdIdn[i]); winS.NocturnalRadiation = wdRN[i]; winE.NocturnalRadiation = wdRN[i]; ws = winS.GetSurface(true); ws.AirTemperature = wdDbt[i]; ws = winE.GetSurface(true); ws.AirTemperature = wdDbt[i]; Console.Write((i + 1).ToString() + "h: " + winS.TransmissionHeatGain.ToString("F0") + ", " + winS.AbsorbedHeatGain.ToString("F0") + ", "); winS.ShadowRate = ss1.GetShadowRate(sun); Console.Write(winS.ShadowRate.ToString("F3") + ", " + winS.TransmissionHeatGain.ToString("F0") + ", " + winS.AbsorbedHeatGain.ToString("F0") + ", "); winS.ShadowRate = ss2.GetShadowRate(sun); Console.Write(winS.ShadowRate.ToString("F3") + ", " + winS.TransmissionHeatGain.ToString("F0") + ", " + winS.AbsorbedHeatGain.ToString("F0") + ", "); winE.ShadowRate = ss3.GetShadowRate(sun); Console.WriteLine(winE.ShadowRate.ToString("F3") + ", " + winE.TransmissionHeatGain.ToString("F0") + ", " + winE.AbsorbedHeatGain.ToString("F0")); dTime = dTime.AddHours(1); sun.Update(dTime); } }
private static void windowTest1() { //気象データ//直達日射,天空放射,乾球温度,夜間放射 double[] wdIdn = new double[] { 0, 0, 0, 0, 0, 244, 517, 679, 774, 829, 856, 862, 847, 809, 739, 619, 415, 97, 0, 0, 0, 0, 0, 0 }; double[] wdIsky = new double[] { 0, 0, 0, 0, 21, 85, 109, 116, 116, 113, 110, 109, 111, 114, 116, 114, 102, 63, 0, 0, 0, 0, 0, 0 }; double[] wdDbt = new double[] { 27, 27, 27, 27, 27, 28, 29, 30, 31, 32, 32, 33, 33, 33, 34, 33, 32, 32, 31, 30, 29, 29, 28, 28 }; double[] wdRN = new double[] { 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24 }; //3mm透明ガラスの窓を作成 GlassPanes.Pane pane = new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass03mm); GlassPanes glassPane = new GlassPanes(pane); Window window = new Window(glassPane); //表面総合熱伝達率を設定 WindowSurface ws = window.GetSurface(true); ws.FilmCoefficient = 23d; ws = window.GetSurface(false); ws.FilmCoefficient = 9.3; //屋外面の傾斜を設定//南向き垂直壁 Incline incline = new Incline(Incline.Orientation.S, 0.5 * Math.PI); window.OutSideIncline = incline; //地表面反射率:アルベドを設定 ws.Albedo = 0.2; //日除けは無し window.Shade = SunShade.EmptySunShade; //7月21日0:00の東京の太陽を作成 Sun sun = new Sun(Sun.City.Tokyo); DateTime dTime = new DateTime(2001, 7, 21, 0, 0, 0); sun.Update(dTime); window.Sun = sun; //室内側乾球温度は25度で一定とする ws = window.GetSurface(false); ws.AirTemperature = 25; //計算結果タイトル行 Console.WriteLine(" 時刻 | 透過日射[W] | 吸収日射[W] | 貫流熱[W] | 対流熱取得[W] | 放射熱取得[W]"); //終日の計算実行 for (int i = 0; i < 24; i++) { //日射量設定 sun.SetGlobalHorizontalRadiation(wdIsky[i], wdIdn[i]); //夜間放射設定 window.NocturnalRadiation = wdRN[i]; //外気乾球温度を設定 ws = window.GetSurface(true); ws.AirTemperature = wdDbt[i]; //計算結果書き出し Console.WriteLine(dTime.ToShortTimeString().PadLeft(5) + " | " + window.TransmissionHeatGain.ToString("F1").PadLeft(11) + " | " + window.AbsorbedHeatGain.ToString("F1").PadLeft(11) + " | " + window.TransferHeatGain.ToString("F1").PadLeft(9) + " | " + window.ConvectiveHeatGain.ToString("F1").PadLeft(13) + " | " + window.RadiativeHeatGain.ToString("F1").PadLeft(13)); //時刻更新 dTime = dTime.AddHours(1); sun.Update(dTime); } Console.Read(); }
/// <summary>室の温湿度変動テスト(MultiRoomクラス)</summary> private static void RoomModelTest2() { //気象データ:乾球温度,絶対湿度,夜間放射,直達日射,天空日射 double[] dbt = new double[] { 24.2, 24.1, 24.1, 24.2, 24.3, 24.2, 24.4, 25.1, 26.1, 27.1, 28.8, 29.9, 30.7, 31.2, 31.6, 31.4, 31.3, 30.8, 29.4, 28.1, 27.5, 27.1, 26.6, 26.3 }; double[] ahd = new double[] { 0.0134, 0.0136, 0.0134, 0.0133, 0.0131, 0.0134, 0.0138, 0.0142, 0.0142, 0.0140, 0.0147, 0.0149, 0.0142, 0.0146, 0.0140, 0.0145, 0.0144, 0.0146, 0.0142, 0.0136, 0.0136, 0.0135, 0.0136, 0.0140 }; double[] nrd = new double[] { 32, 30, 30, 29, 26, 24, 24, 25, 25, 25, 24, 24, 24, 23, 24, 24, 24, 24, 23, 23, 24, 26, 25, 23 }; double[] dnr = new double[] { 0, 0, 0, 0, 0, 0, 106, 185, 202, 369, 427, 499, 557, 522, 517, 480, 398, 255, 142, 2, 0, 0, 0, 0 }; double[] drd = new double[] { 0, 0, 0, 0, 0, 0, 36, 115, 198, 259, 314, 340, 340, 349, 319, 277, 228, 167, 87, 16, 0, 0, 0, 0 }; //屋外を作成 Outdoor outdoor = new Outdoor(); Sun sun = new Sun(Sun.City.Tokyo); outdoor.Sun = sun; outdoor.GroundTemperature = 25; //傾斜を作成 Incline nIn = new Incline(Incline.Orientation.N, 0.5 * Math.PI); //北 Incline eIn = new Incline(Incline.Orientation.E, 0.5 * Math.PI); //東 Incline wIn = new Incline(Incline.Orientation.W, 0.5 * Math.PI); //西 Incline sIn = new Incline(Incline.Orientation.S, 0.5 * Math.PI); //南 Incline hIn = new Incline(Incline.Orientation.S, 0); //水平 //ゾーンを作成 Zone[] zones = new Zone[4]; Zone wpZone = zones[0] = new Zone("西室ペリメータ"); wpZone.Volume = 3 * 5 * 3; Zone wiZone = zones[1] = new Zone("西室インテリア"); wiZone.Volume = 4 * 5 * 3; Zone epZone = zones[2] = new Zone("東室ペリメータ"); epZone.Volume = 3 * 5 * 3; Zone eiZone = zones[3] = new Zone("東室インテリア"); eiZone.Volume = 4 * 5 * 3; foreach (Zone zn in zones) { zn.TimeStep = 3600; zn.DrybulbTemperatureSetPoint = 26; zn.HumidityRatioSetPoint = 0.01; } //東側インテリアに発熱体を設定 eiZone.AddHeatGain(new ConstantHeatGain(100, 100, 20)); //壁構成を作成:400mmコンクリート WallLayers wl = new WallLayers(); wl.AddLayer(new WallLayers.Layer(new WallMaterial(WallMaterial.PredefinedMaterials.ReinforcedConcrete), 0.4)); //窓構成を作成 GlassPanes gPanes = new GlassPanes(new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.HeatReflectingGlass06mm)); //壁体をゾーンに追加 Wall[] walls = new Wall[18]; List<WallSurface> outdoorSurfaces = new List<WallSurface>(); Wall wpwWall = walls[0] = new Wall(wl, "西室ペリメータ西壁"); wpwWall.SurfaceArea = 3 * 3; outdoorSurfaces.Add(wpwWall.GetSurface(true)); wpZone.AddSurface(wpwWall.GetSurface(false)); wpwWall.SetIncline(wIn, true); Wall wpcWall = walls[1] = new Wall(wl, "西室ペリメータ天井"); wpcWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(wpcWall.GetSurface(true)); wpZone.AddSurface(wpcWall.GetSurface(false)); wpcWall.SetIncline(hIn, true); Wall wpfWall = walls[2] = new Wall(wl, "西室ペリメータ床"); wpfWall.SurfaceArea = 3 * 5; outdoor.AddGroundWallSurface(wpfWall.GetSurface(true)); wpZone.AddSurface(wpfWall.GetSurface(false)); Wall winWall = walls[3] = new Wall(wl, "西室インテリア北壁"); winWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(winWall.GetSurface(true)); wiZone.AddSurface(winWall.GetSurface(false)); winWall.SetIncline(nIn, true); Wall wiwWall = walls[4] = new Wall(wl, "西室インテリア西壁"); wiwWall.SurfaceArea = 3 * 4; outdoorSurfaces.Add(wiwWall.GetSurface(true)); wiZone.AddSurface(wiwWall.GetSurface(false)); wiwWall.SetIncline(wIn, true); Wall wicWall = walls[5] = new Wall(wl, "西室インテリア天井"); wicWall.SurfaceArea = 4 * 5; outdoorSurfaces.Add(wicWall.GetSurface(true)); wiZone.AddSurface(wicWall.GetSurface(false)); wicWall.SetIncline(hIn, true); Wall wifWall = walls[6] = new Wall(wl, "西室インテリア床"); wifWall.SurfaceArea = 4 * 5; outdoor.AddGroundWallSurface(wifWall.GetSurface(true)); wiZone.AddSurface(wifWall.GetSurface(false)); Wall epwWall = walls[7] = new Wall(wl, "東室ペリメータ東壁"); epwWall.SurfaceArea = 3 * 3; outdoorSurfaces.Add(epwWall.GetSurface(true)); epZone.AddSurface(epwWall.GetSurface(false)); epwWall.SetIncline(eIn, true); Wall epcWall = walls[8] = new Wall(wl, "東室ペリメータ天井"); epcWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(epcWall.GetSurface(true)); epZone.AddSurface(epcWall.GetSurface(false)); epcWall.SetIncline(hIn, true); Wall epfWall = walls[9] = new Wall(wl, "東室ペリメータ床"); epfWall.SurfaceArea = 3 * 5; outdoor.AddGroundWallSurface(epfWall.GetSurface(true)); epZone.AddSurface(epfWall.GetSurface(false)); Wall einWall = walls[10] = new Wall(wl, "東室インテリア北壁"); einWall.SurfaceArea = 5 * 3; outdoorSurfaces.Add(einWall.GetSurface(true)); eiZone.AddSurface(einWall.GetSurface(false)); einWall.SetIncline(nIn, true); Wall eiwWall = walls[11] = new Wall(wl, "東室インテリア東壁"); eiwWall.SurfaceArea = 4 * 3; outdoorSurfaces.Add(eiwWall.GetSurface(true)); eiZone.AddSurface(eiwWall.GetSurface(false)); eiwWall.SetIncline(eIn, true); Wall eicWall = walls[12] = new Wall(wl, "東室インテリア天井"); eicWall.SurfaceArea = 4 * 5; outdoorSurfaces.Add(eicWall.GetSurface(true)); eiZone.AddSurface(eicWall.GetSurface(false)); eicWall.SetIncline(hIn, true); Wall eifWall = walls[13] = new Wall(wl, "東室インテリア床"); eifWall.SurfaceArea = 4 * 5; outdoor.AddGroundWallSurface(eifWall.GetSurface(true)); eiZone.AddSurface(eifWall.GetSurface(false)); Wall cpWall = walls[14] = new Wall(wl, "ペリメータ部の内壁"); cpWall.SurfaceArea = 3 * 3; wpZone.AddSurface(cpWall.GetSurface(true)); epZone.AddSurface(cpWall.GetSurface(false)); Wall ciWall = walls[15] = new Wall(wl, "インテリア部の内壁"); ciWall.SurfaceArea = 4 * 3; wiZone.AddSurface(ciWall.GetSurface(true)); eiZone.AddSurface(ciWall.GetSurface(false)); Wall wpsWall = walls[16] = new Wall(wl, "西側ペリメータ南壁"); wpsWall.SurfaceArea = 5 * 3 - 3 * 2; outdoorSurfaces.Add(wpsWall.GetSurface(true)); wpZone.AddSurface(wpsWall.GetSurface(false)); wpsWall.SetIncline(sIn, true); Wall epsWall = walls[17] = new Wall(wl, "東側ペリメータ南壁"); epsWall.SurfaceArea = 5 * 3 - 3 * 2; outdoorSurfaces.Add(epsWall.GetSurface(true)); epZone.AddSurface(epsWall.GetSurface(false)); epsWall.SetIncline(sIn, true); //外表面を初期化 foreach (WallSurface ws in outdoorSurfaces) { //屋外に追加 outdoor.AddWallSurface(ws); //放射率を初期化 ws.InitializeEmissivity(WallSurface.SurfaceMaterial.Concrete); } //窓をゾーンに追加 Window wWind = new Window(gPanes, "西室ペリメータ南窓"); wWind.SurfaceArea = 3 * 2; wpZone.AddWindow(wWind); outdoor.AddWindow(wWind); Window eWind = new Window(gPanes, "東室ペリメータ南窓"); eWind.SurfaceArea = 3 * 2; eWind.Shade = SunShade.MakeHorizontalSunShade(3, 2, 1, 1, 1, 0.5, sIn); wpZone.AddWindow(eWind); outdoor.AddWindow(eWind); //多数室オブジェクトを作成 Room eRm = new Room(new Zone[] { epZone, eiZone }); //東側の室 Room wRm = new Room(new Zone[] { wpZone, wiZone }); //西側の室 MultiRoom mRoom = new MultiRoom(new Room[] { eRm, wRm }); //多数室 mRoom.SetTimeStep(3600); //換気の設定 wpZone.VentilationVolume = 10; //西室ペリメータのみ外気導入 mRoom.SetAirFlow(wpZone, wiZone, 10); mRoom.SetAirFlow(epZone, eiZone, 10); mRoom.SetAirFlow(eiZone, epZone, 10); //短波長放射の入射比率を調整:ペリメータ床面6割、その他は面積比率 double sfSum = 0; foreach (ISurface isf in eRm.GetSurface()) sfSum += isf.Area; sfSum -= epfWall.SurfaceArea; foreach (ISurface isf in eRm.GetSurface()) eRm.SetShortWaveRadiationRate(isf, isf.Area / sfSum * 0.4); eRm.SetShortWaveRadiationRate(epfWall.GetSurface(false), 0.6); sfSum = 0; foreach (ISurface isf in wRm.GetSurface()) sfSum += isf.Area; sfSum -= wpfWall.SurfaceArea; foreach (ISurface isf in wRm.GetSurface()) wRm.SetShortWaveRadiationRate(isf, isf.Area / sfSum * 0.4); wRm.SetShortWaveRadiationRate(wpfWall.GetSurface(false), 0.6); //タイトル行書き出し StreamWriter sWriter = new StreamWriter("室の温湿度変動テスト2.csv", false, Encoding.GetEncoding("Shift_JIS")); foreach (Zone zn in zones) sWriter.Write(zn.Name + "乾球温度[C], " + zn.Name + "絶対湿度[kg/kgDA], " + zn.Name + "顕熱負荷[W], " + zn.Name + "潜熱負荷[W], "); sWriter.WriteLine(); //計算実行 for (int i = 0; i < 100; i++) { DateTime dTime = new DateTime(2007, 8, 3, 0, 0, 0); for (int j = 0; j < 24; j++) { //時刻を設定 sun.Update(dTime); mRoom.SetCurrentDateTime(dTime); //空調設定 bool operating = (8 <= dTime.Hour && dTime.Hour <= 19); foreach (Zone zn in zones) { zn.ControlHumidityRatio = operating; zn.ControlDrybulbTemperature = operating; } //気象条件を設定 outdoor.AirState = new MoistAir(dbt[j], ahd[j]); outdoor.NocturnalRadiation = nrd[j]; sun.SetGlobalHorizontalRadiation(drd[j], dnr[j]); //換気の設定 wpZone.VentilationAirState = outdoor.AirState; //外壁表面の状態を設定 outdoor.SetWallSurfaceBoundaryState(); //壁体を更新 foreach (Wall wal in walls) wal.Update(); //多数室を更新 mRoom.UpdateRoomTemperatures(); mRoom.UpdateRoomHumidities(); //時刻を更新 dTime = dTime.AddHours(1); //書き出し設定 if (i == 99) { foreach (Zone zn in zones) { sWriter.Write(zn.CurrentDrybulbTemperature.ToString("F1") + ", " + zn.CurrentHumidityRatio.ToString("F3") + ", " + zn.CurrentSensibleHeatLoad.ToString("F0") + ", " + zn.CurrentLatentHeatLoad.ToString("F0") + ", "); } sWriter.WriteLine(); } } } sWriter.Close(); }
static void Main(string[] args) { //makeWeatherData(); //Create an instance of the Outdoor class Outdoor outdoor = new Outdoor(); Sun sun = new Sun(Sun.City.Tokyo); //Located in Tokyo outdoor.Sun = sun; outdoor.GroundTemperature = 20; //Ground temperature is assumed to be constant //Create an instance of the Incline class Dictionary<string, Incline> inclines = new Dictionary<string, Incline>(); inclines.Add("N", new Incline(Incline.Orientation.N, 0.5 * Math.PI)); //North, Vertical inclines.Add("E", new Incline(Incline.Orientation.E, 0.5 * Math.PI)); //East, Vertical inclines.Add("W", new Incline(Incline.Orientation.W, 0.5 * Math.PI)); //West, Vertical inclines.Add("S", new Incline(Incline.Orientation.S, 0.5 * Math.PI)); //South, Vertical inclines.Add("H", new Incline(Incline.Orientation.S, 0)); //Horizontal //壁層を作成 Dictionary<string, WallLayers> wallLayers; makeWallLayers(out wallLayers); //室を作成 Dictionary<string, Zone> zones; makeZones(out zones); //窓を作成 Dictionary<string, Window> windows; Dictionary<string, Wall> frames; makeWindows(zones, inclines, outdoor, wallLayers, out windows, out frames); //建具を作成 Dictionary<string, Wall> doors; makeDoors(zones, wallLayers, inclines, outdoor, out doors); //外壁を作成 Dictionary<string, Wall> exWalls; makeExWalls(zones, wallLayers, inclines, windows, frames, doors, outdoor, out exWalls); //内壁を作成 Dictionary<string, Wall> inWalls; makeInWalls(zones, wallLayers, doors, out inWalls); //床を作成 Dictionary<string, Wall> floors; makeFloors(zones, wallLayers, out floors); //Creat an insances of the Room class and MultiRoom class List<Room> rooms = new List<Room>(); foreach (string key in zones.Keys) rooms.Add(new Room(new Zone[] { zones[key] })); MultiRoom mRoom = new MultiRoom(rooms.ToArray()); mRoom.SetTimeStep(TIME_STEP); //換気経路を設定 setAirFlow(mRoom, zones); //空調制御OFF foreach (string key in zones.Keys) zones[key].ControlDrybulbTemperature = false; //Output title wrine to standard output stream using (StreamWriter sWriter = new StreamWriter("out.csv", false, Encoding.GetEncoding("Shift_JIS"))) { sWriter.Write("日時,"); foreach (string key in zones.Keys) sWriter.Write(zones[key].Name + "室温[C], " + zones[key].Name + "顕熱負荷[W], "); sWriter.WriteLine(); DateTime dTime = new DateTime(1999, 11, 1, 0, 0, 0); List<string[]> wData = new List<string[]>(); using (StreamReader sReader = new StreamReader("weather.csv")) { //タイトル行 sReader.ReadLine(); string strBuff; while ((strBuff = sReader.ReadLine()) != null) wData.Add(strBuff.Split(',')); } //反復計算 int iterNum = 0; bool iter = true; bool output = false; double lastTemp = 9999; while (iter) { iterNum++; if (output) iter = false; for (int j = 0; j < wData.Count; j++) { string[] strData = wData[j]; dTime = DateTime.Parse(strData[0]); sun.Update(dTime); mRoom.SetCurrentDateTime(dTime); //Set weather state. outdoor.AirState = new MoistAir(double.Parse(strData[1]), double.Parse(strData[2])); outdoor.NocturnalRadiation = double.Parse(strData[5]); outdoor.GroundTemperature = double.Parse(strData[1]); sun.SetGlobalHorizontalRadiation(double.Parse(strData[3]), double.Parse(strData[4])); //Set ventilation air state. foreach (string key in zones.Keys) zones[key].VentilationAirState = outdoor.AirState; //空調制御 setHVACControl(dTime, zones); //Update boundary state of outdoor facing surfaces. outdoor.SetWallSurfaceBoundaryState(); //Update the walls. foreach (string key in frames.Keys) frames[key].Update(); foreach (string key in doors.Keys) doors[key].Update(); foreach (string key in exWalls.Keys) exWalls[key].Update(); foreach (string key in inWalls.Keys) inWalls[key].Update(); foreach (string key in floors.Keys) floors[key].Update(); //Update the MultiRoom object. mRoom.UpdateRoomTemperatures(); mRoom.UpdateRoomHumidities(); if (output) { sWriter.Write(dTime.ToString() + ","); foreach (string key in zones.Keys) sWriter.Write(zones[key].CurrentDrybulbTemperature + ", " + zones[key].CurrentSensibleHeatLoad + ", "); sWriter.WriteLine(); } } double err = Math.Abs(zones["床下"].CurrentDrybulbTemperature - lastTemp); if (err < 0.01) output = true; lastTemp = zones["床下"].CurrentDrybulbTemperature; Console.WriteLine(iterNum + ":" + err); } } }
/// <summary>Sample program calculating the air state and heat load of the building (MultiRoom class)</summary> private static void AirStateAndHeatLoadTest2() { //A sample weather data //Drybulb temperature [C] double[] dbt = new double[] { 24.2, 24.1, 24.1, 24.2, 24.3, 24.2, 24.4, 25.1, 26.1, 27.1, 28.8, 29.9, 30.7, 31.2, 31.6, 31.4, 31.3, 30.8, 29.4, 28.1, 27.5, 27.1, 26.6, 26.3 }; //Humidity ratio [kg/kg(DA)] double[] hum = new double[] { 0.0134, 0.0136, 0.0134, 0.0133, 0.0131, 0.0134, 0.0138, 0.0142, 0.0142, 0.0140, 0.0147, 0.0149, 0.0142, 0.0146, 0.0140, 0.0145, 0.0144, 0.0146, 0.0142, 0.0136, 0.0136, 0.0135, 0.0136, 0.0140 }; //Nocturnal radiation [W/m2] double[] nrd = new double[] { 32, 30, 30, 29, 26, 24, 24, 25, 25, 25, 24, 24, 24, 23, 24, 24, 24, 24, 23, 23, 24, 26, 25, 23 }; //Direct normal radiation [W/m2] double[] dnr = new double[] { 0, 0, 0, 0, 0, 0, 106, 185, 202, 369, 427, 499, 557, 522, 517, 480, 398, 255, 142, 2, 0, 0, 0, 0 }; //Diffuse horizontal radiation [W/m2] double[] drd = new double[] { 0, 0, 0, 0, 0, 0, 36, 115, 198, 259, 314, 340, 340, 349, 319, 277, 228, 167, 87, 16, 0, 0, 0, 0 }; //Create an instance of the Outdoor class Outdoor outdoor = new Outdoor(); Sun sun = new Sun(Sun.City.Tokyo); //Located in Tokyo outdoor.Sun = sun; outdoor.GroundTemperature = 25; //Ground temperature is assumed to be constant //Create an instance of the Incline class Incline nIn = new Incline(Incline.Orientation.N, 0.5 * Math.PI); //North, Vertical Incline eIn = new Incline(Incline.Orientation.E, 0.5 * Math.PI); //East, Vertical Incline wIn = new Incline(Incline.Orientation.W, 0.5 * Math.PI); //West, Vertical Incline sIn = new Incline(Incline.Orientation.S, 0.5 * Math.PI); //South, Vertical Incline hIn = new Incline(Incline.Orientation.S, 0); //Horizontal //Create an instance of the Zone class Zone[] zones = new Zone[4]; Zone wpZone = zones[0] = new Zone("West perimeter zone"); wpZone.Volume = 3 * 5 * 3; //Ceiling height is 3m Zone wiZone = zones[1] = new Zone("West interior zone"); wiZone.Volume = 4 * 5 * 3; Zone epZone = zones[2] = new Zone("East perimeter zone"); epZone.Volume = 3 * 5 * 3; Zone eiZone = zones[3] = new Zone("East interior zone"); eiZone.Volume = 4 * 5 * 3; foreach (Zone zn in zones) { zn.VentilationVolume = 10; //Ventilation volume[CMH] zn.TimeStep = 3600; zn.DrybulbTemperatureSetPoint = 26; zn.HumidityRatioSetPoint = 0.01; } //Set a heat production element to the east interior zone //Convective sensible heat=100W, Radiative sensible heat=100W, Latent heat=20W eiZone.AddHeatGain(new ConstantHeatGain(100, 100, 20)); //Create an instance of the WallLayers class : Concrete,400mm WallLayers wl = new WallLayers(); wl.AddLayer(new WallLayers.Layer(new WallMaterial(WallMaterial.PredefinedMaterials.ReinforcedConcrete), 0.4)); //Create an instance of the GlassPanes class:Low-emissivity coating single glass GlassPanes gPanes = new GlassPanes(new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.HeatReflectingGlass06mm)); //Set wall surfaces to the zone objects Wall[] walls = new Wall[18]; List<WallSurface> outdoorSurfaces = new List<WallSurface>(); Wall wpwWall = walls[0] = new Wall(wl, "West wall in the west perimeter zone"); wpwWall.SurfaceArea = 3 * 3; outdoorSurfaces.Add(wpwWall.GetSurface(true)); wpZone.AddSurface(wpwWall.GetSurface(false)); wpwWall.SetIncline(wIn, true); Wall wpcWall = walls[1] = new Wall(wl, "Ceiling in the west perimeter zone"); wpcWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(wpcWall.GetSurface(true)); wpZone.AddSurface(wpcWall.GetSurface(false)); wpcWall.SetIncline(hIn, true); Wall wpfWall = walls[2] = new Wall(wl, "Floor in the west perimeter zone"); wpfWall.SurfaceArea = 3 * 5; outdoor.AddGroundWallSurface(wpfWall.GetSurface(true)); wpZone.AddSurface(wpfWall.GetSurface(false)); Wall winWall = walls[3] = new Wall(wl, "North wall in the west interior zone"); winWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(winWall.GetSurface(true)); wiZone.AddSurface(winWall.GetSurface(false)); winWall.SetIncline(nIn, true); Wall wiwWall = walls[4] = new Wall(wl, "West wall in the west interior zone"); wiwWall.SurfaceArea = 3 * 4; outdoorSurfaces.Add(wiwWall.GetSurface(true)); wiZone.AddSurface(wiwWall.GetSurface(false)); wiwWall.SetIncline(wIn, true); Wall wicWall = walls[5] = new Wall(wl, "Ceiling in the west interior zone"); wicWall.SurfaceArea = 4 * 5; outdoorSurfaces.Add(wicWall.GetSurface(true)); wiZone.AddSurface(wicWall.GetSurface(false)); wicWall.SetIncline(hIn, true); Wall wifWall = walls[6] = new Wall(wl, "Floor in the west interior zone"); wifWall.SurfaceArea = 4 * 5; outdoor.AddGroundWallSurface(wifWall.GetSurface(true)); wiZone.AddSurface(wifWall.GetSurface(false)); Wall epwWall = walls[7] = new Wall(wl, "East wall in the east perimeter zone"); epwWall.SurfaceArea = 3 * 3; outdoorSurfaces.Add(epwWall.GetSurface(true)); epZone.AddSurface(epwWall.GetSurface(false)); epwWall.SetIncline(eIn, true); Wall epcWall = walls[8] = new Wall(wl, "Ceiling in the east perimeter zone"); epcWall.SurfaceArea = 3 * 5; outdoorSurfaces.Add(epcWall.GetSurface(true)); epZone.AddSurface(epcWall.GetSurface(false)); epcWall.SetIncline(hIn, true); Wall epfWall = walls[9] = new Wall(wl, "Floor in the east perimeter zone"); epfWall.SurfaceArea = 3 * 5; outdoor.AddGroundWallSurface(epfWall.GetSurface(true)); epZone.AddSurface(epfWall.GetSurface(false)); Wall einWall = walls[10] = new Wall(wl, "North wall in the east interior zone"); einWall.SurfaceArea = 5 * 3; outdoorSurfaces.Add(einWall.GetSurface(true)); eiZone.AddSurface(einWall.GetSurface(false)); einWall.SetIncline(nIn, true); Wall eiwWall = walls[11] = new Wall(wl, "East wall in the east interior zone"); eiwWall.SurfaceArea = 4 * 3; outdoorSurfaces.Add(eiwWall.GetSurface(true)); eiZone.AddSurface(eiwWall.GetSurface(false)); eiwWall.SetIncline(eIn, true); Wall eicWall = walls[12] = new Wall(wl, "Ceiling in the east interior zone"); eicWall.SurfaceArea = 4 * 5; outdoorSurfaces.Add(eicWall.GetSurface(true)); eiZone.AddSurface(eicWall.GetSurface(false)); eicWall.SetIncline(hIn, true); Wall eifWall = walls[13] = new Wall(wl, "Floor in the east interior zone"); eifWall.SurfaceArea = 4 * 5; outdoor.AddGroundWallSurface(eifWall.GetSurface(true)); eiZone.AddSurface(eifWall.GetSurface(false)); Wall cpWall = walls[14] = new Wall(wl, "Inner wall at perimeter"); cpWall.SurfaceArea = 3 * 3; wpZone.AddSurface(cpWall.GetSurface(true)); epZone.AddSurface(cpWall.GetSurface(false)); Wall ciWall = walls[15] = new Wall(wl, "Inner wall at interior"); ciWall.SurfaceArea = 4 * 3; wiZone.AddSurface(ciWall.GetSurface(true)); eiZone.AddSurface(ciWall.GetSurface(false)); Wall wpsWall = walls[16] = new Wall(wl, "South wall in the west perimeter zone"); wpsWall.SurfaceArea = 5 * 3 - 3 * 2; //Reduce window surface area outdoorSurfaces.Add(wpsWall.GetSurface(true)); wpZone.AddSurface(wpsWall.GetSurface(false)); wpsWall.SetIncline(sIn, true); Wall epsWall = walls[17] = new Wall(wl, "South wall in the east perimeter zone"); epsWall.SurfaceArea = 5 * 3 - 3 * 2; //Reduce window surface area outdoorSurfaces.Add(epsWall.GetSurface(true)); epZone.AddSurface(epsWall.GetSurface(false)); epsWall.SetIncline(sIn, true); //Initialize outdoor surfaces foreach (WallSurface ws in outdoorSurfaces) { //Add wall surfaces to Outdoor object outdoor.AddWallSurface(ws); //Initialize emissivity of surface ws.InitializeEmissivity(WallSurface.SurfaceMaterial.Concrete); } //Add windows to the west zone Window wWind = new Window(gPanes, "Window in the west perimeter zone"); wWind.SurfaceArea = 3 * 2; wpZone.AddWindow(wWind); outdoor.AddWindow(wWind); //Add windows to the east zone Window eWind = new Window(gPanes, "Window in the east perimeter zone"); eWind.SurfaceArea = 3 * 2; //Set horizontal sun shade. eWind.Shade = SunShade.MakeHorizontalSunShade(3, 2, 1, 1, 1, 0.5, sIn); wpZone.AddWindow(eWind); outdoor.AddWindow(eWind); //Creat an insances of the Room class and MultiRoom class Room eRm = new Room(new Zone[] { epZone, eiZone }); //East room Room wRm = new Room(new Zone[] { wpZone, wiZone }); //Weast room MultiRoom mRoom = new MultiRoom(new Room[] { eRm, wRm }); //Multi room (east and west rooms) mRoom.SetTimeStep(3600); //Set ventilation volume wpZone.VentilationVolume = 10; //Only west perimeter zone has outdoor air ventilation mRoom.SetAirFlow(wpZone, wiZone, 10); mRoom.SetAirFlow(epZone, eiZone, 10); mRoom.SetAirFlow(eiZone, epZone, 10); //Set short wave radiation distribution:60% of short wave is distributed to perimeter floor. double sfSum = 0; foreach (ISurface isf in eRm.GetSurface()) sfSum += isf.Area; sfSum -= epfWall.SurfaceArea; foreach (ISurface isf in eRm.GetSurface()) eRm.SetShortWaveRadiationRate(isf, isf.Area / sfSum * 0.4); eRm.SetShortWaveRadiationRate(epfWall.GetSurface(false), 0.6); sfSum = 0; foreach (ISurface isf in wRm.GetSurface()) sfSum += isf.Area; sfSum -= wpfWall.SurfaceArea; foreach (ISurface isf in wRm.GetSurface()) wRm.SetShortWaveRadiationRate(isf, isf.Area / sfSum * 0.4); wRm.SetShortWaveRadiationRate(wpfWall.GetSurface(false), 0.6); //Output title wrine to standard output stream StreamWriter sWriter = new StreamWriter("AirStateAndHeatLoadTest2.csv"); foreach (Zone zn in zones) sWriter.Write(zn.Name + "Drybulb temperature[C], " + zn.Name + "Humidity ratio[kg/kgDA], " + zn.Name + "Sensible heat load[W], " + zn.Name + "Latent heat load[W], "); sWriter.WriteLine(); //Update the state (Iterate 100 times to make state steady) for (int i = 0; i < 100; i++) { DateTime dTime = new DateTime(2007, 8, 3, 0, 0, 0); for (int j = 0; j < 24; j++) { //Set date and time to Sun and Zone object. sun.Update(dTime); mRoom.SetCurrentDateTime(dTime); //Operate HVAC system (8:00~19:00) bool operating = (8 <= dTime.Hour && dTime.Hour <= 19); foreach (Zone zn in zones) { zn.ControlHumidityRatio = operating; zn.ControlDrybulbTemperature = operating; } //Set weather state. outdoor.AirState = new MoistAir(dbt[j], hum[j]); outdoor.NocturnalRadiation = nrd[j]; sun.SetGlobalHorizontalRadiation(drd[j], dnr[j]); //Set ventilation air state. wpZone.VentilationAirState = outdoor.AirState; //Update boundary state of outdoor facing surfaces. outdoor.SetWallSurfaceBoundaryState(); //Update the walls. foreach (Wall wal in walls) wal.Update(); //Update the MultiRoom object. mRoom.UpdateRoomTemperatures(); mRoom.UpdateRoomHumidities(); //Update date and time dTime = dTime.AddHours(1); //If it is last iteration, output result to CSV text. if (i == 99) { foreach (Zone zn in zones) { sWriter.Write(zn.CurrentDrybulbTemperature.ToString("F1") + ", " + zn.CurrentHumidityRatio.ToString("F3") + ", " + zn.CurrentSensibleHeatLoad.ToString("F0") + ", " + zn.CurrentLatentHeatLoad.ToString("F0") + ", "); } sWriter.WriteLine(); } } } sWriter.Close(); }
/// <summary>Sample program calculating the heat gain from the air flow window</summary> private static void airFlowWindowTest() { AirFlowWindow afWindow = new AirFlowWindow(new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass06mm), 0.04, new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass06mm), 0.04, 0.8, 1.59, new Incline(Incline.Orientation.S, 0.5 * Math.PI)); Sun sun = new Sun(Sun.City.Tokyo); afWindow.InteriorSideFilmCoefficient = 15 * 4.186 / 3.6; afWindow.ExteriorSideFilmCoefficient = 8 * 4.186 / 3.6; afWindow.Sun = sun; using (StreamReader sReader = new StreamReader("bnd.csv")) using (StreamWriter sWriter = new StreamWriter("out.csv")) { sun.Update(new DateTime(1985, 11, 21, 0, 30, 0)); afWindow.SetAirFlowVolume(0.22 * 0.032 * 3600 * 0.5, 0.22 * 0.032 * 3600 * 0.5); afWindow.SetBlind(0.05, 0.45); for (int i = 0; i < 24; i++) { string buff = sReader.ReadLine(); string[] sb = buff.Split(','); afWindow.OutdoorTemperature = double.Parse(sb[2]); afWindow.IndoorTemperature = double.Parse(sb[6]); afWindow.SetInletAirTemperature(afWindow.IndoorTemperature); afWindow.SetNocturnalRadiation(double.Parse(sb[7])); sun.SetGlobalHorizontalRadiation(double.Parse(sb[9]), double.Parse(sb[8])); sWriter.WriteLine( afWindow.GetExteriorGlassTemperature() + "," + afWindow.GetBlindTemperature() + "," + afWindow.GetInteriorGlassTemperature() + "," + afWindow.GetHeatRemovalByAirFlow()); sun.Update(sun.CurrentDateTime.AddHours(1)); } sun.Update(new DateTime(1985, 11, 19, 0, 30, 0)); afWindow.SetAirFlowVolume(0.22 * 0.032 * 3600, 0.22 * 0.032 * 3600); afWindow.SetBlind(0.05, 0.45); for (int i = 0; i < 24; i++) { string buff = sReader.ReadLine(); string[] sb = buff.Split(','); afWindow.OutdoorTemperature = double.Parse(sb[2]); afWindow.IndoorTemperature = double.Parse(sb[6]); afWindow.SetInletAirTemperature(afWindow.IndoorTemperature); afWindow.SetNocturnalRadiation(double.Parse(sb[7])); sun.SetGlobalHorizontalRadiation(double.Parse(sb[9]), double.Parse(sb[8])); sWriter.WriteLine( afWindow.GetExteriorGlassTemperature() + "," + afWindow.GetBlindTemperature() + "," + afWindow.GetInteriorGlassTemperature() + "," + afWindow.GetHeatRemovalByAirFlow()); sun.Update(sun.CurrentDateTime.AddHours(1)); } sun.Update(new DateTime(1985, 12, 3, 0, 30, 0)); afWindow.SetAirFlowVolume(0.22 * 0.032 * 3600 * 2, 0.22 * 0.032 * 3600 * 2); afWindow.SetBlind(0.05, 0.45); for (int i = 0; i < 24; i++) { string buff = sReader.ReadLine(); string[] sb = buff.Split(','); afWindow.OutdoorTemperature = double.Parse(sb[2]); afWindow.IndoorTemperature = double.Parse(sb[6]); afWindow.SetInletAirTemperature(afWindow.IndoorTemperature); afWindow.SetNocturnalRadiation(double.Parse(sb[7])); sun.SetGlobalHorizontalRadiation(double.Parse(sb[9]), double.Parse(sb[8])); sWriter.WriteLine( afWindow.GetExteriorGlassTemperature() + "," + afWindow.GetBlindTemperature() + "," + afWindow.GetInteriorGlassTemperature() + "," + afWindow.GetHeatRemovalByAirFlow()); sun.Update(sun.CurrentDateTime.AddHours(1)); } sun.Update(new DateTime(1985, 10, 2, 0, 30, 0)); afWindow.SetAirFlowVolume(0.22 * 0.032 * 3600, 0.22 * 0.032 * 3600); afWindow.SetBlind(0.027, 0.243); for (int i = 0; i < 24; i++) { string buff = sReader.ReadLine(); string[] sb = buff.Split(','); afWindow.OutdoorTemperature = double.Parse(sb[2]); afWindow.IndoorTemperature = double.Parse(sb[6]); afWindow.SetInletAirTemperature(afWindow.IndoorTemperature); afWindow.SetNocturnalRadiation(double.Parse(sb[7])); sun.SetGlobalHorizontalRadiation(double.Parse(sb[9]), double.Parse(sb[8])); sWriter.WriteLine( afWindow.GetExteriorGlassTemperature() + "," + afWindow.GetBlindTemperature() + "," + afWindow.GetInteriorGlassTemperature() + "," + afWindow.GetHeatRemovalByAirFlow()); sun.Update(sun.CurrentDateTime.AddHours(1)); } } /*sun.Update(new DateTime(1985, 10, 2, 0, 30, 0)); Incline sinc = new Incline(Incline.Orientation.S, 0.5 * Math.PI); Console.WriteLine(sun.GetExtraterrestrialRadiation()); Console.WriteLine(sun.Altitude); for (int i = 0; i < 24; i++) { sun.Update(sun.CurrentDateTime.AddHours(1)); //Console.WriteLine(sun.Altitude); Console.WriteLine(sinc.GetDirectSolarRadiationRate(sun)); }*/ }
/// <summary>Sample program calculating the heat gain from the window</summary> private static void windowTest() { //A sample weather data //direct normal radiation [W/m2] double[] wdIdn = new double[] { 0, 0, 0, 0, 0, 244, 517, 679, 774, 829, 856, 862, 847, 809, 739, 619, 415, 97, 0, 0, 0, 0, 0, 0 }; //diffuse horizontal radiation [W/m2] double[] wdIsky = new double[] { 0, 0, 0, 0, 21, 85, 109, 116, 116, 113, 110, 109, 111, 114, 116, 114, 102, 63, 0, 0, 0, 0, 0, 0 }; //drybulb temperature [C] double[] wdDbt = new double[] { 27, 27, 27, 27, 27, 28, 29, 30, 31, 32, 32, 33, 33, 33, 34, 33, 32, 32, 31, 30, 29, 29, 28, 28 }; //nocturnal radiation [W/m2] double[] wdRN = new double[] { 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 24, 24, 24 }; //Create a window with a single 3mm transparent glass pane GlassPanes.Pane pane = new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass03mm); GlassPanes glassPane = new GlassPanes(pane); Window window = new Window(glassPane); //Set wall surface information WindowSurface outsideWindowSurface = window.GetSurface(true); outsideWindowSurface.FilmCoefficient = 23d; outsideWindowSurface.Albedo = 0.2; WindowSurface insideWindowSurface = window.GetSurface(false); insideWindowSurface.FilmCoefficient = 9.3; //Set incline of an outdoor surface : South, vertical incline window.OutSideIncline = new Incline(Incline.Orientation.S, 0.5 * Math.PI); //There is no sun shade window.Shade = SunShade.EmptySunShade; //Initialize sun. Tokyo : 7/21 0:00 Sun sun = new Sun(Sun.City.Tokyo); DateTime dTime = new DateTime(2001, 7, 21, 0, 0, 0); sun.Update(dTime); window.Sun = sun; //Indoor drybulb temperature is constant (25C) window.IndoorDrybulbTemperature = 25; //Result : Title line Console.WriteLine(" Time |Transmission[W]|Absorption[W]|Transfer[W]|Convective[W]|Radiative[W]"); //execute simulation for (int i = 0; i < 24; i++) { //Set radiations (calculate global horizontal radiation from direct normal and diffuse horizontal radiation) sun.SetGlobalHorizontalRadiation(wdIsky[i], wdIdn[i]); //Set nocturnal radiation window.NocturnalRadiation = wdRN[i]; //Set outdoor temperature window.OutdoorDrybulbTemperature = wdDbt[i]; //Output result Console.WriteLine(dTime.ToShortTimeString().PadLeft(5) + " | " + window.TransmissionHeatGain.ToString("F1").PadLeft(13) + " | " + window.AbsorbedHeatGain.ToString("F1").PadLeft(11) + " | " + window.TransferHeatGain.ToString("F1").PadLeft(9) + " | " + window.ConvectiveHeatGain.ToString("F1").PadLeft(11) + " | " + window.RadiativeHeatGain.ToString("F1").PadLeft(11)); //Update time dTime = dTime.AddHours(1); sun.Update(dTime); } Console.Read(); }