OpenSML icon indicating copy to clipboard operation
OpenSML copied to clipboard

OpenSML_Axiscontroller axis not enabling

Open RinMa89 opened this issue 2 years ago • 1 comments

Hi,

This is the first time i use Github for bug report so forgive me if i am not doing it wrong.

I noticed a small bug in the latest OpenSML.library V1.9.

When using the OpenSML_Axiscontroller FB the first time after starting the controller. At STEP 10 of the state machine the axis gets disabled because the mode of operation has to be set first there is a line to enable the axis again after operating mode = 8 but because the axis was enabled first the Axis.StatusWord.2 is still true and the state machine steps to STEP 20 before the axis is enabled again.

see the code change i made to fix this:

10://Set Mode
	Axis.Modes_of_operation:=8;//Cyclic Synchronous Position Mode
	Axis.ControlWord.3:=Axis.Modes_of_operation_display=8;//Success change mode, enable operation
	otg.CurrentPosition:=DINT_TO_LREAL(Axis.Position_Actual_Value) / Control.Scale;//Write actual position to otg
	IF Axis.StatusWord.2 **AND (Axis.Modes_of_operation_display=8)** THEN//Operation Enabled
		iState:=20;
	END_IF

I made another change to be able to change the cycle time of the otg FB, it was fixed to 0.01...

	otg(
		ControlInterface:= InterfaceType,//ControlInterfaceType.Position , 
		TargetPosition:= Control.lrFollowPosition , 
		TargetVelocity:= JogVel , 
		TargetAcceleration:= 0 , 
		CycleTIme:= **Control.CycleTime**,//was 0.01
		MaxVelocity:= MoveVel,//Control.para.MaxVelocity , 
		MaxAcceleration:= Control.MaxAcceleration , 
		MaxJerk:= Control.MaxJerk);//accept new position and going on

BR, Rinie

RinMa89 avatar Jan 18 '24 09:01 RinMa89

Hi Rinie,

Thanks for your feedback, Good suggestions. Please check newest V2.0.
Also this enabling bug will happen on othermode, i had patch it.

Thanks.

feecat avatar Jan 18 '24 15:01 feecat