Class BiasingSimulation
A class that can bias components.
Inheritance
Implements
Inherited Members
Namespace: SpiceSharp.Simulations
Assembly: SpiceSharp.dll
Syntax
public abstract class BiasingSimulation : Simulation, IBiasingSimulation, ISimulation<IVariable<double>>, ITemperatureSimulation, ISimulation, IParameterSetCollection, IParameterSet, IStateful<ITemperatureSimulationState>, IBehavioral<ITemperatureBehavior>, IBehavioral<IBiasingBehavior>, IBehavioral<IConvergenceBehavior>, IStateful<IBiasingSimulationState>, IStateful<TemperatureSimulationState>, IStateful<IIterationSimulationState>, IStateful, IBehavioral<IBiasingUpdateBehavior>, IBehavioral, IParameterized<BiasingParameters>
Constructors
BiasingSimulation(string)
Initializes a new instance of the BiasingSimulation class.
Declaration
protected BiasingSimulation(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the simulation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Fields
AfterTemperature
Represents the action after doing temperature-dependent calculations.
Declaration
public const int AfterTemperature = 1048576
Field Value
Type | Description |
---|---|
int |
Properties
BiasingParameters
Gets the biasing parameters.
Declaration
public BiasingParameters BiasingParameters { get; }
Property Value
Type | Description |
---|---|
BiasingParameters | The biasing parameters. |
Iteration
Gets the iteration state.
Declaration
protected BiasingSimulation.IterationState Iteration { get; }
Property Value
Type | Description |
---|---|
BiasingSimulation.IterationState | The iteration state. |
ProblemVariable
Gets the variable that causes issues.
Declaration
public IVariable ProblemVariable { get; protected set; }
Property Value
Type | Description |
---|---|
IVariable |
Remarks
This variable can be used to close in on the problem in case of non-convergence.
Statistics
Gets the statistics.
Declaration
public BiasingSimulationStatistics Statistics { get; }
Property Value
Type | Description |
---|---|
BiasingSimulationStatistics | The statistics. |
Methods
CreateBehaviors(IEntityCollection)
Creates all behaviors for the simulation.
Declaration
protected override void CreateBehaviors(IEntityCollection entities)
Parameters
Type | Name | Description |
---|---|---|
IEntityCollection | entities | The entities. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
CreateStates()
Creates all the simulation states for the simulation.
Declaration
protected override void CreateStates()
Overrides
Execute(int)
Executes the simulation.
Declaration
protected override IEnumerable<int> Execute(int mask = 65535)
Parameters
Type | Name | Description |
---|---|---|
int | mask | A bit mask for simulation export identifiers. |
Returns
Type | Description |
---|---|
IEnumerable<int> |
Overrides
Exceptions
Type | Condition |
---|---|
SpiceSharpException | Thrown if the simulation can't continue. |
Finish()
Finish the simulation.
Declaration
protected override void Finish()
Overrides
IsConvergent()
Checks that the solution converges to a solution.
Declaration
protected bool IsConvergent()
Returns
Type | Description |
---|---|
bool |
|
Exceptions
Type | Condition |
---|---|
SpiceSharpException | Thrown if a solution is not a number (NaN). |
Iterate(int)
Iterates towards a solution.
Declaration
protected virtual bool Iterate(int maxIterations)
Parameters
Type | Name | Description |
---|---|---|
int | maxIterations | The maximum allowed iterations. |
Returns
Type | Description |
---|---|
bool |
|
Exceptions
Type | Condition |
---|---|
SpiceSharpException | Thrown if any behavior cannot load the matrix and/or right hand side vector, or if the solution is not a number (NaN). |
SingularException | Thrown if the equation matrix is singular. |
IterateDiagonalGminStepping(int, int)
Iterates to a solution while adding a conductive path to ground on all nodes.
Declaration
protected bool IterateDiagonalGminStepping(int maxIterations, int steps)
Parameters
Type | Name | Description |
---|---|---|
int | maxIterations | The maximum number of iterations per step. |
int | steps | The number of steps. |
Returns
Type | Description |
---|---|
bool |
|
IterateGminStepping(int, int)
Iterates to a solution while shunting PN-junctions with a conductance.
Declaration
protected bool IterateGminStepping(int maxIterations, int steps)
Parameters
Type | Name | Description |
---|---|---|
int | maxIterations | The maximum number of iterations per step. |
int | steps | The number of steps. |
Returns
Type | Description |
---|---|
bool |
|
IterateSourceStepping(int, int)
Iterates to a solution slowly ramping up independent voltages and currents.
Declaration
protected bool IterateSourceStepping(int maxIterations, int steps)
Parameters
Type | Name | Description |
---|---|---|
int | maxIterations | The maximum number of iterations per step. |
int | steps | The number of steps. |
Returns
Type | Description |
---|---|
bool |
|
Load()
Load the current simulation state solver.
Declaration
protected void Load()
Exceptions
Type | Condition |
---|---|
SpiceSharpException | Thrown if any behavior cannot load the matrix or right hand side vector. |
LoadNodeSets(object, LoadStateEventArgs)
Applies nodesets.
Declaration
protected void LoadNodeSets(object sender, LoadStateEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | The object sending the event. |
LoadStateEventArgs | e | The event arguments for loading the convergence aids. |
OnAfterLoad(LoadStateEventArgs)
Raises the AfterLoad event.
Declaration
protected virtual void OnAfterLoad(LoadStateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
LoadStateEventArgs | args | The LoadStateEventArgs instance containing the event data. |
OnBeforeLoad(LoadStateEventArgs)
Raises the BeforeLoad event.
Declaration
protected virtual void OnBeforeLoad(LoadStateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
LoadStateEventArgs | args | The LoadStateEventArgs instance containing the event data. |
Op(int)
Calculates the operating point of the circuit.
Declaration
protected void Op(int maxIterations)
Parameters
Type | Name | Description |
---|---|---|
int | maxIterations | The maximum amount of allowed iterations. |
StoreSolution()
Stores the solution.
Declaration
protected void StoreSolution()
Validate(IEntityCollection)
Validates the input.
Declaration
protected override void Validate(IEntityCollection entities)
Parameters
Type | Name | Description |
---|---|---|
IEntityCollection | entities | The entities. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ValidationFailedException | Thrown if the validation failed. |
Events
AfterLoad
Occurs after loading the matrix and right-hand side vector.
Declaration
public event EventHandler<LoadStateEventArgs> AfterLoad
Event Type
Type | Description |
---|---|
EventHandler<LoadStateEventArgs> |
Remarks
For better performance, you can also create an entity with a low priority that generates a load behavior.
BeforeLoad
Occurs before loading the matrix and right-hand side vector.
Declaration
public event EventHandler<LoadStateEventArgs> BeforeLoad
Event Type
Type | Description |
---|---|
EventHandler<LoadStateEventArgs> |
Remarks
For better performance, you can also create an entity with a high priority that generates a load behavior.