Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

How can I get the diagnostic message in plain text in the PLC?

How can I get the diagnostic message in plain text in the PLC?

Nexy
New Poster

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.

3 REPLIES 3

CodeShepherd
Community Moderator
Community Moderator

Please have a look to this thread.

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.

Nexy_0-1663750082591.png

 

CodeShepherd
Community Moderator
Community Moderator

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"}':

Data Layer viewer get main diagnosis textData Layer viewer get main diagnosis text

For detail diagnosis number send object '{"detailedDiagnosisNumber": "0C550145", "relatedMainDiagnosisNumber": "090A0000"}':

Data Layer viewer get detailed diagnosis textData Layer viewer get detailed diagnosis text

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist