PLS SETUP PROCEDURE

From SoftMC-Wiki
Revision as of 11:17, 2 November 2014 by Nigeller (talk | contribs)
Jump to: navigation, search

The following example demonstrates the set up of a PLS data structure.

IMPORTANT.svgIMPORTANT
The PLS data object must be defined in CONFIG.PRG:

Common Shared <PLS Name> as PLS <Axis> System.Dout.<DOut number>

For Example: Common Shared Demo_PLS1 as PLS A1 System.Dout.1


Program

	call SetAxis

	try
		Demo_PLS1.PlsEnable = OFF
	catch 3163  ' PLS value cannot be accessed before the pls data is created
		Print "CreatePlsData not done!"
	end try

	CreatePlsData 2 Demo_PLS1  '  2 points to toggle PLS
	Demo_PLS1.PlsPosition[1] =  100.0
	Demo_PLS1.PlsPosition[2] =  250
	Print "PLS position 1: "; Demo_PLS1.PlsPosition[1]
	Print "PLS position 2: "; Demo_PLS1.PlsPosition[2]

	Print "Polarity:   "; Demo_PLS1.PlsPolarity
	Print "PLS-Repeat: "; Demo_PLS1.PlsRepeat
	'Demo_PLS1.PlsRepeat     = 1000   'Repeat distance e.g. for endless axes, switch all 1000mm
	Print "PLS-Hysteresis: "; Demo_PLS1.PlsHysteresis
	'Demo_PLS1.PlsHysteresis = 0.01   'necessary if the axis must stop at PLS position

	Print A1.PlsSource
	Attach A1
		A1.PlsSource = A1.Pfb
	Detach A1

	'  Print "PLS-Axis :  "; Demo_PLS1.PlsAxisname
	Print Demo_PLS1.PlsAxisname

	'  Print "PLS-Output: "; Demo_PLS1.PlsOutput
	Demo_PLS1.PlsOutput = Sys.DOut.1

	Print Demo_PLS1.PlsOutput

	Print "PLS-Active: "; Demo_PLS1.PlsEnable

	Demo_PLS1.PlsPolarity = ON  'switch default SignalOutput-Status to OFF
	Demo_PLS1.PlsEnable   = ON

	Print "PLS-Active: "; Demo_PLS1.PlsEnable


End Program


'****************************************************************************
' Subroutine Name: SetAxis
' Description: Generic Axis Setup
' Called From: Program
' Author: Nir Geller
' Input Parameters: None
' Output Parameters: None
' Return Value: Void
' Algorithm: 
' Global Variables Used:
' Revisions:
'****************************************************************************
sub SetAxis

	with A1

		attach
		Simulated = 1
		en = 0
		sleep 1000

		Vmax = 3000
		VelocityOverride = 100
		VelocityOverspeed = 3600
		VRate = 100
		ARate = 100
		DRate = 100
		JRate = 100
		Vcruise = 3000
		'VelocityJog = 100
		Amax = 30000
		Acc = 30000
		Dmax = 30000
		Dec = 30000
		Jmax = 948000
		Jerk = 948000
		Cp = 0.0000
		BlendingMethod = 1
		BlendingFactor = 100

		Pfac = 6400
		Vfac = 6.4
		Afac = 0.0064
		Jfac = 0.0000064

		Feedback = 0
		PmaxEn = 1
		Pmax = 495

		PminEn = 1
		Pmin = -10

		PeMax = 1000000000000000000000
		PositionErrorDelay = 3
		PositionErrorSettle = 0.1
		TimeSettle = 4
		TimeSettleMax = 992

		Direction = 1

		Wrap = 0

		Absolute = 1

		detach

	end with

end sub

See Also