LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel sheet input to 'setpoint' of PID controller

Solved!
Go to solution

Hello

 I am using this (attached) vi to control Lakeshore temperature controller. I got the vi from NI website. I want to change the vi such that, for setpoint, it takes input from an excel sheet (could be any other form too). this Excel sheet contains a list of temperatures. The vi reads the first temperature and then sets that as setpoint of the PID controller. Once the setpoint is 'set' the vi waits for some time (say 1 hour) before reading the next setpoint entry from the excel sheet. The reason I want it to wait is because I have programed a gamma spectrum software such that it counts for 1 hour and then starts a new counting. The spectrum part is not very intelligent but its ok for now. The problem I am having is that when I run this vi (attached), the setpoint indicator on the temperature controller (the hardware) goes to zero and stays there. Can anyone help me by pointing out the mistake I am doing. This vi is Labview 6.0 based ( its a poor establishment!)

thank you

saurabh

Download All
0 Kudos
Message 1 of 9
(4,775 Views)

Is xlsx a must or can you make do with a csv or a text file?

If yes you have made your life a bit easy

setpoint.png

 

 

 

if not you will need to install a plugin or find an excel interface library such as https://decibel.ni.com/content/docs/DOC-2343

and then do the same as above.

hope this helps.

 


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 2 of 9
(4,769 Views)

Thanks, Ace.

No, excel is not must. Text or csv is ok. I will give it a try.

saurabh

0 Kudos
Message 3 of 9
(4,766 Views)

Ace,

I got couple of very stupid questions. The function pallette in my LABVIEW 6.0 does not show csv reader icon or the array icon (the one marked double and one after it). Can you please tell their names so that I would be able to find 'em. My labview experience is less than a week. Also the Lakeshore vi (I hope I am calling it correctly) goes in the FOR loop, correct?

So what does the 'array' at the end is doing?

saurabh

0 Kudos
Message 4 of 9
(4,762 Views)

I am not sure if 'read from spreadsheet file.vi' is present in LabVIEW 6.0.

However, I can see it in the vi you posted previously.

The array at the end is just to show you that all the values are read, you can safely ignore it.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 5 of 9
(4,755 Views)

Ace,

thanks for the reply. I got it - the first one is 'read from spreadsheet.vi'. I have that. What is the vi that is taking the output from it?

thanks

saurabh

0 Kudos
Message 6 of 9
(4,751 Views)

That's just index array, which gives you the 1-d array that's relevant.


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 7 of 9
(4,748 Views)

Hi Ace,

 I am attaching a vi which i tried. What I want it to do is read the first setpoint, pass it to the output, then wait for some time (say 1 hr, which is adjustable) and then read the second setpoint and so on. would be able to help in this matter?

thanks

saurabh 

0 Kudos
Message 8 of 9
(4,724 Views)
Solution
Accepted by topic author easyrider

Saurabh,

 

You could possibly have the step timing in the spreadsheet as well?

 

This would be a classic case where you could use state machines (or producer / consumer - events if user input is critical), search for this architecture and examples on ni.com. Also for timing purposes, search for functional global timer or try modify this example https://decibel.ni.com/content/docs/DOC-6523 to add 'time has expired' (as in the elapsed time express vi) functionality similar to this code.

 

You could have states such as:

 

Initialise: Initialise your front panel controls/graphs etc. Read the spreadsheet file. Ensure that comms exist between the software and the controller etc.

 

Set Temperature: Set the first value, start a timer (depending on what you set)

 

Check Status: Check the controller failure status etc. Check if the user has pressed stop button. Check if the timer set in the previous state has expired?

 

On error stop the timer and take the necessary steps to correct, report to the user

 

If user pressed the stop button, close all references, reset hardware etc and quit application.

 

If the timer has expired, obtain the next value and go to Set Temperature.

 

Hope this helps.

 


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
Message 9 of 9
(4,721 Views)