Header menu logo issie

ModelHelpers Module

Types and nested modules

Type/Module Description

Constants

CSSGridPos

type used for CSS grids in the UI to position an item on a grid

ModelLocations

Both input text and its parsed numeric value must be stored in the model. The two fields contain optics used to access these items in the model

ViewableJob

a long function to be executed in a message after the view function has run at least once

Functions and values

Function or value Description

asyncJobs

Full Usage: asyncJobs

Returns: ViewableJob list

list of jobs awaiting execution

Returns: ViewableJob list

canvasInspection model

Full Usage: canvasInspection model

Parameters:
Returns: (type)

Everything the draw block is showing on the open sheet, as data. Computed on demand, not on every render: MainView publishes a function that calls this.

model : Model
Returns: (type)

canvasRaw model

Full Usage: canvasRaw model

Parameters:
Returns: string

The complete drawing state, serialised with the same library that writes .dgm files. SimpleJson round-trips F# maps - including the ones keyed by a record or a single-case DU, which it writes as an array of [key, value] pairs rather than as a JSON object - along with sets, options and bigints. So there is no need to reduce anything by hand: this is every symbol, wire, port and port map exactly as the model holds it. BusWireT.Model is the largest part of the model that contains no functions at all. SheetT.Model above it holds PopupViewFunc and a ChildProcess, and its undo and redo lists are whole models, which would multiply the dump by the undo depth. Returns a message rather than throwing if serialisation fails, so that a type SimpleJson cannot represent degrades to a readable error instead of breaking the caller. Fable only: SimpleJson's reflection does not work under .NET, which does not matter for renderer debug code.

model : Model
Returns: string

circuitCheckIsNeeded model (arg2, arg3)

Full Usage: circuitCheckIsNeeded model (arg2, arg3)

Parameters:
Returns: bool

Should the Simulation tab ask for a new verdict? True when the stored one is missing or no longer describes the design, and no check is already on its way. The CheckPending test comes first, and not only to save the comparison: this is asked while rendering, and a render that asked again for a check already scheduled would be answered with another render, and so on without ever reaching the check.

model : Model
arg1 : Component list
arg2 : Connection list
Returns: bool

clampSelection index entries

Full Usage: clampSelection index entries

Parameters:
    index : int
    entries : 'a list

Returns: int

Keep a project browser selection on a row that exists. The folder can grow or shrink under it between one refresh and the next, and an index past the end would leave Enter doing nothing.

index : int
entries : 'a list
Returns: int

drawBlockModelToUserData model userData

Full Usage: drawBlockModelToUserData model userData

Parameters:
Returns: UserData

This is needed because DrawBlock cannot directly access Issie Model. can be replaced when all Model is placed at start of compile order and DB model is refactored

model : Model
userData : UserData
Returns: UserData

execOneAsyncJobIfPossible (model, cmd)

Full Usage: execOneAsyncJobIfPossible (model, cmd)

Parameters:
Returns: Model * Cmd<Msg>

called from update function, it will execute outstanding async jobs. each job modifies model.

model : Model
cmd : Cmd<Msg>
Returns: Model * Cmd<Msg>

getComponentIds model

Full Usage: getComponentIds model

Parameters:
Returns: Set<ComponentId>
model : Model
Returns: Set<ComponentId>

getCurrFile model

Full Usage: getCurrFile model

Parameters:
Returns: string option

returns a string option representing the current file name if file is loaded, otherwise None

model : Model
Returns: string option

getCurrSheets model

Full Usage: getCurrSheets model

Parameters:
Returns: string list option
model : Model
Returns: string list option

getSavedWaveInfo wsModel

Full Usage: getSavedWaveInfo wsModel

Parameters:
Returns: SavedWaveInfo

Get saveable record of WaveSimModel

wsModel : WaveSimModel
Returns: SavedWaveInfo

getUpdatedLoadedComponents project model

Full Usage: getUpdatedLoadedComponents project model

Parameters:
Returns: Project

Return the project with with open file contents in loadedcomponents updated according to current Draw Block contents.

project : Project
model : Model
Returns: Project

getWSModel model

Full Usage: getWSModel model

Parameters:
Returns: WaveSimModel

Get the current WaveSimModel used by the Model (index the map using the current wavesim sheet). If no WaveSimModel for that sheet, return an empty wave sim model.

model : Model
Returns: WaveSimModel

initWSModel

Full Usage: initWSModel

