PLS SETUP PROCEDURE/zh-hans

From SoftMC-Wiki
Jump to: navigation, search
语言: English  • 中文(简体)‎

以下示例演示了PLS数据结构的设置。


IMPORTANT.svgIMPORTANT
PLS数据对象必须在CONFIG.PRG中定义:

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

例如: Common Shared Demo_PLS1 as PLS A1 System.Dout.1


有关PLS的完整说明,请参阅Programmable Limit Switch.


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



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


该示例对应于在GIT中的提交的SHA-1: 33f496b1c050f69ee648413402ce11c9fab95820。


参见