LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to populate 2D array

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).

Download All
0 Kudos
Message 21 of 38
(846 Views)

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)

eenjeruu_0-1669769656786.png

 

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. 

0 Kudos
Message 22 of 38
(788 Views)

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:

  1. How to reliable received the data (non-duplicates, non-garbage, correctly framed, etc.). Does the PLC really send data non-stop? Wouldn't it be more reasonable to have a request/response two-way communication?
  2. How to append it to the 2D array (I already showed you that!)

So let's focus on 1. Can you write a simple simulator that mimics the received PLC data?

0 Kudos
Message 23 of 38
(757 Views)

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!

0 Kudos
Message 24 of 38
(732 Views)

@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?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 25 of 38
(723 Views)

@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).

0 Kudos
Message 26 of 38
(706 Views)

@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!  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 27 of 38
(688 Views)

@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? 

0 Kudos
Message 28 of 38
(682 Views)

Well, if you have problems, show us the code. Make sure you only feed it the current data, not the data from the table.

0 Kudos
Message 29 of 38
(642 Views)

Some ideas....

 

(Note that charts take a variety of inputs. You could also create a cluster of three scalara, for example.)

 

altenbach_0-1670096236881.png

 

0 Kudos
Message 30 of 38
(633 Views)