Resources Numerical accuracy
Calculations
Every calculation under our calculation policies: what it works out, its formula and the precision it runs at. Open one to see its code as it is in the released app.
Calculations
-
On-delay timer
The elapsed time and output of a TON block.
ET = min(now − t₀, PT); Q = ET ≥ PT
Controller standard functions and integer types std.js Every app64-bit -
Up counter
The count and output of a CTU block.
CV ← CV + 1 on a rising edge while CV < 32767; Q = CV ≥ PV
Controller standard functions and integer types std.js Every appExact -
Round to nearest, ties to even
The rounding used when a real is converted to an integer.
nearest whole number; a tie goes to the even neighbor
Controller standard functions and integer types std.js Every appExact -
Arithmetic functions
ABS, SQRT, LN, LOG, EXP, the trigonometric functions, MIN, MAX, LIMIT, TRUNC, SHL and SHR.
SQRT, LN, LOG, EXP, SIN and the rest from Math; SHL: x × 2ⁿ; SHR: ⌊x ÷ 2ⁿ⌋; TRUNC toward zero
Controller standard functions and integer types std.js Every app64-bit -
Type conversions
REAL_TO_INT, INT_TO_REAL, BOOL_TO_INT, TIME_TO_REAL and the other A_TO_B functions.
to an integer type: round to nearest (ties to even), then wrap; to a real type: unchanged
Controller standard functions and integer types std.js Every app64-bit -
Probability of a basic event
The probability of an event from a fixed value, a failure rate and time, a test interval, or repair data.
failed by t: 1 − e^(−λt); tested every τ: 1 − (1 − e^(−λτ)) ÷ (λτ), or λτ ÷ 2 below 1e-9; repairable: MTTR ÷ (MTTF + MTTR)
Fault trees and reliability block diagrams logic.js Every app64-bit -
At least k of n events
The probability that k or more of a set of independent events occur.
the distribution of the count, built one event at a time, summed from k up
Fault trees and reliability block diagrams logic.js Every app64-bit -
AND, OR and voting gates
The probability of a gate from its inputs when no event is repeated.
AND: Π pᵢ; OR: 1 − Π (1 − pᵢ)
Fault trees and reliability block diagrams logic.js Every app64-bit -
Top event with repeated events
The probability of the top event when the same event appears in several places.
P = p_x × P(tree | x occurs) + (1 − p_x) × P(tree | x does not)
Fault trees and reliability block diagrams logic.js Every app64-bit -
Cut set probabilities and bounds
The probability of each minimal cut set and two bounds on the top event.
rare event: min(1, Σ P(cut set)); upper bound: 1 − Π (1 − P(cut set))
Fault trees and reliability block diagrams logic.js Every app64-bit -
Importance measures
How much each event matters to the top event.
Birnbaum = P(top | p = 1) − P(top | p = 0); Fussell–Vesely = (P − P₀) ÷ P; RAW = P₁ ÷ P; RRW = P ÷ P₀
Fault trees and reliability block diagrams logic.js Every app64-bit -
Reliability of a component
The chance a block still works at the mission time.
R = e^(−λt); Weibull: R = e^(−(t ÷ η)^β)
Fault trees and reliability block diagrams logic.js Every app64-bit -
Block diagram reliability
The reliability of series, parallel and k-of-n arrangements.
series = OR of failures; parallel = AND; reliability = 1 − P(failure)
Fault trees and reliability block diagrams logic.js Every app64-bit -
Mean time to failure
The mean life of a system that is not repaired.
MTTF = ∫ R(t) dt by Simpson's rule, 4000 steps, to the time R ≤ 1e-9
Fault trees and reliability block diagrams logic.js Every app64-bit -
Common-cause split
The independent and the shared part of a failure rate.
independent = λ (1 − β); common = λ β
Fault trees and reliability block diagrams logic.js Every app64-bit -
Gamma function
Γ(x), used for the mean life.
Lanczos approximation, g = 7, 9 coefficients; reflection below 0.5
Weibull life data weibull.js Every app64-bit -
Weibull distribution functions
Failure probability, reliability, density, hazard, quantile, mean and B-life.
F = 1 − e^(−(t ÷ η)^β); quantile = η (−ln(1 − F))^(1 ÷ β); mean = η Γ(1 + 1 ÷ β)
Weibull life data weibull.js Every app64-bit -
Log-likelihood
How well a shape and scale explain the failure and suspension times.
Σ failures ln f(t) + Σ suspended ln R(t)
Weibull life data weibull.js Every app64-bit -
Maximum-likelihood fit
Shape, scale and their confidence bounds from failure times, with suspensions.
g(β) = Σ tᵝ ln t ÷ Σ tᵝ − 1 ÷ β − mean ln t = 0; η = (Σ tᵝ ÷ r)^(1 ÷ β)
Weibull life data weibull.js Every app64-bit -
Median ranks
The plotting position of each failure, adjusted for suspended units.
F = (rank − 0.3) ÷ (n + 0.4); rank increment = (n + 1 − previous rank) ÷ (1 + units at or after this one)
Weibull life data weibull.js Every app64-bit -
Rank regression fit
Shape and scale from a straight line on the Weibull plot.
β = S_xy ÷ S_xx on (ln t, ln(−ln(1 − F))); η = e^(−a ÷ β)
Weibull life data weibull.js Every app64-bit -
Duration drawn for a task
One trial's duration of a task given as minimum, most likely and maximum.
u < f: min + √(u (max − min)(mode − min)); else max − √((1 − u)(max − min)(max − mode)); duration = round(v)
Schedule risk (Monte Carlo) simulate.js Every app64-bit -
Finish percentiles, mean and spread
The finish day at each confidence level over all trials.
P = sorted[⌈p × n⌉ − 1]; mean = Σ ÷ n; sd = √(Σ (x − mean)² ÷ n)
Schedule risk (Monte Carlo) simulate.js Every app64-bit -
Criticality and sensitivity
The share of trials in which a task was critical, and the correlation of its duration with the finish.
criticality = times critical ÷ n; sensitivity = Σ (d − d̄)(F − F̄) ÷ √(Σ (d − d̄)² × n × sd²)
Schedule risk (Monte Carlo) simulate.js Every app64-bit -
Source signals
Step, ramp, sine and pulse sources as functions of time.
sine: offset + amp × sin(2π f t + phase); ramp: v₀ + (v₁ − v₀)(t − t₀) ÷ (t₁ − t₀)
Lumped system models model.js Every app64-bit -
Resistive element laws
The flow through a resistor, damper, orifice, diode or user law for a given difference across it.
resistor: i = v ÷ R; orifice: i = v ÷ √(K √(v² + ε²)); diode: i = Is (e^(v ÷ nVt) − 1), a straight line above 40 nVt
Lumped system models model.js Every app64-bit -
Storage elements
Capacitors, masses, tanks, inductors and springs: what they store and how it enters the equations.
capacitive: i + d(C v)/dt = 0; inductive: v + d(L i)/dt = 0; spring: L = 1 ÷ k
Lumped system models model.js Every app64-bit -
Reported flow through an element
The current, heat flow, flow or force reported for an element.
the element's law at the solved state; diode: Is (e^(min(v, 40 nVt) ÷ nVt) − 1)
Lumped system models model.js Every app64-bit -
Dense linear solve
Solves the Newton step.
Gaussian elimination with partial pivoting
Lumped system models solve.js Every app64-bit -
Newton iteration
Finds the state that satisfies the equations at one time.
J_ij = (F_i(x + h e_j) − F_i(x − h e_j)) ÷ 2h, h = 1e-7 × max(|x_j|, 1); stop when |Δxᵢ| ≤ rtol |xᵢ| + atol + 1e-11 × max(1, largest |x|)
Lumped system models solve.js Every app64-bit -
Operating point
The steady state, or the state set by the given initial values.
one Newton solve from zero
Lumped system models solve.js Every app64-bit -
One time step
The state one step later.
trapezoid: (2 ÷ h)(S − S₀) − Ṡ₀ + g = 0; backward Euler: (1 ÷ h)(S − S₀) + g = 0
Lumped system models solve.js Every app64-bit -
Step-size control
Chooses the time step from an estimate of the error, when adaptive stepping is on.
err = max |x(two half steps) − x(one step)| ÷ (rtol |x| + atol), ÷ 3 for the trapezoid; h ← h × clamp(0.9 err^(−1/3), 0.2, 5)
Lumped system models solve.js Every app64-bit -
Value between stored times
A node value at a time between two computed points.
y = y₀ + (y₁ − y₀)(t − t₀) ÷ (t₁ − t₀)
Lumped system models solve.js Every app64-bit -
Parameter expressions
The value of a parameter written as an expression, such as 2*3.3e3.
numbers, parameters, + − × ÷ ^, brackets, pi
Lumped system models modelica.js Every app64-bit -
Thermal conductance to resistance
A thermal conductor from a model file as the engine's thermal resistance.
R = 1 ÷ G
Lumped system models modelica.js Every app64-bit -
Center, radius and sweep of a bulge arc
The circle an arc segment lies on, from its two end points and its bulge.
θ = 4·atan(b); k = (c ÷ 2) ÷ tan(θ ÷ 2); center = midpoint + k × left normal; r = |p − center|
Arcs from bulges and three points geom.js64-bit- TakeoffCraft
-
Arc through three points
The bulge of the arc that starts at one point, passes through a second and ends at a third.
center = circumcenter(p, m, q); sweep = atan2(q − center) − atan2(p − center) ± 2π; b = tan(sweep ÷ 4)
Arcs from bulges and three points geom.js64-bit- TakeoffCraft
-
Segment lengths of a run and their sum
The length of each segment of an open run, and the run's total.
L = Σ segLength(pᵢ₋₁, pᵢ, bᵢ₋₁)
Arcs from bulges and three points geom.js64-bit- TakeoffCraft
-
Snap to the nearest 45° direction
Moves a picked point onto the nearest of the eight 45° directions from the point before it, keeping its distance along that direction.
u = round(cos, sin of k·45° to 12 decimals); p′ = base + u × ((p − base)·u)
Arcs from bulges and three points geom.js64-bit- TakeoffCraft
-
Circle as two half-circle arcs
Stores a drawn circle as two points on opposite sides of the center, each starting a half-circle arc.
r = |edge − c|; points (c.x + r, c.y) and (c.x − r, c.y), b = 1 each
Arcs from bulges and three points takeoffcraft.js64-bit- TakeoffCraft
-
Arc reshaped by dragging its middle
Recomputes a segment's bulge when its arc handle is dragged.
Arcs from bulges and three points takeoffcraft.js64-bit- TakeoffCraft
-
Length and area shown while drawing
The length of the last segment, the run so far, the area and perimeter so far, or a circle's radius and area, shown in the status line as the pointer moves.
length = L × k; area = A × k²; circle preview = π·r²
Arcs from bulges and three points takeoffcraft.js64-bit- TakeoffCraft
-
Check distance between two points
The real distance between two picked points, in feet-inches, decimal feet and meters.
ft = |b − a| × k; m = ft × 0.3048
Arcs from bulges and three points takeoffcraft.js64-bit- TakeoffCraft
-
Dropping repeated points when a mark is finished
Removes a point that sits on the one before it, as a double-click adds.
drop pᵢ when |pᵢ − previous kept point| ≤ 2 ÷ zoom
Arcs from bulges and three points takeoffcraft.js64-bit- TakeoffCraft
-
Arcs broken into chords
Replaces each arc of a run or outline by points on the arc, at most one step apart.
k = max(2, ⌈|θ| ÷ step⌉); pⱼ = center + r·(cos tⱼ, sin tⱼ), tⱼ = a₀ + θ·j ÷ k
Outline checks: inside, crossing, cut-outs geom.js64-bit- TakeoffCraft
-
Point inside an outline
Whether a point lies inside a closed outline.
Outline checks: inside, crossing, cut-outs geom.js64-bit- TakeoffCraft
-
Two segments cross or touch
Whether two straight segments cross or touch.
d₁ = (d − c) × (a − c), …; cross when d₁, d₂ lie beyond ±s on opposite sides and d₃, d₄ too
Outline checks: inside, crossing, cut-outs geom.js64-bit- TakeoffCraft
-
Outline crosses itself
Whether a closed outline crosses itself.
Outline checks: inside, crossing, cut-outs geom.js64-bit- TakeoffCraft
-
Outline that cannot be measured
Refuses an outline with too few points, one that crosses itself, or one with no area.
Outline checks: inside, crossing, cut-outs geom.js64-bit- TakeoffCraft
A calculation is added only after its source was read. Each statement can be checked in the code shown on its policy's page; the app repositories are public. When a release changes a calculation, its page says so until it has been read again.