Difference between revisions of "AXY:PLS Software Specification/zh-hans"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "{{Languages}} = 参考 = * PLS Timing Issues * Path PLS =介绍= A programmable limit switch (PLS) is a mechanism which triggers a system...")
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Languages}}
+
{{Languages|PLS_Software_Specification}}
 +
'''NEW PLS ARTICLE - [[Programmable Limit Switch|Programmable Limit Switch]]'''
 +
<strike>
 
= 参考 =
 
= 参考 =
 
* [[PLS Timing Issues|PLS Timing Issues]]
 
* [[PLS Timing Issues|PLS Timing Issues]]
* [[path-PLS|Path PLS]]
 
  
 
=介绍=
 
=介绍=
  
A programmable limit switch (PLS) is a mechanism which triggers a system output when a specified axis position is reached. The PLS implementation in the softMC has the following features:
+
可编程限位开关(PLS)是在达到指定轴位置时触发系统输出的机构。softMC中的PLS实现具有以下特点:
  
* Multiple position specifications
+
* 多位置规格
* PLS pattern repetition
+
* PLS模式重复
* Position hysteresis
+
* 位置滞后
* Enabling and disabling of PLS
+
* 启用和禁用PLS
* The output may be digital or virtual
+
* 输出可以是数字或模拟的
  
This article specifies the PLS functionality as it is implemented in the softMC. The functionality is described and the supporting commands are defined.
+
本文详细说明在softMC中PLS实现的功能。 描述功能并定义支持的命令。
  
=Definitions=
+
=定义=
'''PLS''' – Programmable limit switch.
+
'''PLS''' – 可编程限位开关
  
'''PLS''' – Position specified in the PLS command, at which the state of the output is toggled.
+
'''PLS''' – 在PLS命令中指定的位置,其输出状态被切换。
  
'''Digital output''' – Can be mapped to a device that resides on the motion bus, to either one of the drive outputs, or to EtherCAT/CAN I/O block. <br/>(Local is not supported in firmware version 5.0 and later; it is supported only in legacy SERCOS II motion controller.)  
+
'''Digital output''' – 可以映射到位于运动总线上的设备,驱动器输出中的任一个或 EtherCAT/CAN I/O模块。 <br/>(固件版本5.0及更高版本不支持本地; 它只支持传统的SERCOS II运动控制器。)  
  
'''Soft output''' – One of the 32 virtual outputs.
+
'''Soft output''' – 32个虚拟输出之一
  
PLS positions are defined in an array that allows you to change individual values of PLS positions. This array must be increasing monotonic. There is no limit of the number of positions or PLSs that can be defined. The initial output polarity is specified with [[MC-Basic:pls.PLSPOLARITY|Pls Polarity ]]. The output state is set when the PLS is enabled.
+
PLS位置在数组中定义,允许您更改PLS位置的各个值。这个数组必须单调增加。 定义的位置数量和PLS数量没有限制。初始输出极性由[[MC-Basic:pls.PLSPOLARITY|Pls Polarity ]]指定。当PLS被使能时,输出状态被设置。
  
= PLS Functional Description =
+
= PLS功能描述 =
  
== PLS Polarity ==
+
== PLS极性 ==
The output polarity is determined via the polarity property of the PLS. This property determines the output polarity of the first entry of the PLS position table i.e. in the segment between the first and second entries. If the actual location of the axis is elsewhere, the output polarity will be determined accordingly so when the axis will reach the first segment the polarity will be as indicated.
+
输出极性由PLS的极性决定。该属性确定PLS位置表的第一条目的输出极性,即在第一和第二条目之间的段中。如果轴的实际位置在别处,则相应地确定输出极性,因此当轴将到达第一段时,极性将如图所示。
  
For example: consider the following PLS whose positions are 10, 25, 30, 50, 65, and polarity is 0, as shown in this figure.
+
例如: 考虑以下PLS,其位置为10,25,30,50,65,极性为0,如图所示。
 
   
 
   
 
