Issie logo Issie

Simulator Module

Types

Type Description

SimCache

Functions and values

Function or value Description

cacheIsEqual cache ldcs

Full Usage: cacheIsEqual cache ldcs

Parameters:
Returns: bool
cache : SimCache
ldcs : LoadedComponent list
Returns: bool

cap sheet

Full Usage: cap sheet

Parameters:
    sheet : string

Returns: string
sheet : string
Returns: string

childrenOf ldcs sheet

Full Usage: childrenOf ldcs sheet

Parameters:
Returns: (string * string) list
ldcs : LoadedComponent list
sheet : string
Returns: (string * string) list

designForSidecar fs

Full Usage: designForSidecar fs

Parameters:
Returns: SimpleDesign

The design to send to the .NET sidecar: THE sheets this simulation was built from. **Built from the simulation and not from the project, and that is the point.** The renderer has already turned the project into the circuit it simulates - array components expanded into a wrapper and a body - and this hands the sidecar that, so the two processes simulate the same sheets rather than each deriving them from the same input and hoping to agree. They had to agree exactly, because SimSetInputs names a component by ID across the wire and expansion MINTS ids for everything it makes. Two expansions agreeing was luck: the same code over the same list in the same order. Nothing enforced it and nothing tested it. Now only one of the two ever expands, so there is nothing to agree about. It is also why the wire format knows nothing about array components, and must not learn: a SimpleSheet that crossed this boundary is an ordinary sheet by construction.

fs : FastSimulation
Returns: SimpleDesign

designOnlySimulation simulationArraySize diagramName (arg3, arg4) loadedDependencies

Full Usage: designOnlySimulation simulationArraySize diagramName (arg3, arg4) loadedDependencies

Parameters:
Returns: Result<SimulationData, SimulationError>

A simulation carrier with no simulation in it: what the renderer holds when the .NET sidecar is the one simulating. It carries the DESIGN - which answers every structure question the UI asks - the top sheet's IOs, whether the circuit is clocked, and the checked graph, exactly as a real build would. What it does not hold is the expansion: no components, no step arrays, no drivers. Widths and data come from the sidecar - widths through the port slices, data through the reads - and the local fields every gate consults say so: NumStepArrays 0, empty maps. The design is still validated here, by the same checks a build runs, so a design that cannot simulate is refused synchronously with the same error the user has always seen - components highlighted and all. What is skipped is everything after validation: the flatten, the arrays, the ordering.

simulationArraySize : int
diagramName : string
arg2 : Component list
arg3 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationData, SimulationError>

getCurrentSimulationState (arg1, arg2) project fs

Full Usage: getCurrentSimulationState (arg1, arg2) project fs

Parameters:
Returns: SimulationRunStatus

gets the status of the simulation given current canvasState and project

arg0 : Component list
arg1 : Connection list
project : Project option
fs : FastSimulation
Returns: SimulationRunStatus

getDirectDependencies (arg1, arg2)

Full Usage: getDirectDependencies (arg1, arg2)

Parameters:
Returns: (string * string) list
arg0 : Component list
arg1 : Connection list
Returns: (string * string) list

getFastSim ()

Full Usage: getFastSim ()

Parameters:
    () : unit

Returns: FastSimulation

The currently active FastSimulation - a dummy if none has been built. Callers on wave-sim paths must be guarded by the MODEL saying a wave simulation is live (WaveSimSheet, ws.State): under mutual exclusion the slot then holds that simulation and nothing else can.

() : unit
Returns: FastSimulation

getLdcList ldcs openSheet

Full Usage: getLdcList ldcs openSheet

Parameters:
Returns: LoadedComponent

look up a sheet in a set of loaded components, return [] or a list of the matching LoadedComponent

ldcs : LoadedComponent list
openSheet : string
Returns: LoadedComponent

getSheet ldcs openSheet

Full Usage: getSheet ldcs openSheet

Parameters:
Returns: LoadedComponent

look up a sheet in a set of loaded components

ldcs : LoadedComponent list
openSheet : string
Returns: LoadedComponent

getUpdatedLoadedComponentState diagramName (arg2, arg3) projLdcs

Full Usage: getUpdatedLoadedComponentState diagramName (arg2, arg3) projLdcs

Parameters:
Returns: LoadedComponent list

canvasState: extracted canvasState from draw block. projLdcs: ldcs from project (current sheet ldc may be outofdate) diagramName: name of current open sheet. return updated list of all LDCs

diagramName : string
arg1 : Component list
arg2 : Connection list
projLdcs : LoadedComponent list
Returns: LoadedComponent list

makeDummySimulationError msg

Full Usage: makeDummySimulationError msg

Parameters:
    msg : string

Returns: SimulationError
msg : string
Returns: SimulationError

portSheetPort compsWithIds name port

Full Usage: portSheetPort compsWithIds name port

Parameters:
Returns: SheetPort option

Helper used convert port into SheetPort for use by wave simulator determining connectivity within a design sheet. name is the name of the containing sheet.

compsWithIds : Map<ComponentId, Component>
name : string
port : Port
Returns: SheetPort option

prepareSimulationMemoized localBuild isWaveSim simulationArraySize openFileName diagramName (arg6, arg7) loadedDependencies

Full Usage: prepareSimulationMemoized localBuild isWaveSim simulationArraySize openFileName diagramName (arg6, arg7) loadedDependencies

Parameters:
    localBuild : bool
    isWaveSim : bool
    simulationArraySize : int
    openFileName : string
    diagramName : string
    arg5 : Component list
    arg6 : Connection list
    loadedDependencies : LoadedComponent list

Returns: Result<SimulationData, SimulationError> * CanvasState

