## module:Simulation(appInstance)

This class runs the network simulation.

note: all connectors that are used in this class are output connectors

#### new module:Simulation(appInstance)
`modules/Simulation.js`, `line 35`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `appInstance` | App | instance of App

### Classes

#### SimulationDummy
`module:Simulation.SimulationDummy`

### Members

#### appInstance :App
`modules/Simulation.js`, `line 44`

  instance of App this Simulation belongs to

#### cycledConnectors :Map
`modules/Simulation.js`, `line 63`

  maps cycled connector id to set of states this connector was in

#### predecessors :Map
`modules/Simulation.js`, `line 50`

  maps each affected output connector to it's directly preceeding output connectors

#### resolvedCycledConnectors :Set
`modules/Simulation.js`, `line 69`

  set of cycled connectors that have been already resolved

#### waves :Map
`modules/Simulation.js`, `line 56`

  maps waveId to an array of affected outputConnectors

### Methods

#### addPredecessor(connectorId, predecessorConnectorId)
`modules/Simulation.js`, `line 156`

  mark a predecessorConnectorId as a predecessor of connectorId

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connectorId` | string | ID of a connector
  `predecessorConnectorId` | string | predecessor of `connectorId`

#### getAllPredecessors(connectorId) → {Set}
`modules/Simulation.js`, `line 169`

  get set of all output connectors that are before this output connector

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connectorId` | string | ID of a connector

  ##### Returns:

  Set -

  set of connector ids that are before this output connector

#### notifyChange(connectorId, state)
`modules/Simulation.js`, `line 198`

  Notify a change in the network. This function adds the changed connector to the next wave

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `connectorId` | string | ID of the changed connector
  `state` | Logic.state | new Logic.state of the connector

#### run()
`modules/Simulation.js`, `line 75`

  run the simulation

#### step()
`modules/Simulation.js`, `line 89`

  one step/wave of the simulation

  determines states of the connectors in the current wave, detects cycles