[[File:AXY;PLS plolarity description.jpeg|Figure 1a: Programmable Limit Switch polarity description|480px]]
 
[[File:AXY;PLS plolarity description.jpeg|Figure 1a: Programmable Limit Switch polarity description|480px]]
  
As can be seen, the polarity of the first segment (between 10-25) is as indicated by the polarity (1). Enabling the PLS in any other segment will cause the output to be as indicated in the figure.
+
可以看出,第一段的极性(在10-25之间)如极性(1)所示。 在任何其他段中启用PLS将导致输出如图所示。
  
== Output State ==
+
== 输出状态 ==
A PLS causes an output (digital or virtual) to be triggered when a specified axis position is reached. The initial state of the output will be determined by the PLS polarity property. When the position is reached, the state of the output is toggled. The state is also toggled each time the position is reached, irrespective of the direction of motor travel.
+
当达到指定的轴位置时,PLS会触发输出(数字或模拟)。输出的初始状态将由PLS极性属性决定。当达到位置时,输出的状态被触发。每当达到位置时也会切换状态,而不考虑电机的转动方向。
 
   
 
   
 
[[File:AXY;PLS description.jpeg|Figure 1b: Programmable Limit Switch description|480px]]
 
[[File:AXY;PLS description.jpeg|Figure 1b: Programmable Limit Switch description|480px]]
  
 
+
可以指定多个位置,在这种情况下,当达到每个位置时,数字输出的状态将被触发。例如,注意以下PLS规范:指定位置为100和200,启用后数字输出的初始状态为0.下表说明了输出状态如何随位置变化而变化。
Multiple positions may be specified, in which case the state of the digital output will be toggled as each position is reached. For example, consider the following PLS specification: positions 100 and 200 are specified, and the initial state of the digital output after enabling is 0. The following table illustrates how the state of output changes with changing position.
 
  
 
{|border="0" cellpadding="3" cellspacing="0"  
 
{|border="0" cellpadding="3" cellspacing="0"  
Line 51: Line 51:
 
|0||0
 
|0||0
 
|-
 
|-
|100||1 (Toggle)
+
|100||1 (触发)
 
|-
 
|-
|150||1 (No change)
+
|150||1 (没有变化)
 
|-
 
|-
|200||0 (Toggle)
+
|200||0 (触发)
 
|-
 
|-
|210||0 (No change yet)
+
|210||0 (还没有变化)
 
|-
 
|-
|200||1 (Toggle again)
+
|200||1 (再次触发)
 
|-
 
|-
|150||1 (No change)
+
|150||1 (没有变化)
 
|-
 
|-
|100||0 (Toggle again)
+
|100||0 (再次触发)
 
|-
 
|-
 
|}
 
|}
Line 70: Line 70:
 
[[File:AXY;Multiple PLS positions.jpeg|Figure 2: Multiple PLS positions|480px]]
 
[[File:AXY;Multiple PLS positions.jpeg|Figure 2: Multiple PLS positions|480px]]
  
If the axis position were to oscillate around a specified PLS position, the output would be triggered each time the specified position was crossed.
+
如果轴位置围绕指定的PLS位置振荡,则每当指定位置被越过时,输出将被触发。
  
The initial output state is specified implicitly by the user. The output is set to this state when the PLS is enabled.
+
初始输出状态由用户隐式指定。 当PLS启用时,输出设置为此状态。
  
== PLS Position Data ==
+
== PLS位置数据 ==
The PLS position data is stored in a data structure that belongs to the PLS mechanism. This data structure is explicitly created, using the CreatePlsData command.
+
PLS位置数据存储在属于PLS机制的数据结构中。 使用CreatePlsData命令显式创建此数据结构。
  
The PLS data has read/write access. The user must ensure that the PLS position data is monotonic (to allow a PLS to be enabled).
+
PLS数据具有读/写访问权限。 用户必须确保PLS位置数据是单调的(以允许启用PLS)。
  
