예제 #1
0
 public HSFLogData(Constraint constraint, Subsystem subsystem, Task task, double value, double timeInfo)
 {
     AssetName = constraint.Name;
     SubName = subsystem.Name;
     TaskName = task.Type.ToString();
     TargetName = task.Target.Name;
     ConstraintName = constraint.Name;
     Violation = "Constraint Failed";
     Value = value;
     TimeInfo = timeInfo;
 }
예제 #2
0
        public double TimeInfo { get; private set; }      // Time information 


        public HSFLogData(Subsystem subsystem, Task task, string violation, double value, double timeInfo)
        {
            AssetName = subsystem.Asset.Name;
            SubName = subsystem.Name;
            TaskName = task.Type.ToString();
            TargetName = task.Target.Name;
            ConstraintName = null;
            Violation = violation;
            Value = value;
            TimeInfo = timeInfo;
        }
예제 #3
0
 /// <summary>
 /// The default canPerform method. 
 /// Should be used to check if all dependent subsystems can perform and extended by subsystem implementations.
 /// </summary>
 /// <param name="oldState"></param>
 /// <param name="newState"></param>
 /// <param name="tasks"></param>
 /// <param name="environment"></param>
 /// <returns></returns>
 public virtual bool CanPerform(Event proposedEvent, Universe environment)
 {
     foreach (var sub in DependentSubsystems)
     {
         if (!sub.IsEvaluated)// && !sub.GetType().Equals(typeof(ScriptedSubsystem)))
             if (sub.CanPerform(proposedEvent, environment) == false)
                 return false;
     }
     _task = proposedEvent.GetAssetTask(Asset); //Find the correct task for the subsystem
     _newState = proposedEvent.State;
     IsEvaluated = true;
     return true;
 }
예제 #4
0
 /// <summary>
 /// Returns the number of times the specified task has been completed in this schedule for a specific asset
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public int timesCompletedTask(Task task)
 {
     int count = 0;
     foreach (Event eit in Events)
     {
        if (eit.Tasks.ContainsValue(task))
             count++;
     }
     return count;
 }
예제 #5
0
 /// <summary>
 /// Returns the number of times the specified task has been completed in this schedule for a specific asset
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public int timesCompletedTask(Asset asset, Task task)
 {
     int count = 0;
     KeyValuePair<Asset, Task> search = new KeyValuePair<Asset, Task>(asset, task);
     foreach(Event eit in Events)
     {
         foreach(KeyValuePair<Asset, Task> pair in eit.Tasks)
         {
             if (pair.Equals(search))
                 count++;
         }
     }
     return count;
 }
예제 #6
0
파일: Access.cs 프로젝트: emehiel/Horizon
 public Access(Asset asset, Task task)
 {
     Asset = asset;
     Task = task;
 }
예제 #7
0
        public override bool CanPerform(Event proposedEvent,  Universe environment)
        {
            if (IsEvaluated)
                return true;

            // Check all dependent subsystems
            foreach (var sub in DependentSubsystems)
            {
                if (!sub.IsEvaluated)
                    if (sub.CanPerform(proposedEvent, environment) == false)
                        return false;
            }

            _task = proposedEvent.GetAssetTask(Asset); //Find the correct task for the subsystem
            _newState = proposedEvent.State;
            IsEvaluated = true;

            // Call the can perform method that is in the python class
            dynamic perform = _pythonInstance.CanPerform(proposedEvent, environment);
            return (bool)perform;
        }