mtconnect / cppagent

C++ Agent toolkit - Pre-built binaries, visit: https://github.com/mtconnect/cppagent/releases Docker images available at https://hub.docker.com/repositories/mtconnect
http://mtcup.org/
Apache License 2.0
141 stars 91 forks source link

Condition ID format and example not matching on Agent version 2.3? #444

Closed hulinning2 closed 4 months ago

hulinning2 commented 6 months ago

Based on readme document of version 2.3, the SHDR format of CONDITION only has 6 fields but, in the example, it shows 7 data fields (not included time stamp). Is that correct?

<timestamp>|<data_item_name>|<level>|<native_code>:<condition_id>|<native_severity>|<qualifier>|<message>

2014-09-29T23:59:33.460470Z|htemp|WARNING|HTEMP-1-HIGH|HTEMP|1|HIGH|Oil Temperature High**

image

I got errors when validating the current output with schema as shown below that require condition ID: 2024-04-22T18:49:48.2554602Z|UserMessage1||UNAVAILABLE 2024-04-22T18:49:48.2554602Z|system|NORMAL|3|4|5|6 2024-04-22T18:49:48.2554602Z|CoolantSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|ElectricSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|HydraulicSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|LubricationSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|PneumaticSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|LoaderSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|WasteDisposalSystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|ToolingDeliverySystem1_cond|UNAVAILABLE|||| 2024-04-22T18:49:48.2554602Z|BarFeederSystem1_cond|UNAVAILABLE||||

File http://localhost:5000/current is not valid. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed. Attribute 'conditionId' is required in element . Annotations of element 'Normal' (see below) {{term(condition state)}} that indicates operation within specified limits. Annotations of type 'NormalType' (see below) {{term(condition state)}} that indicates operation within specified limits. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Normal Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'NormalType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'NormalType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Normal' failed.`

wsobel commented 6 months ago

The nativeCode and conditionId are separated by a colon (:) not by a pipe (|)

hulinning2 commented 6 months ago

This means the sample shdr in the document is not correct because there is no colon. Is that correct?

2014-09-29T23:59:33.460470Z|htemp|WARNING|HTEMP-1-HIGH|HTEMP|1|HIGH|Oil Temperature High

wsobel commented 6 months ago

The example is wrong. There should not be the extra field. Missed that. I'll ask Dave to fix the docs.

There should only be 6 field not 7.

hulinning2 commented 6 months ago

It seems agent does not produce the data stream correctly or the schema is not correct.

I got invalid conditionId value of 1700 when validating with XMLSpy.

shdr data: 2024-04-23T15:15:17.3726547Z|system|FAULT|1700:1700|1700|HIGH|1700 ALARM_A 1

current output: `

1700 ALARM_A 1

`

XMLSpy Error: Value '1700' is not allowed for attribute 'conditionId'. Annotations of attribute 'conditionId' (see below) Identifier of an individual condition activation provided by a piece of equipment Annotations of type 'IDType' (see below) An identifier Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Fault / @conditionId Details cvc-datatype-valid.1.2.1: For type definition 'IDType' the string '1700' does not match a literal in the lexical space of built-in type definition 'xs:ID'. cvc-simple-type.1: For type definition 'IDType' the string '1700' is not valid. cvc-attribute.3: Value '1700' of attribute 'conditionId' does not match simple type definition 'IDType'. cvc-assess-elt.2: Assessment of attribute 'conditionId' failed.

hulinning2 commented 6 months ago

It seems missing conditionId in the data stream

2024-04-23T15:15:17.3726547Z|CoolantSystem1_cond|UNAVAILABLE||||

`

    </Condition>`

Error: Attribute 'conditionId' is required in element . Annotations of element 'Unavailable' (see below) The conditon can not be determined. Annotations of type 'UnavailableType' (see below) The conditon can not be determined. Error location: MTConnectStreams / Streams / DeviceStream / ComponentStream / Condition / Unavailable Details cvc-complex-type.4: Required attribute 'conditionId' is missing from element . cvc-type.3.2: Element is not valid with respect to type definition 'UnavailableType'. cvc-elt.5: The element is not valid with respect to the actual type definition 'UnavailableType'. cvc-assess-elt.1.1: Strict assessment of element with governing element declaration 'Unavailable' failed.

wsobel commented 6 months ago

It should be a string type not an id type. Shaurabh should fix it in the schema generator.

Thanks for finding this! - W

hulinning2 commented 5 months ago

still cannot validate streaming data with the latest schema because of invalid condition ID for MTConnect spec 2.3