== Hysteresis ==
+
== 滞后 ==
If the axis were to stop on a specified PLS position, the state of the digital output may be continually toggled, due to slight instability in the actual axis position. In this case, a hysteresis value may optionally be specified. The output state will be toggled when the PLS position is reached, and is passed by the hysteresis value. If, as shown in this example, the hysteresis value is 10, then the output will change from Low to High at position 110. It will revert to Low when the position goes down to 90.
+
如果轴在指定的PLS位置停止,则由于实际轴位置的轻微不稳定性,数字输出的状态可能会持续触发。在这种情况下,可以选择指定滞后值。当并通过滞后值达到PLS位置时,输出状态将被触发。如在本示例中,如果滞后值为10,则输出将在位置110处从低电平变为高电平。当位置下降至90时,将返回到低电平。
 
   
 
   
 
[[File:AXY;Hysteresis_in_PLS_position.jpeg|Figure 3: Hysteresis in PLS position|480px]]
 
[[File:AXY;Hysteresis_in_PLS_position.jpeg|Figure 3: Hysteresis in PLS position|480px]]
  
== Repetition Interval ==
+
== 重复间隔 ==
PLS positions may be continually repeated at a specified interval. Thus if a PLS position of 100, for example, is specified with a repetition interval of 2000, then the output state will be toggled at 100, and again at 2100, 4100, and so on, in the positive direction, and at -1900, -3900, and so on in the negative direction.
+
可以以指定的间隔持续重复PLS位置。因此如果PLS位置指定为100,例如,重复间隔为2000,则在正方向上,输出状态在100位置上触发,再次在2100,4100,等位置上触发。并且在负方向上,在 -1900, -3900等位置上触发。
  
The repetition interval must be positive, and it must be greater than the absolute value difference between the least and greatest PLS position values. That is:
+
重复间隔必须为正,并且必须大于最小和最大PLS位置值之间的绝对值差. :
  
 
Repetition Interval > abs(PLS_Pos_Max - PLS_Pos_Min)
 
Repetition Interval > abs(PLS_Pos_Max - PLS_Pos_Min)
  
Example:
+
示例:
  
 
* PLS Position values: -300, 100, 200
 
* PLS Position values: -300, 100, 200
Line 97: Line 97:
 
* Polarity: 0
 
* Polarity: 0
  
The output state will be toggled at -300, 100, 200, as well as at 1700 (-300 + 2000), 2100 (100+2000), 2200, and at 3700 (-300 + 2000 + 2000) etc. In the negative direction, the output state will be toggled at -1800 (200 - 2000), -1900 (100 - 2000), -2300 (-300 - 2000), -3800 etc.
+
输出状态在-300, 100, 200触发,同样在1700 (-300 + 2000), 2100 (100+2000), 2200, 3700 (-300 + 2000 + 2000) 等位置触发。 在负方向上输出状态在-1800 (200 - 2000), -1900 (100 - 2000), -2300 (-300 - 2000), -3800等位置触发。
 
   
 
   
 
[[File:AXY;PLS Repetition Interval.jpeg|Figure 4: PLS Repetition Interval|480px]]
 
[[File:AXY;PLS Repetition Interval.jpeg|Figure 4: PLS Repetition Interval|480px]]
  
== PLS Constraints ==
+
== PLS 约束 ==
* The number of PLSes is not be limited by the system. It is understood that there is a direct tradeoff between the number of PLSes defined and the system performance.
+
* PLS的数量不受系统限制。 可以理解为定义的PLS数量与系统性能之间存在直接的权衡。
* The number of PLS positions defined per PLS is not be limited.
+
* 每个PLS定义的PLS位置的数量不受限制。
* More than one PLS may be defined per axis.
+
* 每个轴可以定义多个PLS。
* PLSes are scanned at the motion bus cycle rate.
+
* PLSes以运动总线循环速率扫描
  