Returns: WaveSimModel
Returns: WaveSimModel

inputBigint props placeholder locs isValid dispatch model

Full Usage: inputBigint props placeholder locs isValid dispatch model

Parameters:
Returns: ReactElement

Display an input box which is parsed as a bigint and written back to the Model using textOptic (the text) and valOptic (the value). isValid must return true for the value to be written back to the model

props : IHTMLProp list
placeholder : string
locs : ModelLocations
isValid : bigint -> Model -> bool
dispatch : Msg -> unit
model : Model
Returns: ReactElement

loadWSModelFromSavedWaveInfo swInfo

Full Usage: loadWSModelFromSavedWaveInfo swInfo

Parameters:
Returns: WaveSimModel

Setup current WaveSimModel from saved record NB: note that SavedWaveInfo can only be changed if code is added to make loading backwards compatible with old designs

swInfo : SavedWaveInfo
Returns: WaveSimModel

mapFst mapFn (model, cmd)

Full Usage: mapFst mapFn (model, cmd)

Parameters:
    mapFn : 'a -> 'b
    model : 'a
    cmd : 'c

Returns: 'b * 'c
mapFn : 'a -> 'b
model : 'a
cmd : 'c
Returns: 'b * 'c

mapOverProject defaultValue model transform

Full Usage: mapOverProject defaultValue model transform

Parameters:
Returns: 'a
defaultValue : 'a
model : Model
transform : Project -> 'a
Returns: 'a

memoryWidthsInDesign model compId mem

Full Usage: memoryWidthsInDesign model compId mem

Parameters:
Returns: (int * int) list

The address and data widths one memory component of the open sheet has ACROSS ITS DESIGN: one pair per set of parameter values the sheet is used at, never empty. Contents are one map shared by every instance of the sheet, so data offered to a memory - typed into the editor, or read from a .ram file it is linked to - has to fit every one of these, not merely the shape the sheet happens to be drawn at. Where nothing is parameterised there is one pair and this says what it always said.

model : Model
compId : ComponentId
mem : Memory1
Returns: (int * int) list

openSheetIsReadOnly model

Full Usage: openSheetIsReadOnly model

Parameters:
Returns: bool

Whether the sheet now open is a library sheet the user asked to look inside, and so must not be editable.

model : Model
Returns: bool

pinDrawBlock pinned model

Full Usage: pinDrawBlock pinned model

Parameters:
Returns: Model

pinSheet applied to the draw block of the whole model. The model is returned untouched when the sheet is, so a message that changed nothing pinned allocates nothing.

pinned : PinnedCanvas
model : Model
Returns: Model

pinIfReadOnly msg model

Full Usage: pinIfReadOnly msg model

Parameters:
Returns: Model

Hold the draw block at its pinned state if the open sheet is being viewed read-only. Applied to the result of every message.

msg : Msg
model : Model
Returns: Model

pinSheet pinned sheet

Full Usage: pinSheet pinned sheet

Parameters:
Returns: Model

Write the pinned state back over the live draw block, so that nothing which would be saved can change while a library sheet is being viewed. This is the whole of read-only enforcement. It restores rather than refuses because there are too many ways to edit to block them one at a time and be sure: 58 mutating cases across the three draw block Msg types, half a dozen places that write model.Sheet directly through Optic.map without reaching any update function, and UpdateModel, which carries an arbitrary Model -> Model and cannot be inspected at all. Undoing the change afterwards catches every one of those, and goes on catching messages added later. Everything the user can reach that would be reverted is separately disabled, so nothing appears to work and then springs back. Called after every message, so it first asks whether anything it pins was touched at all: the maps are persistent, so an untouched one is still the same object and the usual case costs seven reference comparisons and no allocation.

pinned : PinnedCanvas
sheet : Model
Returns: Model

pinnedCanvasOf sheet

Full Usage: pinnedCanvasOf sheet

Parameters:
Returns: PinnedCanvas

The draw block state to hold a read-only sheet at. Taken once the sheet has settled, never while it loads: loading recomputes symbol sizes, reroutes wires whose ports have moved and centres the circuit, all of which are changes the pin would otherwise undo one by one until the sheet never finished opening.

sheet : Model
Returns: PinnedCanvas

readProjectBrowserFolder folder selected

Full Usage: readProjectBrowserFolder folder selected

Parameters:
    folder : string
    selected : int

Returns: ProjectBrowserState

