FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
09-20-2022 04:21 PM
I get the diagnostic number from the flatbuffer. However, the assignment to plain text is missing. Unfortunately, this cannot be copied from the documentation (https://docs.automation.boschrexroth.com/doc/2072012419/080f0001-error-during-backup-or-restoration-...) and mapped because the subelements are created as links which makes it just to hard to copy.
Are the diagnostic messages available somewhere as a table or Excel sheet or can I also query the plain text via the flat buffer? I have tried it via the method in "diagnosis/get/text/detailed" but I always get the error message 'Function not implemented'.
Code:
_writeDLNode(Execute:=TRUE, Value:=_mainDiagnosisNumber[0], NodeName:='diagnosis/get/text/detailed');
Where the _mainDiagnosisNumber is set by the _pDiagnosisTable^.getMainDiagnosisNumber() Function.
Solved! Go to Solution.
09-21-2022 09:05 AM
Please have a look to this thread.
09-21-2022 10:59 AM
The post explains how to get the diagnosis numbers, the timestamp and the entity of the event, not the plain text that belongs to the number.
For example, if the pending diagnosis is MainDiag: 090A0000 and Detail Diag: 0C550145, where can I get the plain text: "Position is outside or at the limit and should continue outward" from. I also tried the getText methods I found in the library, with little success.
09-22-2022 09:12 AM - edited 09-22-2022 09:14 AM
As there are flatbuffer (no standard data types) used in the PLC using the get text function via the Data Layer nodes looks like this:
Declaration:
PROGRAM PROG_common_log_diagnosis_fbs_GetMainDiagnosisText
VAR
//Data for creating values to send in the request
fbs_GetMainDiagnosisText: common_log_diagnosis_fbs_GetMainDiagnosisText;
fbs_GetDetailedDiagnosisText: common_log_diagnosis_fbs_GetDetailedDiagnosisText;
fbBuilder: flatbuffers.FlatBufferBuilder;
udiStringMain: UDINT;
udiStringDetail: UDINT;
//Data Layer pathes
NodePathMain: STRING(255) := 'diagnosis/get/text/main';
NodePathDetail: STRING(255) := 'diagnosis/get/text/detailed';
//Diagnosis numbers
strMainDiag: STRING := '090A0000';
strDetailDiag : STRING := '0C550145';
//Reading function
fb_DL_ReadNodeValueType02: DL_ReadNodeValueType02;
bExecute: BOOL;
bDone: BOOL;
bActive: BOOL;
bError: BOOL;
ErrorID: CXA_Datalayer.ERROR_CODE;
ErrorIdent: CXA_Datalayer.ERROR_STRUCT;
NodePath: STRING(255);
DataReadOut: CXA_Datalayer.DL_NodeValue;
fb_R_TRIG: R_TRIG;
bMain: BOOL;
bDetail: BOOL;
fb_DL_ReadNode: DL_ReadNode;
DataReadIn: CXA_Datalayer.DL_NodeValue;
pData: POINTER TO STRING;
//Read text
strDiagText: STRING;
END_VAR
Implementation:
IF bMain THEN
bMain := FALSE;
bExecute := TRUE;
fbBuilder(forceDefaults := TRUE);
udiStringMain := fbBuilder.createString(strMainDiag);
fbs_GetMainDiagnosisText.startGetMainDiagnosisText(fbBuilder);
fbs_GetMainDiagnosisText.addMainDiagnosisNumber(udiStringMain);
fbBuilder.finish(fbs_GetMainDiagnosisText.endGetMainDiagnosisText());
DataReadIn.SetFlatbuffer(fbBuilder);
NodePath := NodePathMain;
ELSIF bDetail THEN
bDetail := FALSE;
bExecute := TRUE;
fbBuilder(forceDefaults := TRUE);
udiStringMain := fbBuilder.createString(strMainDiag);
udiStringDetail := fbBuilder.createString(strDetailDiag);
fbs_GetDetailedDiagnosisText.startGetDetailedDiagnosisText(fbBuilder);
fbs_GetDetailedDiagnosisText.addRelatedMainDiagnosisNumber(udiStringMain);
fbs_GetDetailedDiagnosisText.addDetailedDiagnosisNumber(udiStringDetail);
fbBuilder.finish(fbs_GetDetailedDiagnosisText.endGetDetailedDiagnosisText());
DataReadIn.SetFlatbuffer(fbBuilder);
NodePath := NodePathDetail;
END_IF
fb_DL_ReadNodeValueType02(
Execute:= bExecute,
Done=> bDone,
Active=> bActive,
Error=> bError,
ErrorID=> ErrorID,
ErrorIdent=> ErrorIdent,
ClientId:= ,
NodeName:= NodePath,
NodeValueIn:= DataReadIn,
NodeValueOut:= DataReadOut);
fb_R_TRIG(CLK:= bDone, Q=> );
IF fb_R_TRIG.Q THEN
bExecute := FALSE;
DataReadOut.GetValueString(Value=>pData);
strDiagText := pData^;
END_IF
In the Data Layer viewer it works as you can see here:
For main diagnosis number send object '{"mainDiagnosisNumber": "090A0000"}':
For detail diagnosis number send object '{"detailedDiagnosisNumber": "0C550145", "relatedMainDiagnosisNumber": "090A0000"}':