SimonHub Calc

Hilfe & Referenz

Kleine, sichere Rechensprache mit Python-artiger Syntax.

Inhaltsverzeichnis & Präfixe

Zusammengehörige Funktionen beginnen mit dem angegebenen Präfix. Die bisherigen Namen bleiben als kompatible Aliase gültig.

Enthaltene Funktionen Präfix Ausgesprochen / Bedeutung
Mathematik · Allgemeine mathematische Funktionen ohne Präfix. kein Präfix
Formatierung · Engineering- und SI-Ausgabeformate. fmt_ Format
Programmer · Zahlensysteme, Bitoperationen und Pretty Print. prog_ Programmer
Elektronik · Grundschaltungen und elektrische Größen. ee_ Electrical Engineering
Embedded · Timing, PWM, Timer und ADC. emb_ Embedded
Wechselstrom · Effektiv-, Spitzen- und Spitze-Spitze-Werte. ac_ Alternating Current
Dreiphasig · Stern, Dreieck und dreiphasige Leistung. ac3_ Three-phase Alternating Current
HV-Batterie · Pack, Energie, C-Rate, DCIR und Verluste. bat_ Battery
E-Maschine · Drehzahl, Drehmoment, Leistung und Frequenz. em_ Electric Machine
Leistungselektronik · DC/DC, PWM, Modulation und Halbleiterverluste. pe_ Power Electronics
Visualisierung · Sichere Funktionsplots über der Variablen x. kein Präfix
TILF · Zeitstempel relativ zur UTC-Epoche 2000. tilf_ TILF-Zeitformat
Hilfe · Direkter Verweis auf diese Referenz. kein Präfix

Schnellstart

[I1]: 1 + 2
[O1]: 3
[I2]: o1 * 10
[O2]: 30
[I3]: 230 * sqrt2
[O3]: 325.269119346
[I4]: fmt_si(ac3_p(400, 250, 0.92), "W")
[O4]: 159.349 kW
[I5]: plot(exp(x), -3, 3)
[O5]: Plot: exp(x)
[I6]: plot(log(x), 0.01, 10)
[O6]: Plot: log(x)

Erlaubt sind + - * / // % **, Klammern, & | ^ ~ << >>, Hex-/Binär-/Oktalliterale, die dokumentierten Namen und iN/oN. History-Referenzen sind nicht case-sensitiv.

Pfeil hoch öffnet bei leerer Eingabe den gesamten Katalog. Bei vorhandener Eingabe durchsuchen Pfeil hoch/runter die History. Bei geöffneter Vorschlagsliste wählen die Pfeiltasten; Tab oder Enter übernimmt und Esc schließt.

Engineering-Literale funktionieren ohne Leerzeichen: 1k, 4.7k, 2.2M, 100m, 47u, 100n und 10p. Ein Dezimalpunkt bleibt immer ein Punkt.

Funktionsplots verwenden plot(expression, x_min, x_max, points=300). Erlaubt sind x, mathematische Konstanten, History-Referenzen und reine Mathematikfunktionen wie sin, cos, tan, exp, log, log10, log2 und sqrt. Nicht definierte Werte erzeugen Lücken.

Konstanten

pi e tau sqrt2 sqrt3 G M k m u_micro n pico

Konstanten für ausgeschriebene Multiplikation: G M k m u_micro n pico. Die eindeutigen Namen vermeiden Konflikte mit Funktionen.

Mathematik

Allgemeine mathematische Funktionen ohne Präfix.

abs(x)

Absolutwert.

acos(x)

Arkuskosinus in Radiant.

asin(x)

Arkussinus in Radiant.

atan(x)

Arkustangens in Radiant.

atan2(y, x)

Quadrantenrichtiger Winkel.

ceil(x)

Aufrunden.

cos(x)

Kosinus; x in Radiant.

degrees(rad)

Radiant in Grad.

exp(x)

Exponentialfunktion zur Basis e.

factorial(n)

Fakultät bis n=500.

floor(x)

Abrunden.

hypot(*values)

Euklidische Länge.

log(x, base=e)

Logarithmus.

log10(x)

Zehnerlogarithmus.

log2(x)

Zweierlogarithmus.

max(a, b, ...)

Größter Wert.

min(a, b, ...)

Kleinster Wert.

radians(deg)

Grad in Radiant.

round(x, digits=0)

Wert runden.

sin(x)

Sinus; x in Radiant.

sqrt(x)

Quadratwurzel.

tan(x)

Tangens; x in Radiant.

trunc(x)

Nachkommastellen abschneiden.

Formatierung

Engineering- und SI-Ausgabeformate.