2024-06-04T18:09:41.5803779Z|system|FAULT|1701:1701|1701|HIGH|1701 ALARM_A

image

wsobel commented 4 months ago

@shaurabhsingh Any progress?

shaurabhsingh commented 4 months ago

Apologies. Somehow I missed this. The conditionId type has been corrected for 2.3.

@hulinning2 kindly check if you are still getting the error.

hulinning2 commented 4 months ago

@shaurabhsingh

I got new errors from the latest schema files. Missing conditionId

image

shaurabhsingh commented 4 months ago

This seems like an agent error. As per the model, conditionId must be defined.

@wsobel I think this needs to be added to the Agent. The standard says the multiplicity of conditionId is 1. If conditionId is not given then it should be set to nativeCode. If nativeCode is also not given then the conditionId MUST be generated.

wsobel commented 4 months ago

Depends on the SchemaVersion. I’ll check to make sure it is being produced. - W

wsobel commented 4 months ago

@hulinning2 Can you upload your cfg file?

hulinning2 commented 4 months ago

@wsobel agent.zip

wsobel commented 4 months ago

Found the following issues with the current schema:

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 35:12 End location: 35:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 36:12 End location: 36:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 51:12 End location: 51:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 64:12 End location: 64:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 65:12 End location: 65:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 80:12 End location: 80:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 81:12 End location: 81:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 82:12 End location: 82:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 97:12 End location: 97:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 98:12 End location: 98:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-datatype-valid.1.2.1 Description: '1104' is not a valid value for 'NCName'. Start location: 99:12 End location: 99:19 URL: http://www.w3.org/TR/xmlschema11-2/#cvc-datatype-valid

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-attribute.3 Description: The value '1104' of attribute 'conditionId' on element 'Warning' is not valid with respect to its type, 'IDType'. Start location: 99:32 End location: 99:38 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-attribute

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 108:12 End location: 108:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 138:12 End location: 138:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 148:12 End location: 148:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.2.4.a Description: Invalid content was found starting with element '{"urn:mtconnect.org:MTConnectStreams:2.3":Level}'. One of '{"urn:mtconnect.org:MTConnectStreams:2.3":Event}' is expected. Start location: 153:12 End location: 153:17 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 156:12 End location: 156:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.2.4.a Description: Invalid content was found starting with element '{"urn:mtconnect.org:MTConnectStreams:2.3":FixtureGeometryDataSet}'. One of '{"urn:mtconnect.org:MTConnectStreams:2.3":Event}' is expected. Start location: 161:12 End location: 161:34 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.2.4.a Description: Invalid content was found starting with element '{"urn:mtconnect.org:MTConnectStreams:2.3":ToolSuffix}'. One of '{"urn:mtconnect.org:MTConnectStreams:2.3":Event}' is expected. Start location: 181:12 End location: 181:22 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 205:12 End location: 205:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 206:12 End location: 206:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 216:12 End location: 216:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 241:12 End location: 241:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 256:12 End location: 256:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

System ID: http://localhost:5001/current Main validation file: http://localhost:5001/current Schema: http://localhost:5001/schemas/MTConnectStreams_2.3.xsd Engine name: Xerces Severity: error Problem ID: cvc-complex-type.4 Description: Attribute 'conditionId' must appear on element 'Unavailable'. Start location: 273:12 End location: 273:23 URL: http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type

wsobel commented 4 months ago

In summary, conditionId is not required on normal or unavailable, only warning and fault.

It needs to be a string.

wsobel commented 4 months ago

ID type is fixed in the latest 2.3 schema. We still need to fix the Unavailable requirement.

wsobel commented 4 months ago

Making changes in "update_schema_version_for_demo_to_2.3" branch

shaurabhsingh commented 4 months ago

Updated the schema. Created new ActivatedConditionType which extends ConditionType to include ConditionId only for warning and fault.

@wsobel kindly confirm

wsobel commented 4 months ago

I validate on the agent.

wsobel commented 4 months ago

Fixed!

wsobel commented 4 months ago

@hulinning2 Cfg looks fine. It should be creating the condition ids. With the new schemas, all checks should pass. This will be 2.3.0.12 and I've also updated the demo configuration to track the latest versions.

hulinning2 commented 4 months ago

@wsobel could not get to the latest release 2.3.0.12

wsobel commented 4 months ago

@hulinning2 It's not built yet, I've got it in a PR right now. Need someone to approve. Once I tag it will build and release assets.

wsobel commented 4 months ago

Please approve the PR.