コード例 #1
0
ファイル: Antenna.cs プロジェクト: tdroz/antennachanges
        /// <summary>
        /// An override of the Subsystem CanPerform method
        /// </summary>
        /// <param name="proposedEvent"></param>
        /// <param name="environment"></param>
        /// <returns></returns>
        public override bool CanPerform(Event proposedEvent, Universe environment)
        {
            if (base.CanPerform(proposedEvent, environment) == false)
            {
                return(false);
            }
            //double timetoslew = (rand()%5)+8;
            double timetoslew = _timetoslew;

            double es = proposedEvent.GetEventStart(Asset);
            double ts = proposedEvent.GetTaskStart(Asset);
            double te = proposedEvent.GetTaskEnd(Asset);

            if (es + timetoslew > ts)
            {
                if (es + timetoslew > te)
                {
                    // TODO: Change this to Logger
                    //Console.WriteLine("Antenna: Not enough time to slew event start: "+ es + "task end" + te);
                    return(false);
                }
                else
                {
                    ts = es + timetoslew;
                }
            }

            // set task end based upon time to capture
            te = ts + timetocapture;
            proposedEvent.SetTaskEnd(Asset, te);
            // from Brown, Pp. 99
            DynamicState    position               = Asset.AssetDynamicState;
            double          timage                 = ts + timetocapture / 2;
            Matrix <double> m_SC_pos_at_ts_ECI     = position.PositionECI(ts);
            Matrix <double> m_target_pos_at_ts_ECI = _task.Target.DynamicState.PositionECI(ts);
            Matrix <double> m_pv     = m_target_pos_at_ts_ECI - m_SC_pos_at_ts_ECI;
            Matrix <double> pos_norm = -m_SC_pos_at_ts_ECI / Matrix <double> .Norm(-m_SC_pos_at_ts_ECI);

            Matrix <double> pv_norm = m_pv / Matrix <double> .Norm(m_pv);


            double I               = (arc - Math.Sin(arc)) * (Math.Pow(r2, 4) - Math.Pow(r1, 4)) / 8;
            double area            = (Math.Pow(r2, 2) - Math.Pow(r1, 2)) * (Math.PI);
            double volume          = area * L;
            double deltaangle      = Math.Acos(Matrix <double> .Dot(position.PositionECI(te), position.PositionECI(ts))) / (Matrix[System.Double].Norm(position.PositionECI(te)) * Matrix[System.Double].Norm(position.PositionECI(ts)));
            double a               = deltaangle / (Math.Pow(te - ts, 2));
            double M               = density * volume;
            double force           = a * M;
            double finaldeflection = force * Math.Pow(L / 2, 2) * ((5 * (L / 2)) / (6 * E * I));
            double antstress       = (M * L / 2) / I;
            double incidenceang    = 90 - 180 / Math.PI * Math.Acos(Matrix <double> .Dot(pos_norm, pv_norm));

            // set state data
            _newState.AddValue(ANTDATA_KEY, new KeyValuePair <double, double>(timage, incidenceang));
            _newState.AddValue(ANTINCIDENCE_KEY, new KeyValuePair <double, double>(timage, incidenceang));
            _newState.AddValue(ANTSTRESS_KEY, new KeyValuePair <double, double>(timage, incidenceang));

            return(true);
        }
コード例 #2
0
        public override bool canPerform(Event proposedEvent, Universe environment)
        {
            if (!base.canPerform(proposedEvent, environment))
            {
                return(false);
            }
            DynamicState    position     = Asset.AssetDynamicState;
            Matrix <double> assetPosECI  = position.PositionECI(proposedEvent.GetTaskStart(Asset));
            Matrix <double> targetPosECI = _task.Target.DynamicState.PositionECI(proposedEvent.GetTaskStart(Asset));

            return(GeometryUtilities.hasLOS(assetPosECI, targetPosECI));
        }
コード例 #3
0
ファイル: AccessSub.cs プロジェクト: jacksonbalfour/Horizon
        public override bool CanPerform(Event proposedEvent, Domain environment)
        {
            if (!base.CanPerform(proposedEvent, environment))
            {
                return(false);
            }
            DynamicState position     = Asset.AssetDynamicState;
            Vector       assetPosECI  = position.PositionECI(proposedEvent.GetTaskStart(Asset));
            Vector       targetPosECI = _task.Target.DynamicState.PositionECI(proposedEvent.GetTaskStart(Asset));

            return(GeometryUtilities.hasLOS(assetPosECI, targetPosECI));
        }
