Esempio n. 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;
 }
Esempio n. 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;
        }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 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;
 }
Esempio n. 6
0
 public Access(Asset asset, Task task)
 {
     Asset = asset;
     Task = task;
 }
Esempio n. 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;
        }