Esempio n. 1
0
 public double GetSolorElevation(Sun sun, Windows win, double time)
 {
     return(Math.Asin(
                Math.Sin(sun.Angle) *
                Math.Sin(win.Latitude)
                + Math.Cos(sun.Angle) *
                Math.Cos(win.Latitude) *
                Math.Cos(angle2Rad(15 * time + rad2Angle(win.Longitude) - 300))
                ));
 }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="anaTimePeriod"></param>
        /// <param name="win"></param>
        /// <param name="sun"></param>
        /// <param name="influencedLine"></param>
        /// <returns></returns>
        internal string AddInfluencedTime(
            AnalysisTimePeriod anaTimePeriod,
            Windows win,
            Sun sun,
            IrraditedBuilding irraditedBuiding)
        {
            Dictionary <string, int> partialInfTimeTable = new Dictionary <string, int>();

            double startTime, endTime, interval;

            startTime = dataTime2Hour(anaTimePeriod.StartTime);
            endTime   = dataTime2Hour(anaTimePeriod.EndTime);
            interval  = anaTimePeriod.IntervalInHour;

            double now;

            for (now = startTime; now <= endTime; now += interval)
            {
                double h0    = sun.CalcElevation(win.Latitude, win.Longitude, now);
                double alpha = sun.CalcAzimuth(win.Latitude, win.Longitude, now);

                if (h0 <= 0 ||
                    (alpha + win.Direction >= Math.PI / 2 && win.Direction != Math.PI) ||
                    (alpha + win.Direction <= -1 * Math.PI / 2 && win.Direction != Math.PI) ||
                    (win.Direction == Math.PI &&
                     (alpha + win.Direction <= 1.50 * Math.PI) &&
                     (alpha + win.Direction >= Math.PI / 2.0)
                    ))
                {
                    int cnt = partialInfTimeTable.Count;
                    if (cnt == 0 || partialInfTimeTable.ElementAt(cnt - 1).Value != 0)
                    {
                        partialInfTimeTable.Add(convertTimeDouble2String(now), 0);
                    }
                }
                else
                {
                    ed.WriteMessage("\n Time : " + convertTimeDouble2String(now) + " ");
                    Point3dCollection points = GetReflectedLinePoints(win, sun);
                    //irraditedBuiding.Sun = sun;
                    double dist = irraditedBuiding.midP2LineInDirection(win.Entity, points[0] - points[1]);
                    irraditedBuiding.AngleOfBuildingGap       = Math.Atan((win.Top - irraditedBuiding.Height) / dist);
                    irraditedBuiding.AngleOfIrraditedBuilding = Math.Atan(irraditedBuiding.Height / dist);
                    irraditedBuiding.IrraditedStatus          = irraditedBuiding.GetIrraditedStatus(points, sun.Elevation);

                    PartialTimePeriod(points, irraditedBuiding, now, partialInfTimeTable);
                }
            }
            return(convertDict2String(partialInfTimeTable, endTime));
        }
Esempio n. 3
0
        public Point3dCollection GetReflectedLinePoints(Windows win, Sun sun)
        {
            Geometry          geometry = new Geometry();
            Point3dCollection points   = new Point3dCollection();

            points.Add(geometry.getReflectedLinePoint_rad(
                           win.Entity.StartPoint,
                           win.Bottom,
                           sun.Elevation,
                           sun.Azimuth,
                           win.Direction
                           ));

            points.Add(geometry.getReflectedLinePoint_rad(
                           win.Entity.StartPoint,
                           win.Top,
                           sun.Elevation,
                           sun.Azimuth,
                           win.Direction
                           ));

            points.Add(geometry.getReflectedLinePoint_rad(
                           win.Entity.EndPoint,
                           win.Top,
                           sun.Elevation,
                           sun.Azimuth,
                           win.Direction
                           ));

            points.Add(geometry.getReflectedLinePoint_rad(
                           win.Entity.EndPoint,
                           win.Top,
                           sun.Elevation,
                           sun.Azimuth,
                           win.Direction
                           ));

            return(points);
        }
