Пример #1
0
 /// <summary>
 /// Tries to construct a power for <paramref name="currentSource"/>, returns true on success
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 private bool TryConstructPower(ICurrentSource currentSource)
 {
     return(false);
     // TODO: Adapt for new current resolution
     //// Try to get voltage drop across the element
     //if (_VoltageDrops.TryGet(currentSource, out var voltageDrop))
     //{
     //	// If successful, create a new power signal based on it, cache it
     //	CachePower(currentSource, new CharacteristicValuesPowerSignal(
     //		// Minimum power (the maximum supplied or the least dissipated, depending on actual values)
     //		// It's the minimum voltage drop minus twice DC voltage drop times current. (Minimum already has +VDC in it so in order
     //		// to have -VDC in total there's -2VDC. We need to subtract DC due to passive sign convention)
     //		(voltageDrop.Interpreter.Maximum() - 2 * voltageDrop.DC) * currentSource.ProducedCurrent,
     //		// Maximum power (the maximum dissipated or the least supplied, depending on actual values)
     //		// It's the maximum voltage drop minus twice DC voltage drop times current. (Maximum already has +VDC in it so in order
     //		// to have -VDC in total there's -2VDC. We need to subtract DC due to passive sign convention)
     //		(voltageDrop.Interpreter.Maximum() - 2 * voltageDrop.DC) * currentSource.ProducedCurrent,
     //		// Average is negative voltage drop times produced current (to abide passive sign convention)
     //		-voltageDrop.DC * currentSource.ProducedCurrent));
     //
     //	// And return success
     //	return true;
     //}
     //else
     //{
     //	// Return failure
     //	return false;
     //}
 }
Пример #2
0
 /// <summary>
 /// Gets information about power on an <see cref="ICurrentSource"/>
 /// </summary>
 /// <param name="voltageDrop"></param>
 /// <param name="currentSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(ICurrentSource currentSource, bool voltageBA) =>
 // Check if power can be enabled and if it can be fetched, if so return it, otherwise return null
 TryEnablePower(currentSource) && _Cache.TryGetValue(currentSource, out var power) ? power : null;
Пример #3
0
 /// <summary>
 /// Returns true if power for <paramref name="currentSource"/> can be obtained from <see cref="_Cache"/>
 /// </summary>
 /// <param name="currentSource"></param>
 /// <returns></returns>
 private bool TryEnablePower(ICurrentSource currentSource) =>
 // Check if the cache already contains an entry, otherwise try to construct it
 _Cache.ContainsKey(currentSource) || TryConstructPower(currentSource);
Пример #4
0
 /// <summary>
 /// Gets information about power on an <see cref="ICurrentSource"/>
 /// </summary>
 /// <param name="voltageDrop"></param>
 /// <param name="currentSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(ICurrentSource currentSource, bool voltageBA) =>
 // Check if power can be enabled and if it can be fetched, if so return it, otherwise return null
 TryEnablePower(currentSource, voltageBA) &&
 _Cache.TryGetValue(Tuple.Create <IBaseComponent, bool>(currentSource, voltageBA), out var power) ? power.Item2 : null;
Пример #5
0
 public PCSource(string name, Point3D position, ICurrentSource basesource, double startT = 0.0, double pulseT = 1.0, double pulserestT = 1.0, int pulses = 10, double amplitude = 1.0, bool on = true)
     : base(name, position, amplitude, on)
 {
     this.basesource = basesource;
     this.startT = startT;
     this.pulseT = pulseT;
     this.pulserestT = pulserestT;
     this.pulses = pulses;
     ispulserested = true;
 }
Пример #6
0
 /// <summary>
 /// Returns null
 /// </summary>
 /// <param name="voltageDrop"></param>
 /// <param name="currentSource"></param>
 /// <returns></returns>
 public ISignalInformation Get(ICurrentSource currentSource, bool voltageBA) => null;
Пример #7
0
Файл: MP.cs Проект: babaq/Soul
 public void InjectedFrom(ICurrentSource currentsource)
 {
     if (!this.CurrentSources.ContainsValue(currentsource))
     {
         this.CurrentSources.Add(currentsource.ID, currentsource);
     }
 }