Read a folder for the project browser: what is in it, or why it cannot be shown. Done here, from the update function, rather than while rendering. A popup body runs on every message, so a view that read the disk would read it continuously - and the keyboard needs the number of rows before it can move between them.

folder : string
selected : int
Returns: ProjectBrowserState

reduce this

Full Usage: reduce this

Parameters:
Returns: (type)
this : Model
Returns: (type)

reduceApprox this

Full Usage: reduceApprox this

Parameters:
Returns: (type)
this : Model
Returns: (type)

removeAllSimulationsFromModel model

Full Usage: removeAllSimulationsFromModel model

Parameters:
Returns: Model

For reasons of space efficiency, ensure that no non-empty unused FastSimulation records are kept. A FastSimulation holds a step array per net and a SimulationGraph node per component instance, so a large design's is hundreds of MB: one left behind slows every later edit, because each major GC must trace all of it. Call this before building a new simulation. CurrentStepSimulationStep is the only field of the model holding one. Every WaveSim entry is released as well - see releaseWaveSimData - which covers the sheet the caller is about to resimulate (its AllWaves is rebuilt by the refresh), the sheets left behind by switching the waveform simulator between sheets, and the entry EndWaveSim is about to mark Ended. The truth table's TableSimData is deliberately left alone: it is what regenerates the table when a constraint changes, so it is in use rather than stale.

model : Model
Returns: Model

runAfterView jobName workFn

Full Usage: runAfterView jobName workFn

Parameters:
jobName : string
workFn : Model -> Model * Cmd<Msg>

runCircuitCheck model

Full Usage: runCircuitCheck model

Parameters:
Returns: CircuitCheck

Work out whether the open design builds into a simulation, and whether it is synchronous. Called from the update function on a delay, never while rendering.

model : Model
Returns: CircuitCheck

setAsyncJobsRunnable dispatch

Full Usage: setAsyncJobsRunnable dispatch

Parameters:
    dispatch : Msg -> unit

dispatch : Msg -> unit

setModelInt (arg1, arg2) dispatch maxVal minVal intToSet

Full Usage: setModelInt (arg1, arg2) dispatch maxVal minVal intToSet

Parameters:
    arg0 : Model -> int
    arg1 : int -> Model -> Model
    dispatch : Msg -> unit
    maxVal : int
    minVal : int
    intToSet : int

Set the part of model specified by optic_ to initToSet: bounded by maxVal, minVal. dispatch: the Elmihs dispatch function.

arg0 : Model -> int
arg1 : int -> Model -> Model
dispatch : Msg -> unit
maxVal : int
minVal : int
intToSet : int

setWSModel wsModel model

Full Usage: setWSModel wsModel model

Parameters:
Returns: Model

Set WaveSimModel of current sheet.

wsModel : WaveSimModel
model : Model
Returns: Model

simReset dispatch

Full Usage: simReset dispatch

Parameters:
    dispatch : Msg -> unit

dispatch : Msg -> unit

simulateModel isWaveSim simulatedSheet simulationArraySize (arg4, arg5) model

Full Usage: simulateModel isWaveSim simulatedSheet simulationArraySize (arg4, arg5) model

Parameters:
    isWaveSim : bool
    simulatedSheet : string option
    simulationArraySize : int
    arg3 : Component list
    arg4 : Connection list
    model : Model

Returns: Result<SimulationData, SimulationError> * CanvasState
isWaveSim : bool
simulatedSheet : string option
simulationArraySize : int
arg3 : Component list
arg4 : Connection list
model : Model
Returns: Result<SimulationData, SimulationError> * CanvasState

simulationHeapEstimate simulatedSheet (arg2, arg3) model

Full Usage: simulationHeapEstimate simulatedSheet (arg2, arg3) model

Parameters:
Returns: float

Start simulating the current Diagram. Return SimulationData that can be used to extend the simulation as needed, or error if simulation fails. Note that simulation is only redone if current canvas changes. What the design a simulation of this sheet would expand to costs in heap, worked out the way GraphMerger refuses on and from the same pair of canvas and project the simulation itself is assembled from.

simulatedSheet : string option
arg1 : Component list
arg2 : Connection list
model : Model
Returns: float

simulationIsOpen model

Full Usage: simulationIsOpen model

Parameters:
Returns: bool

True if a step simulation, truth table or waveform simulation is currently open. Parameters create dependencies across a whole design, so they cannot be changed while one is open.