Esempio n. 4
0
        /// <summary>
        /// 多天 - 添加日期
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            //////////////////////  Input Test   /////////////////////
            if (entity == null)
            {
                MessageBox.Show("选择幕墙边");
                return;
            }
            if (textBoxSurfaceReflectivity.Text == "")
            {
                MessageBox.Show("输入材料表面发射率");
                return;
            }


            //////////////////////////////////////////////////////////

            Geometry geometry = new Geometry();

            string[] row = new string[dataGridView1.ColumnCount];
            row[0] = "";
            row[1] = dateTimePickerAddDate.Value.ToString("M");
            row[2] = dateTimePickerAddStart.Value.ToString("HH:mm") + "-" +
                     dateTimePickerAddEnd.Value.ToString("HH:mm");

            /////////////////////////////////////////////////////////
            AnalysisTimePeriod anaTimePeriod = new AnalysisTimePeriod();

            anaTimePeriod.Date = dateTimePickerAddDate.Value;


            anaTimePeriod.StartTime      = dateTimePickerAddStart.Value;
            anaTimePeriod.EndTime        = dateTimePickerAddEnd.Value;
            anaTimePeriod.IntervalInHour = 5.0 / 3600;
            //ed.WriteMessage("Analysis Time Period - Month :" + anaTimePeriod.Month);

            int month = dateTimePickerAddDate.Value.Month - 1;
            int day   = dateTimePickerAddDate.Value.Day - 1;

            double startTime = formServices.dataTimePicker2Hour(dateTimePickerAddStart);
            double endTime   = formServices.dataTimePicker2Hour(dateTimePickerAddEnd);
            double interval  = 5.0 / 3600; // time interval related to prcision

            /////////////////////////////////////////////////////////
            Windows win = new Windows();

            win.Reflectivity = Convert.ToDouble(textBoxSurfaceReflectivity.Text);
            win.Entity       = (Line)entity;
            win.Direction    = geometry.angle2Rad(geometry.getWindowsDirectionAngle((Line)entity, comboBoxWindowsDirection2));
            win.Bottom       = GetWindowsDownHeight();
            win.Top          = GetWindowsUpHeight();
            win.Latitude     = geometry.angle2Rad(getLatitudeAngle());
            win.Longitude    = geometry.angle2Rad(getLongitudeAngle());

            double surfaceReflectivity   = Convert.ToDouble(textBoxSurfaceReflectivity.Text);
            double windowsDirectionAngle = geometry.getWindowsDirectionAngle((Line)entity, comboBoxWindowsDirection2);

            row[3] = addWindowsDirectionName();

            /////////////
            Sun sun = new Sun();

            sun.Angle = geometry.angle2Rad(
                constantValue.angleSun[anaTimePeriod.Date.Month - 1, anaTimePeriod.Date.Day - 1]
                );


            Line influencedLine = (Line)influencedEntity;
            Line windowsLine    = (Line)entity;

            //row[4] = geometry.AddInfluencedTime2(anaTimePeriod, win, sun, influencedLine);

            IrraditedBuilding irraditedBuiding = new IrraditedBuilding();

            if (influencedEntity != null)
            {
                irraditedBuiding.Entity = (Line)influencedEntity;
                irraditedBuiding.Height = Convert.ToDouble(textBoxInfluencedBuildingHeight.Text);

                row[4] = formServices.AddInfluencedTime(anaTimePeriod, win, sun, irraditedBuiding);
            }

            /*
             * row[4] = geometry.AddInfluencedTime(
             *  month,
             *  day,
             *  startTime,
             *  endTime,
             *  interval,
             *  geometry.angle2Rad(constantValue.angleSun[month, day]),
             *  geometry.angle2Rad(getLatitudeAngle()),
             *  geometry.angle2Rad(getLongitudeAngle()),
             *  geometry.angle2Rad(windowsDirectionAngle),
             *  getWindowsDownHeight(),
             *  getWindowsUpHeight(),
             *  windowsLine,
             *  influencedLine);
             */



            row[5] = geometry.getSunReflectedLightAngleInterval(
                month,
                day,
                startTime,
                endTime,
                interval,
                constantValue.angleSun[month, day],
                getLatitudeAngle(),
                getLongitudeAngle(),
                windowsDirectionAngle);

            row[6] = geometry.getReflectedLightAngleInterval(
                month,
                day,
                startTime,
                endTime,
                interval,
                constantValue.angleSun[month, day],
                getLatitudeAngle(),
                getLongitudeAngle());

            row[7] = geometry.getLuminanceInterval(
                month,
                day,
                startTime,
                endTime,
                interval,
                surfaceReflectivity,
                constantValue.angleSun[month, day],
                getLatitudeAngle(),
                getLongitudeAngle());

            dataGridView1.Rows.Add(row);
        }