Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        /// <summary>気象状態計算の例</summary>
        private static void weatherTest()
        {
            //東京における太陽を作成
            Sun sun = new Sun(Sun.City.Tokyo);

            //太陽位置を12月21日12時に調整
            DateTime dTime = new DateTime(1983, 12, 21, 12, 0, 0);
            sun.Update(dTime);
            sun.GlobalHorizontalRadiation = 467;

            Console.WriteLine("東京の12月21日12時における");
            Console.WriteLine("太陽高度=" + Sky.RadianToDegree(sun.Altitude).ToString("F1") + " 度");
            Console.WriteLine("太陽方位=" + Sky.RadianToDegree(sun.Orientation).ToString("F1") + " 度");
            Console.WriteLine("水平面全天日射=" + sun.GlobalHorizontalRadiation.ToString("F1") + " W/m2");

            //傾斜面を作成(南西の垂直面と東の45°傾斜面)
            Incline seInc = new Incline(Incline.Orientation.SE, 0.5 * Math.PI);
            Incline wInc = new Incline(Incline.Orientation.W, 0.25 * Math.PI);

            //直散分離の手法を取得
            Array methods = Enum.GetValues(typeof(Sun.DiffuseAndDirectNormalRadiationEstimatingMethod));
            foreach (Sun.DiffuseAndDirectNormalRadiationEstimatingMethod method in methods)
            {
                //直散分離を実行して太陽に設定
                sun.EstimateDiffuseAndDirectNormalRadiation(sun.GlobalHorizontalRadiation, method);

                //傾斜面へ入射する直達日射成分を計算する
                double cosThetaSE, cosThetaW;
                cosThetaSE = seInc.GetDirectSolarRadiationRate(sun);
                cosThetaW = wInc.GetDirectSolarRadiationRate(sun);

                Console.WriteLine();
                Console.WriteLine("直散分離手法 : " + method.ToString());
                Console.WriteLine("法線面直達日射=" + sun.DirectNormalRadiation.ToString("F1") + " W/m2");
                Console.WriteLine("水平面直達日射=" + (sun.DirectNormalRadiation * Math.Sin(sun.Altitude)).ToString("F1") + " W/m2");
                Console.WriteLine("天空日射=" + sun.DiffuseHorizontalRadiation.ToString("F1") + " W/m2");
                Console.WriteLine("南西垂直面の直達日射=" + (sun.DirectNormalRadiation * cosThetaSE).ToString("F1") + " W/m2");
                Console.WriteLine("東45度面の直達日射=" + (sun.DirectNormalRadiation * cosThetaW).ToString("F1") + " W/m2");

            }
            Console.Read();
        }
Esempio n. 3
0
        /// <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();
        }
Esempio n. 4
0
 /// <summary>傾斜を設定する</summary>
 /// <param name="incline">傾斜面</param>
 /// <param name="isSide1">1側か否か</param>
 /// <remarks>裏面は自動で設定される</remarks>
 public void SetIncline(ImmutableIncline incline, bool isSide1)
 {
     if (isSide1)
     {
         incline1 = incline;
         Incline ic = new Incline(incline1);
         ic.Reverse();
         incline2 = ic;
     }
     else
     {
         incline2 = incline;
         Incline ic = new Incline(incline2);
         ic.Reverse();
         incline1 = ic;
     }
 }
Esempio n. 5
0
        /// <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();
        }
Esempio n. 6
0
        /// <summary>Sample program calculating weather state</summary>
        private static void weatherTest()
        {
            //Create an instance of the Sun class. (Location is Tokyo)
            Sun sun = new Sun(Sun.City.Tokyo);

            //Set date and time information(1983/12/21 12:00)
            DateTime dTime = new DateTime(1983, 12, 21, 12, 0, 0);
            sun.Update(dTime);

            //Create instances of the Incline class. Vertical south east surface and 45 degree west surface.
            Incline seInc = new Incline(Incline.Orientation.SE, 0.5 * Math.PI);
            Incline wInc = new Incline(Incline.Orientation.W, 0.25 * Math.PI);

            //Estimate direct normal and diffuse horizontal radiation from global horizontal radiation (467 W/m2)
            sun.EstimateDiffuseAndDirectNormalRadiation(467);

            //Calculate insolation rate on the inclined plane.
            double cosThetaSE, cosThetaW;
            cosThetaSE = seInc.GetDirectSolarRadiationRate(sun);
            cosThetaW = wInc.GetDirectSolarRadiationRate(sun);

            Console.WriteLine("Location:Tokyo, Date and time:12/21 12:00");
            Console.WriteLine("Altitude of sun=" + Sky.RadianToDegree(sun.Altitude).ToString("F1") + " degree");
            Console.WriteLine("Orientation of sun=" + Sky.RadianToDegree(sun.Orientation).ToString("F1") + " degree");
            Console.WriteLine("Direct normal radiation=" + sun.DirectNormalRadiation.ToString("F1") + " W/m2");
            Console.WriteLine("Diffuse horizontal radiation=" + sun.GlobalHorizontalRadiation.ToString("F1") + " W/m2");
            Console.WriteLine("Direct normal radiation to SE surface=" + (sun.DirectNormalRadiation * cosThetaSE).ToString("F1") + " W/m2");
            Console.WriteLine("Direct normal radiation to W surface=" + (sun.DirectNormalRadiation * cosThetaW).ToString("F1") + " W/m2");

            Console.Read();
        }