How to Retain Axis Position limits Set by PLC Program

Hello,

I am able to change axis postion limits OK via PLC using DL_WriteNode to path 'motion/axs/{axisname}/cfg/lim/pos-max' for example but after power cycle the change is lost.

How do I make the change permanent?

Many thanks

Best reply by CodeShepherd

Like when using the ctrlX CORE Web UI you need to execute a save after changing the values to persists them to the active configuration. Then it will be the same after power cycle.

Right now I only know the way of writing the corresponding flatbuffer:

Declaration:

PROGRAM PLC_PRG
VAR
	fb_comm_datalayer_PersistenceParam: comm_datalayer_PersistenceParam;
	fb_DL_CreateNodeValue: DL_CreateNodeValue;
	bExecute: BOOL;
	bDone: BOOL;
	bActive: BOOL;
	bError: BOOL;
	NodeValueOut: CXA_Datalayer.DL_NodeValue;
	NodeValueIn: CXA_Datalayer.DL_NodeValue;
	bWrite: BOOL;
	fbBuilder: flatbuffers.FlatBufferBuilder;
	udiPhase: UDINT;
	strPhase: STRING := 'save';
	udiConfigurationPath: UDINT;
	strEmpty: STRING := '';
	udiId: UDINT;
END_VAR
VAR_INPUT
	NodePath: STRING(255) := 'motion/axs/Axis_1/cfg/save';
END_VAR

Implementation:

IF bWrite THEN
	fbBuilder(forceDefaults := TRUE);                   //Start flatbuffer builder and load with default values
	udiPhase := fbBuilder.createString(strPhase); 
	udiConfigurationPath := fbBuilder.createString(strEmpty);
	udiId := fbBuilder.createString(strEmpty);
	fb_comm_datalayer_PersistenceParam.startPersistenceParam(fbBuilder);
	fb_comm_datalayer_PersistenceParam.addPhase(udiPhase);
	fb_comm_datalayer_PersistenceParam.addConfigurationPath(udiConfigurationPath);
	fb_comm_datalayer_PersistenceParam.addId(udiId);
	fbBuilder.finish(fb_comm_datalayer_PersistenceParam.endPersistenceParam());
	NodeValueIn.SetFlatbuffer(fbBuilder);                 //Set flatbuffer out of the builder in the variable to be written
	bExecute := TRUE;
	bWrite := FALSE;
END_IF

fb_DL_CreateNodeValue(
	Execute:= bExecute, 
	Done=> bDone, 
	Active=> bActive, 
	Error=> bError, 
	ErrorID=> , 
	ErrorIdent=> , 
	ClientId:= , 
	NodeName:= NodePath, 
	NodeValueIn:= NodeValueIn, 
	NodeValueOut:= NodeValueOut);
	
IF bDone THEN
	bExecute := FALSE;
END_IF

 

View original
1 reply