11-29-2022 10:43 AM - edited 11-29-2022 10:44 AM
I have attached the zip file (2022 version as I am not on my work laptop at the moment) and manual as requested. There is nothing particularly special about the received message, it will just appear in a large string as mentioned above.... I was given the skeleton code by my colleague which included the TCP connection and HTTP get command. For the HTTP get command, it basically sends "1" to the relay of the PLC to activate it. The relay sends the TCP connection signal to the GUI, if that makes sense to you! The ultimate goal is to connect to the PLC without opening its application and completely controlling it via labview. Unfortunately, this is my first time dealing with a PLC, TCP connection and HTTP protocols as well as the GUI even though I do have prior coding knowledge. I apologise if I fail to answer satisfactorily!
I think my earlier code would work perfectly well once you sort out your TCP connection. Is there anything special about the received message? (Size? termination character?) For example "immediate mode" is certainly not typical. (see also)
Do you have the manual for the device? can you attach the pdf?
You have that "HTTP get commend" in your original code (with no outputs wired!). What output does it provide? (remove all the other TCP stuff).
Can you create indictors for all its outputs, run in in your setup, and shows us what the output is?
I thought of using HTTP send instead of GET, but I'm not very sure about the protocol - the idea is that we send that string to the HTTP address, which will activate the relay in the PLC, which will send a TCP connection signal for the GUI to get the while loop started. I will create indicators etc tomorrow morning once I get to the office. Thank you so much for your comments and help thus far, I am now trying to use a state machine instead (albeit with some difficulty).
11-29-2022 07:15 PM - edited 11-29-2022 07:31 PM
The HTTP get command is only meant to activate the relay of the PLC remotely using the GUI, here are the outputs of it (which are unwired)
I just realized that maybe my colleague set the TCP mode to immediate, which is why the strings were to be concatenated as it is never ending or something like that? This may have also caused the program to run out of memory after ~10 minutes.
Here's the zip folder for the full GUI for an older version of labview.
12-01-2022 09:30 AM - edited 12-01-2022 09:52 AM
Sorry, I am on a 1080p laptop and cannot manage gigantic Rube Goldberg diagrams at this time. The code is extremely convoluted and constipated. My guess is that properly coded, the size would reduce to 20%. This simply needs to be a state machine with defined dataflow and execution order.
So let's forget about that for the moment and focus on the gist of your problem:
Your PLC is constantly sending data in a specific format and you need to somehow parse it and append it to an existing 2D array.
There are two main problems to solve:
So let's focus on 1. Can you write a simple simulator that mimics the received PLC data?
12-01-2022 06:33 PM
The PLC only sends out data every second, so I previously tried to let the chart only "refresh" every 1 second using a case structure. However, that caused some data to not appear. I will try to make a simulator to act as the PLC sending out the data!
12-01-2022 06:47 PM
@eenjeruu wrote:
The PLC only sends out data every second, so I previously tried to let the chart only "refresh" every 1 second using a case structure. However, that caused some data to not appear. I will try to make a simulator to act as the PLC sending out the data!
This statement scares me a little. It indicates that you might not understand basic instrument communications. Have you ever communicated with an instrument before?
12-01-2022 07:21 PM
@billko wrote:
@eenjeruu wrote:
The PLC only sends out data every second, so I previously tried to let the chart only "refresh" every 1 second using a case structure. However, that caused some data to not appear. I will try to make a simulator to act as the PLC sending out the data!
This statement scares me a little. It indicates that you might not understand basic instrument communications. Have you ever communicated with an instrument before?
No, I have not really communicated with an instrument - I've only had some limited experience with things like Arduino back in school. PLC and GUI programming are completely new to me 😀 trying my best to learn on the job but I only had exposure to Core 1 (whose access I no longer have out of a sudden).
12-01-2022 09:21 PM
@eenjeruu wrote:
@billko wrote:
@eenjeruu wrote:
The PLC only sends out data every second, so I previously tried to let the chart only "refresh" every 1 second using a case structure. However, that caused some data to not appear. I will try to make a simulator to act as the PLC sending out the data!
This statement scares me a little. It indicates that you might not understand basic instrument communications. Have you ever communicated with an instrument before?
No, I have not really communicated with an instrument - I've only had some limited experience with things like Arduino back in school. PLC and GUI programming are completely new to me 😀 trying my best to learn on the job but I only had exposure to Core 1 (whose access I no longer have out of a sudden).
Believe it or not, this is invaluable information! This allows us to know how to help you! 🙂
12-01-2022 09:24 PM
@billko wrote:
@eenjeruu wrote:
@billko wrote:
@eenjeruu wrote:
The PLC only sends out data every second, so I previously tried to let the chart only "refresh" every 1 second using a case structure. However, that caused some data to not appear. I will try to make a simulator to act as the PLC sending out the data!
This statement scares me a little. It indicates that you might not understand basic instrument communications. Have you ever communicated with an instrument before?
No, I have not really communicated with an instrument - I've only had some limited experience with things like Arduino back in school. PLC and GUI programming are completely new to me 😀 trying my best to learn on the job but I only had exposure to Core 1 (whose access I no longer have out of a sudden).
Believe it or not, this is invaluable information! This allows us to know how to help you! 🙂
That's great! I managed to incorporate Alterbach's 2D array populating system into my code, but I have issues displaying it on a chart - the chart displays everything in the 2D array, but we only want to display the first row/most recent data taken in - what can I do here?
12-03-2022 01:27 PM
Well, if you have problems, show us the code. Make sure you only feed it the current data, not the data from the table.
12-03-2022 01:38 PM
Some ideas....
(Note that charts take a variety of inputs. You could also create a cluster of three scalara, for example.)