---
# System prepended metadata

title: Untitled

---

Entry = MeasurementSeries

MeasurementSeries = RegularMeasurementSeries / IrregularMeasurementSeries

RegularMeasurementSeries = [
    interval: Time,
    values: [ * $Value ]  ; * = zero or more
]

IrregularMeasurementSeries = [
    * [
        time: Time,
        value: $Value,
      ],
]

Time = [
    seconds: uint / float,
    unitMultiple: UnitMultipleSi,
]

$Value /= ElectricalValue .within GenericValue

GenericValue = [
    value:        unit / float,
    unitMultiple: UnitMultipleSi,
    unit:         $UnitSi,
]

ElectricalValue = [
    value:        float,
    unitMultiple: UnitMultipleSi,
    unit:         ElectricalUnitSi,
]
;  yocto => -24;
; &(yocto: -24)
; Im Prinzip wie ein Enum, also in CDDL menschenlesbar und in Code eine Zahl

UnitMultipleSi = &(
    yocto: -24,  ; y    (10^-24)
    zepto: -21,  ; z    (10^-21)
    atto:  -12,  ; a    (10^-18)
    femto: -15,  ; f    (10^-15)
    pico:  -12,  ; p    (10^-12)
    nano:   -9,  ; n    (10^-9)
    micro:  -6,  ; u    (10^-6)
    milli:  -3,  ; m    (10^-3)
    centi:  -2,  ; c    (10^-2)
    deci:   -1,  ; d    (10^-1)
    none:    0,  ; none (10^0)
    deca:    1,  ; da   (10^1)
    hecto:   2,  ; h    (10^2)
    kilo:    3,  ; k    (10^3)
    mega:    6,  ; M    (10^6)
    giga:    9,  ; G    (10^9)
    tera:   12,  ; T    (10^12)
    peta:   15,  ; P    (10^15)
    exa :   18,  ; E    (10^18)
    zetta:  21,  ; Z    (10^21)
    yotta:  24,  ; Y    (10^24)
)

$UnitSi /= ElectricalUnitSi

ElectricalUnitSi = &(
    none:         0,  ; none
    voltage:      1,  ; Volt    (V or E); unit of electrical potential: V=I*R
    current:      2,  ; Ampere  (I or i); unit of electrical current: I=V/R
    resistance:   3,  ; Ohm     (R or omega); unit of DC resistance R=V/I
    conductance:  4,  ; Siemen  (G or minuscle); reciprocal of resistance G=1/R
    capacitance:  5,  ; Farad   (C)     ; unit of capacitance C=Q/V
    charge:       6,  ; Coulomb (Q)     ; unit of electrical charge: Q=C*V
    inductance:   7,  ; Henry   (L or H); unit of inductance: V_L = -L(di/dt)
    power:        8,  ; Watts   (W)     ; unit of power: P=V*I or P=I2*R
    impedance:    9,  ; Ohm     (Z)     ; unit of AC resistance: Z^2=R^2+X^2
    frequency:   10,  ; Hertz   (Hz)    ; unit of frequency f=1/T,
)

; measurement_series_t

; Messreihe
; Regelmaessige Zeitreihe
; Unregelmaessige Zeitreihe

; https://datatracker.ietf.org/doc/html/rfc8428#section-12.1
; https://ucum.org/ucum.html
; https://github.com/qudt/qudt-public-repo
; https://www.rfc-editor.org/rfc/rfc8610.html#section-2.1
; https://github.com/cose-wg/Examples/blob/master/examples.cddl
; https://www.electronics-tutorials.ws/dccircuits/dcp_3.html
; https://www.computerwissen.de/software/office/libreoffice/calc-libreoffice/wie-sie-unregelmaessige-und-regelmaessige-zeitreihen-in-calc-erstellen/
; https://en.wikipedia.org/wiki/Physical_quantity
; https://github.com/anweiss/cddl

