示例#1
0
        /// <summary>
        /// Calculate the solar panel power in over the time of the task
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="state"></param>
        /// <param name="position"></param>
        /// <param name="universe"></param>
        /// <returns></returns>
        protected HSFProfile <double> CalcSolarPanelPowerProfile(double start, double end, SystemState state, DynamicState position, Universe universe)
        {
            // create solar panel profile for this event
            double              freq                   = 5;
            ShadowState         lastShadow             = universe.Sun.castShadowOnPos(position, start);
            HSFProfile <double> solarPanelPowerProfile = new HSFProfile <double>(start, GetSolarPanelPower(lastShadow));

            for (double time = start + freq; time <= end; time += freq)
            {
                ShadowState shadow = universe.Sun.castShadowOnPos(position, time);
                // if the shadow state changes during this step, save the power data
                if (shadow != lastShadow)
                {
                    solarPanelPowerProfile[time] = GetSolarPanelPower(shadow);
                    lastShadow = shadow;
                }
            }
            state.AddValue(POWIN_KEY, solarPanelPowerProfile);
            return(solarPanelPowerProfile);
        }
示例#2
0
文件: Power.cs 项目: emehiel/Horizon
        /// <summary>
        /// Calculate the solar panel power in over the time of the task
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="state"></param>
        /// <param name="position"></param>
        /// <param name="universe"></param>
        /// <returns></returns>
        protected HSFProfile<double> CalcSolarPanelPowerProfile(double start, double end, SystemState state, DynamicState position, Universe universe)
        {
            // create solar panel profile for this event
            double freq = 5;
            ShadowState lastShadow = universe.Sun.castShadowOnPos(position, start);
            HSFProfile<double> solarPanelPowerProfile = new HSFProfile<double>(start, GetSolarPanelPower(lastShadow));

            for (double time = start + freq; time <= end; time += freq)
            {
                ShadowState shadow = universe.Sun.castShadowOnPos(position, time);
                // if the shadow state changes during this step, save the power data
                if (shadow != lastShadow)
                {
                    solarPanelPowerProfile[time] = GetSolarPanelPower(shadow);
                    lastShadow = shadow;
                }
            }
            state.AddValue(POWIN_KEY, solarPanelPowerProfile);
            return solarPanelPowerProfile;
        }