== Enable and Disable ==
+
== 启用和禁用 ==
After being defined, a PLS is disabled (output pattern is not generated). The output is set when the PLS is enabled. The output is set to the defined initial state. PLS properties are changed only when the PLS is disabled. Each enabled PLS requires CPU resources. Conserve those resources by disabling the unused PLS(s). [[MC-Basic:pls.PLSENABLE|PLSEnable]] controls the status of the PLS:
+
定义后,禁用PLS(不生成输出模式)。 当PLS被使能时,输出被设置。 输出设置为定义的初始状态。只有当PLS被禁用时,才能更改PLS属性。每个启用的PLS都需要CPU资源。通过禁用未使用的PLS(s)来节省这些资源。 [[MC-Basic:pls.PLSENABLE|PLSEnable]] 控制PLS的状态。
 
  MyPLS.PlsEnable = ON | OFF
 
  MyPLS.PlsEnable = ON | OFF
PLSENABLE queries the status of a PLS:
+
PLSENABLE查询PLS的状态:
 
  ?MyPls.PlsEnable
 
  ?MyPls.PlsEnable
 
  if(MyPLS.PlsEnable = OFF)
 
  if(MyPLS.PlsEnable = OFF)
 
  . . .
 
  . . .
or drives events:
+
或驱动事件:
 
  EventOn MyEvent MyPLS.PlsOutput = ON
 
  EventOn MyEvent MyPLS.PlsOutput = ON
  
==PLS Output State==
+
==PLS 输出状态==
Query the digital output associated with the PLS to query the state of the PLS output.<br/>
+
查询与PLS关联的数字输出,以查询PLS输出的状态。<br/>
For example, assume the PLS output is assigned to
+
例如,假设PLS输出被分配给SYSTEM.DOUT.1。 要确定PLS的输出状态,请查询SYSTEM.DOUT.1的状态:
SYSTEM.DOUT.1. To determine the output state of the PLS, query the state
 
of SYSTEM.DOUT.1:
 
 
  -->?Sys.Dout.1
 
  -->?Sys.Dout.1
 
  0 | 1
 
  0 | 1
  
==Example==
+
==示例==
 
===Step 1===
 
===Step 1===
Declare the PLS with [[MC-Basic:COMMON SHARED ... AS PLS|<nowiki>COMMON SHARED <PLS name> AS PLS</nowiki>]] in Config.Prg or at the
+
在Config.Prg或终端中使用[[MC-Basic:COMMON SHARED ... AS PLS|<nowiki>COMMON SHARED <PLS name> AS PLS</nowiki>]]声明PLS。您必须命名PLS,指定驱动PLS的轴,并命名要由PLS控制的输出。例如:
terminal. You must name the PLS, specify the axis that drives the PLS, and
 
name an output to be controlled by the PLS. For example:
 
 
  Common Shared MyPLS as PLS A1 System.Dout.1
 
  Common Shared MyPLS as PLS A1 System.Dout.1
sets up MyPLS as a PLS driven by axis A1 connected to SYSTEM.DOUT.1.
+
将MyPLS设置为由连接到SYSTEM.DOUT.1的轴A1驱动的PLS。
The output can be a digital output (SYSTEM.DOUT.1 through DOUT.20) or it
+
输出可以是数字输出(SYSTEM.DOUT.1到DOUT.20)或者可以是模拟输出之一(SYSTEM.VOUT.1到VOUT.32).
can be one of the virtual outputs (SYSTEM.VOUT.1 through VOUT.32).
+
在Common Shared as PLS执行后, PLS禁用。
After the Common Shared as PLS executes, the PLS is disabled.
+
PLS的属性设置为:
Properties of the PLS are set as:
+
*单个PLS位置存在于0
*A single PLS position exists at 0.
+
*初始输出极性为1
*The initial output polarity is 1.
+
*PLSREPEAT设置为0.
*PLSREPEAT is set to 0.
+
*滞后设置为0.<br/>
*The hysteresis is set to 0.<br/>
+
只要PLS保持禁用,可以明确设置这些属性。
These properties may be set explicitly, as long as the PLS remains disabled.
+
您可以使用PLSOUTPUT来检查与给定PLS相关联的输出。
You can check which output is associated with a given PLS using
 
