LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HOW AND WHERE TO INSERT EVENT STRUCTURE IN PRODUCER/CONSUMER LOOP FOR DATA LOGGING?

MY TASK:

In my thesis, it is necessary to implement an application that will log measurements from the inverters (total of 7 inverters, of which 3 inverters from SMA  and 4 inverters from Fronius). The inverters have integrated Modbus TCP servers and are supported for communication using the MODBUS TCP / IP communication protocol of the photovoltaic power plant. In that regard, it is necessary to create a communication module of the application which will be connected to the inverters of the photovoltaic power plant via MODBUS TCP/IP protocol and collect measurements of appropriate process quantities Furthermore, all collected measurements need to be saved on a 15-minute basis in separate csv files for each day. Additionally, it is necessary to develop a graphical user interface (GUI) where the collected measurements from the photovoltaic power plant will be displayed. The graphical interface itself should consist of a main screen on which it will be possible to select measurements from an individual power plant inverter or total measurements for the entire power plant.

 

MY PROBLEM:

I started solving my problem using producer/consumer design patterns for collecting and saving data, but when I need to develop GUI I don't realize where I can insert Event structure here ? and sorry because some parts of projects are on Croatian language!

0 Kudos
Message 1 of 28
(811 Views)

Hi, may I confirm with you some details first?

  1. Would you mind share your VI file in .zip or rar format? I can't open it. Although I can't help you modify your program, but I can try to give you direction.
  2. If I understand your quetions correct, based on my experience,  try to limit only 1 event structure in your block diagram. That means you can put your event structure in your producer loop. If you put too many independent event structure in your block diagram, it's hard to keep track which event occurs during your program running.
  3. You may check the Queued Message Handler (QMH) example in LABVIEW. You can imagine QMH is another "form" of producer-consumer loop. The QMH labview Example also involve data logging.Using a Queued Message Handler in LabVIEW - NI
0 Kudos
Message 2 of 28
(726 Views)

Hi, thank you for answer!

 

1. I hope that you can open it now, my version is 2016.

In this zip file I have project named Diplomski rad. There I made program for data logging ( collecting and reading measurements from inverters in producer loop and writing measurements in file in consumer loop). Now, I need to develop a graphical user interface (GUI) where the collected measurements from the photovoltaic power plant will be displayed. The graphical interface itself should consist of a main screen on which it will be possible to select measurements from an individual power plant inverter or total measurements for the entire power plant.

 

I have problem because I don't have idea where (in which part of my program could develop GUI) and how I can do develop GUI in this project?

 

0 Kudos
Message 3 of 28
(708 Views)

An event structure cannot do datalogging, it is for user interactions. Your program seems to be mostly free running and the user interaction is limited to selecting channels.

 

Your zip attachments contains tons of VIs and at least two projects. It would help if you could narrow it down what we should be looking at.

 

You should really focus on giving your code reasonable names (Control 1.ctl ... Control 22.ctl, Untitled Library 1.lvlib ... Untitled Library 3.lvlib, enum.ctl, enum1.ctl, etc. These make code maintenance very difficult.

 

(Sorry, I am currently on a laptop and you diagram is too large to efficiently inspect)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 4 of 28
(678 Views)

Hi, I got same opinion with @altenbach 

I think your main reason that feeling loss is because you dont have a "Main.VI" which compile all the VI you have done.

If I not mistaken, I think you want to complete each feature in single independent VI so easy for your troubleshooting. 

So if you make sure each feature VI can run smoothly without error, then we can start discuss the step to "combine" all you VI into 1 "Main.VI".

I try to wirte some step to give you direction:

  1. Identify which VI is core VI.
    • Based on your explanation, I think your are using producer(Event loop)-consumer loop.
    •  So you can select the most complicated VI which have producer(Event loop)-consumer loop as core VI.
    • That means the core VI will become your "Main.VI" in your final project. 
  2. Try to add another VI/Sub VI into your core VI in Step 1.
    • This step is taking some time. Add one VI, then test first, if no error only proceed adding next VI. 
    • Make sure add all related VI into same folder and "Project explorer" .
  3. When you complete Step 1 & 2, congratulation you have ONLY ONE "Main.VI" with all the feature, so now you can start design GUI.

If you face any difficulities during follow the steps above, we can discuss at here anytime.

 

0 Kudos
Message 5 of 28
(660 Views)

Thank You very much on yours answers and yours help! And to you @altenbach, too!!! I really appreciate it!!!

 

I hope that in my new .zip file it is everything good sorted, as you advised me.  I have my Main.vi (producer-consumer design pattern with subVIs where I logging and saved my measurements) and I have my final project DataLogging and Monitoring.lvproj.

 

In this project, I need to develop GUI (something like on this picture which I uploaded, it doesn't have to be complicated). I understand that producer-consumer pattern is used for data logging and that Event structure is used for User interactions, but I am a little bit confused where I need to put Event structure (for User interaction) in producer loop.

 

In GUI, I need to show measurements for each individual inverter in chart and in table (like on the pictures, when the user wants to see the measurements for inverter 1, he wedges the inverter button, etc.) 

 

I hope that it is more clearly now about my project and that You understand what I need to do

Download All
0 Kudos
Message 6 of 28
(642 Views)

Hi,

  1. So if i not mistaken, in you "Main.vi" ,your producer loop is "Reading" , your consumer loop is "Writing".
    • It's ok to use structure like this if you not involve user interaction.
    • Dataflow: Read data (Producer) --> Write data (Consumer)
  2. However actually user intercation (Event structure) is consider producer too. Now got 2 producer in you project, and you confused about this.
  3. So my suggestion is convert your "Reading" loop become consumer.  Event structure become producer
    • Producer : Event structure 
    • Consumer :"Reading" state , "Writing" state
    • Dataflow: User interaction trigger event structure (Producer) --> Read data (Consumer first state) -->  Write data (Consumer second state)

If you refer QMH example in Labview, you can see that there's many state in consumer loop.

Ya i know this method will used a lot of time, you may hear the other suggestion first if you want.

Message 7 of 28
(635 Views)

Thank you, again!

 

1. Yes, its right!

 

2. Yes, I thought that I can use producer loop for reading and for event structure, but now I see that it is not effective.

 

3. Do you have same suggestion how to convert my reading loop in consumer loop? 

 

I hope that I can use my project that I made till now for reading and writing measurement? Or I need make everything new?

 

0 Kudos
Message 8 of 28
(628 Views)

Because I don't want to interrupt your project too much as data protection policy, and don't want to make you confused.

You may pay attention on Case structure+ Dequeue Element Function (Consumer loop) in QMH labview example.

See how producer pass data to consumer to switch state (case).

I think you can find inspiration from that.

0 Kudos
Message 9 of 28
(622 Views)

Can you post that example here because I don't know on which you think? And do you think that it is (QMH) the only way to develop GUI in my project?

 

For the first time i meet with QMH and it is very confusing to me! Sry 😞

 

Thank you 

0 Kudos
Message 10 of 28
(615 Views)