diff --git a/code/go/dse/kind/SignalGroup.go b/code/go/dse/kind/SignalGroup.go index da2bfda..4fc975a 100644 --- a/code/go/dse/kind/SignalGroup.go +++ b/code/go/dse/kind/SignalGroup.go @@ -9,6 +9,7 @@ const ( type Signal struct { Annotations *Annotations `yaml:"annotations,omitempty"` Signal string `yaml:"signal"` + Transform *Transform `yaml:"transform,omitempty"` } type SignalGroup struct { Kind SignalGroupKind `yaml:"kind"` diff --git a/code/go/dse/kind/config.yaml b/code/go/dse/kind/config.yaml index 205894a..934835b 100644 --- a/code/go/dse/kind/config.yaml +++ b/code/go/dse/kind/config.yaml @@ -2,5 +2,6 @@ package: kind generate: models: true import-mapping: - metadata.yaml: delete_this_line channel.yaml: delete_this_line + metadata.yaml: delete_this_line + transform.yaml: delete_this_line diff --git a/code/go/dse/kind/transform.go b/code/go/dse/kind/transform.go new file mode 100644 index 0000000..3236251 --- /dev/null +++ b/code/go/dse/kind/transform.go @@ -0,0 +1,8 @@ +package kind + +type Transform struct { + Linear *struct { + Factor float64 `yaml:"factor"` + Offset float64 `yaml:"offset"` + } `yaml:"linear,omitempty"` +} diff --git a/doc/content/schemas/yaml/SignalGroup.md b/doc/content/schemas/yaml/SignalGroup.md index 6791767..1626895 100644 --- a/doc/content/schemas/yaml/SignalGroup.md +++ b/doc/content/schemas/yaml/SignalGroup.md @@ -25,6 +25,10 @@ metadata: spec: signals: - signal: string + transform: + linear: + factor: 0 + offset: 0 annotations: ? property1 ? property2 @@ -62,6 +66,10 @@ A signal group definition. ```yaml signals: - signal: string + transform: + linear: + factor: 0 + offset: 0 annotations: ? property1 ? property2 @@ -83,6 +91,10 @@ signals: ```yaml signal: string +transform: + linear: + factor: 0 + offset: 0 annotations: ? property1 ? property2 @@ -96,6 +108,10 @@ A signal definition. |Name|Type|Required|Description| |---|---|---|---| |signal|string|true|The name of the signal.| +|transform|object|false|A transformation definition.| +|» linear|object|false|Represents a linear transformation in the form:
f(X) = X * factor + offset.| +|»» factor|number(double)|true|none| +|»» offset|number(double)|true|none| |annotations|object|false|Non identifying information (i.e. information specific to the object itself).| |» **additionalProperties**|any|false|none| diff --git a/schemas/yaml/SignalGroup.yaml b/schemas/yaml/SignalGroup.yaml index 773042f..4f97f63 100644 --- a/schemas/yaml/SignalGroup.yaml +++ b/schemas/yaml/SignalGroup.yaml @@ -54,5 +54,7 @@ components: signal: type: string description: The name of the signal. + transform: + $ref: 'transform.yaml#/components/schemas/Transform' annotations: $ref: 'metadata.yaml#/components/schemas/Annotations' diff --git a/schemas/yaml/transform.yaml b/schemas/yaml/transform.yaml new file mode 100644 index 0000000..2bb9562 --- /dev/null +++ b/schemas/yaml/transform.yaml @@ -0,0 +1,41 @@ +# Copyright 2024 Robert Bosch GmbH +# +# SPDX-License-Identifier: Apache-2.0 + +--- +openapi: 3.0.0 +info: + title: Transform +paths: + /Transform: + get: + responses: + '200': + description: '' + content: + text/yaml: + schema: + type: array + items: + $ref: '#/components/schemas/Transform' +components: + schemas: + Transform: + type: object + description: A transformation definition. + properties: + linear: + type: object + description: > + Represents a linear transformation in the form: + f(X) = X * factor + offset. + required: + - factor + - offset + properties: + factor: + type: number + format: double + offset: + type: number + format: double