/// <summary> /// Read the voltage and write to the output /// </summary> /// <param name="stream">Stream</param> /// <param name="data">Simulation data</param> public override double Extract(SimulationData data) { Voltagesource vsrc = (Voltagesource)data.GetObject(Source); if (data.Circuit.State.Domain == Circuits.CircuitState.DomainTypes.Frequency || data.Circuit.State.Domain == Circuits.CircuitState.DomainTypes.Laplace) { return(vsrc.GetComplexCurrent(data.Circuit).Real); } else { return(vsrc.GetCurrent(data.Circuit)); } }
/// <summary> /// Extract /// </summary> /// <param name="data"></param> /// <returns></returns> public override double Extract(SimulationData data) { Voltagesource vsrc = (Voltagesource)data.GetObject(Source); switch (data.Circuit.State.Domain) { case CircuitState.DomainTypes.Frequency: case CircuitState.DomainTypes.Laplace: return(vsrc.GetComplexCurrent(data.Circuit).Magnitude); default: return(vsrc.GetCurrent(data.Circuit)); } }
/// <summary> /// Extract /// </summary> /// <param name="data"></param> /// <returns></returns> public override double Extract(SimulationData data) { Voltagesource vsrc = (Voltagesource)data.GetObject(Source); switch (data.Circuit.State.Domain) { case CircuitState.DomainTypes.Frequency: case CircuitState.DomainTypes.Laplace: Complex c = vsrc.GetComplexCurrent(data.Circuit); return(10.0 * Math.Log10(c.Real * c.Real + c.Imaginary + c.Imaginary)); default: return(20.0 * Math.Log10(vsrc.GetCurrent(data.Circuit))); } }