Ejemplo 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();
        }
Ejemplo n.º 2
0
        /// <summary>多数室テスト</summary>
        /// <remarks>
        /// 東西2室で壁・窓表面の相互放射を考慮した計算を行う。
        /// 東側は南北で2ゾーンに分割する。
        /// 壁体は全て200mmのコンクリートとする。
        /// 幅×奥行き×高さ = 8m×7m×3mとする。
        /// 地面(床)は考慮しない。
        /// 
        ///        N1           N2
        ///   -------------------------
        ///   |           |           |
        ///   |           |    znE1   | E1
        ///   |           |           |
        /// W |    znW    |- - - - - -|
        ///   |           |           |
        ///   |           |    znE2   | E2
        ///   |           |           |
        ///   ----+++++----------------
        ///        S1           S2
        /// 
        /// </remarks>
        private static void multiRoomTest()
        {
            const double TIME_STEP = 3600;
            const double INIT_TEMP = 15;
            const double H_GAIN = 0;
            const int ITER_NUM = 100;
            const double W_AI = 8;
            const double E_AI = 9.3;
            const double W_AO = 20;
            const double E_AO = 23;
            bool USE_TUBE = false;

            //モデル作成処理*********************************************************

            //屋外
            Outdoor outDoor = new Outdoor();
            Sun sun = new Sun(Sun.City.Tokyo);
            sun.Update(new DateTime(2001, 1, 1, 0, 0, 0));
            outDoor.Sun = sun;

            //壁リスト
            Wall[] walls = new Wall[12];

            //ゾーンを作成
            Zone znW = new Zone();
            znW.Volume = 7 * 4 * 3;
            znW.SensibleHeatCapacity = znW.Volume * 12000;//単位容積あたり12kJ
            Zone znE1 = new Zone();
            znE1.Volume = 3.5 * 4 * 3;
            znE1.SensibleHeatCapacity = znE1.Volume * 12000;//単位容積あたり12kJ
            Zone znE2 = new Zone();
            znE2.Volume = 3.5 * 4 * 3;
            znE2.SensibleHeatCapacity = znE2.Volume * 12000;//単位容積あたり12kJ
            znW.TimeStep = znE1.TimeStep = znE2.TimeStep = TIME_STEP;

            //壁構成を作成(コンクリート)
            WallLayers layers;
            WallLayers.Layer layer;
            layers = new WallLayers();
            layer = new WallLayers.Layer(new WallMaterial("コンクリート", 1.4, 1934), 0.150, 2);
            layers.AddLayer(layer);

            //西外壁
            walls[0] = new Wall(layers);
            walls[0].SurfaceArea = 7 * 3;
            WallSurface ews = walls[0].GetSurface(true);
            WallSurface iws = walls[0].GetSurface(false);
            ews.FilmCoefficient = W_AO;
            iws.FilmCoefficient = W_AI;
            walls[0].SetIncline(new Incline(Incline.Orientation.W, 0.5 * Math.PI), true);
            znW.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //東外壁1
            walls[1] = new Wall(layers);
            walls[1].SurfaceArea = 3.5 * 3;
            ews = walls[1].GetSurface(true);
            iws = walls[1].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[1].SetIncline(new Incline(Incline.Orientation.E, 0.5 * Math.PI), true);
            znE1.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //東外壁2
            walls[2] = new Wall(layers);
            walls[2].SurfaceArea = 3.5 * 3;
            ews = walls[2].GetSurface(true);
            iws = walls[2].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[2].SetIncline(new Incline(Incline.Orientation.E, 0.5 * Math.PI), true);
            znE2.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //北外壁1
            walls[3] = new Wall(layers);
            walls[3].SurfaceArea = 4 * 3;
            ews = walls[3].GetSurface(true);
            iws = walls[3].GetSurface(false);
            ews.FilmCoefficient = W_AO;
            iws.FilmCoefficient = W_AI;
            walls[3].SetIncline(new Incline(Incline.Orientation.N, 0.5 * Math.PI), true);
            znW.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //北外壁2
            walls[4] = new Wall(layers);
            walls[4].SurfaceArea = 4 * 3;
            ews = walls[4].GetSurface(true);
            iws = walls[4].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[4].SetIncline(new Incline(Incline.Orientation.N, 0.5 * Math.PI), true);
            znE1.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //南外壁1
            walls[5] = new Wall(layers);
            walls[5].SurfaceArea = 4 * 3;
            ews = walls[5].GetSurface(true);
            iws = walls[5].GetSurface(false);
            ews.FilmCoefficient = W_AO;
            iws.FilmCoefficient = W_AI;
            walls[5].SetIncline(new Incline(Incline.Orientation.S, 0.5 * Math.PI), true);
            znW.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //南外壁2
            walls[6] = new Wall(layers);
            walls[6].SurfaceArea = 4 * 3;
            ews = walls[6].GetSurface(true);
            iws = walls[6].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[6].SetIncline(new Incline(Incline.Orientation.S, 0.5 * Math.PI), true);
            znE2.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //屋根1
            walls[7] = new Wall(layers);
            walls[7].SurfaceArea = 4 * 7;
            ews = walls[7].GetSurface(true);
            iws = walls[7].GetSurface(false);
            ews.FilmCoefficient = W_AO;
            iws.FilmCoefficient = W_AI;
            walls[7].SetIncline(new Incline(Incline.Orientation.N, 0), true);
            znW.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //屋根2
            walls[8] = new Wall(layers);
            walls[8].SurfaceArea = 4 * 3.5;
            ews = walls[8].GetSurface(true);
            iws = walls[8].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[8].SetIncline(new Incline(Incline.Orientation.N, 0), true);
            znE1.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //屋根3
            walls[9] = new Wall(layers);
            walls[9].SurfaceArea = 4 * 3.5;
            ews = walls[9].GetSurface(true);
            iws = walls[9].GetSurface(false);
            ews.FilmCoefficient = E_AO;
            iws.FilmCoefficient = E_AI;
            walls[9].SetIncline(new Incline(Incline.Orientation.N, 0), true);
            znE2.AddSurface(iws);
            outDoor.AddWallSurface(ews);

            //内壁1
            walls[10] = new Wall(layers);
            walls[10].SurfaceArea = 7 * 3.5;
            ews = walls[10].GetSurface(true);
            iws = walls[10].GetSurface(false);
            ews.FilmCoefficient = E_AI;
            iws.FilmCoefficient = W_AI;
            znW.AddSurface(iws);
            znE1.AddSurface(ews);

            //内壁2
            walls[11] = new Wall(layers);
            walls[11].SurfaceArea = 7 * 3.5;
            ews = walls[11].GetSurface(true);
            iws = walls[11].GetSurface(false);
            ews.FilmCoefficient = E_AI;
            iws.FilmCoefficient = W_AI;
            znW.AddSurface(iws);
            znE2.AddSurface(ews);

            //南窓
            GlassPanes gPanes = new GlassPanes(new GlassPanes.Pane[] {
                new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass03mm),
                new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.HeatAbsorbingGlass03mm)
            });
            //外側ブラインド
            GlassPanes gPanesWithBlind = new GlassPanes(new GlassPanes.Pane[] {
                new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.TransparentGlass03mm),
                new GlassPanes.Pane(GlassPanes.Pane.PredifinedGlassPane.HeatAbsorbingGlass03mm),
                new GlassPanes.Pane(0.05, 0.35, 9999)
            });
            Window window = new Window(gPanes, new Incline(Incline.Orientation.S, 0.5 * Math.PI));
            window.SurfaceArea = 1 * 3;
            WindowSurface ws1 = window.GetSurface(true);
            WindowSurface ws2 = window.GetSurface(false);
            ws1.LongWaveEmissivity = 0.7;
            ws1.FilmCoefficient = W_AO;
            ws2.FilmCoefficient = W_AI;
            znW.AddWindow(window);
            outDoor.AddWindow(window);

            /*//debug
            for (int i = 0; i < walls.Length; i++)
            {
                walls[i].GetSurface(true).ConvectiveRate = 0;
                walls[i].GetSurface(false).ConvectiveRate = 0;
            }
            //window.GetSurface(false).ConvectiveRate = 0;
            //debug*/

            //発熱体*****************************************************************
            znW.AddHeatGain(new ConstantHeatGain(0, H_GAIN, 0));

            //制御*******************************************************************
            znE1.ControlDrybulbTemperature = false;
            znE1.DrybulbTemperatureSetPoint = 20;
            znE2.ControlDrybulbTemperature = false;
            znE2.DrybulbTemperatureSetPoint = 20;
            znW.ControlDrybulbTemperature = false;
            znW.DrybulbTemperatureSetPoint = 20;

            //外界条件設定***********************************************************
            outDoor.AirState = new MoistAir(30, 0.020);
            outDoor.SetWallSurfaceBoundaryState();

            //天井に冷水配管を設置
            if (USE_TUBE)
            {
                Tube tube = new Tube(0.999, 0.275, 4186);
                tube.SetFlowRate(0.222);
                tube.FluidTemperature = 10;
                walls[7].AddTube(tube, 0);
                walls[8].AddTube(tube, 0);
                walls[9].AddTube(tube, 0);
            }

            //室温・壁温初期化*******************************************************
            for (int i = 0; i < walls.Length; i++) walls[i].InitializeTemperature(INIT_TEMP);
            znE1.InitializeAirState(INIT_TEMP, 0.015);
            znE2.InitializeAirState(INIT_TEMP, 0.015);
            znW.InitializeAirState(INIT_TEMP, 0.015);

            //多数室オブジェクトを作成・初期化
            Room[] rooms = new Room[2];
            rooms[0] = new Room(new Zone[] { znW });
            rooms[1] = new Room(new Zone[] { znE1, znE2 });
            MultiRoom mRoom = new MultiRoom(rooms);
            mRoom.SetTimeStep(TIME_STEP);
            //初期化
            mRoom.Initialize();

            //室間換気設定***********************************************************
            znW.VentilationVolume = znW.Volume * 0;
            znE1.VentilationVolume = znE1.Volume * 0;
            znE2.VentilationVolume = znE2.Volume * 0;
            znW.VentilationAirState = outDoor.AirState;
            znE1.VentilationAirState = outDoor.AirState;
            znE2.VentilationAirState = outDoor.AirState;
            //mRoom.SetAirFlow(znE1, znE2, 10);
            //mRoom.SetAirFlow(znE2, znW, 10);
            //mRoom.SetAirFlow(znW, znE1, 10);

            //熱収支確認用変数*******************************************************
            double heatTransferToExWall = 0;
            double heatTransferToTube = 0;
            double heatTransferToWindow = 0;
            double oaLoad = 0;

            //外気データ読み込み*****************************************************
            StreamReader sReader = new StreamReader("BESTestWeather.csv");
            sReader.ReadLine();

            //室温更新テスト*********************************************************
            for (int i = 0; i < ITER_NUM; i++)
            {
                //外気条件設定
                string[] wData = sReader.ReadLine().Split(',');
                outDoor.AirState = new MoistAir(double.Parse(wData[2]), double.Parse(wData[3]));
                sun.DirectNormalRadiation = double.Parse(wData[4]);
                sun.GlobalHorizontalRadiation = double.Parse(wData[5]);
                sun.DiffuseHorizontalRadiation = double.Parse(wData[6]);
                outDoor.NocturnalRadiation = double.Parse(wData[8]);

                //12~13時は外側ブラインドを利用
                if (sun.CurrentDateTime.Hour == 12 && sun.CurrentDateTime.Minute == 0) window.Initialize(gPanesWithBlind);
                if (sun.CurrentDateTime.Hour == 13 && sun.CurrentDateTime.Minute == 0) window.Initialize(gPanes);

                Console.WriteLine(
                    znW.CurrentDrybulbTemperature.ToString("F3").PadLeft(5) + " | "
                    + znE1.CurrentDrybulbTemperature.ToString("F3").PadLeft(5) + " | "
                    + znE2.CurrentDrybulbTemperature.ToString("F3").PadLeft(5) + " | "
                    + znW.CurrentSensibleHeatLoad.ToString("F2").PadLeft(5) + " | "
                    + znE1.CurrentSensibleHeatLoad.ToString("F2").PadLeft(5) + " | "
                    + znE2.CurrentSensibleHeatLoad.ToString("F2").PadLeft(5) + " | "
                    + walls[0].GetWallTemprature(true).ToString("F2").PadLeft(5) + " | "
                    + walls[0].GetWallTemprature(false).ToString("F2").PadLeft(5) + " | "
                    );

                //壁体状態更新
                for (int j = 0; j < walls.Length; j++) walls[j].Update();
                //外気条件を壁に設定
                outDoor.SetWallSurfaceBoundaryState();
                //室状態更新
                mRoom.UpdateRoomTemperatures();
                mRoom.UpdateRoomHumidities();

                //壁体への熱移動量を積算
                for (int j = 0; j < 10; j++) heatTransferToExWall += walls[j].GetHeatTransfer(true);
                //窓面への熱移動量を積算
                heatTransferToWindow += window.AbsorbedHeatGain + window.TransferHeatGain + window.TransmissionHeatGain;
                heatTransferToWindow -= rooms[0].TransmissionHeatLossFromWindow + rooms[1].TransmissionHeatLossFromWindow;
                //チューブへの熱移動量を積算
                heatTransferToTube += walls[7].GetHeatTransferToTube(0) + walls[8].GetHeatTransferToTube(0) + walls[9].GetHeatTransferToTube(0);
                //外気負荷を計算
                Zone[] zns = new Zone[] { znE1, znE2, znW };
                for (int j = 0; j < zns.Length; j++)
                {
                    if (zns[j].VentilationVolume != 0)
                    {
                        double airDS = 1d / (MoistAir.GetAirStateFromDBHR(zns[j].CurrentDrybulbTemperature, zns[j].CurrentHumidityRatio, MoistAir.Property.SpecificVolume));
                        double cpAir = MoistAir.GetSpecificHeat(zns[j].CurrentHumidityRatio);
                        oaLoad += zns[j].VentilationVolume * airDS * cpAir * (zns[j].VentilationAirState.DryBulbTemperature - zns[j].CurrentDrybulbTemperature);
                    }
                }

                //日時更新
                sun.Update(sun.CurrentDateTime.AddSeconds(TIME_STEP));
            }
            sReader.Close();

            //熱収支を書き出し
            //屋外から壁体への熱移動量[MJ]
            heatTransferToExWall *= TIME_STEP / 1000000d;
            //窓面への熱移動量[MJ]
            heatTransferToWindow *= TIME_STEP / 1000000d;
            //壁体からチューブへの熱移動量[MJ]
            heatTransferToTube *= TIME_STEP / 1000000d;
            //外気負荷[MJ]
            oaLoad *= TIME_STEP / 1000000d / 3.6;
            //壁体蓄熱量[MJ]
            double wallHeatStorage = 0;
            for (int i = 0; i < walls.Length; i++) wallHeatStorage += walls[i].GetHeatStorage(INIT_TEMP);
            wallHeatStorage /= 1000d;
            //室蓄熱量[MJ]
            double zoneHeatStorage = (znE1.GetHeatStorage(INIT_TEMP) + znE2.GetHeatStorage(INIT_TEMP) + znW.GetHeatStorage(INIT_TEMP)) / 1000d;
            //発熱量
            double heatGain = (H_GAIN * TIME_STEP * ITER_NUM) / 1000000;

            //書き出し
            Console.WriteLine("壁体への熱移動[MJ] | 窓面への熱移動[MJ] | 壁体の蓄熱量[MJ] | 室の蓄熱量[MJ] | 発熱量[MJ] | チューブへの熱移動[MJ] | 外気負荷[MJ]");
            Console.WriteLine(heatTransferToExWall.ToString("F2") + " | " +  heatTransferToWindow.ToString("F2") + " | " +
                wallHeatStorage.ToString("F2") + " | " + zoneHeatStorage.ToString("F2") + " | " + heatGain + " | " + heatTransferToTube.ToString("F2") + " | " + oaLoad.ToString("F2"));
            Console.WriteLine("熱収支[MJ] = " + (heatTransferToExWall + heatTransferToWindow - heatTransferToTube - wallHeatStorage - zoneHeatStorage + heatGain + oaLoad));

            Console.Read();
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        /// <summary>気象データ作成処理</summary>
        /// <param name="wdataPath">元の気象データのパス</param>
        /// <param name="outputPath">変換後の気象データのパス</param>
        public static void ReadAndWriteBESTestWeatherData(string wdataPath, string outputPath)
        {
            bool success;
            WeatherDataTable wdTable = TMY1Converter.ToPWeatherData(wdataPath, out success);

            using (StreamWriter sWriter = new StreamWriter(outputPath))
            {
                sWriter.WriteLine("Date,Time,Drybulb temperature[C],Humidity ratio[kg/kg],Dirct normal radiation[W/m2],Global horizontal radiation[W/m2],Diffuse horizontal radiation[W/m2],Cloud cover,Nocturnal radiation[W/m2],Solar altitude[radian],Ground temperature(0.675m)[C],Ground temperature(1.35m)[C],Ground temperature(2.35m)[C]");

                ImmutableWeatherRecord wr;
                ImmutableWeatherData wd;
                DateTime dTime;

                //年平均気温、年較差、最大平均気温日の通日を計算
                double dbt;
                double dbtAve = 0;
                double dbtMin = 100;
                double dbtMax = -100;
                double dbtMinSum = 0;
                double dbtMaxSum = 0;
                double maxDay = 1;
                double daySum = 0;
                double maxDaySum = 0;
                double[] maxAve = new double[12];
                double[] minAve = new double[12];
                dTime = new DateTime(1999, 1, 1, 0, 0, 0);
                int days = 0;
                for (int i = 0; i < wdTable.WeatherRecordNumber; i++)
                {
                    wr = wdTable.GetWeatherRecord(i);
                    dbt = wr.GetData(WeatherRecord.RecordType.DryBulbTemperature).Value;
                    dbtAve += dbt;
                    dbtMin = Math.Min(dbt, dbtMin);
                    dbtMax = Math.Max(dbt, dbtMax);
                    daySum += dbt;

                    if (dTime.Hour == 23)
                    {
                        days++;
                        dbtMaxSum += dbtMax;
                        dbtMinSum += dbtMin;
                        dbtMax = -100;
                        dbtMin = 100;
                        if (maxDaySum < daySum)
                        {
                            maxDaySum = daySum;
                            maxDay = (i / 24) + 1;
                        }
                        daySum = 0;
                    }

                    dTime = dTime.AddHours(1);

                    if ((dTime.Day == 1) && (dTime.Hour == 0))
                    {
                        if (dTime.Month == 1)
                        {
                            maxAve[11] = dbtMaxSum / days;
                            minAve[11] = dbtMinSum / days;
                        }
                        else
                        {
                            maxAve[dTime.Month - 2] = dbtMaxSum / days;
                            minAve[dTime.Month - 2] = dbtMinSum / days;
                        }
                        dbtMaxSum = dbtMinSum = 0;
                        days = 0;
                    }
                }
                dbtAve /= 8760d;
                for (int i = 0; i < maxAve.Length; i++)
                {
                    dbtMax = Math.Max(maxAve[i], dbtMax);
                    dbtMin = Math.Min(minAve[i], dbtMin);
                }

                Sun sun = new Sun(39.8, 360 - 104.9, 360 - 105);

                for (int i = 0; i < wdTable.WeatherRecordNumber; i++)
                {
                    wr = wdTable.GetWeatherRecord(i);

                    dTime = wr.DataDTime;
                    sun.Update(dTime.AddMinutes(30));
                    sWriter.Write(dTime.ToShortDateString() + "," + dTime.ToShortTimeString() + ",");

                    dbt = wr.GetData(WeatherRecord.RecordType.DryBulbTemperature).Value;
                    sWriter.Write(dbt + ",");

                    double dpt = wr.GetData(WeatherRecord.RecordType.DewPointTemperature).Value;
                    double atm = wr.GetData(WeatherRecord.RecordType.AtmosphericPressure).Value;
                    double ahd = MoistAir.GetSaturatedHumidityRatio(dpt, MoistAir.Property.DryBulbTemperature, atm);
                    sWriter.Write(ahd + ",");

                    wd = wr.GetData(WeatherRecord.RecordType.DirectNormalRadiation);
                    sWriter.Write(wd.Value + ",");
                    sun.DirectNormalRadiation = wd.Value;

                    wd = wr.GetData(WeatherRecord.RecordType.GlobalHorizontalRadiation);
                    sWriter.Write(wd.Value + ",");
                    sun.GlobalHorizontalRadiation = wd.Value;

                    //日の出の場合の補正
                    if (sun.SunRiseTime.Hour == sun.CurrentDateTime.Hour) sun.Update(sun.CurrentDateTime.AddMinutes(30));
                    //日没の場合の補正
                    if (sun.SunSetTime.Hour == sun.CurrentDateTime.Hour) sun.Update(sun.CurrentDateTime.AddMinutes(-30));

                    sWriter.Write(Math.Max(0, Sun.GetDiffuseHorizontalRadiation(sun.DirectNormalRadiation, sun.GlobalHorizontalRadiation, sun.Altitude)) + ","); ;

                    wd = wr.GetData(WeatherRecord.RecordType.TotalSkyCover);
                    double cc;
                    if (wd.Source == WeatherData.DataSource.MissingValue) cc = 10;
                    else cc = wd.Value;
                    sWriter.Write(cc + ",");

                    double wbp = MoistAir.GetWaterVaporPressure(ahd, atm);
                    double nr = Sky.GetNocturnalRadiation(dbt, cc, wbp);
                    sWriter.Write(nr + ",");

                    //太陽高度
                    sWriter.Write(sun.Altitude + ",");

                    //地中温度[C]
                    double nd = dTime.DayOfYear + dTime.Hour / 24d + (dTime.Minute + 30d) / 24d / 60d;
                    //0.675m
                    double tgrz = dbtAve + 0.5 * (dbtMax - dbtMin) * Math.Exp(-0.526 * 0.675) * Math.Cos((nd - maxDay - 30.556 * 0.675) * 0.017214);
                    sWriter.Write(tgrz + ",");
                    //1.35m
                    tgrz = dbtAve + 0.5 * (dbtMax - dbtMin) * Math.Exp(-0.526 * 1.35) * Math.Cos((nd - maxDay - 30.556 * 1.35) * 0.017214);
                    sWriter.Write(tgrz + ",");
                    //2.65m
                    tgrz = dbtAve + 0.5 * (dbtMax - dbtMin) * Math.Exp(-0.526 * 2.65) * Math.Cos((nd - maxDay - 30.556 * 2.65) * 0.017214);
                    sWriter.Write(tgrz + ",");

                    sWriter.WriteLine();

                    dTime = dTime.AddHours(1);
                }

            }
        }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
        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);
                }
            }
        }
Ejemplo n.º 8
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();
        }
Ejemplo n.º 9
0
        /// <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));
            }*/
        }
Ejemplo n.º 10
0
        /// <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();
        }
Ejemplo n.º 11
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();
        }