CedarEDA.configure_logging!Method
configure_logging!(; log_level, log_file)

Configures the global logger to log anything more severe than log_level, and to also copy the logs into the log_file, if provided. Default log_level is LogLevel(-1) for progress logging.

For more complex or custom usecases, configure the global logger directly. See the Logging and LoggingExtras packages for more details.

CedarEDA.exploreMethod
explore(sp::SimParameterization, as::ACSolutionType)

Display a figure exploring the frequency response results from an ac!() call. If solved across a parameter sweep, sliders allow exploration of the frequency response across different points along the sweep.

CedarEDA.exploreMethod
explore(sp::SimParameterization, as::NoiseSolutionType)

Display a figure exploring the frequency response results from a noise!() call. If solved across a parameter sweep, sliders allow exploration of the frequency response across different points along the sweep.

CedarEDA.exploreMethod
explore(sp::SimParameterization, ss::SensitivitySolutionType; with_transient = true)

Display a figure exploring the sensitivity results from a sensitivities!() call. If with_transient is set to true, also displays the transient solution. If solved across a parameter sweep, sliders allow exploration of the sensitivities across different points along the sweep.

CedarEDA.exploreMethod
explore(sp::SimParameterization, ts::TransientSolutionType)

Display a figure exploring the sensitivity results from a tran!() call. If solved across a parameter sweep, sliders allow exploration of the transients across different points along the sweep.

CedarEDA.exploreMethod
explore(sp::SimParameterization)

explore(sp) with no solution passed in will default to explore(sp, tran!(sp)), see the documentation for the explore(sp, ::TransientSolutionType) method for more details.

CedarEDA.export_csvMethod
export_csv(file::String, sig::AbstractSignal)

Export a single signal to .csv, saving time values as the first column t, and the amplitude values as the second column y.

CedarEDA.export_csvsMethod
export_csvs(dir::String, sp::SimParameterization)

Perform transient analysis on the given SimParameterization, then export all saved signals (set via set_saved_signals!()) to .csv, across all parameterization points, into the given output directory.

CedarEDA.export_csvsMethod
export_csvs(dir::String, ss::SolutionSet, probe)

Given a SolutionSet and probe, export the signal referred to by that probe for all solutions contained within that SolutionSet, naming each individual file based on its index within the SolutionSet.

CedarEDA.join_syms_splitFunction
join_syms_split(refs, out_vars, out_obs, (vars_inds, obs_inds))

Similar to DAECompiler's join_syms(), but instead of copying out_vars and out_obs to a new Matrix, returns a vector of views into those matrices. This can be thought of as a zero-copy version of join_syms, meant to have these vectors inserted into a SolutionSet's internal reconstruction_caches object.

CedarEDA.load_surrogateMethod
load_surrogate!(surrogate_path::String, sm::SimManager, control)

Loads a surrogate located at surrogate_path and associates with a SimManager Returns a SurroagateSimManager which can perform tran! using the surrogate.

Requires loading Surrogatize

CedarEDA.optimizeMethod
optimize(loss, sp, p0; lb, ub, optimizer=LBFG())

Optimize the circuit over the provided parameters for the given loss, and return an updated SimParameterization with the optimal parameter values.

Information about the success/failure of optimization, convergence conditions, and loss per iteration can be found in the returned OptimizationInfo object.

Examples

julia> p0 = (c_match = 1.5e-12, l_match = 150e-9); # initial guess
julia> lb = (c_match = 1.0e-12, l_match = 1e-9);   # lower-bound
julia> ub = (c_match = 1.0e-9, l_match = 1e-6);    # upper-bound
julia> sp, sol_info = CedarEDA.optimize(loss, sp; lb, ub);
julia> sol_info.retcode

Arguments

  • loss::Function: The objective function for the optimization. The optimizer will attempt to minimize the (scalar) output of this function.
  • sp::SimParameterization: The SimParameterization for the circuit to be optimized.
  • p0::NamedTuple: An initial guess for the optimal parameter values.
  • lb::NamedTuple: A lower-bound of the region to search for parameter values. Applies component-wise to each parameter.
  • ub::NamedTuple: An upper-bound of the region to search for parameter values. Applies component-wise to each parameter.
  • optimizer: The algorithm to use for optimization (e.g. BFGS, Gradient Descent, CG, etc.). May be any Gradient-Free or Gradient-Required algorithm from Optim.jl.
CedarEDA.plot_checkMethod
plot_check(sp, cs)

Plot a single check along with all of the measures in a particular sp

CedarEDA.sensitivities!Method
sensitivities!(sm::SimManager, sp::SimParameterization)

Performs Sensitivity analysis upon the specified parameterization. Returns a SolutionSet object of the same shape as the parameterization.

CedarEDA.set_checks!Method
set_checks!(sp::SimParameterization; tran, dc, ac)

Set the set of checks that will be applied to the given SimParameterization when check() is called. These checks are visualized within explore() output.

CedarEDA.set_saved_signals!Method
set_saved_signals!(sp::SimParameterization, saved_signals::Vector{Probe})

Defines the set of signals that are plotted via explore() or saved to .csv via export_csvs() by default. Signals can always be extracted from SolutionSet objects, this usage is merely a convenience for marking certain signals that will be commonly plotted or exported.

CedarEDA.value_and_params_gradientMethod
value_and_params_gradient(loss, sp)

Given an arbitary loss function, which likely calls measure(sp) for some measure) compute its value and its gradient with respect to each parameter specified in sp.

CedarEDA.warmup_problem!Method
warmup_problem!(prob)

