Reference Standard library

Standard library

The standard library is plain Hover source shipped next to the compiler binary. Everything here is reached with an angle-bracket import, and every model is readable — if a device's behaviour surprises you, the equations are right there.

Each heading below is one importable directory, and importing it brings in everything listed under it — an import names a directory, not a file, and subdirectories are separate units. Names arrive qualified by the last path segment (<semiconductors/bjt> binds bjt) unless you write from … import. See Imports.

<math>

  • importc "<math.h>" plus extern func declarations for the C math library: sin, cos, tan and their inverses, the hyperbolics, exp, log, pow, sqrt, fabs, atan2. Import this before using any of them.
  • Helper functions over the above.

In a math-dense analog body, bind the names directly rather than reading math.sin everywhere: from <math> import sin, exp;.

<semiconductors>

  • Diode<Is, n, Vt>[anode, cathode]. The Shockley equation with physical clamping at +0.85 V forward and −100 V reverse, relying on the runtime's diagonally-scaled trust-region solver to survive Newton-Raphson's exponential.

<semiconductors/bjt>

A separate import — <semiconductors> does not pull it in.

  • NPN<Is, Bf, Br, Vt>.
  • PNP<Is, Bf, Br, Vt>.

<optoelectronics/leds>

  • LED<Is, n, Vt, Vf_clamp, eta>[anode, cathode, light_out]. Same diode equation with LED-typical parameters, using NR junction limiting rather than a hard clamp because the exponential is much steeper at turn-on. light_out is an informational third port carrying luminous intensity as a voltage, proportional to forward current — illustrative units, not calibrated photometry.
  • Ready-made wrappers: LED_RED, LED_YELLOW, LED_GREEN, LED_BLUE, LED_WHITE, each with no generic parameters.

Both were separate files before 0.8; one import <optoelectronics/leds>; now covers them, and the split is the author's business rather than yours.

<electromechanical>

  • PMSM<Rs, Ld, Lq, flux_m, p, J, B>, a permanent-magnet synchronous machine.

Browse the sources on GitHub.