fmt_
fmt_eng(value, digits=6)

Engineering-Notation.

Kompatibler Alias: eng() Beispiel: fmt_eng(0.0000047)
fmt_si(value, unit, digits=6)

SI-Wert mit Einheit.

Kompatibler Alias: si() Beispiel: fmt_si(188495, "W")

Programmer

Zahlensysteme, Bitoperationen und Pretty Print.

prog_
prog_bin(value)

Binärdarstellung.

Kompatibler Alias: bin()
prog_bits(value)

Kompakte Bitübersicht; gibt value zurück.

Kompatibler Alias: bits()
prog_byteswap(value, bits=32)

Byte-Reihenfolge umkehren.

Kompatibler Alias: byteswap()
prog_chr(codepoint)

Unicode-Zeichen.

Kompatibler Alias: chr()
prog_clear_bit(value, bit)

Bit löschen.

Kompatibler Alias: clear_bit()
prog_hex(value)

Hexadezimaldarstellung.

Kompatibler Alias: hex()
prog_int(value, base=10)

Ganzzahl konvertieren.

Kompatibler Alias: int()
prog_oct(value)

Oktaldarstellung.

Kompatibler Alias: oct()
prog_ord(character)

Unicode-Codepoint.

Kompatibler Alias: ord()
prog_popcount(value)

Gesetzte Bits zählen.

Kompatibler Alias: popcount()
prog_pp(value)

Pretty Print als DEC/HEX/BIN; gibt value zurück.

Kompatibler Alias: pp() Beispiel: prog_pp(0x1234abcd)
prog_rol(value, shift, bits=32)

Nach links rotieren.

Kompatibler Alias: rol()
prog_ror(value, shift, bits=32)

Nach rechts rotieren.

Kompatibler Alias: ror()
prog_s16(value)

Signed 16-Bit.

Kompatibler Alias: s16()
prog_s32(value)

Signed 32-Bit.

Kompatibler Alias: s32()
prog_s64(value)

Signed 64-Bit.

Kompatibler Alias: s64()
prog_s8(value)

Signed 8-Bit.

Kompatibler Alias: s8()
prog_set_bit(value, bit)

Bit setzen.

Kompatibler Alias: set_bit()
prog_test_bit(value, bit)

Bit als 0 oder 1 lesen.

Kompatibler Alias: test_bit()
prog_toggle_bit(value, bit)

Bit umschalten.

Kompatibler Alias: toggle_bit()
prog_twos(value, bits)

Zweierkomplement interpretieren.

Kompatibler Alias: twos() Beispiel: prog_twos(0xff, 8)
prog_u16(value)

Unsigned 16-Bit.

Kompatibler Alias: u16()
prog_u32(value)

Unsigned 32-Bit.

Kompatibler Alias: u32()
prog_u64(value)

Unsigned 64-Bit.

Kompatibler Alias: u64()
prog_u8(value)

Unsigned 8-Bit.

Kompatibler Alias: u8()

Elektronik

Grundschaltungen und elektrische Größen.

ee_
ee_db(ratio)

Amplitudenverhältnis in dB.

Kompatibler Alias: db()
ee_db_power(ratio)

Leistungsverhältnis in dB.

Kompatibler Alias: db_power()
ee_dbm(power_w)

Watt in dBm.

Kompatibler Alias: dbm()
ee_divider(vin, r_top, r_bottom)

Unbelasteter Spannungsteiler.

Kompatibler Alias: divider()
ee_fc_rc(resistance, capacitance)

RC-Grenzfrequenz.

Kompatibler Alias: fc_rc()
ee_i(voltage, resistance)

Ohmsches Gesetz I=U/R.

Kompatibler Alias: i()
ee_p(voltage, current)

Elektrische Leistung U·I.

Kompatibler Alias: p()
ee_parallel(*resistances)

Paralleler Ersatzwiderstand.

Kompatibler Alias: parallel() Beispiel: ee_parallel(1000, 2200)
ee_r(voltage, current)

Ohmsches Gesetz R=U/I.

Kompatibler Alias: r()
ee_ratio_db(db_value)

dB in Amplitudenverhältnis.

Kompatibler Alias: ratio_db()
ee_rc(resistance, capacitance)

RC-Zeitkonstante.

Kompatibler Alias: rc()
ee_rl(inductance, resistance)

RL-Zeitkonstante.

Kompatibler Alias: rl()
ee_series(*values)

Reihenschaltung addieren.

Kompatibler Alias: series()
ee_u(current, resistance)

Ohmsches Gesetz U=I·R.

Kompatibler Alias: u()
ee_watts_dbm(dbm_value)

