SimulationWorker Class

Simulation worker is a class that performs the actual simulation, by using the IMike1DController. It handles special log file writing, html summery/error, apv files. It also takes care of running any autocalibration before the actual simulation.

Special behavior can be specified in the SimulationParameters.

Definition

Namespace: DHI.Mike1D.SimLauncher
Assembly: DHI.Mike1D.SimLauncher (in DHI.Mike1D.SimLauncher.dll) Version: 24.0.0.0 (11.1.1.1111)
C#
public class SimulationWorker
Inheritance
Object    SimulationWorker

Constructors

SimulationWorker Constructor. If form is null, then the simulation run in silent mode (no GUI output)

Properties

Controller Controller that the worker is currently working on.
DiagnosticsHandler Diagnostics handler that are used for all diagnostics objects and events.
HtmlErrorLog 
HtmlSummary 
Mike1DData MIKE 1D setup.

This will be populated during Load. It is also possible to provide the Mike1DData and call directly Run.

NumberOfRuns Number of consecutive runs to complete when the user chooses to re-run the calculation. Only relevant for Pipe Design simulations. Default value is 1.
SetupFilePath Path of setup file
SimulationParameters Simulation parameters
WorkerThread 

Methods

CreateSetupfilenameWithID Create a setup file name including the id provided.
DisposeReleases all resources used by the SimulationWorker
DrawTextProgressBar Draw a progress bar at the current cursor position. Be careful not to Console.WriteLine or anything whilst using this to show progress!
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FlipPauseFlag Flip the Pause flag, i.e. if running, make it pause, if paused, make it run.
GetDefaultLogFileName 
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
Load Load the setup
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
ModifySetupfilepathWithID Modify the setup file path to include the id.
Run Run the simulation. Load must have been called first, but Run can be called multiple times.
RunXmlCompare Run compare on original mike1d data object and an object loaded from xml.
StartWorkInBackground Calling this method will load and run the simulation (call Work) in a background thread
StopSimulation Stop the simulation. The simulation will end when the current time step has been completed.
ToStringReturns a string that represents the current object.
(Inherited from Object)
Work Start work, main method of SimulationWorker.

Calls Load and Run in order.

WriteHtmlSummary 

Events

ControllerEvent Event that is raised while the controller is running. It is raised whenever the state of the controller changes.

This is a shortcut for registering for the ControllerEvent. The sender of the event is the IMike1DController that triggered the event.

Note that some simulation types use more than one controller, and the same set of events will be triggered several times.

ErrorEvent Event triggered in case an error occured. This will also be triggered before an exception is thrown.
NewControllerEvent Event triggered when a new controller is created. This can be used to retrieve and connect to the latest controller by using the Controller property
SetupLoadedEvent Event triggered when a setup has been loaded
SetupLoadingEvent Event triggered when a setup starts loading
SimulationDoneEvent Event triggered when the simulation is done
SimulationPauseEvent Event triggered in case the simulation has been paused.

Fields

DateTimeFormatString Date time format used for log files and GUI.

See Also