コード例 #4
0
        /// <summary>
        /// An override of the Subsystem CanPerform method
        /// </summary>
        /// <param name="proposedEvent"></param>
        /// <param name="environment"></param>
        /// <returns></returns>
        public override bool CanPerform(Event proposedEvent, Domain environment)
        {
            if (base.CanPerform(proposedEvent, environment) == false)
            {
                return(false);
            }

            double es = proposedEvent.GetEventStart(Asset);
            double ts = proposedEvent.GetTaskStart(Asset);
            double te = proposedEvent.GetTaskEnd(Asset);

            // from Brown, Pp. 99
            DynamicState    position               = Asset.AssetDynamicState;
            Matrix <double> m_SC_pos_at_ts_ECI     = position.PositionECI(ts);
            Matrix <double> m_target_pos_at_ts_ECI = _task.Target.DynamicState.PositionECI(ts);
            Matrix <double> m_pv = m_target_pos_at_ts_ECI - m_SC_pos_at_ts_ECI;

            Matrix <double> sc_n = m_SC_pos_at_ts_ECI / Matrix <double> .Norm(m_SC_pos_at_ts_ECI);

            Matrix <double> pv_n = m_pv / Matrix <double> .Norm(m_pv);


            double slewAngle = Math.Acos(Matrix <double> .Dot(pv_n, -sc_n)) * 180 / Math.PI;

            //double timetoslew = (rand()%5)+8;
            double timetoslew = slewAngle / _slewRate;

            if (es + timetoslew > ts)
            {
                if (es + timetoslew > te)
                {
                    // TODO: Change this to Logger
                    //Console.WriteLine("ADCS: Not enough time to slew event start: "+ es + "task end" + te);
                    return(false);
                }
                else
                {
                    ts = es + timetoslew;
                }
            }



            // set state data
            _newState.SetProfile(POINTVEC_KEY, new HSFProfile <Matrix <double> >(ts, m_pv));
            proposedEvent.SetTaskStart(Asset, ts);
            return(true);
        }
コード例 #5
0
        public override bool canPerform(Event proposedEvent, Universe environment)
        {
            if (base.canPerform(proposedEvent, environment) == false)
            {
                return(false);
            }
            //double timetoslew = (rand()%5)+8;
            double timetoslew = 10;

            double es = proposedEvent.GetEventStart(Asset);
            double ts = proposedEvent.GetTaskStart(Asset);
            double te = proposedEvent.GetTaskEnd(Asset);

            if (es + timetoslew > ts) //fix event task end!
            {
                if (es + timetoslew > te)
                {
                    Logger.Report("ADCS: Not enough time to slew event start: " + es + "task end" + te);
                    return(false);
                }
                else
                {
                    ts = es + timetoslew;
                }
            }


            // from Brown, Pp. 99
            DynamicState    position               = Asset.AssetDynamicState;
            Matrix <double> m_SC_pos_at_ts_ECI     = position.PositionECI(ts);
            Matrix <double> m_target_pos_at_ts_ECI = _task.Target.DynamicState.PositionECI(ts);
            Matrix <double> m_pv = m_target_pos_at_ts_ECI - m_SC_pos_at_ts_ECI;

            // set state data
            _newState.setProfile(POINTVEC_KEY, new HSFProfile <Matrix <double> >(ts, m_pv));
            proposedEvent.SetTaskStart(Asset, ts);
            return(true);
        }
コード例 #6
0
ファイル: EOSensor.cs プロジェクト: daveasy805/Horizon-1
        public override bool canPerform(Event proposedEvent, Universe environment)
        {
            if (!base.canPerform(proposedEvent, environment))
            {
                return(false);
            }
            if (_task.Type == TaskType.IMAGING)
            {
                //set pixels and time to caputre based on target value
                int    value         = _task.Target.Value;
                double pixels        = _lowQualityPixels;
                double timetocapture = _lowQualityTime;
                if (value <= _highQualityTime && value >= _midQualityTime) //Morgan took out magic numbers
                {
                    pixels        = _midQualityPixels;
                    timetocapture = _midQualityTime;
                }
                if (value > _highQualityTime)
                {
                    pixels        = _highQualityPixels;
                    timetocapture = _highQualityTime;
                }

                // get event start and task start times
                double es = proposedEvent.GetEventStart(Asset);
                double ts = proposedEvent.GetTaskStart(Asset);
                double te = proposedEvent.GetTaskEnd(Asset);
                if (ts > te)
                {
                    Logger.Report("EOSensor lost access");
                    return(false);
                }

                // set task end based upon time to capture
                te = ts + timetocapture;
                proposedEvent.SetTaskEnd(Asset, te);

                // calculate incidence angle
                // from Brown, Pp. 99
                DynamicState    position               = Asset.AssetDynamicState;
                double          timage                 = ts + timetocapture / 2;
                Matrix <double> m_SC_pos_at_tf_ECI     = position.PositionECI(timage);
                Matrix <double> m_target_pos_at_tf_ECI = _task.Target.DynamicState.PositionECI(timage);
                Matrix <double> m_pv     = m_target_pos_at_tf_ECI - m_SC_pos_at_tf_ECI;
                Matrix <double> pos_norm = -m_SC_pos_at_tf_ECI / Matrix <double> .Norm(-m_SC_pos_at_tf_ECI);

                Matrix <double> pv_norm = m_pv / Matrix <double> .Norm(m_pv);

                double incidenceang = 90 - 180 / Math.PI * Math.Acos(Matrix <double> .Dot(pos_norm, pv_norm));

                // set state data
                _newState.addValue(INCIDENCE_KEY, new KeyValuePair <double, double>(timage, incidenceang));
                _newState.addValue(INCIDENCE_KEY, new KeyValuePair <double, double>(timage + 1, 0.0));

                _newState.addValue(PIXELS_KEY, new KeyValuePair <double, double>(timage, pixels));
                _newState.addValue(PIXELS_KEY, new KeyValuePair <double, double>(timage + 1, 0.0));

                _newState.addValue(EOON_KEY, new KeyValuePair <double, bool>(ts, true));
                _newState.addValue(EOON_KEY, new KeyValuePair <double, bool>(te, false));
            }
            return(true);
        }