ModelHelpers Module
Types and nested modules
| Type/Module | Description |
Functions and values
| Function or value | Description |
|
|
|
|
|
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.
|
Full Usage:
circuitCheckIsNeeded model (arg2, arg3)
Parameters:
Model
arg1 : Component list
arg2 : Connection list
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.
|
Full Usage:
clampSelection index entries
Parameters:
int
entries : 'a list
Returns: int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
inputBigint props placeholder locs isValid dispatch model
Parameters:
IHTMLProp list
placeholder : string
locs : ModelLocations
isValid : bigint -> Model -> bool
dispatch : Msg -> unit
model : Model
Returns: ReactElement
|
|
Full Usage:
loadWSModelFromSavedWaveInfo swInfo
Parameters:
SavedWaveInfo
Returns: WaveSimModel
|
|
Full Usage:
mapFst mapFn (model, cmd)
Parameters:
'a -> 'b
model : 'a
cmd : 'c
Returns: 'b * 'c
|
|
|
|
Full Usage:
memoryWidthsInDesign model compId mem
Parameters:
Model
compId : ComponentId
mem : Memory1
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.
|
|
|
Full Usage:
pinDrawBlock pinned model
Parameters:
PinnedCanvas
model : Model
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.
|
|
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.
|
Full Usage:
readProjectBrowserFolder folder selected
Parameters:
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.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
Full Usage:
setWSModel wsModel model
Parameters:
WaveSimModel
model : Model
Returns: Model
|
|
|
|
Full Usage:
simulateModel isWaveSim simulatedSheet simulationArraySize (arg4, arg5) model
Parameters:
bool
simulatedSheet : string option
simulationArraySize : int
arg3 : Component list
arg4 : Connection list
model : Model
Returns: Result<SimulationData, SimulationError> * CanvasState
|
|
Full Usage:
simulationHeapEstimate simulatedSheet (arg2, arg3) model
Parameters:
string option
arg1 : Component list
arg2 : Connection list
model : Model
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
spMess msg
Parameters:
'a
Returns: string
|
|
Full Usage:
spOpt f thingOpt
Parameters:
'a -> string
thingOpt : 'a option
Returns: string
|
|
|
|
Full Usage:
spState (arg1, arg2)
Parameters:
Component list
arg1 : Connection list
Returns: string
|
|
Full Usage:
startingLastClock configured heapEstimate
Parameters:
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.
|
|
|
Full Usage:
updateLdComps name changeFun ldComps
Parameters:
string
changeFun : LoadedComponent -> LoadedComponent
ldComps : LoadedComponent list
Returns: LoadedComponent list
|
|
Full Usage:
updateLdCompsWithCompOpt newCompOpt ldComps
Parameters:
LoadedComponent option
ldComps : LoadedComponent list
Returns: LoadedComponent list
|
|
Full Usage:
updateWSModel updateFn model
Parameters:
WaveSimModel -> WaveSimModel
model : Model
Returns: Model
|
|
Full Usage:
updateWSModelOfSheet sheet updateFn model
Parameters:
string
updateFn : WaveSimModel -> WaveSimModel
model : Model
Returns: Model
|
|
|
|
|
|
Full Usage:
waveSimStepCost model
Parameters:
Model
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.
|