PLSOUTPUT.
 
  
 
===Step 2===
 
===Step 2===
Create the PLS data structure and define PLS positions. The number of
+
创建PLS数据结构并定义PLS位置。定义的位置的数量没有明确限制。调用[[MC-Basic:CREATEPLSDATA|CreatePlsData ]]创建一个存储n个位置位置数据的数组。该数组的索引从1开始,如果您尝试访问数组边界之外的索引,则会生成错误,例如:
defined positions is not explicitly limited. A call to [[MC-Basic:CREATEPLSDATA|CreatePlsData ]]
 
creates an array of n positions that stores the position data. The array is 1-
 
based and an error is generated if you attempt to access an index outside of
 
the array bounds. For example:
 
 
  CreatePLSData 4 MyPLS
 
  CreatePLSData 4 MyPLS
 
  MyPLS.PLSPosition[1] = 1000
 
  MyPLS.PLSPosition[1] = 1000
 
  MyPLS.PLSPosition[2] = 1100
 
  MyPLS.PLSPosition[2] = 1100
As a short form, you can use PPOS in place of [[MC-Basic:pls.PLSPOSITION|PlsPosition ]]:
+
作为一种简短的形式,您可以使用PPOS代替[[MC-Basic:pls.PLSPOSITION|PlsPosition ]]:
 
  MyPLS.Ppos[3] = 2000
 
  MyPLS.Ppos[3] = 2000
 
  MyPLS.Ppos[4] = 2200
 
  MyPLS.Ppos[4] = 2200
You cannot change PLS positions when the PLS is enabled. Position values
+
当PLS启用时,您无法更改PLS位置。 位置值必须单调增加。
must be increasing monotonically.
 
  
 
===Step 3===
 
===Step 3===
Set the polarity. PLSPOLARITY defaults to OFF, indicating the PLS state
+
设置极性. PLSPOLARITY默认为OFF, 表示PLS状态在第一个位置后应为OFF 更改[[MC-Basic:pls.PLSPOLARITY|PlsPolarity ]]为ON以反转状态。
should be OFF after the first position. Change [[MC-Basic:pls.PLSPOLARITY|PlsPolarity ]] to ON to
 
invert the state.
 
 
  MyPLS.PLSPolarity = ON
 
  MyPLS.PLSPolarity = ON
Change [[MC-Basic:pls.PLSPOLARITY|PlsPolarity ]] only if the PLS is disabled.
+
只有当PLS被禁用时才改变[[MC-Basic:pls.PLSPOLARITY|PlsPolarity ]]
  
 
===Step 4===
 
===Step 4===
Set [[MC-Basic:pls.PLSREPEAT|PlsRepeat ]]. If you want the PLS to repeat, set the value of
+
设置[[MC-Basic:pls.PLSREPEAT|PlsRepeat ]]。 如果要使PLS重复,请将PLSREPEAT的值设置为非零正数。 例如,要使PLS每10,000个位置单位重复,请输入:
PLSREPEAT to a non-zero, positive number. For example, to have the PLS
 
repeat every 10,000 position units, enter:
 
 
  MyPLS.PLSRepeat = 10000
 
  MyPLS.PLSRepeat = 10000
PLSREPEAT defaults to 0, indicating that there is no repetition. Change
+
PLSREPEAT默认为0,表示没有重复。 仅在PLS禁用时更改PLSREPEAT。
PLSREPEAT only when the PLS is disabled.
 
  
 
===Step 5===
 
===Step 5===
Set [[MC-Basic:pls.PLSHYSTERESIS|PlsHysteresis]], if the application requires it. Hysteresis is only
+
设置[[MC-Basic:pls.PLSHYSTERESIS|PlsHysteresis]],如果应用程序需要它。 仅当系统在PLS位置或其附近停止时才需要滞后。 通常,5或10个编码器(转换为位置单位)或2或3个解算器分辨率的PLSHYSTERESIS就足够了。
necessary if the system does stop on or near a PLS position. Normally, a
 
