要在两个 Process Executor 之间共享属性或变量来控制托盘顺序,您可以采用以下方法: ### 方法 1:使用全局变量 1. 在 Visual Components 中,创建一个全局变量(例如 `global_pallet_sequence`),用于跟踪当前应处理的托盘类型。 2. 初始化该变量为 `3`(表示首先处理 Label = 3 的托盘)。 3. 在每个 Process Executor 的“Pick”逻辑中: - 检查待处理托盘的 `Label` 属性是否与 `global_pallet_sequence` 匹配。 - 如果匹配,则处理该托盘,并更新 `global_pallet_sequence` 为下一个值(3→2→1,循环或停止)。 - 如果不匹配,则跳过该托盘,等待符合条件的托盘出现。 ### 方法 2:使用共享信号或事件 1. 创建一个全局信号或事件(例如 `PalletProcessed`),当任一节点处理完托盘时触发该事件,并传递已处理的托盘 `Label` 值。 2. 另一个节点监听该事件,并根据接收到的 `Label` 值更新其内部状态,以确定下一个应处理的托盘类型。 ### 方法 3:使用中央控制器 1. 添加一个独立的控制器组件(如 Python 脚本或 Logic 组件),用于管理全局顺序。 2. 每个 Process Executor 在准备处理托盘前,向控制器请求当前可处理的托盘类型。 3. 控制器根据预设顺序(3→2→1)和已处理情况,返回允许的 `Label` 值。 ### 示例步骤(以方法 1 为例): 1. **创建全局变量**: - 在“Model”或“Layout”属性中,添加一个整数型全局变量 `next_label_to_process`,初始值为 `3`。 2. **配置 Process Executor**: - 在节点的“Pick”逻辑中,添加条件判断: ```python if pallet.Label == global_variables.next_label_to_process: # 处理该托盘 # 更新全局变量:3→2→1 if global_variables.next_label_to_process == 3: global_variables.next_label_to_process = 2 elif global_variables.next_label_to_process == 2: global_variables.next_label_to_process = 1 else: # 所有类型处理完毕,可重置或停止 global_variables.next_label_to_process = None return True # 允许拾取 else: return False # 跳过该托盘 ``` 3. **同步节点**: - 确保两个节点都引用同一个全局变量,以实现顺序共享。 ### 注意事项: - 如果两个节点同时尝试处理同一类型的托盘,需考虑并发控制(如使用锁或队列避免冲突)。 - 根据实际需求,顺序完成后可选择重置(重新从 3 开始)或停止处理。 通过以上方法,您可以实现两个节点之间基于托盘 `Label` 的全局顺序控制(3→2→1)。

I am trying to control the processing order of pallets between two Process Executors in Visual Components.

In my layout, there are two nodes (A and B), and both nodes pick pallets for processing.
Each pallet has a custom property calledLabel, which indicates the type of pallet (values:1, 2, or 3).

What I want to achieve is aglobal processing order of 3 → 2 → 1shared between both nodes.

For example:

  • IfNode A processes a pallet with Label = 3, and

  • Node B processes a pallet with Label = 2,

  • then thenext pallet to be processed (by either node)should beLabel = 1.

In other words, the sequence3 → 2 → 1无论哪个节点处理托盘,都应被两个节点共同遵循。

目前,我在每个进程执行器中使用分配变量来管理序列,但我找不到方法在两个执行器之间共享或同步这个值

所以我的问题是:

  1. 有没有办法在两个进程执行器之间实时共享变量或属性

  2. 如果没有,那么实现这种共享处理序列的推荐方式是什么

任何建议或示例将不胜感激。

在GetProperty语句中,您可以自由选择任何组件,因此对于这两个ProcessExecutor的GetProperty语句,可以选择相同的组件和属性。eCat有一个PM全局变量组件,专门为此目的设计。

3个赞

非常感谢您的解释。
这非常有帮助。我会尝试使用PM全局变量组件。