LabVIEW Wireless Sensor Network Module Help
»View Product Info
When you add a WSN target to a WSN node, LabVIEW creates a top-level VI that you can use to acquire data from and communicate with a WSN node. By default, this VI includes a Case structure with cases for the following states.
- Start—Occurs when the application begins to run on the WSN node.
- Sample—Occurs when data is read from the WSN node or data is sent to the WSN gateway. This state occurs based on the sampling rate for the WSN node. Use this state to process the data before it is sent to the gateway.
- Receive—Occurs when the WSN node receives a user message from the host via the gateway.
- Network Status Change—Occurs when the network status of the WSN node changes. Use this state to detect if the WSN node is connected to or disconnected from the WSN gateway and to configure how sampling of data occurs based on the connection state of the WSN node. For example, you can use this state to configure the WSN node to read data less frequently when the WSN node is disconnected from the WSN gateway and to log that data to the user memory instead. Alternatively, you can configure the WSN node to stop reading data when the WSN node is disconnected from the WSN gateway.
- DIO Notification—Occurs when notifications occur on the DIO lines. Use this state to configure the WSN node to respond to external events. For example, you can use this state to sample data from the analog or digital lines or count events.
The WSN VI must periodically exit these states to receive messages from the gateway. As a result, if the application delays too long in a state and blocks the state machine, the application might crash. National Instruments recommends that you use the following guidelines when determining how long the application remains in states:
- The VI must exit states in less than heartbeat/2, which is approximately 30 seconds, to maintain a connection to the network. If the WSN node is not connected to the gateway, the VI must exit states in less than heartbeat interval/16, which is approximately 3.8 seconds. Failure to exit states might prevent the WSN node from connecting the gateway.
- Minimize CPU usage by the VI; otherwise, the WSN node might not receive messages.
- If you are using a WSN voltage node, the VI must exit states in less than 9 seconds; otherwise, the MUX cannot maintain high impedance, and analog input accuracy will decrease. Alternatively, you can read the analog input every 9 seconds, which causes the MUX capacitors to recharge.
||Note Refer to the KnowledgeBase at ni.com for more information about the WSN execution model.