Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa serial communication check device active

Solved!
Go to solution

Hi, I am working on a project to acquire data from a Aeocon feed-in inverter, store the data and show the data on the user interface. The basic program is working; I have communication (thanks to the help of this forum!), receive the correct data, write the data to file and show it on the user interface.

 

The issue that I’m working on now is the following; the aeocon inverter is used to load a small windturbine and feeds the produced power to the grid. The wind turbine powers the inverter. This means that the inverter is active when there is wind and the turbine is running, if there is no wind the turbine is standing still and the inverter is shutdown including the serial communication.

 

I have a inverter here for testing and I have simulated the above situation, I powered up the inverter, started the serial communication, after a minute powered down the inverter and after two minutes power up the inverter again. It seems that during the power down the program holds, waits for the inverter to come online again and the resumes. When I look in the measurement file I see that with the inverter active data is written to the file every second (that is correct) and during the power down data is written every 10 seconds (time out for visa read I assume).

 

What I would like to do is to build some sort of watchdog which checks if the inverter is active, if so the communication is running normal, if not the communication is temporarily on hold until the inverter comes back online again, time and date are written to the file every second and the rest of the data are zero’s.

 

The problem that I have is how to determine if the inverter is active or not. I have searched the forum and went through (old) visa manuals but I have not found a solution. I hope that someone on this forum has experience with the above issue and can put me on the right track to a solution, at this point I have no idea how to continu.   

 

Thank you for your time and looking forward to your respons.

 

Best regards, Martin 

0 Kudos
Message 1 of 8
(4,289 Views)
You seem to already know what happens. You just don't seen to be handling any errors. A timeout is the only way to know if a serial instrument is off line so just look for that error code.
0 Kudos
Message 2 of 8
(4,275 Views)

Thank you (again) for your help, your completely right I'm not handling errors at this time. I'm experimenting with labview for a few months now and the next items on my study list are working with projects, sub vi's and error handling. I guess this is a good reason to work on the error handling first. From the serial communication protocol of the vendor I know that the inverter should answer within 250us after receiving the last byte of the command block so somehow I should be able to test for the appropriate error and handle this in the way described in the original message. So back to the tutorials for now and I hope to post the result in a couple of days.

 

Best regards, Martin  

 

0 Kudos
Message 3 of 8
(4,262 Views)

Martin,

 

The simplest error handling is to wire all the error wires from one VI to the next and connect the  last one to an indicator on the front panel.  That will tell you at a glance whether you have an error and where it originated. Using Explain Error... from the help menu can get more information.  This does not require anything sophisticated and is quite enough for trouble shooting while learning and developing programs.

 

Fancy error handling to detect and correct specific errors are great things to have in a final progam. They may take a lot of work to make them robust, but that is not an excuse not to use the basic error indication described above.

 

Lynn

0 Kudos
Message 4 of 8
(4,251 Views)

Hi Lynn,

 

Thanks for your input, I have wired the error's and placed an indicator on the front panel. I now know the error code (-1073807339(0xBFFF0015)), further I have "unbundeld" the error wire and that gives me the error code in the main loop. I think the next step must be to determine if the error is active, at a Offline state to the state machine (write time, date and zero's to the file) and if the error resets (inverter comes back online) got to the first state and continue business as usual. I will gives this a shot later today and let you know the result.

 

Best regards, Martin

      

0 Kudos
Message 5 of 8
(4,239 Views)

Things are starting to work, I made a simple test to check if the error is active (10763807339+ error code)= 0; error active) and the first state in the state machine checks if this error is active. If true the state machine holds until the error active status is reset and that is when the inverter comes back online.

 

This is working pretty well, the only problem left is when the inverter is offline, the state machine is waiting for the inverter to come back online and I stop the program. Under these conditions Labview shows the error message Error -1073807339 etc. etc. I'm wondering if there is a way to handle this error in the background so that the user does not get the error message.

 

Your suggestions are most welcome!        

0 Kudos
Message 6 of 8
(4,198 Views)
Solution
Accepted by topic author SiddySI

You can check for that specific error.  If the user shuts down the program while that error is present, just clear the error before writing to the error indicator.

 

Lynn

Message 7 of 8
(4,193 Views)

Ahh, found a solution. I now use the error active signal used to detect if the inverter is on or offline to also clear the error, works perfect.

 

Thanks you so much for your advice! 

 

Best regards, Martin

0 Kudos
Message 8 of 8
(4,183 Views)