model : Model
Returns: bool

spCanvas model

Full Usage: spCanvas model

Parameters:
Returns: string
model : Model
Returns: string

spComp comp

Full Usage: spComp comp

Parameters:
Returns: string
comp : Component
Returns: string

spComps comps

Full Usage: spComps comps

Parameters:
Returns: string
comps : Component list
Returns: string

spConn conn

Full Usage: spConn conn

Parameters:
Returns: string
conn : Connection
Returns: string

spLdComp ldc

Full Usage: spLdComp ldc

Parameters:
Returns: string
ldc : LoadedComponent
Returns: string

spMess msg

Full Usage: spMess msg

Parameters:
    msg : 'a

Returns: string
msg : 'a
Returns: string

spOpt f thingOpt

Full Usage: spOpt f thingOpt

Parameters:
    f : 'a -> string
    thingOpt : 'a option

Returns: string
f : 'a -> string
thingOpt : 'a option
Returns: string

spProj p

Full Usage: spProj p

Parameters:
Returns: string
p : Project
Returns: string

spState (arg1, arg2)

Full Usage: spState (arg1, arg2)

Parameters:
Returns: string
arg0 : Component list
arg1 : Connection list
Returns: string

startingLastClock configured heapEstimate

Full Usage: startingLastClock configured heapEstimate

Parameters:
    configured : int
    heapEstimate : float

Returns: int

The clock cycle a waveform simulation should start at, given what its expanded design will cost in heap and what it was configured for. A big design costs minutes to start, not seconds: main6 of the largeTest project is 480,000 components, and at the configured 2000 cycles it spent three minutes building 6GB of step arrays and another two building 835,000 wave records - all before showing anything. Started short it is seconds, and the configuration is still there to raise once the user has seen the design work. This only ever lowers what was asked for.

configured : int
heapEstimate : float
Returns: int

tryGetLoadedComponents model

Full Usage: tryGetLoadedComponents model

Parameters:
Returns: LoadedComponent list
model : Model
Returns: LoadedComponent list

updateLdComps name changeFun ldComps

Full Usage: updateLdComps name changeFun ldComps

Parameters:
Returns: LoadedComponent list
name : string
changeFun : LoadedComponent -> LoadedComponent
ldComps : LoadedComponent list
Returns: LoadedComponent list

updateLdCompsWithCompOpt newCompOpt ldComps

Full Usage: updateLdCompsWithCompOpt newCompOpt ldComps

Parameters:
Returns: LoadedComponent list
newCompOpt : LoadedComponent option
ldComps : LoadedComponent list
Returns: LoadedComponent list

updateWSModel updateFn model

Full Usage: updateWSModel updateFn model

Parameters:
Returns: Model

Update WaveSimModel of current sheet.

updateFn : WaveSimModel -> WaveSimModel
model : Model
Returns: Model

updateWSModelOfSheet sheet updateFn model

Full Usage: updateWSModelOfSheet sheet updateFn model

Parameters:
Returns: Model

Update WaveSimModel of given sheet - if it does not exist do nothing

sheet : string
updateFn : WaveSimModel -> WaveSimModel
model : Model
Returns: Model

userDataToDrawBlockModel model

Full Usage: userDataToDrawBlockModel model

Parameters:
Returns: Model

This is needed because DrawBlock cannot directly access Issie Model. can be replaced when all Model is placed at start of compile order and DB model is refactored

model : Model
Returns: Model

waveSimModel_

Full Usage: waveSimModel_

Returns: Lens<Model, WaveSimModel>

This will - given a project is open - never fail. The getter returns the default WaveSimModel record if none exists. The setter will add the WaveSimModel to the WaveSim map in the model.

Returns: Lens<Model, WaveSimModel>

waveSimStepCost model

Full Usage: waveSimStepCost model

Parameters:
Returns: Result<StepCost, SimulationError>

The per-cycle memory cost of wave-simulating the open design: what the waveform configuration dialog's size message and its OK gating need, and nothing more. This exists because the dialog used to get the same number by building a complete 10-cycle simulation - every FastComponent, every step array - and reading one field off the result: 49 seconds of frozen dialog on a 480,000-component design, and the waveform simulation cache evicted on the way. The cost is a fact about the flattened design, so this stops at the flattening: check the circuit, gather it, price it, allocate nothing.

model : Model
Returns: Result<StepCost, SimulationError>

Type something to start searching.