Start up a simulation, doing all necessary checks and generating simulation errors if necesary. The code to do this is quite long so results are memoized. `localBuild` false builds the design-only carrier above instead of a real simulation - what the renderer wants when the sidecar simulates. Truth tables always pass true: they read their own local simulation whatever mode the simulators are in.

localBuild : bool
isWaveSim : bool
simulationArraySize : int
openFileName : string
diagramName : string
arg5 : Component list
arg6 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationData, SimulationError> * CanvasState

saveStateInSimulation (arg1, arg2) openFileName loadedComponents (arg5, arg6) copyNames fs

Full Usage: saveStateInSimulation (arg1, arg2) openFileName loadedComponents (arg5, arg6) copyNames fs

Parameters:
Returns: FastSimulation

canvasState: extracted canvasState from draw block. loadedComponents: from project diagramName: name of current open sheet. save all needed by simulation ldcs in the FastSimulation record. The top sheet name must be saved separately - since if a simulation is being refreshed it must not change

arg0 : Component list
arg1 : Connection list
openFileName : string
loadedComponents : LoadedComponent list
arg4 : CanvasState
arg5 : LoadedComponent list
copyNames : CopyPortNames
fs : FastSimulation
Returns: FastSimulation

sheetsNeeded ldcs sheet

Full Usage: sheetsNeeded ldcs sheet

Parameters:
Returns: string list

Sheets needed to simulate sheet with name sheet. Sheets form a dependency tree. ldcs is a list of loaded components which must include sheet

ldcs : LoadedComponent list
sheet : string
Returns: string list

simCache

Full Usage: simCache

Returns: SimCache

THE simulation, memoised against the design it was built from - the single-entry memo that makes "the simulation is a memoised version of the simulation spec" literally true. ONE slot, because Issie runs one simulation at a time: the step and waveform simulators are mutually exclusive, one must be stopped before the other starts, and the only difference between their builds is the array-size parameter - the step simulator wraps a small circular buffer, the waveform simulator sizes the same buffer to hold the whole run so it never wraps. There used to be a slot for each, justified by nothing: the memo can never be warm across a switch, since the array size differs and forces the rebuild anyway. What the second slot did do is let a stopped simulation linger unreleased while the other kind ran - the retention problem the refs harness command exists to chase - and starting either kind now evicts whatever was here by replacing it.

Returns: SimCache

simCacheInit ()

Full Usage: simCacheInit ()

Parameters:
    () : unit

Returns: SimCache
() : unit
Returns: SimCache

startCircuitSimulation simulationArraySize diagramName (arg3, arg4) loadedDependencies

Full Usage: startCircuitSimulation simulationArraySize diagramName (arg3, arg4) loadedDependencies

Parameters:
Returns: Result<SimulationData, SimulationError>

A simulation with everything a wave viewer in this process needs, which is what almost every caller wants. The sidecar is the exception and asks for NoWaveTables.

simulationArraySize : int
diagramName : string
arg2 : Component list
arg3 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationData, SimulationError>

startCircuitSimulationFData simulationArraySize diagramName (arg3, arg4) loadedDependencies

Full Usage: startCircuitSimulationFData simulationArraySize diagramName (arg3, arg4) loadedDependencies

Parameters:
Returns: Result<SimulationData, SimulationError>
simulationArraySize : int
diagramName : string
arg2 : Component list
arg3 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationData, SimulationError>

startCircuitSimulationWith waveTables simulationArraySize diagramName (arg4, arg5) loadedDependencies

Full Usage: startCircuitSimulationWith waveTables simulationArraySize diagramName (arg4, arg5) loadedDependencies

Parameters:
Returns: Result<SimulationData, SimulationError>

Extract circuit data from inputs and return a checked SimulationData object or an error SimulationData has some technical debt, it wraps FastSimulation adding some redundant data `waveTables` says whether to build what only a wave viewer reads - see WaveTables.

waveTables : WaveTables
simulationArraySize : int
diagramName : string
arg3 : Component list
arg4 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationData, SimulationError>

storedstateisEqual cache ldcs

Full Usage: storedstateisEqual cache ldcs

Parameters:
Returns: bool
cache : SimCache
ldcs : LoadedComponent list
Returns: bool

validateCircuitSimulation diagramName (arg2, arg3) loadedDependencies

Full Usage: validateCircuitSimulation diagramName (arg2, arg3) loadedDependencies

Parameters:
Returns: Result<SimulationGraph, SimulationError>

Extract circuit data from inputs and return a valid SimulationGraph or an error

diagramName : string
arg1 : Component list
arg2 : Connection list
loadedDependencies : LoadedComponent list
Returns: Result<SimulationGraph, SimulationError>

validateSheetOfDesign sheetName ldcs

Full Usage: validateSheetOfDesign sheetName ldcs

Parameters:
Returns: Result<SimulationGraph, SimulationError>

Does one sheet of a design build into a simulation? The question behind the Simulation tab's verdict button and the wave viewer's price, and the cheapest way to ask it: the graph is checked and thrown away, with no step arrays allocated. **THE one place that says how a design is checked**, and it is written down because it was written twice and the two drifted. The whole design goes to validateCircuitSimulation - the named sheet included - while getStateAndDependencies is asked only for that sheet's canvas: it removes the sheet from the list it returns, and what a sheet IS rather than what is drawn on it (its parameters, and whether it is an ARRAY COMPONENT whose hardware is several copies of what is drawn on it) is on the sheet and not on the canvas. Passing the shortened list on left nothing able to say the sheet being checked was an array component, so the checks ran on its unexpanded canvas and refused its own IO as being on a sheet that is not an array component. `ldcs` is the design as the model holds it now - ModelHelpers.designOf, which puts the canvas being drawn in place of the open sheet's saved copy.

sheetName : string
ldcs : LoadedComponent list
Returns: Result<SimulationGraph, SimulationError>

Type something to start searching.