diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..38b1e56 --- /dev/null +++ b/README.en.md @@ -0,0 +1,48 @@ +# LabVIEW GlobalStop Library + +[中文](./README.md) | [English](./README.en.md) + +[![Check_Broken_VIs](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml) +[![Build_VIPM_Library](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml) +[![GitHub all releases](https://img.shields.io/github/downloads/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/total)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/NEVSTOP-LAB/LabVIEW-GlobalStop-Library)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) + +A global stop library for LabVIEW parallel loops and multi-module applications, providing a unified, lightweight, and thread-safe stop mechanism. + +## Key Features + +![Library Palette](https://cloud.githubusercontent.com/assets/8196752/10752145/8288f624-7cc1-11e5-9700-e3740e08f571.png) + +- `GSTOP INIT.vi`: Initializes the STOP FGV. If an incoming error cluster is in error state, the global stop flag is immediately set to `TRUE`. +- `GSTOP RESET.vi`: Resets a stop flag to `FALSE`; `Index=-1` means reset the global stop flag. +- `GSTOP SET.vi`: Sets a stop flag to `TRUE`; `Index=-1` means set the global stop flag. +- `GSTOP GET.vi`: Reads a stop flag by index; `Index=-1` means read the global stop flag. +- `GSTOP CheckSet.vi`: Checks a Boolean input (typically wired to a Stop button) and triggers stop when the condition is met. + +## Implementation + +- Uses a Functional Global Variable (FGV) to store stop flags (32 Boolean flags by default). +- `Index` identifies module-level stop flags, while `-1` identifies the global stop flag. +- The internal flag array is automatically extended when the input index exceeds current size. + +## Recommended Workflow + +1. Call `GSTOP INIT.vi` once during startup. +2. In each parallel loop, periodically call `GSTOP GET.vi` or `GSTOP CheckSet.vi` to decide whether to exit. +3. Call `GSTOP SET.vi` when any module encounters a fatal error to trigger coordinated global stop. +4. Use a Typedef Enum/Combo to manage `Index` values for better maintainability and to avoid hard-coded numbers. + +## Examples + +The repository includes the following examples: + +- `src/examples/NEVSTOP/GlobalStop/globalstop-example1.vi` +- `src/examples/NEVSTOP/GlobalStop/globalstop-example2.vi` +- `src/examples/NEVSTOP/GlobalStop/globalstop-example3.vi` + +![Example](https://user-images.githubusercontent.com/8196752/200517986-eb2f3ed4-0931-443e-9bb2-d45b227550c0.png) + +## Development Environment + +- LabVIEW 2014 +- VIPM 2020.3 diff --git a/README.md b/README.md index 8624a89..07ba0c1 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,48 @@ -# LabVIEW GlobalStop Library - -[![Check_Broken_VIs](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml) -[![Build_VIPM_Library](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml) -[![GitHub all releases](https://img.shields.io/github/downloads/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/total)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) -[![GitHub release (latest by date)](https://img.shields.io/github/v/release/NEVSTOP-LAB/LabVIEW-GlobalStop-Library)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) - -Simple stop mechanism for parallel loops in LabVIEW. - -## 功能 - -![Library Pallette](https://cloud.githubusercontent.com/assets/8196752/10752145/8288f624-7cc1-11e5-9700-e3740e08f571.png) - -- `Init.vi` : Initialzie Globalstop, if error occurs, GlobalStop will be set to TRUE -- `Reset.vi` : Reset GlobalStop to FALSE. Index=-1 stands for reset all. -- `Set.vi` : Set GlobalStop to TRUE. Index=-1 stands for set all to TRUE. -- `Get.vi` : Get GlobalStop value of index. Set Index=-1 to get the global value of GlobalStop. -- `CheckSet.vi` : Check the boolean input(usually a stop button). - -# Example - -![image](https://user-images.githubusercontent.com/8196752/200517986-eb2f3ed4-0931-443e-9bb2-d45b227550c0.png) - -## Development Environment - -- LabVEW 2014 -- VIPM 2020.3 +# LabVIEW GlobalStop Library + +[中文](./README.md) | [English](./README.en.md) + +[![Check_Broken_VIs](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Check_Broken_VIs.yml) +[![Build_VIPM_Library](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml/badge.svg)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/actions/workflows/Build_VIPM_Library.yml) +[![GitHub all releases](https://img.shields.io/github/downloads/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/total)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/NEVSTOP-LAB/LabVIEW-GlobalStop-Library)](https://github.com/NEVSTOP-LAB/LabVIEW-GlobalStop-Library/releases) + +面向 LabVIEW 并行循环与多模块程序的全局停止(Global Stop)库,提供统一、轻量且线程安全的停止机制。 + +## 主要特性 + +![Library Palette](https://cloud.githubusercontent.com/assets/8196752/10752145/8288f624-7cc1-11e5-9700-e3740e08f571.png) + +- `GSTOP INIT.vi`:初始化 STOP FGV;若输入错误簇为错误状态,则立即将全局停止位置为 `TRUE`。 +- `GSTOP RESET.vi`:将停止位复位为 `FALSE`;`Index=-1` 表示复位全局停止位。 +- `GSTOP SET.vi`:将停止位置为 `TRUE`;`Index=-1` 表示设置全局停止位。 +- `GSTOP GET.vi`:读取指定索引的停止位;`Index=-1` 表示读取全局停止位。 +- `GSTOP CheckSet.vi`:检查布尔输入(通常连接 Stop 按钮),并在满足条件时触发停止。 + +## 实现机制 + +- 使用 Functional Global Variable(FGV)保存停止标志数组(默认 32 个布尔位)。 +- `Index` 用于区分模块停止位,`-1` 代表全局停止位。 +- 当输入索引超出当前长度时,内部标志数组会自动扩展。 + +## 推荐使用流程 + +1. 程序启动时调用一次 `GSTOP INIT.vi` 完成初始化。 +2. 各并行循环中周期性调用 `GSTOP GET.vi` 或 `GSTOP CheckSet.vi` 判断是否退出。 +3. 任一模块发生致命错误时调用 `GSTOP SET.vi`,触发全局联动停止。 +4. 建议使用 Typedef Enum/Combo 管理 `Index`,避免硬编码并提升可维护性。 + +## 示例 + +仓库包含以下示例: + +- `src/examples/NEVSTOP/GlobalStop/globalstop-example1.vi` +- `src/examples/NEVSTOP/GlobalStop/globalstop-example2.vi` +- `src/examples/NEVSTOP/GlobalStop/globalstop-example3.vi` + +![Example](https://user-images.githubusercontent.com/8196752/200517986-eb2f3ed4-0931-443e-9bb2-d45b227550c0.png) + +## 开发环境 + +- LabVIEW 2014 +- VIPM 2020.3 diff --git a/src/LabVIEW-GlobalStop-Library.vipb b/src/LabVIEW-GlobalStop-Library.vipb index 61d545b..8caeb0e 100644 --- a/src/LabVIEW-GlobalStop-Library.vipb +++ b/src/LabVIEW-GlobalStop-Library.vipb @@ -27,26 +27,24 @@ LabVIEW-GlobalStop-Library.vipc - Global Stop library for labview - Simple stop mechanism for parallel loops in LabVIEW. - -## - -![Library Pallette](https://cloud.githubusercontent.com/assets/8196752/10752145/8288f624-7cc1-11e5-9700-e3740e08f571.png) - -- `Init.vi` : Initialzie Globalstop, if error occurs, GlobalStop will be set to TRUE -- `Reset.vi` : Reset GlobalStop to FALSE. Index=-1 stands for reset all. -- `Set.vi` : Set GlobalStop to TRUE. Index=-1 stands for set all to TRUE. -- `Get.vi` : Get GlobalStop value of index. Set Index=-1 to get the global value of GlobalStop. -- `CheckSet.vi` : Check the boolean input(usually a stop button). - -# Example - -![image](https://user-images.githubusercontent.com/8196752/200517986-eb2f3ed4-0931-443e-9bb2-d45b227550c0.png) - -## Development Environment - -- LabVEW 2014 + Global stop library for LabVIEW parallel loops and multi-module applications + Overview +LabVIEW GlobalStop Library provides a lightweight and thread-safe global stop mechanism for parallel loops and multi-module applications. + +Key VIs +- GSTOP INIT.vi: Initialize STOP FGV. If an incoming error is detected, set global stop to TRUE. +- GSTOP RESET.vi: Reset stop flag to FALSE. Index = -1 resets the global stop flag. +- GSTOP SET.vi: Set stop flag to TRUE. Index = -1 sets the global stop flag. +- GSTOP GET.vi: Read stop flag by index. Index = -1 reads the global stop flag. +- GSTOP CheckSet.vi: Check a Boolean input (usually a Stop button) and trigger stop when needed. + +Implementation +- Uses an FGV to store stop flags (32 Boolean flags by default). +- Index identifies module-level stop flags, while -1 identifies the global stop flag. +- The internal stop flag array auto-expands when index exceeds current size. + +Development Environment +- LabVIEW 2014 - VIPM 2020.3 NEVSTOP