Solvers
Dynamic solver
In a dynamic calculation, each components "DynamicCalculation" method is executed once per time step.
Discrete Solver
When using a discrete solver, each component is added to time step 0.
SimulationEnvironment environment = new SimulationEnvironment();
DiscreteSolver discreteSolver = new DiscreteSolver(environment);// (1)
Sine sine = new Sine(environment, solver);
discreteSolver.AddEvent(sine); // (2)
discreteSolver.AddEventAtTime(sine, 20); // (3)
solver.CalculateTo(100);
- Create the discrete solver
- Add an event for sine at the current time step
- Add an event for sine at time step 20
Further events have to be added. This are the possible ways to add events:
-
DiscreteSolver/AddEvent(SimulationBase simulationBase)
If a component should add a event in the same simulation time the solvers AddEvent can be used.
-
DiscreteSolver/AddEventAtTime(SimulationBase simulationBase, long simulationTime)
Similar to the first variant, however, a time can be specified
-
Connection changed
If two components are connected and the value changes, an event is automatically added for the connected component. To recognize a change the C# Equals method is used on the objects.