PLSHYSTERESIS of 5 or 10 counts of encoder (converted to position units)
 
or 2 or 3 counts of resolver resolution is sufficient.
 
 
  MyPLS.PLSHysteresis = 0.01
 
  MyPLS.PLSHysteresis = 0.01
  
 
===Step 6===
 
===Step 6===
Enable the PLS Enter:
+
启用PLS输入:
 
  MyPLS.PLSEnable = ON
 
  MyPLS.PLSEnable = ON
There are a few other PLS functions you may need:
+
还有一些其他可能需要的PLS功能:
*Change Polarity
+
*改变极性
The default output state of a PLS is 0. Change this
+
PLS的默认输出状态为0.通过修改PLSPOLARITY更改此初始状态。
initial state by modifying PLSPOLARITY.
 
 
  MyPLS.PLSPolarity = 1
 
  MyPLS.PLSPolarity = 1
The PLS must be disabled when changing this
+
更改此设置时必须禁用PLS。
setting.
+
*查询名称
*Query the Name
+
  查询驱动PLS的轴的名称:
  Query the name of the axis driving the PLS:
 
 
  ? MyPLS.PLSAxisName
 
  ? MyPLS.PLSAxisName
returns the axis associated with the PLS (A1).
+
返回与PLS(A1)相关联的轴。
*Disable the PLS
+
*禁用PLS
  Disable the PLS. For example:
+
  禁用PLS,例如:
 
  MyPLS.PLSEnable = OFF
 
  MyPLS.PLSEnable = OFF
You must disable a PLS to change PLS properties.
+
您必须禁用PLS才能更改PLS属性。 禁用PLS也有助于节省CPU资源。
Disabling a PLS also helps conserve CPU
+
*删除PLS
resources.
+
删除PLS,只有当PLS被禁用且内存中没有任务时才将其从系统中删除。 例如:
*Delete a PLS
 
Delete a PLS to remove it from the system only
 
when the PLS is disable and there are no tasks in
 
memory. For example:
 
 
  DeletePLS MyPLS
 
  DeletePLS MyPLS
  
= Command Set =
+
= 命令集 =
A PLS is defined using the syntax for variable declaration. The following PLS properties are defined:
+
使用变量声明的语法定义PLS。 定义了以下PLS属性:
* PLS name
+
* PLS 名称
* Axis
+
*
* Output name
+
* 输出名称
* One or more PLS positions
+
* 一个或多个PLS位置
* Optional initial output state
+
* 可选的初始输出状态
* Optional repetition interval
+
* 可选重复间隔
* Optional hysteresis setting
+
* 可选滞后设定
 
+
</strike>
== PLS Commands ==
+
== PLS命令 ==
  
 
* [[MC-Basic:COMMON SHARED ... AS PLS|<nowiki>COMMON | DIM] SHARED <PLS name> AS PLS</nowiki>]]
 
* [[MC-Basic:COMMON SHARED ... AS PLS|<nowiki>COMMON | DIM] SHARED <PLS name> AS PLS</nowiki>]]

Latest revision as of 11:17, 16 October 2018

语言: English

NEW PLS ARTICLE - Programmable Limit Switch

参考

介绍

可编程限位开关(PLS)是在达到指定轴位置时触发系统输出的机构。softMC中的PLS实现具有以下特点:

  • 多位置规格
  • PLS模式重复
  • 位置滞后
  • 启用和禁用PLS
  • 输出可以是数字或模拟的

本文详细说明在softMC中PLS实现的功能。 描述功能并定义支持的命令。

定义

PLS – 可编程限位开关

PLS – 在PLS命令中指定的位置,其输出状态被切换。

Digital output – 可以映射到位于运动总线上的设备,驱动器输出中的任一个或 EtherCAT/CAN I/O模块。
(固件版本5.0及更高版本不支持本地; 它只支持传统的SERCOS II运动控制器。)

Soft output – 32个虚拟输出之一

PLS位置在数组中定义,允许您更改PLS位置的各个值。这个数组必须单调增加。 定义的位置数量和PLS数量没有限制。初始输出极性由Pls Polarity 指定。当PLS被使能时,输出状态被设置。

