Implementing the Nc Program Restart in MpCnc4Axis block

we wanted to implement the power fail recovery system in our cnc machine. for cnc system we are using MpCnc4Axis block. In this block there is a restart input which can restart the Nc program from the specific point. But before restart to perform all axis are to be moved to new starting point this is possible in 2 ways,
we have used 1st option here we have to move all the axis to start position by axis move commands. After moving if we gave restart the restart phase will be in
and then after if in gave continue command in MpCnc4Axis block it give the error 7198.

we want to start the nc program from specified block ,specifically from the point where the power fail happened. we didn’t found ample amount help from AS help. kindly help us with the needs specified.

which information did you use to set the Target Positon of the Axis. As far as i can remember my last restart tests there is a monitoring element which must be used to get the required Position. I think it was this one but i am not completly sure an have currently no time to test it.

I am also curious about the “power fail” situation, as far as i know the required Restart Data for the Restart is stored in the RAM of the PLC, so if you have an Power fail of the PLC the RAM is lost, and there is no Restart Data available.

I think after an Powerfail we can only use a Modal-Start, if we remembered a Linenumber via Remanent Data.

About the Error 7198, i think we need more information about how the Axis is configured.
Which kinematic is used. Which Axis had the error. If its a slave Axis did you use the Periodic in the Group.

If someone else has more expirience please correct me.


*for monitoring part we have planed to read the string LineActual from
mpcncblockmonitortype.(If any other good options kindly suggest).

during power fail we have used the UPS backup for powering the controller only the phase voltage for drives will be cutoff. Along with that we have used the endat encoder to retain the position we will get the position of axis even though there is no phase voltage.

currently we have not used the kinematics for the slave configuration.


ok, so far the UPS is a good solution. :slight_smile:

So back to the Repositioning topic… if you start the ncProgram with the Mode ncRestart, you have to wait until the Phase is in “mcPRGPH_WAIT_FOR_AXES_REPOS” and then you have to move the Axes to the location where the Program expects the Axes to be. To get the Values he expects you to move to, you need to have a look into the Values of the Monitoring Feature, as this Values are the Target Points you have to move to.


			Robo1Par.MoveProgramOptions.InitProgram									:= ''; 
			Robo1Par.MoveProgramOptions.StartMode									:= mcPRGSM_RESTART; 
			Robo1Par.MoveProgramOptions.StartPointType								:= mcPRGSP_ABORT_POINT; 			
			Robo1Par.MoveProgramOptions.StartPointParameter 						:= 0.0; 
			Robo1Par.MoveProgramOptions.RepositioningParameter.Type					:= mcPRGRP_SINGLE_AXIS; 
			Robo1Par.MoveProgramOptions.RepositioningParameter.AxisVelocityFactor	:= 1.0;  
			Robo1Par.MoveProgramOptions.RepositioningParameter.String				:= ''; 
			Robo1Par.MoveProgramOptions.SaveRestartData 							:= mcSWITCH_ON; 

			Robo1.MoveProgram := 1; 
			Step 				:= 150;  	
            IF Robo1.Info.Program.ProgramPhase = mcPRGPH_WAIT_FOR_AXES_REPOS THEN
				// Move Joint Axes to Position 
				// Target Position for Q1 => MonitoringJointSetPositions[0]
				// Target Position for Q2 => MonitoringJointSetPositions[1]
				// IF Repositioning = DONE THEN 
				//	 Step := 151;  	
				// END_IF
			IF Robo1.Info.Program.ProgramPhase = mcPRGPH_WAIT_FOR_AXES_REPOS THEN 
				Robo1.Continue := 1; 
				Step 		   := 160; 

			Robo1.Continue := 0; 
			Step 		   := 170; 	
			IF Robo1.Info.Program.ProgramPhase = mcPRGPH_WAIT_FOR_REAL_RUN THEN 
				Robo1.Continue := 1; 
				Step 		   := 180; 
			Robo1.Continue := 0; 
			Step 		   := 190; 

And After the Target is reached you can then continue with MC_Continue.

You can also try the Mode “mcPRGRP_SINGLE_AXIS_AUTOMATIC” it might be simpler than to make the repositioning by hand.

Hope this made it more clear what i ment with the Monitoring and the Question, were you did get the Target Position from.