Show / Hide Table of Contents

Class SimulationHelper

Helper methods for extracting data from an ISimulation.

Inheritance
object
SimulationHelper
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Simulations
Assembly: SpiceSharp.dll
Syntax
public static class SimulationHelper

Methods

GetComplexCurrent(ISimulation, Reference)

Gets a complex current from a simulation.

Declaration
public static Complex GetComplexCurrent(this ISimulation simulation, Reference entity)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The entity reference.

Returns
Type Description
Complex

Returns the value of the current.

Exceptions
Type Condition
ArgumentException

Thrown if the branch current could not be found.

GetComplexProperty(ISimulation, Reference, string)

Gets a real property value from an entity behavior in a simulation.

Declaration
public static Complex GetComplexProperty(this ISimulation simulation, Reference entity, string propertyName)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity.

string propertyName

The property name.

Returns
Type Description
Complex

Returns the value of the property.

Exceptions
Type Condition
ArgumentException

Thrown if the entity or property could not be found.

GetComplexVoltage(ISimulation, Reference)

Gets a complex voltage from a simulation.

Declaration
public static Complex GetComplexVoltage(this ISimulation simulation, Reference name)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference name

The reference to the node.

Returns
Type Description
Complex

Returns the value of the voltage.

Exceptions
Type Condition
ArgumentException

Thrown if the voltage could not be found.

GetComplexVoltage(ISimulation, Reference, Reference)

Gets a complex voltage from a simulation.

Declaration
public static Complex GetComplexVoltage(this ISimulation simulation, Reference positive, Reference negative)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference positive

The positive node reference.

Reference negative

The negative node reference.

Returns
Type Description
Complex

Returns the value of the voltage.

Exceptions
Type Condition
ArgumentException

Thrown if the voltage could not be found.

GetCurrent(ISimulation, Reference)

Gets a real current from a simulation.

Declaration
public static double GetCurrent(this ISimulation simulation, Reference entity)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The entity reference.

Returns
Type Description
double

Returns the value of the current.

Exceptions
Type Condition
ArgumentException

Thrown if the branch current could not be found.

GetProperty(ISimulation, Reference, string)

Gets a real property value from an entity behavior in a simulation.

Declaration
public static double GetProperty(this ISimulation simulation, Reference entity, string propertyName)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity.

string propertyName

The property name.

Returns
Type Description
double

Returns the value of the property.

Exceptions
Type Condition
ArgumentException

Thrown if the entity or property could not be found.

GetVoltage(ISimulation, Reference)

Gets a real voltage from a simulation.

Declaration
public static double GetVoltage(this ISimulation simulation, Reference name)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference name

The reference to the node.

Returns
Type Description
double

Returns the value of the voltage.

Exceptions
Type Condition
ArgumentException

Thrown if the voltage could not be found.

GetVoltage(ISimulation, Reference, Reference)

Gets a real voltage from a simulation.

Declaration
public static double GetVoltage(this ISimulation simulation, Reference positive, Reference negative)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference positive

The positive node reference.

Reference negative

The negative node reference.

Returns
Type Description
double

Returns the value of the voltage.

Exceptions
Type Condition
ArgumentException

Thrown if the voltage could not be found.

RunToEnd(ISimulation, IEntityCollection, IDictionary<int, Action>)

Runs a simulation to the end.

Declaration
public static void RunToEnd(this ISimulation simulation, IEntityCollection entities, IDictionary<int, Action> actions = null)
Parameters
Type Name Description
ISimulation simulation

The simulation.

IEntityCollection entities

The entities.

IDictionary<int, Action> actions

The actions for each type of export.

TryGetComplexCurrent(ISimulation, Reference, out Complex)

Tries to get a complex current from a simulation.

Declaration
public static bool TryGetComplexCurrent(this ISimulation simulation, Reference entity, out Complex result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity that defines the branch current.

Complex result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

TryGetComplexProperty(ISimulation, Reference, string, out Complex)

Tries to get a real property value from an entity behavior in a simulation.

Declaration
public static bool TryGetComplexProperty(this ISimulation simulation, Reference entity, string propertyName, out Complex result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity.

string propertyName

The property name.

Complex result

The result.

Returns
Type Description
bool

Returns the property value if found; otherwise, NaN.

TryGetComplexVoltage(ISimulation, Reference, Reference, out Complex)

Tries to get a complex voltage from a simulation.

Declaration
public static bool TryGetComplexVoltage(this ISimulation simulation, Reference positive, Reference negative, out Complex result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference positive

The positive node reference.

Reference negative

The negative node reference.

Complex result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

TryGetComplexVoltage(ISimulation, Reference, out Complex)

Tries to get a complex voltage from a simulation.

Declaration
public static bool TryGetComplexVoltage(this ISimulation simulation, Reference name, out Complex result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference name

The reference to the node.

Complex result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

TryGetCurrent(ISimulation, Reference, out double)

Tries to get a real current from a simulation.

Declaration
public static bool TryGetCurrent(this ISimulation simulation, Reference entity, out double result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity that defines the branch current.

double result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

TryGetProperty(ISimulation, Reference, string, out double)

Tries to get a real property value from an entity behavior in a simulation.

Declaration
public static bool TryGetProperty(this ISimulation simulation, Reference entity, string propertyName, out double result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference entity

The name of the entity.

string propertyName

The property name.

double result

The result.

Returns
Type Description
bool

Returns the property value if found; otherwise, NaN.

TryGetVoltage(ISimulation, Reference, Reference, out double)

Tries to get a real voltage from a simulation.

Declaration
public static bool TryGetVoltage(this ISimulation simulation, Reference positive, Reference negative, out double result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference positive

The positive node reference.

Reference negative

The negative node reference.

double result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

TryGetVoltage(ISimulation, Reference, out double)

Tries to get a real voltage from a simulation.

Declaration
public static bool TryGetVoltage(this ISimulation simulation, Reference name, out double result)
Parameters
Type Name Description
ISimulation simulation

The simulation.

Reference name

The reference to the node.

double result

The result.

Returns
Type Description
bool

Returns true if the voltage was found; otherwise, false.

In this article
Back to top Generated by DocFX