Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
WorstCaseError.cs
1using System;
2using System.Collections.Generic;
3using System.Text;
4using Waher.Content;
8
10{
15 {
20 : base()
21 {
22 }
23
27 public float Value { get; set; }
28
34 public override Grade Supports(ClassTypePair RecordTypeId)
35 {
36 return RecordTypeId.Class == 3 && RecordTypeId.Type == 15 ? Grade.Perfect : Grade.NotAtAll;
37 }
38
46 public override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
47 {
48 return new WorstCaseError()
49 {
50 Class = RecordTypeId.Class,
51 Type = RecordTypeId.Type,
52 RawValue = RawValue.Body,
53 Value = RawValue.NextSingle(nameof(WorstCaseError))
54 };
55 }
56
64 public override void AddFields(ThingReference Thing, DateTime Timestamp, List<Field> Fields, Teds Teds)
65 {
66 Fields.Add(new QuantityField(Thing, Timestamp, (Teds?.FieldName ?? "Value") + ", Worst-case Error", this.Value,
67 Math.Min(CommonTypes.GetNrDecimals(this.Value), (byte)2), Teds?.Unit ?? string.Empty,
68 FieldType.Status, FieldQoS.AutomaticReadout));
69 }
70
75 public override void AppendDetails(StringBuilder SnifferOutput)
76 {
77 SnifferOutput.Append("WorstCaseError=");
78 SnifferOutput.AppendLine(this.Value.ToString());
79 }
80 }
81}
Helps with parsing of commong data types.
Definition: CommonTypes.cs:13
static byte GetNrDecimals(double x)
Calculates the number of decimals of a floating-point number.
Definition: CommonTypes.cs:903
string Unit
Field unit of value, if found, otherwise the empty string.
Definition: Teds.cs:69
WorstCaseError()
TEDS Uncertainty under worst-case conditions (§6.5.2.20)
override void AddFields(ThingReference Thing, DateTime Timestamp, List< Field > Fields, Teds Teds)
Adds fields to a collection of fields.
override TedsRecord Parse(ClassTypePair RecordTypeId, Binary RawValue, ParsingState State)
Parses a TEDS record.
override void AppendDetails(StringBuilder SnifferOutput)
Appends record details to sniffer output.
override Grade Supports(ClassTypePair RecordTypeId)
How well the class supports a specific TEDS field type.
Represents one record in a TEDS
Definition: TedsRecord.cs:16
byte Class
This field identifies the TEDS being accessed. The value is the TEDS access code found in Table 72.
Definition: TedsRecord.cs:42
Represents a physical quantity value.
Contains a reference to a thing
Grade
Grade enumeration
Definition: Grade.cs:7
FieldQoS
Field Quality of Service flags
Definition: FieldQoS.cs:10
FieldType
Field Type flags
Definition: FieldType.cs:10