From 40a87f4962b5188e311d84e5242bbde2d36908ec Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 9 Oct 2021 17:38:49 +0200 Subject: [PATCH] add JSONschemas for ACS PMU formats --- doc/config.schema.json | 256 ----------------------- doc/schema/config.yaml | 185 ++++++++++++++++ doc/schema/format/acs-pmu-edgeflex.yaml | 42 ++++ doc/schema/format/acs-pmu-igor.yaml | 87 ++++++++ doc/schema/format/acs-pmu-sogno-old.yaml | 69 ++++++ doc/schema/format/acs-pmu-sogno.yaml | 78 +++++++ 6 files changed, 461 insertions(+), 256 deletions(-) delete mode 100644 doc/config.schema.json create mode 100644 doc/schema/config.yaml create mode 100644 doc/schema/format/acs-pmu-edgeflex.yaml create mode 100644 doc/schema/format/acs-pmu-igor.yaml create mode 100644 doc/schema/format/acs-pmu-sogno-old.yaml create mode 100644 doc/schema/format/acs-pmu-sogno.yaml diff --git a/doc/config.schema.json b/doc/config.schema.json deleted file mode 100644 index 53ce0bcfe..000000000 --- a/doc/config.schema.json +++ /dev/null @@ -1,256 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema", - "$id": "http://example.com/example.json", - "type": "object", - "title": "VILLASnode configuration", - "description": "Schema of the VILLASnode configuration file.", - "default": {}, - "required": [ - "nodes" - ], - "properties": { - "hugepages": { - "$id": "#/properties/hugepages", - "type": "integer", - "title": "The hugepages schema", - "description": "An explanation about the purpose of this instance.", - "default": 0, - "examples": [ - 0 - ] - }, - "http": { - "$id": "#/properties/http", - "type": "object", - "title": "The http schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "htdocs": "/usr/share/villas/node/web" - } - ], - "required": [ - "htdocs" - ], - "properties": { - "htdocs": { - "$id": "#/properties/http/properties/htdocs", - "type": "string", - "title": "The htdocs schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "/usr/share/villas/node/web" - ] - } - }, - "additionalProperties": true - }, - "logging": { - "$id": "#/properties/logging", - "type": "object", - "title": "The logging schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "examples": [ - { - "level": "info" - } - ], - "required": [ - "level" - ], - "properties": { - "level": { - "$id": "#/properties/logging/properties/level", - "type": "string", - "title": "The level schema", - "description": "An explanation about the purpose of this instance.", - "default": "", - "examples": [ - "info" - ] - } - }, - "additionalProperties": true - }, - "nodes": { - "$id": "#/properties/nodes", - "type": "object", - "title": "The nodes schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "patternProperties": { - "[a-z0-9_-]{2,32}": { - "$id": "#/properties/nodes/properties/node", - "type": "object", - "title": "The node schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "required": [ - "type" - ], - "properties": { - "type": { - "$id": "#/properties/nodes/properties/sig/properties/type", - "type": "string", - "title": "The type schema", - "description": "An explanation about the purpose of this instance.", - "default": "" - }, - "in": { - "type": "object", - "properties": { - "vectorize": { - "type": "integer", - "minimum": 1 - }, - "signals": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - - }, - "unit": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "integer", "float", "boolean", "complex" - ] - }, - "init": { - "oneOf": [ - { - "type": "integer" - }, - { - "type": "number", - }, - { - "type": "boolean" - }, - { - "type": "object", - "required": ["real", "imag"], - "additionalProperties": false, - "properties": { - "real": { - "type": "number" - }, - "imag": { - "type": "number" - } - } - } - ] - }, - "enabled": { - "type": "boolean", - "default": true - } - } - } - }, - { - "type": "object", - "additionalProperties": false, - "properties": { - "count": { - "type": "integer", - "minimum": 1 - }, - "type": { - "type": "string", - "enum": [ - "integer", "float", "boolean", "complex" - ] - } - } - } - ] - } - } - }, - "out": { - "type": "object", - "properties": { - "vectorize": { - "type": "integer" - } - } - } - }, - "additionalProperties": true - } - }, - "additionalProperties": false - }, - "paths": { - "$id": "#/properties/paths", - "type": "array", - "title": "The paths schema", - "description": "An explanation about the purpose of this instance.", - "default": [], - "additionalItems": false, - "items": { - "$id": "#/properties/paths/items", - "anyOf": [ - { - "$id": "#/properties/paths/items/anyOf/0", - "type": "object", - "title": "The first anyOf schema", - "description": "An explanation about the purpose of this instance.", - "default": {}, - "required": [ - "in" - ], - "properties": { - "in": { - "$id": "#/properties/paths/items/anyOf/0/properties/in", - "type": "string", - "title": "The in schema", - "description": "An explanation about the purpose of this instance.", - "default": "" - }, - "out": { - "$id": "#/properties/paths/items/anyOf/0/properties/out", - "type": "string", - "title": "The out schema", - "description": "An explanation about the purpose of this instance.", - "default": "" - } - }, - "additionalProperties": true - } - ] - } - }, - "stats": { - "type": "number" - }, - "affinity": { - "type": "integer" - }, - "priority": { - "type": "integer" - }, - "idle_stop": { - "type": "boolean" - }, - "uuid": { - "type": "string", - "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" - } - }, - "additionalProperties": false -} diff --git a/doc/schema/config.yaml b/doc/schema/config.yaml new file mode 100644 index 000000000..ec10f8c41 --- /dev/null +++ b/doc/schema/config.yaml @@ -0,0 +1,185 @@ +--- +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema + +$schema: 'http://json-schema.org/draft-07/schema' +$id: 'https://villas.fein-aachen.org/config.json' + +type: object +title: VILLASnode configuration file +description: Schema of the VILLASnode configuration file. +default: {} +required: +- nodes +additionalProperties: false + +properties: + + hugepages: + type: integer + title: The hugepages schema + description: An explanation about the purpose of this instance. + default: 0 + examples: + - 0 + + stats: + type: number + + affinity: + type: integer + + priority: + type: integer + + idle_stop: + type: boolean + default: false + + uuid: + type: string + format: uuid + + http: + type: object + title: The http schema + description: An explanation about the purpose of this instance. + default: {} + examples: + - htdocs: /usr/share/villas/node/web + required: + - htdocs + properties: + htdocs: + type: string + title: The htdocs schema + description: An explanation about the purpose of this instance. + default: '' + examples: + - /usr/share/villas/node/web + additionalProperties: true + + logging: + type: object + title: The logging schema + description: An explanation about the purpose of this instance. + default: {} + examples: + - level: info + required: + - level + properties: + level: + type: string + title: The level schema + description: An explanation about the purpose of this instance. + default: '' + examples: + - info + additionalProperties: true + + nodes: + type: object + title: The nodes schema + description: An explanation about the purpose of this instance. + default: {} + patternProperties: + '[a-z0-9_-]{2,32}': + type: object + title: The node schema + description: An explanation about the purpose of this instance. + default: {} + required: + - type + properties: + type: + type: string + title: The type schema + description: An explanation about the purpose of this instance. + default: '' + in: + type: object + properties: + vectorize: + type: integer + minimum: 1 + signals: + oneOf: + - type: string + - type: array + items: + type: object + properties: + name: {} + unit: + type: string + type: + type: string + enum: + - integer + - float + - boolean + - complex + init: + oneOf: + - type: integer + - type: number + - type: boolean + - type: object + required: + - real + - imag + additionalProperties: false + properties: + real: + type: number + imag: + type: number + enabled: + type: boolean + default: true + - type: object + additionalProperties: false + properties: + count: + type: integer + minimum: 1 + type: + type: string + enum: + - integer + - float + - boolean + - complex + out: + type: object + properties: + vectorize: + type: integer + additionalProperties: true + additionalProperties: false + paths: + type: array + title: The paths schema + description: An explanation about the purpose of this instance. + default: [] + additionalItems: false + items: + anyOf: + - type: object + title: The first anyOf schema + description: An explanation about the purpose of this instance. + default: {} + required: + - in + properties: + in: + type: string + title: The in schema + description: An explanation about the purpose of this instance. + default: '' + out: + type: string + title: The out schema + description: An explanation about the purpose of this instance. + default: '' + additionalProperties: true diff --git a/doc/schema/format/acs-pmu-edgeflex.yaml b/doc/schema/format/acs-pmu-edgeflex.yaml new file mode 100644 index 000000000..ad43cb8e1 --- /dev/null +++ b/doc/schema/format/acs-pmu-edgeflex.yaml @@ -0,0 +1,42 @@ +--- +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema + +$schema: 'http://json-schema.org/draft-07/schema' +$id: 'https://villas.fein-aachen.org/formats/edgeflex.json' + +title: PMU measurements as used in the EdgeFlex project by Manuel +description: | + VILLASnode does not support deseralization (yet) + +type: object +required: +- created +properties: + created: + description: A timestamps in miliseconds since 1970-01-01 00:00:00 + type: number + min: 0 + +additionalItems: + description: Key-value pairs of measurements + anyOf: + - type: number + - type: integer + - type: boolean + - type: object + description: A complex number represented in real and imaginary components + properties: + real: + type: number + imag: + type: number + +examples: +- - signal0: 123.456 + signal1: true + signal2: 1234 + signal3: + real: 1234.4556 + imag: 23232.12312 + created: 1633791645123 + \ No newline at end of file diff --git a/doc/schema/format/acs-pmu-igor.yaml b/doc/schema/format/acs-pmu-igor.yaml new file mode 100644 index 000000000..9131c7467 --- /dev/null +++ b/doc/schema/format/acs-pmu-igor.yaml @@ -0,0 +1,87 @@ +--- +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema + +$schema: 'http://json-schema.org/draft-07/schema' +$id: 'https://villas.fein-aachen.org/formats/edgeflex.json' + +title: PMU format used by Igor + +examples: +- device: device1 + timestamp: '2020-05-20T10:27:57.980802+00:00' + readings: + - channel: BUS1-VA + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-IA + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-VB + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-IB + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-VC + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-IC + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-VN + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + - channel: BUS1-IN + magnitude: 9.171 + phase: 0.8305 + frequency: 50.1 + rocof: 0.11 + +type: object +required: +- device +- timestamp +- readings + +properties: + device: + description: ID for measurement device + type: string + + timestamp: + description: Timestamp of measurement in ISO 8601 format + type: string + pattern: '^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$' + + readings: + type: array + items: + channel: + type: string + + magnitude: + type: number + + phase: + type: number + + frequency: + type: number + description: Frequency in Hertz + + rocof: + type: number diff --git a/doc/schema/format/acs-pmu-sogno-old.yaml b/doc/schema/format/acs-pmu-sogno-old.yaml new file mode 100644 index 000000000..5fe66c9f1 --- /dev/null +++ b/doc/schema/format/acs-pmu-sogno-old.yaml @@ -0,0 +1,69 @@ + +--- +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema + +title: Original PMU sensor data format as used in the SOGNO EU project + +type: object +required: +- device +- timestamp +- component +- measurand +- phase +- data + +properties: + device: + description: ID for measurement device + type: string + + timestamp: + description: Timestamp of measurement in ISO 8601 format + type: string + pattern: '^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$' + + component: + description: ID (uuid) from CIM document + type: string + format: uuid + + measurand: + type: string + enum: + - voltmagnitude + - voltangle + - currmagnitude + - currangle + - activepower + - reactivepower + - apparentpower + - frequency + + phase: + type: string + enum: + - A + - B + - C + + data: + type: number + description: | + Measurement value as in the following format depending on value of measurand: + - voltmagnitude: phase-to-ground RMS value, unit volts + - voltangle: unit radian + - currmagnitude: RMS value, unit ampere + - currangle: unit radian + - activepower: single phase power, unit watts + - reactivepower: single phase power, unit voltampere reactive + - apparentpower: single phase power, unit voltampere + - frequency: unit hertz + +examples: + - device: pmu-abc0 + timestamp: '2021-10-07T10:11:12.1231241+02:00' + component: 7a30b61a-2913-11ec-9621-0242ac130002 + measurand: voltagemagnitude + phase: A + data: 123124 diff --git a/doc/schema/format/acs-pmu-sogno.yaml b/doc/schema/format/acs-pmu-sogno.yaml new file mode 100644 index 000000000..785312407 --- /dev/null +++ b/doc/schema/format/acs-pmu-sogno.yaml @@ -0,0 +1,78 @@ +--- +# yaml-language-server: $schema=http://json-schema.org/draft-07/schema + +$schema: 'http://json-schema.org/draft-07/schema' +$id: 'https://villas.fein-aachen.org/formats/edgeflex.json' + +title: PMU format used in SOGNO LF project + +examples: +- device: device1 + timestamp: '2020-05-20T10:27:57.980802+00:00' + readings: + - component: BUS1 + measurand: voltmagnitude + phase: A + data: 123 + - component: BUS2 + measurand: voltmagnitude + phase: A + data: 123 + +type: object +required: +- device +- timestamp +- readings + +properties: + device: + description: ID for measurement device + type: string + + timestamp: + description: Timestamp of measurement in ISO 8601 format + type: string + pattern: '^\d{4}(-\d\d(-\d\d(T\d\d:\d\d(:\d\d)?(\.\d+)?(([+-]\d\d:\d\d)|Z)?)?)?)?$' + + readings: + type: array + items: + type: object + properties: + component: + description: ID (uuid) from CIM document + type: string + format: uuid + + measurand: + type: string + enum: + - voltmagnitude + - voltangle + - currmagnitude + - currangle + - activepower + - reactivepower + - apparentpower + - frequency + + phase: + type: string + enum: + - A + - B + - C + + data: + type: number + description: | + Measurement value as in the following format depending on value of measurand: + - voltmagnitude: phase-to-ground RMS value, unit volts + - voltangle: unit radian + - currmagnitude: RMS value, unit ampere + - currangle: unit radian + - activepower: single phase power, unit watts + - reactivepower: single phase power, unit voltampere reactive + - apparentpower: single phase power, unit voltampere + - frequency: unit hertz