public override bool Accepts(SystemState state) //fix this to be a dependency function { HSFProfile <T> prof = state.GetProfile(_key); switch (Type) { case ConstraintType.FAIL_IF_HIGHER: return((dynamic)prof.Max() < _value); case ConstraintType.FAIL_IF_HIGHER_OR_EQUAL: return((dynamic)prof.Max() <= _value); case ConstraintType.FAIL_IF_LOWER: return((dynamic)prof.Max() > _value); case ConstraintType.FAIL_IF_LOWER_OR_EQUAL: return((dynamic)prof.Max() >= _value); case ConstraintType.FAIL_IF_EQUAL: return((dynamic)prof.Max() != _value); case ConstraintType.FAIL_IF_NOT_EQUAL: return((dynamic)prof.Max() == _value); } return(true); }
public void TemplatedGetProfileUnitTest() { SystemState state = new SystemState(); HSFProfile<int> intProf = new HSFProfile<int>(0, 1); intProf.Add(1, 2); intProf.Add(2, -1); StateVarKey<int> intKey = new StateVarKey<int>("testIntVar"); state.SetProfile(intKey, intProf); HSFProfile<double> doubleProf = new HSFProfile<double>(0, 1); doubleProf.Add(1, 2); doubleProf.Add(2, -1); StateVarKey<double> doubleKey = new StateVarKey<double>("testDoubleVar"); state.SetProfile(doubleKey, doubleProf); HSFProfile<Matrix<double>> matrixProf = new HSFProfile<Matrix<double>>(0, new Matrix<double>(1, 2, 1)); matrixProf.Add(1, new Matrix<double>(1, 2, 2)); matrixProf.Add(2, new Matrix<double>(1, 2, -1)); var matrixKey = new StateVarKey<Matrix<double>>("testMatrixVar"); state.SetProfile(matrixKey, matrixProf); HSFProfile<int> newIntProf = state.GetProfile(intKey); HSFProfile<double> newDoubleProf = state.GetProfile(doubleKey); HSFProfile<Matrix<double>> newMatrixProf = state.GetProfile(matrixKey); Console.WriteLine(); }
/// <summary> /// Dependecy Function for the power subsystem /// </summary> /// <param name="currentState"></param> /// <returns></returns> HSFProfile <double> POWERSUB_PowerProfile_SSDRSUB(Event currentEvent) { HSFProfile <double> prof1 = new HSFProfile <double>(); prof1[currentEvent.GetEventStart(Asset)] = 15; return(prof1); }
public override bool Accepts(SystemState state) { // use dynamic in getProfile() HSFProfile <T> prof = state.GetProfile(_key); switch (Type) { case ConstraintType.FAIL_IF_HIGHER: return((dynamic)prof.Max() < _value); case ConstraintType.FAIL_IF_HIGHER_OR_EQUAL: return((dynamic)prof.Max() <= _value); case ConstraintType.FAIL_IF_LOWER: return((dynamic)prof.Max() > _value); case ConstraintType.FAIL_IF_LOWER_OR_EQUAL: return((dynamic)prof.Max() >= _value); case ConstraintType.FAIL_IF_EQUAL: return((dynamic)prof.Max() != _value); case ConstraintType.FAIL_IF_NOT_EQUAL: return((dynamic)prof.Max() == _value); } return(true); }
/// <summary> /// Dependecy function for the power subsystem /// </summary> /// <param name="currentEvent"></param> /// <returns></returns> public HSFProfile <double> POWERSUB_PowerProfile_ADCSSUB(Event currentEvent) { HSFProfile <double> prof1 = new HSFProfile <double>(); prof1[currentEvent.GetEventStart(Asset)] = 40; prof1[currentEvent.GetTaskStart(Asset)] = 60; prof1[currentEvent.GetTaskEnd(Asset)] = 40; return(prof1); }
HSFProfile <double> POWERSUB_PowerProfile_EOSENSORSUB(Event currentEvent) { HSFProfile <double> prof1 = new HSFProfile <double>(); prof1[currentEvent.GetEventStart(Asset)] = 10; if (currentEvent.State.getValueAtTime(EOON_KEY, currentEvent.GetTaskStart(Asset)).Value) { prof1[currentEvent.GetTaskStart(Asset)] = 60; prof1[currentEvent.GetTaskEnd(Asset)] = 10; } return(prof1); }
/// <summary> /// Dependecy function for the ssdr subsystem /// </summary> /// <param name="currentEvent"></param> /// <returns></returns> HSFProfile <double> COMMSUB_DataRateProfile_SSDRSUB(Event currentEvent) { double datarate = 5000 * (currentEvent.State.getValueAtTime(DATABUFFERRATIO_KEY, currentEvent.GetTaskStart(Asset)).Value - currentEvent.State.getValueAtTime(DATABUFFERRATIO_KEY, currentEvent.GetTaskEnd(Asset)).Value) / (currentEvent.GetTaskEnd(Asset) - currentEvent.GetTaskStart(Asset)); HSFProfile <double> prof1 = new HSFProfile <double>(); if (datarate != 0) { prof1[currentEvent.GetTaskStart(Asset)] = datarate; prof1[currentEvent.GetTaskEnd(Asset)] = 0; } return(prof1); }
/// <summary> /// Default Dependency Collector simply sums the results of the dependecy functions /// </summary> /// <param name="currentState"></param> /// <returns></returns> protected HSFProfile<double> DependencyCollector(Event currentEvent) { if (SubsystemDependencyFunctions.Count == 0) throw new MissingMemberException("You may not call the dependency collector in your can perform because you have not specified any dependency functions for " + Name); HSFProfile<double> outProf = new HSFProfile<double>(); foreach (var dep in SubsystemDependencyFunctions) { HSFProfile<double> temp = (HSFProfile<double>)dep.Value.DynamicInvoke(currentEvent); outProf = outProf + temp; } return outProf; }
/** * Adds a boolean Profile to the state with the given key. If no Profile exists, a new Profile is created * with the corresponding key. If a Profile exists with that key, the Profile is appended onto the end of the Profile. * @param key The key corresponding to the state variable. * @param profIn The Profile to be added to the boolean Profile. */ public void addValue(StateVarKey <Matrix <double> > key, HSFProfile <Matrix <double> > profIn) { HSFProfile <Matrix <double> > valueOut; if (!Mdata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Mdata.Add(key, profIn); } else // Otherwise, add this data point to the existing Profile. { valueOut.Add(profIn); } }
/// <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)) { return(false); } if (_task.Type == TaskType.IMAGING) { double ts = proposedEvent.GetTaskStart(Asset); double te = proposedEvent.GetTaskEnd(Asset); double oldbufferratio = _newState.GetLastValue(Dkeys[0]).Value; Delegate DepCollector; SubsystemDependencyFunctions.TryGetValue("DepCollector", out DepCollector); HSFProfile <double> newdataratein = ((HSFProfile <double>)DepCollector.DynamicInvoke(proposedEvent) / _bufferSize); bool exceeded = false; HSFProfile <double> newdataratio = newdataratein.upperLimitIntegrateToProf(ts, te, 1, 1, ref exceeded, 0, oldbufferratio); if (!exceeded) { _newState.AddValue(DATABUFFERRATIO_KEY, newdataratio); return(true); } // TODO: Change to logger Console.WriteLine("SSDR buffer full"); return(false); } else if (_task.Type == TaskType.COMM) { double ts = proposedEvent.GetTaskStart(Asset); proposedEvent.SetTaskEnd(Asset, ts + 60.0); double te = proposedEvent.GetTaskEnd(Asset); double data = _bufferSize * _newState.GetLastValue(Dkeys.First()).Value; double dataqueout = data / 2 > 50 ? data / 2 : data; if (data - dataqueout < 0) { dataqueout = data; } if (dataqueout > 0) { _newState.AddValue(DATABUFFERRATIO_KEY, new KeyValuePair <double, double>(te, (data - dataqueout) / _bufferSize)); } return(true); } return(true); }
/** * Adds a Matrix Profile value pair to the state with the given key. If no Profile exists, a new Profile is created * with the corresponding key. If a Profile exists with that key, the pair is appended onto the end of the Profile. * Ensure that the Profile is still time ordered if this is the case. * @param key The key corresponding to the state variable. * @param pairIn The pair to be added to the matrix Profile. */ public void addValue(StateVarKey <Matrix <double> > key, KeyValuePair <double, Matrix <double> > pairIn) { HSFProfile <Matrix <double> > valueIn = new HSFProfile <Matrix <double> >(pairIn); HSFProfile <Matrix <double> > valueOut; if (!Mdata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Mdata.Add(key, valueIn); } else // Otherwise, add this data point to the existing Profile. { valueOut.Add(pairIn); //TODO: make sure this is ok. was formally iterator.second.data } }
/// <summary> /// Sets the integer Profile in the state with its matching key. If a Profile is found already under /// that key, this will overwrite the old Profile. /// </summary> /// <param name="key"></param> /// <param name="profIn"></param> public void SetProfile(StateVarKey <bool> key, HSFProfile <bool> profIn) { HSFProfile <bool> valueOut; if (!Bdata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Bdata.Add(key, profIn); } else // Otherwise, erase whatever is there, and insert a new one. { Bdata.Remove(key); Bdata.Add(key, profIn); } }
/** * Sets the Matrix Profile in the state with its matching key. If a Profile is found already under * that key, this will overwrite the old Profile. * @param key The Matrix state variable key that is being set.\ * @param profIn The Matrix Profile being saved. */ public void setProfile(StateVarKey <Matrix <double> > key, HSFProfile <Matrix <double> > profIn) { HSFProfile <Matrix <double> > valueOut; if (!Mdata.TryGetValue(key, out valueOut)) // If there's no Profile matching that key, insert a new one. { Mdata.Add(key, profIn); } else // Otherwise, erase whatever is there, and insert a new one. { Mdata.Remove(key); Mdata.Add(key, profIn); } }
/// <summary> /// Override of the canExtend method for the power subsystem /// </summary> /// <param name="newState"></param> /// <param name="universe"></param> /// <param name="evalToTime"></param> /// <returns></returns> public override bool CanExtend(Event proposedEvent, Universe universe, double evalToTime) { double ee = proposedEvent.GetEventEnd(Asset); if (ee > SimParameters.SimEndSeconds) { return(false); } Sun sun = universe.Sun; double te = proposedEvent.State.GetLastValue(DOD_KEY).Key; if (proposedEvent.GetEventEnd(Asset) < evalToTime) { proposedEvent.SetEventEnd(Asset, evalToTime); } // get the dod initial conditions double olddod = proposedEvent.State.GetValueAtTime(DOD_KEY, te).Value; // collect power profile out Delegate DepCollector; SubsystemDependencyFunctions.TryGetValue("DepCollector", out DepCollector); HSFProfile <double> powerOut = (HSFProfile <double>)DepCollector.DynamicInvoke(proposedEvent); // deps->callDoubleDependency("POWERSUB_getPowerProfile"); // collect power profile in DynamicState position = Asset.AssetDynamicState; HSFProfile <double> powerIn = CalcSolarPanelPowerProfile(te, ee, proposedEvent.State, position, universe); // calculate dod rate HSFProfile <double> dodrateofchange = ((powerOut - powerIn) / _batterySize); bool exceeded_lower = false, exceeded_upper = false; double freq = 1.0; HSFProfile <double> dodProf = dodrateofchange.limitIntegrateToProf(te, ee, freq, 0.0, 1.0, ref exceeded_lower, ref exceeded_upper, 0, olddod); if (exceeded_upper) { return(false); } if (dodProf.LastTime() != ee && ee == SimParameters.SimEndSeconds) { dodProf[ee] = dodProf.LastValue(); } proposedEvent.State.AddValue(DOD_KEY, dodProf); return(true); }
/// <summary> /// An override of the subsystem canPerform method /// </summary> /// <param name="oldState"></param> /// <param name="newState"></param> /// <param name="tasks"></param> /// <param name="environment"></param> /// <returns></returns> public override bool canPerform(Event proposedEvent, Universe environment) { if (!base.canPerform(proposedEvent, environment)) { return(false); } if (_task.Type == TaskType.IMAGING) { double ts = proposedEvent.GetTaskStart(Asset); double te = proposedEvent.GetTaskEnd(Asset); double oldbufferratio = _oldState.getLastValue(Dkeys.First()).Value; HSFProfile <double> newdataratein = (DependencyCollector(proposedEvent) / _bufferSize); bool exceeded = false; HSFProfile <double> newdataratio = newdataratein.upperLimitIntegrateToProf(ts, te, 5, 1, ref exceeded, 0, oldbufferratio); if (!exceeded) { _newState.addValue(DATABUFFERRATIO_KEY, newdataratio); return(true); } Logger.Report("SSDR"); return(false); } else if (_task.Type == TaskType.COMM) { double ts = proposedEvent.GetTaskStart(Asset); proposedEvent.SetTaskEnd(Asset, ts + 60.0); double te = proposedEvent.GetTaskEnd(Asset); double data = _bufferSize * _oldState.getLastValue(Dkeys.First()).Value; double dataqueout = data / 2 > 50 ? data / 2 : data; if (data - dataqueout < 0) { dataqueout = data; } if (dataqueout > 0) { _newState.addValue(DATABUFFERRATIO_KEY, new KeyValuePair <double, double>(te, (data - dataqueout) / _bufferSize)); } return(true); } return(true); }
/// <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) { IsEvaluated = true; if (!base.CanPerform(proposedEvent, environment)) { return(false); } if (_task.Type == TaskType.COMM) { HSFProfile <double> newProf = DependencyCollector(proposedEvent); if (!newProf.Empty()) { proposedEvent.State.SetProfile(DATARATE_KEY, newProf); } } return(true); }
/// <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) { double ts = proposedEvent.GetTaskStart(Asset); IsEvaluated = true; if (!base.CanPerform(proposedEvent, environment)) { return(false); } if (_task == null) { return(true); // TODO Is this what we want to do? } if (_task.Type == TaskType.FLYALONG) { HSFProfile <double> newProf = DependencyCollector(proposedEvent); if (!newProf.Empty()) { proposedEvent.State.SetProfile(MEASURE_KEY, newProf); } } Vector gyro = new Vector(3); Vector accel = new Vector(3); try { gyro = Asset.AssetDynamicState.IntegratorParameters.GetValue(new StateVarKey <Vector>(Asset.Name + "." + "gyro")); accel = Asset.AssetDynamicState.IntegratorParameters.GetValue(new StateVarKey <Vector>(Asset.Name + "." + "accel")); } catch (KeyNotFoundException) { Console.WriteLine("Key Not Found"); } Matrix <double> gyr = Gyroscope(gyro); Matrix <double> acc = Accelerometer(accel); Matrix <double> measure = new Matrix <double>(1, 6); measure[1, new MatrixIndex(1, 3)] = acc; measure[1, new MatrixIndex(4, 6)] = gyr; _newState.AddValue(MEASURE_KEY, new HSFProfile <Matrix <double> >(ts, measure)); return(true); }
/// <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); }
/// <summary> /// Override of the canPerform method for the power subsystem /// </summary> /// <param name="oldState"></param> /// <param name="newState"></param> /// <param name="tasks"></param> /// <param name="universe"></param> /// <returns></returns> public override bool CanPerform(Event proposedEvent, Universe universe) { //Make sure all dependent subsystems have been evaluated if (!base.CanPerform(proposedEvent, universe)) { return(false); } double es = proposedEvent.GetEventStart(Asset); double te = proposedEvent.GetTaskEnd(Asset); double ee = proposedEvent.GetEventEnd(Asset); double powerSubPowerOut = 10; if (ee > SimParameters.SimEndSeconds) { Console.WriteLine("Simulation ended"); return(false); } // get the old DOD double olddod = _newState.GetLastValue(Dkeys.First()).Value; // collect power profile out Delegate DepCollector; SubsystemDependencyFunctions.TryGetValue("DepCollector", out DepCollector); HSFProfile <double> powerOut = (HSFProfile <double>)DepCollector.DynamicInvoke(proposedEvent); // deps->callDoubleDependency("POWERSUB_getPowerProfile"); powerOut = powerOut + powerSubPowerOut; // collect power profile in DynamicState position = Asset.AssetDynamicState; HSFProfile <double> powerIn = CalcSolarPanelPowerProfile(es, te, _newState, position, universe); // calculate dod rate HSFProfile <double> dodrateofchange = ((powerOut - powerIn) / _batterySize); bool exceeded = false; double freq = 1.0; HSFProfile <double> dodProf = dodrateofchange.lowerLimitIntegrateToProf(es, te, freq, 0.0, ref exceeded, 0, olddod); _newState.AddValue(DOD_KEY, dodProf); return(true); }
/* * Returns the Matrix Profile for this state and all previous states merged into one Profile * @param key The Matrix state variable key that is being looked up. * @return The full Profile */ public HSFProfile <Matrix <double> > getFullProfile(StateVarKey <Matrix <double> > key) { HSFProfile <Matrix <double> > valueOut = new HSFProfile <Matrix <double> >(); if (Mdata.Count != 0) { // Are there any Profiles in there? if (Mdata.TryGetValue(key, out valueOut)) { //see if our key is in there if (Previous != null) // Check whether we are at the first state { return(HSFProfile <Matrix <double> > .MergeProfiles(valueOut, Previous.getFullProfile(key))); } return(valueOut); } } if (Previous != null) { return(Previous.getFullProfile(key)); // If no data, return profile from previous states } return(valueOut); //return empty profile }
/// <summary> /// Override of the canExtend method for the power subsystem /// </summary> /// <param name="newState"></param> /// <param name="universe"></param> /// <param name="evalToTime"></param> /// <returns></returns> public override bool canExtend(Event proposedEvent, Universe universe, double evalToTime) { double powOut = 65; double ee = proposedEvent.GetEventEnd(Asset); if (ee > SimParameters.SimEndSeconds) { return(false); } Sun sun = universe.Sun; double te = proposedEvent.State.getLastValue(DOD_KEY).Key; if (proposedEvent.GetEventEnd(Asset) < evalToTime) { proposedEvent.SetEventEnd(Asset, evalToTime); } // get the dod initial conditions double olddod = proposedEvent.State.getValueAtTime(DOD_KEY, te).Value; // collect power profile out HSFProfile <double> powerOut = new HSFProfile <double>(te, powOut); // collect power profile in DynamicState position = Asset.AssetDynamicState; HSFProfile <double> powerIn = calcSolarPanelPowerProfile(te, ee, proposedEvent.State, position, universe); // calculate dod rate HSFProfile <double> dodrateofchange = ((powerOut - powerIn) / _batterySize); bool exceeded_lower = false, exceeded_upper = false; double freq = 5.0; HSFProfile <double> dodProf = dodrateofchange.limitIntegrateToProf(te, ee, freq, 0.0, 1.0, ref exceeded_lower, ref exceeded_upper, 0, olddod); if (exceeded_upper) { return(false); } proposedEvent.State.addValue(DOD_KEY, dodProf); return(true); }
public void HSFProfileAddOperatorTest2() { HSFProfile <double> p1 = new HSFProfile <double>(); HSFProfile <double> p2 = new HSFProfile <double>(); p1[0] = 5; p1[25] = 15; p2[20] = 4; p2[30] = 12; HSFProfile <double> p3 = new HSFProfile <double>(); p3 = p1 + p2; HSFProfile <double> result = new HSFProfile <double>(); result[0] = 5; result[20] = 9; result[25] = 19; result[30] = 27; Assert.AreEqual(result, p3); }
public void TemplatedGetProfileUnitTest() { SystemState state = new SystemState(); HSFProfile <int> intProf = new HSFProfile <int>(0, 1); intProf.Add(1, 2); intProf.Add(2, -1); StateVarKey <int> intKey = new StateVarKey <int>("testIntVar"); state.setProfile(intKey, intProf); HSFProfile <double> doubleProf = new HSFProfile <double>(0, 1); doubleProf.Add(1, 2); doubleProf.Add(2, -1); StateVarKey <double> doubleKey = new StateVarKey <double>("testDoubleVar"); state.setProfile(doubleKey, doubleProf); HSFProfile <Matrix <double> > matrixProf = new HSFProfile <Matrix <double> >(0, new Matrix <double>(1, 2, 1)); matrixProf.Add(1, new Matrix <double>(1, 2, 2)); matrixProf.Add(2, new Matrix <double>(1, 2, -1)); var matrixKey = new StateVarKey <Matrix <double> >("testMatrixVar"); state.setProfile(matrixKey, matrixProf); HSFProfile <int> newIntProf = state.GetProfile(intKey); HSFProfile <double> newDoubleProf = state.GetProfile(doubleKey); HSFProfile <Matrix <double> > newMatrixProf = state.GetProfile(matrixKey); Console.WriteLine(); }
/// <summary> /// Dependecy function for the power subsystem /// </summary> /// <param name="currentEvent"></param> /// <returns></returns> public HSFProfile<double> POWERSUB_PowerProfile_ADCSSUB(Event currentEvent) { HSFProfile<double> prof1 = new HSFProfile<double>(); prof1[currentEvent.GetEventStart(Asset)] = 40; prof1[currentEvent.GetTaskStart(Asset)] = 60; prof1[currentEvent.GetTaskEnd(Asset)] = 40; return prof1; }
/// <summary> /// Dependecy Function for the power subsystem /// </summary> /// <param name="currentState"></param> /// <returns></returns> public HSFProfile<double> POWERSUB_PowerProfile_SSDRSUB(Event currentEvent) { HSFProfile<double> prof1 = new HSFProfile<double>(); prof1[currentEvent.GetEventStart(Asset)] = 15; return prof1; }
/// <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; }
/// <summary> /// Dependency Function for Power Subsystem /// </summary> /// <param name="currentEvent"></param> /// <returns></returns> public HSFProfile<double> POWERSUB_PowerProfile_EOSENSORSUB(Event currentEvent) { HSFProfile<double> prof1 = new HSFProfile<double>(); prof1[currentEvent.GetEventStart(Asset)] = 10; if (currentEvent.State.GetValueAtTime(EOON_KEY, currentEvent.GetTaskStart(Asset)).Value) { prof1[currentEvent.GetTaskStart(Asset)] = 60; prof1[currentEvent.GetTaskEnd(Asset)] = 10; } return prof1; }
/// <summary> /// Default Dependency Collector simply sums the results of the dependecy functions /// </summary> /// <param name="currentState"></param> /// <returns></returns> public virtual HSFProfile<double> DependencyCollector(Event currentEvent) { if (SubsystemDependencyFunctions.Count == 0) throw new MissingMemberException("You may not call the dependency collector in your can perform because you have not specified any dependency functions for " + Name); HSFProfile<double> outProf = new HSFProfile<double>(); foreach (var dep in SubsystemDependencyFunctions) { if (!dep.Key.Equals("DepCollector")) { HSFProfile<double> temp = (HSFProfile<double>)dep.Value.DynamicInvoke(currentEvent); outProf = outProf + temp; } } return outProf; }
/// <summary> /// Dependecy function for the ssdr subsystem /// </summary> /// <param name="currentEvent"></param> /// <returns></returns> public HSFProfile<double> COMMSUB_DataRateProfile_SSDRSUB(Event currentEvent) { double datarate = 5000 * (currentEvent.State.GetValueAtTime(DATABUFFERRATIO_KEY, currentEvent.GetTaskStart(Asset)).Value - currentEvent.State.GetValueAtTime(DATABUFFERRATIO_KEY, currentEvent.GetTaskEnd(Asset)).Value) / (currentEvent.GetTaskEnd(Asset) - currentEvent.GetTaskStart(Asset)); HSFProfile<double> prof1 = new HSFProfile<double>(); if (datarate != 0) { prof1[currentEvent.GetTaskStart(Asset)] = datarate; prof1[currentEvent.GetTaskEnd(Asset)] = 0; } return prof1; }