Hello, I am in the process of saving my sensor readings in an array. At the moment, my sensor data is saved as a float value, but I want it to be stored in an array whenever there is an update. Moving forward, I aim to have the program save the sensor data every 15 seconds. I am attempting to utilize a LFL function to transfer the data, but I am encountering difficulties. My current platform is RSLogix 5000 software. Thank you.
Is it possible to avoid using the copy function and instead manually move the new value into the first position of the array, and then copy the first element to the second with a length of xx (array length - 1)? I am uncertain if the RSL copy function operates in a reverse order like the Mitsubishi Block Move function. In Mitsubishi, the data is copied from length - 1 to length, with the length decreasing until it reaches 0, resulting in a reverse order copy to maintain data integrity when moving data within a block.
Moving fresh data into array[0] and then copying it upward, as suggested by parky, may result in overwriting your data with the same values. Instead, consider copying the fresh data into array[999] and then shifting array[1] to array[0] with a length of 999. This method ensures that the data moves downward correctly, arranging the oldest data at the lowest array element number and the newest at the end. Personally, I often utilize this approach when I require a First-In-First-Out (FIFO) system without the added complexity. I seldom resort to using a Last-In-First-Out (LIFO)/FIFO stack unless specific control tags necessitate special actions.
There are multiple methods to achieve this task. Personally, I prefer utilizing the FAL instruction. In this process, the expression field indicates the data source, while the Destination field represents the array and utilizes variable addressing to determine where the value will be written within the array. The FAL Control Position increases by one each time the timer DN activates, consequently advancing the array destination. It is crucial to determine when a reset should occur, and whether the stored data should be erased or if the process should start anew, overwriting previous data. Alternatively, the FIFO (FFL/FFU) and LIFO (LFL/LFU) methods can be employed. Similar to the FAL instruction, it is essential to establish a plan for when the array becomes full. Another option is to utilize a standard MOV instruction and variable addressing for the array destination, potentially incorporating a counter to vary the destination. An important consideration with any of these methods is to ensure that the number of recorded values does not surpass the array's capacity. For instance, my arrays are defined with 250 elements, while the instruction length is set to 240. If the length is mistakenly adjusted to exceed 250, the controller may attempt to write to a non-existent array address, resulting in a critical controller fault and system shutdown. To prevent such errors, it can be beneficial to include safeguards, such as an LEQ check before the MOV instruction. By implementing these measures and documenting the process thoroughly, potential issues can be avoided, ensuring the system operates smoothly.
When designing a program, it is recommended to use First In First Out (FIFO) or First Fit Lowest Used (FFU) methodology, or simply a Common Operational Picture (COP). Some may prefer to replicate FIFO functionality using Counter Timer Units (CTUs) and Move (MOVs) instructions. Whichever method is chosen, the challenge arises when the array becomes full. One of the easiest solutions is to use a branch with eXamine If Closed (XIC) fifoctl.Done FFU before the FFL instruction. This setup ensures the newest data is at one end of the array while the oldest data is retained at the other end. If the goal is not to maintain a specific order of data, a circular buffer may be a more efficient alternative to the FFL/FFU pair. However, with modern processors, CPU cycles are typically abundant, making efficiency less of a concern in practical applications.
When performing a block move operation in an array, it is possible to avoid the need to remove items from the end or reset the array. Instead, the process involves copying from the second to last element to the last element, iterating until the first element is copied to the second element. Finally, only display elements from the second to the last position. This approach results in the oldest reading being discarded. The success of this method depends on how the block move operation is implemented in a specific programmable logic controller (PLC). It can be compared to a for/next loop, as exemplified by moving 199 elements in an array of 200 readings with a pointer. By carefully executing the block move operation, the desired results can be achieved without unnecessary complications.
Sounds like you're on the right track! One way to achieve this could be by using a Timer-On-Delay (TON) function, which can be set to 15 seconds. This would allow you to read your sensor data at regular intervals. As for storing the sensor data into an array, consider creating a global array variable where each new float value can be stored. Then you just need to ensure in your LFL function that the next available index of the array is selected each time a new reading is saved. This way, every 15 seconds (as dictated by the TON), the sensor reading should be automatically saved into the next available spot in your array.
Hi there! It sounds like a timer might be beneficial in your situation to regulate saving the data every 15 seconds. RSLogix 5000 allows for the creation of such timers. As for storing the readings in an array, you'd likely want to use a FOR loop to iterate over each sensor reading and assign it to an array index. This can be done within the LFL function. Remember, you'll need to initialize an array first with the size equating to the number of sensor readings you intend to save. Hope this helps and feel free to ask more detailed questions if you run into more issues.
It sounds like you're doing some interesting work with your sensor data! One thing I'd suggest is to use a Timer (TON or TOF) that's set for 15 seconds. On the completion of each timer cycle, trigger your LFL (Load File in List) function to store your float value into the array. This way, your program would be able to save the data every 15 seconds just as you're aiming for. I hope this helps!
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: - To save sensor readings in an array for automated updates, you can use programming techniques to store the data in an array whenever there is an update. You can set up a timer to save the sensor data every 15 seconds for regular updates.
Answer: - You can store sensor readings in an array using data types like float values, integers, or any other data type that suits your requirements. Make sure the data type chosen can accurately represent the sensor data with the desired precision.
Answer: - To implement a LFL (Load from Latch) function in RSLogix 5000 software for transferring sensor data, you need to configure the function block with the appropriate input and output parameters. Consult the software documentation or seek assistance from online resources or forums for detailed guidance on setting up the LFL function in RSLogix 5000.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.