dBm in Watt.

Kompatibler Alias: watts_dbm()
ee_xc(frequency, capacitance)

Kapazitiver Blindwiderstand.

Kompatibler Alias: xc()
ee_xl(frequency, inductance)

Induktiver Blindwiderstand.

Kompatibler Alias: xl()

Embedded

Timing, PWM, Timer und ADC.

emb_
emb_adc_code(voltage, vref, bits)

Spannung in idealen ADC-Code.

Kompatibler Alias: adc_code()
emb_adc_voltage(code, vref, bits)

ADC-Code in Spannung.

Kompatibler Alias: adc_voltage()
emb_bit_time(baudrate)

Bitdauer aus Baudrate.

Kompatibler Alias: bit_time()
emb_frequency(period)

Periodendauer in Frequenz.

Kompatibler Alias: frequency()
emb_period(frequency)

Frequenz in Periodendauer.

Kompatibler Alias: period()
emb_pwm_duty(on_time, period)

PWM-Tastgrad 0…1.

Kompatibler Alias: pwm_duty()
emb_timer_frequency(clock, prescaler, period)

Timerfrequenz; period zählt inklusive 0.

Kompatibler Alias: timer_frequency()

Wechselstrom

Effektiv-, Spitzen- und Spitze-Spitze-Werte.

ac_
ac_peak(rms_value)

Sinus-Effektivwert ·√2.

Kompatibler Alias: peak()
ac_peak_from_pp(vpp_value)

Peak-to-Peak in Spitzenwert.

Kompatibler Alias: peak_from_pp()
ac_rms(peak_value)

Sinus-Spitzenwert /√2.

Kompatibler Alias: rms()
ac_vpp(peak_value)

Peak-to-Peak; pp() bleibt Pretty Print.

Kompatibler Alias: vpp()

Dreiphasig

Stern, Dreieck und dreiphasige Leistung.

ac3_
ac3_delta_line_current(i_phase)

Dreieck: I_line=I_phase·√3.

Kompatibler Alias: delta_line_current()
ac3_delta_phase_current(i_line)

Dreieck: I_phase=I_line/√3.

Kompatibler Alias: delta_phase_current()
ac3_p(v_line, i_line, cosphi=1)

Wirkleistung einer symmetrischen Last.

Kompatibler Alias: p3() Beispiel: ac3_p(400, 250, 0.92)
ac3_q(v_line, i_line, cosphi)

Blindleistungsbetrag; sinφ aus cosφ.

Kompatibler Alias: q3()
ac3_s(v_line, i_line)

Scheinleistung √3·U_LL·I_L.

Kompatibler Alias: s3()
ac3_star_line_current(i_phase)

Stern: I_line=I_phase.

Kompatibler Alias: star_line_current()
ac3_star_line_voltage(v_phase)

Stern: U_LL=U_phase·√3.

Kompatibler Alias: star_line_voltage()
ac3_star_phase_voltage(v_line)

Stern: U_phase=U_LL/√3.

Kompatibler Alias: star_phase_voltage()

HV-Batterie

Pack, Energie, C-Rate, DCIR und Verluste.

bat_
bat_c_rate(current, capacity_ah)

C-Rate.

Kompatibler Alias: c_rate()
bat_cell_v(pack_v, ns)

Zellspannung aus Packspannung.

Kompatibler Alias: cell_v()
bat_current_c(c_rate, capacity_ah)

Strom aus C-Rate.

Kompatibler Alias: current_c()
bat_dcir(delta_v, delta_i)

DC-Innenwiderstand ΔU/ΔI.

Kompatibler Alias: dcir()
bat_eff(pin, pout)

Wirkungsgrad Pout/Pin als 0…1.

Kompatibler Alias: eff()
bat_energy_kwh(voltage, capacity_ah)

Nennenergie in kWh.

Kompatibler Alias: energy_kwh()
bat_energy_wh(voltage, capacity_ah)

Nennenergie in Wh.

Kompatibler Alias: energy_wh()
bat_loss(pin, pout)

Verlustleistung Pin−Pout.

Kompatibler Alias: loss()
bat_pack_ah(cell_ah, np)

Packkapazität.

Kompatibler Alias: pack_ah()
bat_pack_kwh(cell_v, cell_ah, ns, np)

Pack-Nennenergie in kWh.

Kompatibler Alias: pack_kwh() Beispiel: bat_pack_kwh(3.7, 5, 216, 24)
bat_pack_v(cell_v, ns)

Packspannung.

Kompatibler Alias: pack_v()
bat_pdc(voltage, current)

DC-Leistung U·I.