PLS功能描述

PLS极性

输出极性由PLS的极性决定。该属性确定PLS位置表的第一条目的输出极性,即在第一和第二条目之间的段中。如果轴的实际位置在别处,则相应地确定输出极性,因此当轴将到达第一段时,极性将如图所示。

例如: 考虑以下PLS,其位置为10,25,30,50,65,极性为0,如图所示。

Figure 1a: Programmable Limit Switch polarity description

可以看出,第一段的极性(在10-25之间)如极性(1)所示。 在任何其他段中启用PLS将导致输出如图所示。

输出状态

当达到指定的轴位置时,PLS会触发输出(数字或模拟)。输出的初始状态将由PLS极性属性决定。当达到位置时,输出的状态被触发。每当达到位置时也会切换状态,而不考虑电机的转动方向。

Figure 1b: Programmable Limit Switch description

可以指定多个位置,在这种情况下,当达到每个位置时,数字输出的状态将被触发。例如,注意以下PLS规范:指定位置为100和200,启用后数字输出的初始状态为0.下表说明了输出状态如何随位置变化而变化。

Position Output State
0 0
100 1 (触发)
150 1 (没有变化)
200 0 (触发)
210 0 (还没有变化)
200 1 (再次触发)
150 1 (没有变化)
100 0 (再次触发)


Figure 2: Multiple PLS positions

如果轴位置围绕指定的PLS位置振荡,则每当指定位置被越过时,输出将被触发。

初始输出状态由用户隐式指定。 当PLS启用时,输出设置为此状态。

PLS位置数据

PLS位置数据存储在属于PLS机制的数据结构中。 使用CreatePlsData命令显式创建此数据结构。

PLS数据具有读/写访问权限。 用户必须确保PLS位置数据是单调的(以允许启用PLS)。

滞后

如果轴在指定的PLS位置停止,则由于实际轴位置的轻微不稳定性,数字输出的状态可能会持续触发。在这种情况下,可以选择指定滞后值。当并通过滞后值达到PLS位置时,输出状态将被触发。如在本示例中,如果滞后值为10,则输出将在位置110处从低电平变为高电平。当位置下降至90时,将返回到低电平。

Figure 3: Hysteresis in PLS position

重复间隔

可以以指定的间隔持续重复PLS位置。因此如果PLS位置指定为100,例如,重复间隔为2000,则在正方向上,输出状态在100位置上触发,再次在2100,4100,等位置上触发。并且在负方向上,在 -1900, -3900等位置上触发。

重复间隔必须为正,并且必须大于最小和最大PLS位置值之间的绝对值差. 即:

Repetition Interval > abs(PLS_Pos_Max - PLS_Pos_Min)

示例:

  • PLS Position values: -300, 100, 200
  • Repetition Interval: 2000
  • Polarity: 0

输出状态在-300, 100, 200触发,同样在1700 (-300 + 2000), 2100 (100+2000), 2200, 和 3700 (-300 + 2000 + 2000) 等位置触发。 在负方向上输出状态在-1800 (200 - 2000), -1900 (100 - 2000), -2300 (-300 - 2000), -3800等位置触发。

Figure 4: PLS Repetition Interval

PLS 约束

  • PLS的数量不受系统限制。 可以理解为定义的PLS数量与系统性能之间存在直接的权衡。
  • 每个PLS定义的PLS位置的数量不受限制。
  • 每个轴可以定义多个PLS。
  • PLSes以运动总线循环速率扫描

启用和禁用

定义后,禁用PLS(不生成输出模式)。 当PLS被使能时,输出被设置。 输出设置为定义的初始状态。只有当PLS被禁用时,才能更改PLS属性。每个启用的PLS都需要CPU资源。通过禁用未使用的PLS(s)来节省这些资源。 PLSEnable 控制PLS的状态。

MyPLS.PlsEnable = ON | OFF

PLSENABLE查询PLS的状态:

