Components and scattering models
Component values, port models, rational fits, and their noise and DC assumptions.
See the API overview for other analyses and conventions for units and array ordering.
JosephsonCircuits.Capacitor Type
Capacitor(C; temperature = nothing)A two terminal linear capacitor with capacitance C in Farads. Terminals are 1 and 2. The value may be a number or a symbolic variable.
temperature is the physical temperature in Kelvin, finite and nonnegative, which sets the noise a lossy instance adds; a lossless one adds none. nothing, the default, takes the temperature the analysis is run at.
Examples
julia> Capacitor(100e-15)
Capacitor{Float64}(1.0e-13, nothing)
julia> Capacitor(100e-15; temperature = 4.0).temperature
4.0JosephsonCircuits.ConjugateSymmetry Type
ConjugateSymmetry()The default negative frequency rule for scattering and covariance providers: data is evaluated at the absolute value of the requested frequency and conjugated for negative frequencies, imposing S(-ω) = conj(S(ω)). This is uniformly safe for tabulated positive-frequency data and for user callables.
sourceJosephsonCircuits.CurrentSource Type
CurrentSource(I)A two terminal source of the constant current I in Amperes, which it drives through itself from its first terminal to its second: it draws the current from the node at its first terminal and delivers it to the node at its second, the opposite sense of a port source, which injects its current into the port's first (positive) terminal. The value is a number, or a name whose number circuitdefs supplies.
Harmonic balance drives the zero frequency mode with the constant current, so a solve of a circuit holding a nonzero one retains that mode, dc = true. A transient solve takes the constant as well, unless a TransientSource names the source, whose waveform then replaces it.
JosephsonCircuits.FrequencyDependent Type
FrequencyDependent(f)A frequency dependent component value. f is called with a nonnegative frequency in radians per second, zero at a direct current mode, and returns the component value at that frequency. The function may be arbitrary Julia: a closure over other parameters, a special function, an interpolation of tabulated data.
R0 = 50.0; wc = 2*pi*10e9
Resistor(FrequencyDependent(w -> R0*(1 + im*w/wc)))A sweep evaluates each distinct function, as === tells them apart, once at each mode frequency however many components share it, so f depends on the frequency alone.
The value describes the element at positive frequencies. A mode of negative frequency, such as an idler, takes the complex conjugate of the value at the magnitude of its frequency, conj(f(abs(w))), which is the value of a real element there, as the data of a scattering block is extended by ConjugateSymmetry.
The value is the whole function: it does not combine with numbers or other values, so a value derived from others is computed inside the closure.
sourceJosephsonCircuits.Inductor Type
Inductor(L; temperature = nothing)A two terminal linear inductor with inductance L in Henries. Terminals are 1 and 2 with orientation from terminal 1 to terminal 2. The value may be a number or a symbolic variable.
temperature is the physical temperature in Kelvin, finite and nonnegative, which sets the noise a lossy instance adds; a lossless one adds none. nothing, the default, takes the temperature the analysis is run at.
Examples
julia> Inductor(1e-9)
Inductor{Float64}(1.0e-9, nothing)
julia> Inductor(1e-9; temperature = 4.0).temperature
4.0JosephsonCircuits.LaplaceResponse Type
LaplaceResponse(f)An explicitly supplied Laplace-domain response, with time convention exp(s*t). Calling the wrapper at a real angular frequency w returns f(im*w), so it can be used by harmonic balance as well as hbstability:
Resistor(FrequencyDependent(LaplaceResponse(s -> 50*(1 + s/1e10))))
ScatteringParameters(LaplaceResponse(s -> fill(0.2/(1 + s/1e10), 1, 1));
nports = 1, zref = 50.0)For a lumped element, f returns its component value (ohms, farads or henries), not its admittance. For a scattering provider it returns a matrix; form = :inplace also works, with f(dest, s). The response must be analytic wherever the pole search evaluates it and must represent the intended causal model. Ordinary real components and unconverted scattering responses require f(conj(s)) == conj(f(s)). For a converted harmonic of LinearizedScattering, the opposite harmonic is supplied by this reflection instead. No passivity, causality or global analyticity proof is inferred from this wrapper. Internal states hidden from a transfer function cannot be recovered; use RationalScattering when their poles are required.
Frequency tables and arbitrary frequency-only callbacks do not specify a Laplace continuation. Fit tables using RationalScattering, or explicitly supply a model with this wrapper; hbstability never fits one silently.
Examples
julia> f = LaplaceResponse(s -> 50*(1 + s/1e10));
julia> f(1e10) == 50 + 50im
true
julia> r = Resistor(FrequencyDependent(f));JosephsonCircuits.LinearizedScattering Type
LinearizedScattering(linearized, wp; ports = nothing, zref = 50.0,
grounded = true, noise = Lossless(), phase = 0.0,
interpolation = :cubic, atol = 1e-6, dcmodel = ScatteringLimit(),
envelope = nothing)
LinearizedScattering(H, wp; harmonics, nports, zref = 50.0,
grounded = true, noise = Lossless(), phase = 0.0,
dcmodel = ScatteringLimit(), envelope = nothing, atol = 1e-6)The linearized scattering of a pumped device, a linear time-periodic multiport: a parametric amplifier, converter or isolator in its periodic steady state, whose small signal response converts between frequencies separated by harmonics of its pump wp (radians per second). It is described by harmonic transfer functions H_k(nu), the wave leaving at the absolute frequency nu + k*wp per unit wave incident at nu, for the harmonics k >= 0 it converts by; a real device has H_{-k}(nu) = conj(H_k(-nu)), which supplies the rest. H_0 is an ordinary scattering matrix, and every H_k is a function of the signed frequency, so the block is evaluated natively at negative frequencies.
The harmonic transfer functions act on power waves, as the hybrid stamp does; the scattering matrix the solvers report is in waves of photons per second, so a conversion entry of the two differs by the square root of the ratio of the frequencies, which the first form applies.
The first form builds one from the linearized output of hbsolve of the device, with its keyed scattering matrix over the modes of one pump and its frequencies: the entry from input mode n to output mode m at the signal frequency w is a sample of H_{m-n} at w + n*wp, and the samples of every harmonic from every mode pair are collected, folded onto k >= 0, and tabulated band by band over the shifted bands with interpolation, zero between and beyond them, since the data says nothing there (see PiecewiseTabulatedProvider): a band is samples no further apart than the solve's frequencies are, and a solve at one frequency gives each sample a band of its own. Samples which fall on the same frequency from different mode pairs must agree to atol, relative to the largest entry, which is what makes the data that of one periodic steady state, and the block built from the tables is checked against its declaration over the modes of the solve at every frequency, as every solve checks it, since the tables hold at one frequency samples from solves of neighboring signal frequencies whose mode truncations differ; a device whose mode truncation was too tight fails both, and atol admits the discrepancy of one which was nearly so. ports selects and orders the device's ports which become the block's, by default all of them, and zref gives their reference impedances. A port left out takes its termination into the block, so a stated covariance gains the noise that termination sends in, scattered to the ports the block keeps, at the temperature the solve records for it (porttemperatures). phase rotates H_k by exp(im*k*phase), the phase of the block's pump relative to the one the data was computed with, which matters when other elements of the circuit share the pump.
The second form takes the harmonic transfer functions directly: H is a vector of providers, one per entry of harmonics (nonnegative, ascending, beginning with zero), each a matrix, a callable of the signed angular frequency, or a tuple (frequencies, values) tabulated over signed frequencies. H_0 is the response of a real system, H_0(-nu) = conj(H_0(nu)): a constant one must be real, and a table holding both signs of a frequency is checked for it there, to atol.
The block is stamped by the harmonic balance solvers as a coupling between the modes of the circuit whose frequencies differ by its harmonics, so the circuit must be solved with the block's pump: its wp must be a harmonic combination of the circuit's pump frequencies and the mode set must reach the harmonics the block converts by, which is how a circuit with no junctions is solved with a pumped block, by giving hbsolve the pump frequency and no source at it. The block is linear, so it acts on the circuit's own pump harmonics the same way.
noise = Lossless() asserts that the device is lossless: its multi-mode scattering matrix S satisfies J - S J S' = 0 with J the signs of the mode frequencies, which is checked on the block as built and again over the modes of every solve which evaluates it, in harmonic balance at every signal frequency and in time at every bath frequency, and the block then emits no noise. A device with loss states the noise it adds with noise = NoiseCovariance(linearized.Cnoise), the covariance its solve reports with returnCnoise = true, over the same modes, ports and frequencies: in the units of Cnoise, where a vacuum channel counts as 1/2, it becomes the harmonic covariances V_k(nu) = <n(nu + k wp) n(nu)'>, sampled like the transfer functions, and is held to the minimum the commutation relations require, V - K/2 and V + K/2 positive semidefinite with K = J - S J S', on the data and again at every frequency of a sweep. The block then carries channels of both kinds over all its modes at once, as an active block does (see NoiseCovariance), so it adds the noise its solve found, correlated across the modes, and its output obeys the commutation relations. Given by its harmonic transfer functions, the stated noise is one covariance provider per harmonic. atol is the tolerance of the block's data, relative to the square of the largest entry of the multi-mode scattering matrix: the consistency of the data of one periodic steady state, the losslessness declared or the commutation relations a stated covariance must satisfy, which the block is checked for on its stored data when it is built, a table at its knots and a block of constants which does not convert at any one frequency, and over the modes of every solve, whatever outputs the solve is asked for, a callable and constants which convert being checkable only there, and an entry of the data below it is zero where the pump solve asks whether the block converts the conjugate of a mode; a covariance's own atol counts for its checks as well. A fit of the block is held to no tolerance: it states the noise its own commutator requires, a covariance completed to the commutation relations (see NoiseCovariance). grounded and dcmodel are as for ScatteringParameters; the direct current behavior is that of H_0 at zero unless stated.
In time the block is realized by RationalScattering(block, npoles), which fits every harmonic transfer function to stable filters: H_0 as an ordinary rational block, and each H_k as the pair of real filters of its cosine and sine parts, strictly proper, whose outputs the transient multiplies by 2 cos(k wp t) and -2 sin(k wp t). envelope is a callable of the time in seconds which multiplies every harmonic but the zeroth there, a prescribed gate of the conversion and not a model of the pump being switched: H_0, the filters and a stated covariance stay those of the pumped device while the conversion is scaled, so the block satisfies the commutation relations only where the envelope is one, or zero for a device whose H_0 is that of the device unpumped. What the gate is for is the start of a record: ramped from zero, it leaves the circuit time invariant before the record a noise calculation needs, as the pumps of the junction circuits are, and the noise is read once the conversion has been on longer than the block's memory. nothing is a conversion always on, which a noise calculation then takes as periodic from the start of its record with the fluctuations before it those of the unconverted response, not of the periodic device.
JosephsonCircuits.Lossless Type
Lossless()A noise model for a ScatteringParameters asserting that its scattering matrix is unitary at every frequency, or for a LinearizedScattering that its multi-mode scattering matrix S satisfies J - S J S' = 0 with J the signs of the mode frequencies, so that the block absorbs nothing and adds no noise.
With the default Passive model a block gets noise channels unless its data can be shown to be unitary (see provablylossless), which is possible for a constant matrix and a table but not for a callable, whose values away from the evaluated frequencies are unknown. A lossless callable would therefore carry noise channels which are identically zero, at a real cost on a circuit with many blocks; Lossless() removes them.
The assertion is held to the block's atol (see checkblockcontract): when a constant, tabulated or rational block is built, at every sample of stored data and between and beyond them, and over every frequency of a realization, and it is an error if false. A callable is checked by a sweep at every frequency it evaluates the block at and is otherwise taken on trust, and asserting it of a block which does absorb omits the noise the block should add, making the quantum efficiency and the commutation relations wrong by that much. A pumped block is checked when it is built and again over the modes of every solve which evaluates it, to the block's atol; a fit of a pumped block is not lossless to better than its error, and states the noise it needs instead (see NoiseCovariance).
JosephsonCircuits.MatchedTermination Type
MatchedTermination(; temperature = 0.0)A source and load environment matched to the port's reference impedance, acting across the two port terminals, at the physical temperature in kelvin, finite and nonnegative. This is the default: a port owns its environment, so no resistor should be added in order to terminate it.
The environment sends into the port the thermal field of a matched load: the symmetrized noise nbar + 1/2 in each mode, nbar its thermaloccupation at the mode's frequency, which is the vacuum's half photon at zero temperature. The temperature is the port's own and is zero unless it is given here, whatever temperature an analysis gives its dissipative elements: the termination is the measurement line, not the device. For a line whose noise is not that of one temperature, give the temperature of the field arriving at the port (effectivetemperature), or put the line's attenuators in the circuit at their own temperatures.
Examples
julia> MatchedTermination(temperature = 0.05).temperature
0.05JosephsonCircuits.MutualInductor Type
MutualInductor(K, inductor1, inductor2)A mutual inductor with the dimensionless mutual coupling coefficient K coupling the two Inductor instances with identifiers inductor1 and inductor2 in the same circuit level. A mutual inductor couples two named inductor branches rather than nets, so it appears in the component list with no entries in the connections:
:k1 => MutualInductor(0.9, :l1, :l2)The referenced identifiers are resolved within the containing circuit during elaboration, so each instance of a subcircuit couples its own inductors.
The sign of K follows the order each inductor's terminals are declared in: with K > 0 currents entering the first terminal of each inductor add flux to both, as with the dots of a SPICE coupling statement at the first named nodes, and reversing the terminals of one inductor, or the sign of K, opposes them.
In the netlist form of Circuit the entry names the two inductors in place of nodes, and the component is written MutualInductor(K) alone:
(:k1, :l1, :l2, MutualInductor(0.9))JosephsonCircuits.Native Type
Native()A negative frequency rule declaring that the provider is natively valid on signed frequencies and may be evaluated directly at negative frequencies. Opt-in for analytic providers whose formulas satisfy the physical conjugation identity by construction.
sourceJosephsonCircuits.NoiseCovariance Type
NoiseCovariance(V; interpolation = :cubic, extrapolation = :error,
atol = 1e-8, completed = false, padding = 4)The noise a ScatteringParameters adds, stated outright rather than derived from its loss, which is how an active block, an amplifier given by its scattering parameters, declares its noise. V is the symmetrized covariance of the noise wave the block emits at its ports, in quanta, the units of the rest of the noise outputs, where a vacuum channel counts as 1/2 and a channel at temperature T as nbar + 1/2: the same units as Cnoise. It may be a matrix, a callable of angular frequency, or a tuple (frequencies, values) of tabulated data, following the same provider forms as the scattering data, and is evaluated with the block's negative frequency rule.
The block's output must obey the commutation relations, so with K = I - S S' the added noise has the commutator K, and a covariance is realizable only when V - K/2 and V + K/2 are both positive semidefinite. V + K/2 then factors into channels which emit like a mode in its vacuum and V - K/2 into channels which emit like the conjugate of one, the idler channels of an amplifier; each channel carries the vacuum's half photon, so the block adds half their sum, V. A passive block in thermal equilibrium is the case V = (nbar + 1/2) K. A phase insensitive amplifier of power gain G from port 1 to port 2 has K[2,2] = 1 - G, so V[2,2] >= (G - 1)/2, the noise of a quantum limited amplifier, and one with an input referred added noise of nadd photons has V[2,2] = G*nadd (see noisequanta for a noise temperature); V[1,1] is what it emits backward out of its input, (nbar + 1/2)*K[1,1] for an input matched at its physical temperature.
The condition is checked on the eigenvalues to atol when the block is built, at the samples where both the scattering data and V are stored, and at every frequency a solver evaluates the block at. V is also held to Hermitian symmetry, to atol of its largest entry, or of one for a covariance whose entries are below one (see checkblockcontract). A block with this model carries no temperature: its noise is V, whatever the analysis temperature.
With completed = true the covariance is completed to the commutation relations rather than held to them: V is replaced by V + neg(V - K/2) + neg(V + K/2), neg taking the negative part of a Hermitian matrix, the sum of -lambda v v' over its negative eigenvalues, which makes V - K/2 and V + K/2 positive semidefinite and adds nothing where they are. For V = 0 the addition is |K|/2, the least total noise a Gaussian channel with the block's map can add, the Ymin of the quantum optics functions in the basis of the modes; for a stated V it is a sufficient addition, the least being a semidefinite program with no closed form. The block then adds the noise it states and what more its commutator requires, and its output obeys the commutation relations exactly, whatever V and S are. An ordinary block is completed at each frequency. A pumped block's covariance spans the modes of a solve at once, and the negative part of a matrix is not that of its parts, so it is completed over the ladder of the modes padded by padding multiples of the pump frequency on either side, with every input which feeds it, and restricted to the modes of the solve (see completedcovariance): the block's noise is then one model whatever modes a solve keeps, to the precision of the padding, which converges since a fit's conversion vanishes at high frequency, and the inputs a solve lacks are traced out in their vacuum. padding is that precision and not a bound on it, so a device whose conversion reaches far is checked by raising it and comparing the covariance the solve keeps. Every mode a solve asks for is completed, including one beyond the sidebands the block's data holds, which it scatters nothing at and so carries the vacuum its commutator requires, as its stamp takes it. This is how a fit states its noise, of a pumped block and of an ordinary one which states a covariance (see RationalScattering): a fit is neither lossless nor consistent with a stated covariance to better than its error, and the completion turns that error into noise the block emits, where a tolerance would only excuse it.
JosephsonCircuits.NonlinearInductor Type
NonlinearInductor(L0, cpr)A two terminal nonlinear inductive element defined by its current-phase relation: I(φ) = (phi0/L0)*cpr(φ) where φ is the reduced branch phase, L0 is the small signal inductance in Henries, and cpr is a callable with unit slope at zero. The solvers take its derivatives analytically, those of a PolynomialCPR through cprderivative.
This supports specifying the effective nonlinearity of a SNAIL, SQUID, or Quarton directly, as an alternative to composing the underlying junctions. A quadratic term in the relation is what makes such an element a three wave mixer, which the Josephson relation, being odd, is not.
The relations the solvers evaluate are the sinusoidal Josephson one, which is what JosephsonJunction writes, and a PolynomialCPR; another callable is refused when the circuit is compiled. The element is a junction to everything else in the solvers: it makes the same branch, enters the same matrices, and L0 is its inductance there, so only the pointwise relation differs. Harmonic balance evaluates it, in the residual, in the Jacobian, in the Hessian and in the pump modulation of the linearized system, and the transient solver steps it, in its residual, its Jacobian, its tangent and adjoint, and the linearization its noise is taken about.
See also JosephsonJunction.
JosephsonCircuits.OpenDC Type
OpenDC()A ScatteringParameters which is an open circuit at zero frequency: S(0) = I, so no direct current flows through any port. This is the constant of a series capacitance and of anything else which blocks direct current.
JosephsonCircuits.Passive Type
Passive()The default noise model for a ScatteringParameters: the block is a passive network with no locally specified noise, so what it adds is set by what it absorbs and by the temperature the analysis is run at. A dissipative block adds noise of symmetrized covariance (nbar + 1/2)(I - S S') (see ScatteringNoisePlan), with nbar the occupation at the temperature given to the analysis, which defaults to zero temperature and so to the vacuum's (I - S S')/2.
Saying nothing here is what keeps temperature out of a component definition which several analyses share. ThermalEquilibrium is how a block states its own temperature instead.
JosephsonCircuits.PassivityEnforcement Type
PassivityEnforcement(; margin = 1e-6, rounds = 60, scalelimit = 1e-2,
maxtime = 300.0, regularization = 1e-12)The numerical parameters of the passivity enforcement of a fit by RationalScattering.
A round searches the fit for bands where its dissipation
I - S'Sfalls below-atol, the tolerance the block's samples and constant term are held to, its largest singular value abovesqrt(1 + atol), about one plus half ofatol, on a logarithmic grid of points per pole reaching past the band on either side, and at each complex pole and half a width and a width either side of it, a pole found above the level adding a band of half widths either side. Where the grid finds none, the certified sweep below decides: it establishes the fit passive, or finds the bands the grid passed between, as where a correction holds the response at one beside the points it constrains and a bump narrower than the grid's spacing rises. It constrains the worst of a few dozen points across each band, and infinite frequency where the constant term stands above the level; the points of the earlier rounds, infinite frequency among them, are constrained again at their largest singular value whether or not it stands above one, so that a correction cannot push a point back over one that an earlier one brought under. It changes the residues and the constant term by the least amount, in the norm of the fit over the samples, each entry weighed by its weight where the fit takes weights (seeRationalScattering), that brings every singular value above one there to1 - margin, over at mostroundsrounds.marginmust be well below the block's own dissipation1 - sigma, or the enforcement writes over the loss it should preserve.The certified sweep settles every interval of the frequency axis, infinity included: it bounds the fit's dissipation
I - S'Sfrom below across an interval, by its value and derivative at the interval's centre and the distances of the poles from the interval, and halves an interval its bound does not settle, so that no band passes between its points. A sweep which settles every interval under that level establishes that the fit is passive to it; otherwise its bands are those where the fit stands above the level, or within the roundoff of it, and the worst point of each is constrained. The dissipation of a lossless fit vanishes, residues and all, and a bound over the whole axis from its residues and constant settles such a fit, and its norm, before any interval. Elsewhere the intervals it needs grow as the margin by which the fit stands under the level shrinks, over the bands where it stands near it. Where the fit is lossless in some directions at every frequency and lossy in the others, a bound by the dissipation's second derivative as well settles an interval the first order would halve many times, and they grow as the inverse cube root of the margin rather than its inverse square root. Each generation of intervals is shared among the threads Julia runs with, where the form is large enough for that to pay, each thread running BLAS on one thread, and gives the same result on any number of them; on a single Julia thread BLAS keeps its own threads, whose products round differently in the last digits, so that the result is the same there only where BLAS runs on one thread as well. An interval costs as the cube of the ports, so the sweeps are bounded in time rather than in intervals: the sweeps and norm searches of the enforcement stop at their first reading of the clockmaxtimeseconds or more after it began, and a fit they have not settled by then is refused. Only they are timed, not the grid searches and corrections between them, so that the enforcement can run pastmaxtime, and the bound over the whole axis, which takes no interval, settles a lossless fit however little time is left. A fit settled is the same whatever the time left, andmaxtime = Inflets the sweeps run to the floating-point resolution.The least change is found in the coordinates of the residues at the frequency scaled to the band: each residue's change within the space of its rows which its states span (
ranktolofVectorFitting), so that the block keeps its states, measured by the Gram matrix of the pole basis over the samples, which carries no unit, and weighted by each entry's weights where the fit takes them, a Gram matrix for each entry. Samples which are reciprocal toatolhave the transpose of each constraint as well. Where every residue has full rank, and an entry and its transpose have the same weights, the least change is then reciprocal, to the accuracy of its solve, which above the band, where the samples hardly determine the change, can fall short ofatol; a residue of lower rank changes within the space of its rows, which its transpose need not lie in, and the fit can lose its reciprocity by as much as the change.The normal matrix of that least squares carries
regularizationtimes its mean diagonal entry on its diagonal, which must be positive: it keeps the change finite in the directions the samples hardly determine, above the band, and a larger one keeps it smaller there at the cost of a larger change over the samples.A result the certified sweep has not established passive is measured by its largest singular value over every frequency, found by the same bounds: the response at each interval's centre raises a lower bound, and an interval whose bound is under that bound times one and a relative tolerance is settled, as is one halving cannot settle, its centre within the roundoff of that level, its bound's own width within the roundoff, or its half width at the floating-point resolution of its centre, whose bound then counts toward a ceiling no frequency reaches, so that a tolerance under the roundoff gives a ceiling looser than itself. The fit is accepted where that ceiling stands under the level, never on the lower bound alone. The tolerance is
1e-8, or half the margin between one and the level where that is finer, so that the ceiling of a fit which reaches one, as a fit held at a value of unit norm at zero frequency does, stands under the level.A fit the rounds leave within
scalelimitabove one, by what it reaches, is contracted the rest of the way: toward nothing until its ceiling stands under one, by the step the ceiling gives where that measures under one and otherwise by a step searched for on the path; toward a value stated at zero frequency, whose own norm may be one, by such a step until its ceiling stands under the level. One further above is refused, since a contraction that large describes a block which is mostly loss rather than the data, as is one whose ceiling a contraction cannot bring under its target; a contraction which moves the response over the samples by more thanatolis warned of.
JosephsonCircuits.PolynomialCPR Type
PolynomialCPR(coefficients; atol = 1e-12)A current-phase relation (CPR) specified by the coefficients of its polynomial expansion f(φ) = coefficients[1]*φ + coefficients[2]*φ^2 + ..., where φ is the reduced branch phase. The linear coefficient must equal one, to atol, so that the L0 of the containing NonlinearInductor is the small signal inductance. The object is callable and its analytic derivative is available through cprderivative.
This supports specifying the effective nonlinearity of a SNAIL, SQUID, Quarton, or kinetic inductor directly through its expansion coefficients without wiring up the underlying junction arrangement. An array of N identical junctions in series, for example, divides the phase and so has the relation N*sin(φ/N) with small signal inductance N*Lj, whose expansion is [1, 0, -1/(6N^2), 0, 1/(120N^4), ...]. A kinetic inductor whose inductance rises with its current as L(I) = L0*(1 + I^2/Istar^2) carries the flux L0*(I + I^3/(3*Istar^2)), which inverted for the current is the relation [1, 0, -(IL/Istar)^2/3, 0, (IL/Istar)^4/3, ...], with IL = phi0/L0 the current scale of the element; the quintic term matters only as the current approaches Istar.
The coefficients are taken as given. A polynomial is not periodic and not bounded, so where it leaves the range it was fitted on, and what the harmonic count must be for the harmonics its degree generates, are the user's to judge: the solver evaluates what it is given.
Examples
julia> p = PolynomialCPR([1.0, 0.0, -1/6]); p(0.1)
0.09983333333333333
julia> JosephsonCircuits.cprderivative(p)(0.0)
1.0JosephsonCircuits.Port Type
Port(number::Integer; Z0 = 50.0,
termination = MatchedTermination())An analysis port with the port number number and reference impedance Z0 in Ohms. A Port identifies an electrical port for excitation and observation; excitation amplitudes belong to the analysis arguments, not to the circuit topology.
By default the port owns a matched external source and load environment of impedance Z0 acting across its two terminals, so a port needs no resistor to define its impedance. The environment is at zero temperature unless termination = MatchedTermination(temperature = T) warms it (see MatchedTermination); its thermal field then enters the port as the field of a matched load at T. The environment acts between the port terminals and is never tied to Ground on its own, so a differential port behaves the same way as a ground referenced one.
termination = nothing keeps Z0 for wave normalization but adds no physical loading, which is the right form when the circuit already contains the resistor that terminates the port. Such a port is an ideal current source and an impedance probe: a source on it drives its whole current into the circuit, and since the incident wave is that of the source current with nothing to absorb it, the reflection reported at the port is S = 2Z/Z0 - 1 with Z the impedance across its terminals, so the impedance at the node is Z = Z0 (1 + S)/2.
Any further Resistor across the same terminals is an ordinary device resistor: it loads the port in parallel with the environment, it remains a dissipative noise source, and it is never mistaken for the port's own environment.
Examples
julia> Port(1)
Port(1; Z0 = 50.0)
julia> Port(2; Z0 = 1000.0, termination = nothing)
Port(2; Z0 = 1000.0, termination = nothing)JosephsonCircuits.Resistor Type
Resistor(R; temperature = nothing)A two terminal linear resistor with resistance R in Ohms. Terminals are 1 and 2. The value may be a number or a symbolic variable.
temperature is the physical temperature in Kelvin, finite and nonnegative, which sets the noise a dissipative instance adds. nothing, the default, takes the temperature the analysis is run at.
Examples
julia> Resistor(50.0)
Resistor{Float64}(50.0, nothing)
julia> Resistor(50.0; temperature = 4.0).temperature
4.0JosephsonCircuits.ScatteringDC Type
ScatteringDC(S0)A ScatteringParameters whose zero frequency scattering matrix is stated as S0, which must be real, finite, and of the block's dimension.
Every realizable zero frequency behavior is one of these: a resistor, a transformer, an attenuator, and the open, short and through the named models are shorthand for. It is validated for passivity when the containing ScatteringParameters is constructed, with that block's atol, on the same terms as the block's own data, so an active zero frequency model needs the same NoiseCovariance declaration an active block does.
JosephsonCircuits.ScatteringLimit Type
ScatteringLimit()The default zero frequency model of a ScatteringParameters: its own scattering data, evaluated at zero frequency.
The result must be real and finite there. A block whose limit exists but is not evaluable at zero – a series capacitance written 1/(im*w*C), whose limit is the open circuit – has to state that limit with one of the other models rather than be asked for it.
JosephsonCircuits.ScatteringParameters Type
ScatteringParameters(S; nports = nothing, zref = nothing, grounded = true,
noise = Passive(), negative_frequency = ConjugateSymmetry(),
interpolation = :cubic, extrapolation = :error, form = :matrix,
derivatives = NamedTuple(), dcmodel = ScatteringLimit(),
atol = 1e-8)A multiport component defined by its scattering parameters. S may be:
a constant matrix;
a callable of angular frequency returning a matrix (requires
nports);a tuple
(frequencies, values)of tabulated data withfrequenciesin radians per second andvaluesof size (nports, nports, nfrequencies);a path to a Touchstone file of S, Y or Z parameters, from which the reference impedances are also read; Y and Z parameters are converted to S at those impedances.
Tabulated data is interpolated with the cubic spline through each entry's samples (interpolation = :cubic, the default; :linear takes the chords between them, which lag a rotating phase) and is never extrapolated unless asked: extrapolation is :error by default, with :constant, :linear and :zero to opt in (see TabulatedMatrixProvider). The harmonic balance solvers evaluate a block wherever their mixing products fall, which can be far outside the band the data covers, so measured data meant for them is better fitted with RationalScattering, which extrapolates as a passive rational function and is passive at every frequency by construction, where any interpolant of passive samples can stray between and beyond them.
zref is the reference impedance in Ohms, a scalar broadcast to all ports or a vector with one entry per port. For a Touchstone file the reference impedance is read from the file, and a zref which disagrees with it is an error, since the intent is ambiguous between correcting a mislabeled file and requesting renormalization. Scattering data is used at its native reference impedance; no renormalization of the data is ever performed when stamping, and conversion to analysis reference impedances happens only in the wave domain at analysis boundaries.
With the default grounded = true every reference terminal is automatically tied to Ground and (:instance, p) in a connection group addresses the signal terminal of port p; explicitly connecting a reference terminal of a grounded block is an error. With grounded = false each port p has terminals 1 (signal) and 2 (reference), addressed as (:instance, p, t), and ports may be floating or differential.
noise is Passive (default), Lossless, ThermalEquilibrium, or NoiseCovariance. A dissipative block adds noise, which the noise scattering parameters, the quantum efficiency and the commutation relations account for. A NoiseCovariance states the added noise outright, which is what an active block, an amplifier given by its scattering parameters, needs, and is held to the minimum the commutation relations require of it. Lossless says the block is unitary, which spares a callable, whose data cannot be shown to be, the noise channels of a loss it does not have. negative_frequency is ConjugateSymmetry (default) or Native. form says how a callable S is called; see CallableMatrixProvider.
atol is the tolerance of the block's data, which the block keeps: it is passive, the smallest eigenvalue of I - S S' no lower than -atol, unless it states its noise with a NoiseCovariance, which permits an active block, and declared Lossless it is unitary, no entry of I - S S' larger than atol (see checkblockcontract). The data is held to this when the block is built, wherever it is stored: at the samples of constant and tabulated data, over every frequency of a RationalScattering realization, and between and beyond the samples of a table declared lossless. A callable is known only where it is evaluated.
dcmodel states the block's zero frequency behavior when its own data does not give it: OpenDC, ShortDC, ThroughDC or ScatteringDC, defaulting to ScatteringLimit, which evaluates the block at zero. Measured data which starts at gigahertz has no zero frequency entry, and a closed form whose limit exists may not be evaluable there – a series capacitance written 1/(im*w*C) is an open circuit at direct current and infinite at zero – so those state the limit instead. The model is used only by the direct current rows; the alternating current path always uses the block's own data.
derivatives supplies analytic derivatives of the scattering matrix with respect to design parameters, for designsensitivities: a named tuple keyed by parameter name whose values are accepted in the same forms as S (a matrix, a callable of angular frequency, or tabulated data), tabulated data interpolated and extrapolated as S is and a callable called in the form S is. The block holds them as name => provider pairs in the order given, which are no part of its type, so blocks which differ in their derivatives alone are one type, for which the solvers are compiled once. A block depends on a design parameter through these entries alone. A derivative is not a scattering matrix and is never passivity checked. The block's scattering matrix and its derivatives describe one design point: the definitions move the component values written as names, not values a block's data or closure has captured, so a block whose data depends on a parameter must be restated at each point along with its derivatives. A Touchstone path is tabulated data: its derivatives are read as a table's are, and form, which says how a callable is called, is refused with it as with any other data.
Examples
julia> ScatteringParameters([0 1;1 0]).nports
2JosephsonCircuits.ShortDC Type
ShortDC()A ScatteringParameters each of whose ports is shorted to its own reference terminal at zero frequency: S(0) = -I. The port voltages are held at zero and the currents are whatever the rest of the circuit sends, which is the ideal short the direct current rows are written to express.
JosephsonCircuits.ThermalEquilibrium Type
ThermalEquilibrium(temperature)A noise model for a passive ScatteringParameters in thermal equilibrium at the physical temperature temperature in Kelvin, finite and nonnegative. The added noise covariance is (nbar + 1/2)(I - S S'), the commutator I - S S' weighted by the symmetrized noise of a mode at that temperature, nbar its thermaloccupation.
This states the block's temperature where the block is defined, so it overrides the temperature argument of the analysis. At zero temperature, under an analysis at zero temperature, it coincides with Passive.
JosephsonCircuits.ThroughDC Type
ThroughDC()A two port ScatteringParameters which passes direct current unchanged: S(0) = [0 1; 1 0], so the port voltages are equal and the currents are equal and opposite. This is the constant of a series inductance and of a transmission line.
JosephsonCircuits.VectorFitting Type
VectorFitting(; iterations = 30, stallpatience = 5, start = :linear,
pruneslack = 0.05, ranktol = 1e-12, zerotol = 1e-12)The numerical parameters of the vector fit of RationalScattering at a number of poles.
iterationsis the most rounds of pole relocation. The relocation ends sooner whenstallpatiencerounds in a row bring the largest deviation over the samples no lower than a thousandth of itself under the least so far, which is a fit that has settled, or one circling, or when the fit meets its samples to their roundoff. The rounds go on while the fit improves, however far its poles move, and the iterate returned is the one measured to fit best.startis where the relocation starts.:linearspreads complex pairs evenly over the positive band and:logevenly over the logarithm of its frequency, the lowest positive sample standing in for zero, with a real pole at the centre of the band in the same spacing when the count is odd, each damped by a hundredth of its frequency.:linlogspreads about half of the pairs each way, the logarithmic ones short of the band's ends, with the real pole at the logarithmic centre, as the linlogcmplx start of Gustavsen's VFdriver does, and five poles or fewer as:log. Where the relocation ends can depend on where it starts, and no spacing is the better on every data set. A vector of poles in rad/s starts from those, as many as the poles fitted: each finite and in the open left half plane, and each complex one given with its conjugate. The order search fits many orders from a spacing and takes no vector.pruneslackbounds how much the fit error may grow over the whole pruning of needless poles, as a fraction of the error before any pole was dropped, in the largest deviation over the samples and in the rms deviation over every entry and sample, each against its own value: the largest deviation alone can be pinned by one feature of the data, a seam or a spike, and leave the rest of the fit free to worsen. It bounds the pruned fit, not the returned block: the repair of the constant term and the passivity enforcement come after.A pole takes as many states as its residue has singular values above
ranktolof the largest, decided on the fit before its passivity enforcement: the residue is taken within the space of the singular vectors kept, which the enforcement changes it within and the realization spans, so that the block returned is the one made passive. A value stated at zero frequency is met all the same, with or without the enforcement: the constant term takes back the share of it that the parts left out carry.In the fit of a
LinearizedScatteringblock, the cosine or sine part of a harmonic whose samples all stand belowzerotolof the harmonic's largest is realized as zero, with no state.
The relocation shares its columns among the threads Julia runs with, where their least squares are large enough for that to pay, each thread running BLAS on one thread, and gives the same poles on any number of them; on a single Julia thread BLAS keeps its own threads, whose products round differently in the last digits. A relocation on data its poles cannot follow exactly carries such a difference into a different set of poles, as it does any other change of rounding, so that a fit is the same on any number of threads only where BLAS runs on one thread throughout.
sourceJosephsonCircuits.JosephsonJunction Method
JosephsonJunction(Lj)
JosephsonJunction(; Ic)A Josephson junction with junction inductance Lj in Henries, or equivalently critical current Ic in Amperes, and the sinusoidal current-phase relation I(φ) = Ic*sin(φ). Equal to NonlinearInductor(Lj, sin).
Examples
julia> JosephsonJunction(100e-12) == NonlinearInductor(100e-12, sin)
true
julia> JosephsonJunction(Ic = 1e-6).L0
3.291059784754534e-10JosephsonCircuits.RationalScattering Method
RationalScattering(A, B, C, D; zref = 50.0, grounded = true,
noise = Passive(), atol = 1e-8)A ScatteringParameters block from the real state space realization S(s) = D + C (s I - A)^(-1) B of a passive rational multiport, with A the nz by nz state matrix, B nz by nports, C nports by nz and D nports by nports, all real and finite, A stable. The block is validated as passive to atol over every frequency, its dissipation I - S'S no lower than -atol as its samples would be, by a search for its peaks and the crossing test of the level sqrt(1 + atol) (see passivityassessment), and it is rejected where a singular value is found above that level, unless it states its noise with a NoiseCovariance, which is how an active block, an amplifier given by its scattering parameters, declares it; declared Lossless, it is held to singular values whose squares stand within atol of one at every frequency, by the same test on it and on its inverse. A block the test cannot settle either way is accepted: the crossing test cannot tell a peak above the level by less than its roundoff from one just under it, and a lossless block, within atol of the level at every frequency, often leaves it undecided. Stability is required of every realization. It is evaluated by the harmonic balance solvers at every frequency and realized in time by the transient solver with its states, so the two describe the same block, and its noise is the noise of its loss at every frequency by Bosma's relation, or the noise it states. The realization is what a vector fit of measured or simulated data delivers; a lossless line is TransmissionLine instead, which needs no states.
JosephsonCircuits.RationalScattering Method
RationalScattering(block::LinearizedScattering, npoles; frequencies = nothing,
band = nothing, delays = nothing, tol = 1e-2, noisetol = 5e-3,
padding = 4, fitting = VectorFitting())The LinearizedScattering block with every harmonic transfer function fitted to a stable rational realization, which is how the transient realizes it: H_0 as an ordinary rational function with its constant term, or as its constant alone with no state where the data needs no pole, and each H_k for k > 0 as the pair of real rational functions of its cosine and sine parts (see ModulatedRationalProvider), strictly proper, since a conversion vanishes at infinite frequency. Each is fitted at npoles poles by the vector fit of the ScatteringParameters method, with the parameters of fitting (see VectorFitting), at the angular frequencies in rad/s, by default the magnitudes of the angular frequencies the harmonic is tabulated at, within band = (wlo, whi) in rad/s when given: a block built from a solve carries every sideband its mode truncation reached, far above the band a signal occupies, and a harmonic with no sample in the band is realized as zero; no passivity is enforced, since the harmonic transfer functions of a pumped block are not passive one by one, whatever the block is as a whole. A harmonic is read where its data covers a frequency and is zero beyond its tables, and H_0, a real function, is read at whichever sign of a frequency its data holds and mirrored to the other, H_0(-nu) = conj(H_0(nu)), so a table of one sign fits. A fit within a band is an approximation within it: a solve evaluates the block at every sideband its harmonics reach from a signal, where such a fit only extrapolates, so it serves signals and pulses in the band and states, through its completed noise, that it is no better outside it. A lumped device fits over all of its sidebands at a few poles each; a long line does not, its sidebands being dispersive delay of many turns of phase. delays, one per port in seconds, removes a delay from the data before the fit, as a cable's is removed before its fit: the entry from port q to port p at the harmonic k is fitted with exp(i (nu + k wp) tau_p + i nu tau_q) taken out, so the fitted block is the device with a lossless line of delay tau_p cut off each port, and is put back with a TransmissionLine of that delay in cascade at the port; the delay of a line's signal band is not that of its sidebands, which keep the difference. The pump phase of block is folded into the fitted functions, and the fitted block keeps its pump, ports, noise model and envelope; a stated covariance is rotated by the phase and the delays as the functions are.
The data must meet what the block declares, that it is lossless or the covariance it states, over the modes its harmonics reach from every frequency it holds, each output against every input which feeds it (see pumpedfamily), to the block's atol and a covariance's, which the fit checks first and refuses otherwise. The fit itself meets the declaration no better than its error, so the fitted block does not declare it: its noise is the covariance the block states, zero for a lossless one, completed to the commutation relations of the fitted functions over the ladder of the modes of a solve padded by padding multiples of the pump frequency (see NoiseCovariance), so that it adds, whatever modes a solve keeps, the noise its own commutator requires, the least a channel with the fitted functions can add for a lossless device, and its output obeys the commutation relations exactly. That noise is what the fit costs, and the fit is refused when it exceeds, in quanta, noisetol of the square of the largest entry over the modes the data reaches from its frequencies and from the midpoints between them; the block's atol stays that of the data. A covariance the block itself states completed already carries the noise its own functions require, over the same ladder, which the fitted block carries as well: the fit costs what its completion adds beyond that. The fit is held to the data as well, and refused where it misses a sample by more than tol of the largest response, in the spectral norm, as the ScatteringParameters method measures a fit: a stated covariance large enough covers the commutator of a poor fit at no noise, so the noise a fit adds says nothing of its accuracy, and the two are held apart. A band must leave the unconverted response a sample. A dcmodel the block states is met by the fit of H_0 exactly. The harmonic balance solvers evaluate the fitted block too, so the two describe the same block.
JosephsonCircuits.RationalScattering Method
RationalScattering(block::ScatteringParameters, npoles;
frequencies = nothing, tol = 1e-2, atol = 1e-8, noisetol = 5e-3,
fitting = VectorFitting(), passivity = PassivityEnforcement(),
delays = nothing, maxstates = defaultmaxstates(), weights = nothing)A RationalScattering block fitted to the scattering data of block at npoles common poles by vector fitting: starting poles, spread over the band or given, are relocated by the relaxed iteration of Gustavsen and Semlyen until they settle, and the residues of every entry and the constant term follow by least squares, with the numerical parameters of fitting (see VectorFitting). The data is sampled at the angular frequencies in rad/s, by default a tabulated block's own. Poles the data does not need drift out of the band or coalesce and are pruned, so npoles is a budget rather than the order returned; too few poles settle on a poor fit. The block returned is measured against the samples, by its largest deviation from them in the spectral norm as a fraction of the largest response, as the tol method of the search measures it, and refused where that exceeds tol, since a block quietly far from its data is worse than none; where no fit with the poles the relocation settles on can come within tol, as a weighted least squares at them bounds, it is refused before the passivity enforcement, which keeps the poles. The result is a real state space realization, stable by construction, with as many states per pole as its residue has rank. The fitted block keeps the reference impedances, grounding and noise model of block, a stated covariance completed (see below).
weights, an array of the samples' shape, (nports, nports, K) for K frequencies, of positive numbers, weighs each entry at each sample: the least squares of the relocation and of the residues, the errors the pruning holds and tol bounds, and the least change of the passivity enforcement all take each entry's deviation times its weight, and the largest response is that of the samples so weighted. 1 ./ abs.(S) of the samples S fits every entry to the same relative accuracy, as the individual element weighting of Gustavsen's VFdriver does, which small entries such as an isolation or a crosstalk need, and a weight the same for every entry at a sample weighs the samples. Only the weights' ratios matter, and weights the same everywhere are no weights. Weighted, the relocation runs on the entries, each with a least squares of its own, rather than on their singular components, and so do the residues, so that a fit costs as the square of the ports rather than as the components; the entries are shared among Julia's threads.
The realization holds dense matrices of the states, so the memory a fit takes grows as the square of its states. A fit of more than maxstates states is refused before any of them is formed. By default that is the most states whose matrices take half the memory, as Sys.total_memory() reports it. Weighted, the passivity enforcement holds a metric of its own for each entry, or where a residue has less than full rank for each port, of every unknown of a port's row, and a correction whose metric needs more than the states leave of that memory is refused before the metric is formed.
A delay is not a rational function. A stable proper rational function's impulse response starts at zero time, so a fit of a delay answers throughout the delay rather than after it, and no pole budget removes that: the fit follows the phase of exp(-i w tau) over the band it is given and no further, and the turns above the band are what arrive early. delays, one per port in seconds, takes a delay out of the data before the fit, as a cable's is taken out before its fit: the entry from port q to port p is fitted with exp(i w (tau_p + tau_q)) taken out, so the block returned is the device with a lossless line of delay tau_p cut off each port, and is put back with a TransmissionLine of that delay in cascade at the port, which carries it exactly. A stated covariance is a correlation of the waves the block emits and is rotated by the difference of the delays where the scatter carries their sum, so delays which are all equal, and uncorrelated ports, leave it alone; one they do turn is turned at the frequency it is read at, whatever kind of provider states it. The delays leave a block passive, a diagonal phase on each side of S holding its singular values, and leave the zero frequency statement of a dcmodel alone.
With passivity, a PassivityEnforcement, the fit is perturbed wherever its dissipation I - S'S falls below -atol, its largest singular value above sqrt(1 + atol), about one plus half of atol, found on a grid over the band and at each resonance of the fit, or by a sweep of the frequency axis which bounds the fit over every interval, by the smallest change of its residues and constant that brings each such point under one by its margin, over at most its rounds rounds, and the result is established passive to atol by the sweep's bounds, at every frequency and not only at samples. A peak the rounds leave under sqrt(1 + atol) stands where it is, so a solve which needs a block further under one asks for a smaller atol. A fit the rounds leave within its scalelimit of one is contracted the rest of the way, which moves its response by about that much, and a warning says how far where that exceeds atol; one further above is refused, since a contraction that large describes a block which is mostly loss rather than the data. passivity = nothing returns the raw fit, without the enforcement or its repair of an active constant term, but still refuses one which the same sweep finds above sqrt(1 + atol) at some frequency, or does not settle within the enforcement's default maxtime, 300 s; enforcing passivity with a larger maxtime gives the sweep longer.
A block which states its noise with a NoiseCovariance may be active, so it is fitted as it is, with neither the enforcement nor the validation, and passivity is moot; the fit is still stable by construction. Its data must meet the commutation relations its covariance declares at every sample, to the covariance's atol, which the fit checks first and refuses otherwise. The fit meets them no better than its error, so the fitted block states the covariance completed to the commutation relations of the fitted scattering matrix (completed = true, see NoiseCovariance): it adds, at every frequency a solver evaluates it at, the noise its own commutator requires, and its output obeys the commutation relations exactly. That noise is what the fit costs, and the fit is refused when it exceeds, in quanta, noisetol of the square of the largest entry, or of one where the entries are smaller, at the samples and at the midpoints between them, as the fit of a LinearizedScattering block measures it. A covariance the block itself states completed already carries the noise the block's own scattering matrix requires, which the fitted block carries as well: the fit costs what its completion adds beyond that.
If block states its zero frequency behavior, through the dcmodel it was built with, the fit meets the statement exactly: the value at zero is linear in the residues once the poles settle, so it is imposed as an equality, on the residue fit and through the passivity enforcement. The statement is the caller's to make and is not checked against the data, which begins above zero and cannot check it. A statement far below the band may need poles placed there, which a start given as a vector of poles places. A statement of unit norm – a through, an open, a short – pins the norm of any fit meeting it at one, so such a fit is accepted at one to atol rather than contracted, which would move the statement; where the statement and passivity cannot both hold, the fit is refused.
The dissipation I - S S' is a difference of nearly equal quantities when the block is nearly lossless, so a fit error E appears in it as roughly 2E. A block with dissipation of order 1e-5 needs a fit accurate to well under that before its noise means anything; compare the fitted dissipation against the data's before trusting the noise of a fit.
JosephsonCircuits.RationalScattering Method
RationalScattering(block::ScatteringParameters; tol, minpoles = 4,
maxpoles = nothing, noisefloor = 1e-12, frequencies = nothing,
atol = 1e-8, noisetol = 5e-3, fitting = VectorFitting(),
passivity = PassivityEnforcement(), delays = nothing,
maxstates = defaultmaxstates(), weights = nothing)A RationalScattering block fitted to the scattering data of block at the fewest poles that meet tol, the largest allowed error over the samples as a fraction of the largest response, measured on the block that is returned, after any passivity enforcement. The order matters beyond tidiness because the states of the fit are the states a transient solve steps.
The search scans one order at a time from minpoles, because more poles do not always fit better: past the order the data supports, the pole relocation is decided by directions the samples do not determine, and the fit is then not merely inaccurate but often cannot be made passive at all. The orders meeting a tolerance are therefore a window rather than a tail, so there is nothing to bisect on, and an order that fails to fit counts as one that missed the tolerance. minpoles is the way not to pay for orders a block is known not to need. The samples themselves rule out the lowest orders of a block with many ports: a fit of N poles and a constant is a combination of N + 1 real functions of frequency, so its error is at least the part of the samples beyond their best approximation of that rank (Eckart and Young), and orders whose bound exceeds tol are not fitted. Nor is an order up to the degree the samples determine made passive whose poles admit no fit within tol: the enforcement keeps the poles, and a least squares at them, weighted toward the samples it misses most, bounds the error of every fit with them from below. Past that degree every order is made passive, since which of them can be decides where the scan ends.
Without maxpoles the search budgets itself by the degree the samples determine, the numerical rank of their Loewner pencil with noisefloor as the rank threshold, as a fraction of the largest singular value; it scans to twice that degree or to one pole fewer than the samples, whichever is fewer, and stops sooner if four consecutive orders past that degree produce no fit at all, which is the model class running out. Below the degree an order which produces no fit has too few poles for the data, and the scan goes on. The degree is an estimate, not a bound: it moves with noisefloor, which measured data with a real noise floor wants larger than the default, which suits data good to nearly full precision; the pencil is built along cycling coordinate directions from at most four hundred samples, so dynamics weak or narrow in the directions it does not probe can be missed; and a constant term contributes to it. Data of a high degree, as measured interconnects with long lines are, can put the end of the scan hundreds of orders away, each dearer than the last, so the scan also stops once the order has doubled since the fit's own errors before its passivity enforcement, its largest deviation over the samples or its rms over every entry and sample, last fell by a tenth of themselves, counted from the first fit whose largest deviation is under the largest response. The rms is counted as well because data of many features of equal strength, resonances as strong as one another, holds the largest deviation at a feature the fit has yet to take until it has taken them all, while the rms falls with each it takes. An error that has stalled can still fall again at much higher orders, so this is a budget rather than a proof, and the refusal says where the scan stopped and why. maxpoles overrides all of this and is a hard ceiling, which the scan reaches unless an order meets tol.
Whatever the ceiling, a fit of more than maxstates states ends the scan, since the memory a fit takes grows as the square of its states and the states grow with the order (see the npoles method).
If no order meets tol, the closest fit found and its order, the nearest of the orders refused before the enforcement and its bound, the degree the samples determine, where the scan ended if it stopped on its progress or on maxstates, and why any orders failed to fit are reported as an error, since a block quietly less accurate than asked for is worse than none: loosen tol, raise maxpoles, sample the block more finely, or fit a narrower band. Where no order produced a fit at all, the error says so, and names why they failed. A block which states its noise is returned at the first order which meets tol and whose completed covariance adds no more than noisetol (see the npoles method), and the error names the orders which met tol alone.
A delays given here is taken out before the search, so the order it reports is the order of what is left after the delay, which for a cable is a small fraction of what the delay itself would cost.
A contraction made to bring a fit under one is warned of for the fit returned alone: an order the search discards describes nothing the caller receives.
Every order starts from the spacing fitting names; starting poles given as a vector fix one order, and are refused here.
With weights every error is the weighted one (see the npoles method), and the samples' singular values rule out no order, each entry being fitted by the basis weighed by its own weights; the least squares bound on the poles of an order still refuses it before its enforcement.
See the npoles method for the meaning of the remaining arguments, and for the warning about fitting a block with little loss: a tolerance which looks tight against S may still be far too loose against the dissipation I - S S', where the error appears roughly doubled.
JosephsonCircuits.TransmissionLine Method
TransmissionLine(Z0, len; vp = speed_of_light, grounded = true,
noise = Passive())An ideal lossless transmission line of characteristic impedance Z0 Ohms, length len meters, and phase velocity vp meters per second, as a two port ScatteringParameters referenced to Z0. Its TransmissionLineProvider is exact at every signed frequency, so the block uses Native negative frequency evaluation. grounded and noise are as for ScatteringParameters.
Examples
julia> TransmissionLine(50.0, 1e-3).nports
2JosephsonCircuits.passivityassessment Method
passivityassessment(A, B, C, D; atol = 1e-8)Whether the real rational block S(s) = D + C (s I - A)^(-1) B is passive to within atol, its dissipation I - S'S no lower than -atol at any frequency, the tolerance a block's data is held to: its largest singular value at most sqrt(1 + atol), the level. The answer is the named tuple (; verdict, lower, upper, frequency): verdict one of :passive, :active and :indeterminate, lower the largest singular value found, at frequency in rad/s, and upper a level no singular value reaches, sqrt(1 + atol) where the block is passive and Inf where none was established.
The largest singular value is sought where a peak can stand: at the feedthrough, at zero, at the frequency of each pole and on a grid spanning the poles' magnitudes, and by a golden section search either side of each complex pole and between the neighbours of the best sample, since a narrow resonance peaks near its pole but not at it. A peak can be narrower than any search finds, so the frequencies where a singular value equals the level are found as well, as the imaginary eigenvalues of the Hamiltonian matrix of S over that level where the feedthrough stands well under it, and otherwise of a pencil which inverts nothing, so that a feedthrough at the level is no obstacle (Boyd and Balakrishnan), and the largest singular value between consecutive crossings is measured. A block is :active where a value found exceeds the level, which settles it, and :passive where none does and the level has no crossing, which settles it too.
Otherwise it is :indeterminate. The crossing test resolves a pair of crossings only so far as the roundoff lets their eigenvalues stand apart on the axis: a peak above the level by less than that brings its two crossings together into a nearly double eigenvalue which leaves the axis, and a narrow resonance under the level can leave eigenvalues near enough to the axis to be taken for crossings no value between them reaches. The caller is told so rather than given a side. The frequency axis alone is assessed: the stability of A, which passivity needs as well, is the caller's to check.