Kompatibler Alias: pdc()
bat_ploss(current, resistance)

Ohmsche Verlustleistung I²R.

Kompatibler Alias: ploss()
bat_soc_energy(capacity_kwh, soc)

Verfügbare Energie; soc 0…1.

Kompatibler Alias: soc_energy()
bat_vdrop(current, resistance)

Spannungsabfall I·R.

Kompatibler Alias: vdrop()

E-Maschine

Drehzahl, Drehmoment, Leistung und Frequenz.

em_
em_electrical_frequency(rpm, pole_pairs)

Elektrische Grundfrequenz.

Kompatibler Alias: electrical_frequency()
em_mech_power(torque, rpm)

Mechanische Leistung M·ω in W.

Kompatibler Alias: mech_power()
em_omega(rpm)

Drehzahl in rad/s.

Kompatibler Alias: omega()
em_rpm(power, torque)

Drehzahl aus Leistung und Drehmoment.

Kompatibler Alias: rpm()
em_rpm_from_omega(omega)

rad/s in rpm.

Kompatibler Alias: rpm_from_omega()
em_rpm_sync(frequency, pole_pairs)

Synchrondrehzahl.

Kompatibler Alias: rpm_sync()
em_torque(power, rpm)

Drehmoment aus Leistung und Drehzahl.

Kompatibler Alias: torque()

Leistungselektronik

DC/DC, PWM, Modulation und Halbleiterverluste.

pe_
pe_boost_duty(vout, vin)

Idealer Boost-Tastgrad 1−Vin/Vout.

Kompatibler Alias: boost_duty()
pe_boost_v(vin, duty)

Idealer Boost CCM: Vout=Vin/(1−D).

Kompatibler Alias: boost_v()
pe_buck_v(vin, duty)

Idealer Buck: Vout=Vin·D; D 0…1.

Kompatibler Alias: buck_v()
pe_cond_loss(i_rms, r_on, duty=1, devices=1)

I_rms²·R_on·D·devices.

Kompatibler Alias: cond_loss()
pe_duty(vout, vin)

Idealer Buck-Tastgrad Vout/Vin.

Kompatibler Alias: duty()
pe_spwm_mod_index(vll_rms, vdc)

SPWM-Modulationsindex.

Kompatibler Alias: spwm_mod_index()
pe_spwm_vll_rms(vdc, m=1)

2-Level-SPWM: U_LL,rms=m·Vdc·√3/(2√2).

Kompatibler Alias: spwm_vll_rms()
pe_svpwm_mod_index(vll_rms, vdc)

Normierter SVPWM-Modulationsindex.

Kompatibler Alias: svpwm_mod_index()
pe_svpwm_vll_rms(vdc, m=1)

SVPWM linear normiert: U_LL,rms=m·Vdc/√2.

Kompatibler Alias: svpwm_vll_rms()
pe_switch_loss(eon, eoff, fsw, devices=1)

(Eon+Eoff)·fsw·devices; Energie in J.

Kompatibler Alias: switch_loss()

Visualisierung

Sichere Funktionsplots über der Variablen x.

plot(expression, x_min, x_max, points=300)

Sicherer Funktionsplot über der Variablen x.

Beispiel: plot(sin(x), -2*pi, 2*pi)

TILF

Zeitstempel relativ zur UTC-Epoche 2000.

tilf_
tilf_convert(timestamp)

UTC und Sekunden seit 2000 darstellen.

Kompatibler Alias: tilf() Beispiel: tilf_convert("2020-07-16 08:07:00")
tilf_diff(timestamp1, timestamp2)

Differenz zweier TILF-Zeiten in Sekunden.

Kompatibler Alias: dtilf()
tilf_now()

Aktuelle UTC-Zeit als TILF-Sekunden.

Kompatibler Alias: tnowilf()

Hilfe

Direkter Verweis auf diese Referenz.

help()

Verweist auf die Web-Hilfe.

Sicherheitsgrenzen

Calc führt keinen freien Python-Code aus. Attribute, Imports, Builtins, Dunder-Namen, Zuweisungen, Lambdas, Comprehensions, Container-Literale und beliebige Calls werden abgewiesen. Grenzen gelten außerdem für Eingabelänge, AST-Größe und -Tiefe, Argumente, Strings, Ganzzahlen, Exponenten, Shifts, Ergebnisse und HTTP-Request-Größe. Engineering-Suffixe werden ausschließlich für direkt angehängte, dezimale Zahlen aus einer festen Whitelist übersetzt. Plots verwenden eine eigene Mathematik-Whitelist und höchstens 500 Stützpunkte.