Esempio n. 1
0
 /// <summary>
 /// Tries to construct a power for <paramref name="voltageSource"/>, returns true on success
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 private bool TryConstructPower(IDCVoltageSource voltageSource)
 {
     return(false);
     // TODO: Adapt for new current resolution
     //// Try to get voltage drop across the element
     //if (_Currents.TryGet(voltageSource.ActiveComponentIndex, out var current))
     //{
     //	// If successful, create a new power signal based on it, cache it
     //	CachePower(voltageSource, new CharacteristicValuesPowerSignal(
     //		current.Interpreter.Maximum() * voltageSource.ProducedDCVoltage,
     //		current.Interpreter.Minimum() * voltageSource.ProducedDCVoltage,
     //		-current.DC * voltageSource.ProducedDCVoltage));
     //
     //
     //	// And return success
     //	return true;
     //}
     //else
     //{
     //	// Return failure
     //	return false;
     //}
 }
Esempio n. 2
0
 /// <summary>
 /// Gets information about power on an <see cref="IDCVoltageSource"/>
 /// </summary>
 /// <param name="current"></param>
 /// <param name="voltageSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(IDCVoltageSource voltageSource, bool voltageBA) =>
 // Check if power can be enabled and if it can be fetched, if so return it, otherwise return null
 TryEnablePower(voltageSource) && _Cache.TryGetValue(voltageSource, out var power) ? power : null;
Esempio n. 3
0
 /// <summary>
 /// Gets information about power on an <see cref="IDCVoltageSource"/>
 /// </summary>
 /// <param name="current"></param>
 /// <param name="voltageSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(IDCVoltageSource voltageSource, bool voltageBA) =>
 // Check if power can be enabled and if it can be fetched, if so return it, otherwise return null
 TryEnablePower(voltageSource, voltageBA) &&
 _Cache.TryGetValue(Tuple.Create <IBaseComponent, bool>(voltageSource, voltageBA), out var power) ? power.Item2 : null;
Esempio n. 4
0
 /// <summary>
 /// Returns true if power for <paramref name="voltageSource"/> can be obtained from <see cref="_Cache"/>
 /// </summary>
 /// <param name="voltageSource"></param>
 /// <returns></returns>
 private bool TryEnablePower(IDCVoltageSource voltageSource) =>
 // Check if the cache already contains an entry, otherwise try to construct it
 _Cache.ContainsKey(voltageSource) || TryConstructPower(voltageSource);
Esempio n. 5
0
 /// <summary>
 /// Returns null
 /// </summary>
 /// <param name="current"></param>
 /// <param name="voltageSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(IDCVoltageSource voltageSource, bool voltageBA) => null;