Because we have JITOpaqueClosures sitting around, we need to ensure that the specialization for our problems is properly cached before we start multithreading solve() calls that would all hit the JIT cache.

CedarSim.ac!Method
ac!(sm::SimManager, sp::SimParameterization, frequencies::Vector{Float64})

Performs AC analysis upon the specified parameterization, evaluated at the given frequencies. See acdec for one convenient method of selecting frequencies to evaluate at. Returns a SolutionSet object of the same shape as the parameterization.

CedarSim.dc!Method
dc!(sm::SimManager, sp::SimParameterization)

Performs DC analysis upon the specified parameterization. Returns a SolutionSet object of the same shape as the parameterization.

CedarSim.noise!Method
noise!(sm::SimManager, sp::SimParameterization, frequencies::Vector{Float64})

Performs noise analysis upon the specified parameterization, evaluated at the given frequencies. See acdec for one convenient method of selecting frequencies to evaluate at. Returns a SolutionSet object of the same shape as the parameterization.

CedarSim.sweepvarsMethod
sweepvars(sp::SimParameterization)

Return a Set{Symbol} of the parameters that are swept over in the given SimParameterization object.

CedarSim.tran!Method
tran!(sm::SimManager, sp::SimParameterization)

Performs Transient analysis upon the specified parameterization. Returns a SolutionSet object of the same shape as the parameterization.

CedarEDA.FunctionCheckType
FunctionCheck(measure, fn)

A definition of a check to be executed in the future on the measure, applying the fn to the

CedarEDA.FunctionMeasureType
FunctionMeasure(probes, callback, measure_name)

A generic helper type to define a measure as a function of another measure; can take in potentially multiple source measures (typically a Probe or another FunctionMeasure) and invokes the wrapped function upon those probes.

M is the type of the measure that this function returns; e.g. DxMeasure

CedarEDA.ILSSliceType
ILSSlice

Helper object that slices IndependentlyLinearizedSolution objects as stored into by the LinearizingSavingCallback() from DiffEqCallbacks by state index. Example usage:

# Construct slice on states 1, 3 and 7
u_idxs = [1, 3, 7]
slice = ILSSlice(ils, u_idxs)

# Iterate over saved points in the linearization
for (t_idx, (t, us)) in enumerate(slice)
    # iterating over `slice()` is giving us `u` and `du` as two columns in `us`:
    u = us[:, 1]
    du = us[:, 2]
    ...
end

This structure is used internally by all SolutionSet objects that deal with timeseries-like data, such as the output of tran!() or sensitivities!().

CedarEDA.OptimizationInfoType
OptimizationInfo

A struct to contain the results of a circuit optimization.

Contains two fields:

  • history: A vector of NamedTuples containing the parameters and loss seen at each iteration.
  • sol : The OptimizationSolution object from Optimization.jl returned from Optimization.jl
CedarEDA.SimManagerType
SimManager

Top-level simulation manager; Load your netlist into this object, then create a parameterization from it via SimParameterization. That parameterization can then be used to run various simulations.

CedarEDA.SimParameterizationType
SimParameterization

General struct representing the parameterization of a simulation; which parameters are swept over, the tolerance of the simulation, etc... Changing these values will generally require the problem to be re-compiled.

CedarEDA.SolutionSetType
SolutionSet

A structure representing a set of solutions, typically from a tran!(), sensitivities!(), ac!() or dc!() call. Holds outputs in such a way as to make it easy to access probe points across the entire sweep of solves as well as single parameter points.

Different analyses result in SolutionSet objects with different properties:

  • A tran!() solution contains op, tran and parameters properties, which hold the DC operating point, transient signal, and simulation parameters, respectively.

  • A [dc!()])(@ref) solution contains just op and parameters.

  • An ac!() solution contains op, ac and parameters, where ac holds the frequency response curves.

  • A sensitivities!() solution contains op, tran, sensitivities and parameters properties, where sensitivities are indexed first by the parameter the sensitivities are calculated with respect to, then the signal to probe for sensitivities.

Example usage:

ts = tran!(sp)

# This returns an array of solutions for the `node_vout` probe
ss.tran.node_vout

# Index into it to get a single solution
ss.tran.node_vout[1]

# Transient analysis requires an initial DC operating point,
# which you can obtain via the following:
ss.dc.node_vout[2:5]

# Similarly, we can collect parameters from the solution
ss.parameters.cload[end]
CedarEDA.TabCompleterType
TabCompleter{T}

A convenient object that provides tab-completion through some kind of recursive datastructure; e.g. a dict of dicts, or an array of arrays. The recursive structure is followed until an object that has no children is found, at which point a leaf function is called upon that object and returned to the user.

This enables the caller to create something that explores a deeply-nested structure (typically a sys object that exposes the circuit's structure) but instead of getting the leaf node itself, it passes through the leaf() function allowing for things like returning a signal associated with that circuit node, instead of the node itself.

The exploration of the original recursive object can be customized by providing keys() and getindex() functions. If not specified, the TabCompleter will attempt to guess an appropriate function based on T.

Note

It's crucial to note that user callbacks passed as leaf, keys, or getindex must meet the :foldable !:consistent effects (note that it does not necessarily to taint its :consistent-cy). This requirement is vital for enhancing tab completion accuracy. However, if the user callback fails to satisfy these conditions, attempting tab completion could lead to undefined behavior.

CedarSim.acdecFunction
acdec(nd, fstart, fstop)

Generate a logarithmically spaced frequency vector from fstart to fstop with nd points per decade. Equivalent to the SPICE command:

.ac dec nd fstart fstop

Return value is a vector in hertz per second.