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; }
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; }
/// <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; }
/// <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; }
/// <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; }
public Access(Asset asset, Task task) { Asset = asset; Task = task; }
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; }