?MyPls.PlsEnable
if(MyPLS.PlsEnable = OFF)
. . .

或驱动事件:

EventOn MyEvent MyPLS.PlsOutput = ON

PLS 输出状态

查询与PLS关联的数字输出,以查询PLS输出的状态。
例如,假设PLS输出被分配给SYSTEM.DOUT.1。 要确定PLS的输出状态,请查询SYSTEM.DOUT.1的状态:

-->?Sys.Dout.1
0 | 1

示例

Step 1

在Config.Prg或终端中使用COMMON SHARED <PLS name> AS PLS声明PLS。您必须命名PLS,指定驱动PLS的轴,并命名要由PLS控制的输出。例如:

Common Shared MyPLS as PLS A1 System.Dout.1

将MyPLS设置为由连接到SYSTEM.DOUT.1的轴A1驱动的PLS。 输出可以是数字输出(SYSTEM.DOUT.1到DOUT.20)或者可以是模拟输出之一(SYSTEM.VOUT.1到VOUT.32). 在Common Shared as PLS执行后, PLS禁用。 PLS的属性设置为:

  • 单个PLS位置存在于0
  • 初始输出极性为1
  • PLSREPEAT设置为0.
  • 滞后设置为0.

只要PLS保持禁用,可以明确设置这些属性。 您可以使用PLSOUTPUT来检查与给定PLS相关联的输出。

Step 2

创建PLS数据结构并定义PLS位置。定义的位置的数量没有明确限制。调用CreatePlsData 创建一个存储n个位置位置数据的数组。该数组的索引从1开始,如果您尝试访问数组边界之外的索引,则会生成错误,例如:

CreatePLSData 4 MyPLS
MyPLS.PLSPosition[1] = 1000
MyPLS.PLSPosition[2] = 1100

作为一种简短的形式,您可以使用PPOS代替PlsPosition :

MyPLS.Ppos[3] = 2000
MyPLS.Ppos[4] = 2200

当PLS启用时,您无法更改PLS位置。 位置值必须单调增加。

Step 3

设置极性. PLSPOLARITY默认为OFF, 表示PLS状态在第一个位置后应为OFF 更改PlsPolarity 为ON以反转状态。

MyPLS.PLSPolarity = ON

只有当PLS被禁用时才改变PlsPolarity

Step 4

设置PlsRepeat 。 如果要使PLS重复,请将PLSREPEAT的值设置为非零正数。 例如,要使PLS每10,000个位置单位重复,请输入:

MyPLS.PLSRepeat = 10000

PLSREPEAT默认为0,表示没有重复。 仅在PLS禁用时更改PLSREPEAT。

Step 5

设置PlsHysteresis,如果应用程序需要它。 仅当系统在PLS位置或其附近停止时才需要滞后。 通常,5或10个编码器(转换为位置单位)或2或3个解算器分辨率的PLSHYSTERESIS就足够了。

MyPLS.PLSHysteresis = 0.01

Step 6

启用PLS输入:

MyPLS.PLSEnable = ON

还有一些其他可能需要的PLS功能:

  • 改变极性

PLS的默认输出状态为0.通过修改PLSPOLARITY更改此初始状态。

MyPLS.PLSPolarity = 1

更改此设置时必须禁用PLS。

  • 查询名称
查询驱动PLS的轴的名称:
? MyPLS.PLSAxisName

返回与PLS(A1)相关联的轴。

  • 禁用PLS
禁用PLS,例如:
MyPLS.PLSEnable = OFF

您必须禁用PLS才能更改PLS属性。 禁用PLS也有助于节省CPU资源。

  • 删除PLS

删除PLS,只有当PLS被禁用且内存中没有任务时才将其从系统中删除。 例如:

DeletePLS MyPLS

命令集

使用变量声明的语法定义PLS。 定义了以下PLS属性:

  • PLS 名称
  • 输出名称
  • 一个或多个PLS位置
  • 可选的初始输出状态
  • 可选重复间隔
  • 可选滞后设定

PLS命令