LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and FP-DO-400

Hey all,

 

I'm a senior mechanical engineering student at Bradley University trying to finish up a senior design project for the year.  I've got a LabVIEW VI with all of our instrumentation running exactly the way I want it...everything on that end works well.  In my set up, I've also got an FP-DO-400 module that I intend to use for some limited controlling.  For reference, the host module is an FP-1000.  We're trying to simulate rapid cycling of a compressor in an air conditioning apparatus, but that's not what I'm looking for help with.  Here's what I'm trying to accomplish:

 

    1. Get a cycling on/off percentage using logic that I've already got (for example, 80% on, 20% off).  Multiply that by 40 seconds (so 32 seconds on, 8 seconds off).
    2. Send a voltage out of Channel 0 of the FP-DO-400 during the 'on' stage, but not during the 'off' stage.  So, there should be a voltage out for 32 seconds, and no voltage for 8 seconds.
    3. Update the cycling on/off percentage every 40 seconds.

Steps 1 and 3 aren't horrible...I think I've got them figured out.  The biggest problem I've got right now is that I don't know how to trigger the on/off for the FP-DO-400 in LabVIEW.  The command that I think I need to use is "Activate Outputs" (page 4-15 in the FP-1000/1001 Programmer Reference Manual).  The problem is that I have no idea how to execute this command from within LabVIEW.  If possible, I'd like to handle everything using my VI's block diagram, but I couldn't seem to find any way to switch the output voltage on and off from the standard toolbox.

 

Can you guys help?  I feel like this is a pretty simple/straightforward operation...I'm just pretty new to LabVIEW programming.

 

Thank you in advance for all of your help!!!

 

-Tom-

0 Kudos
Message 1 of 4
(2,292 Views)

Hi Tom,

 

Since it sounds like you understand how to code steps 1 or 3, I'll address step 2, the need to write a digital out to your FieldPoint module under certain conditions.

 

I'm also not sure what software you're using or if you've programmed your FP-1000 at all. Therefore these directions start from the beginning and assume you're using a seminew version of LabVIEW and a seminew version of the FieldPoint drivers (I'm using LabVIEW 2011 and FieldPoint 6.0.10).

 

Here are the steps:

1) Add your FieldPoint Serial Device in MAX by right-clicking on "Devices and Interfaces" and selecting Create New...

Add Serial Device - Copy.png

2) Select FieldPoint Serial and configure it appropriately. Now you should be able to see your FieldPoint under Devices and Interfaces. It should autodetect the modules you have; If not, right click on your Bank and choose "Create New Device" to add your DO module manually.

SerialFieldPoint.png

3) In LabVIEW, navigate to your FieldPoint palette by opening your Functions palette>Measurement I/O>FieldPoint. There you should see FP Write and the FP I/O Point. These should be the only blocks you need to set you DO to true.

FPWrite.png

4) Wire them up as shown below. Click on the purple arrow and choose Browse.

FPIOPoint.png

5) If you've configured it correctly in MAX, then you should see your FP@COM. Expand to select your module and channel that you want to change the value of.

DeviceSelection.png

6) Now its just a matter of writing true or false to the input of the FieldPoint Write in order to change the output. (You do need an extra external power supply to produce a Digital Out). Among other options, you could put the FieldPoint Write in a case structure in order to control when you want it to write true and when false. Be aware that this will be software times and that update rates won't be extremely high.

0 Kudos
Message 2 of 4
(2,271 Views)

Hi Alisha,

 

Thanks for the quick response!  It was extremely helpful!  I've now successfully gotten the module set up so that I can turn the channel on and off from within LabVIEW.

 

However, I believe that I over-estimated my understanding of steps 1 and 3.  For reference, below is the portion of my block diagram as it appears now:

 

LabVIEW Controller Block Diagram.jpg

As you can see, given T_5, T_Cabin_Desired, and Cycle_Length, the arithmetic on the left calculcates the amount of time that I'll require FP-DO-400 channel 0 to be turned on.  For example, if T_5 is 26 and the constants from the diagram are used, then the Channel_On time would be 14.42 seconds (Channel_Off time would be 40-14.42=25.58 seconds).

 

So....what I need is some way to output 'True' for 14 seconds, and then 'False' for 26 seconds...then repeat.  I was thinking that I could store the output of the arithmetic on the left as a variable (Channel_On_Time) and then use a loop structure similar to the pseudo-code below:

 

For t = 1 To 40

 

While t < Cycle_On_Time

Output 'True'

End While

 

While t > Cycle_On_Time

Output 'False'

End While

 

End For

 

I hope that makes sense.  Could you show me (or point me to an example of) how I might program this into my block diagram?

 

Thanks again for all of your help!

 

-Tom-

0 Kudos
Message 3 of 4
(2,258 Views)

Hi Tom,

 

There are, of course, a number of ways you could implement this functionality and only you can be the judge of what it best.

 

You could use a while loop, calculate the time elapsed (by subtracting out the current tick count from the starting tick count), and use the current time to determine whether or not to write true or false to the DO. Here's an example of that idea:

whileloop.png

 

The only problem with that is you're constant writing values to the FieldPoint that you really only need to write once. So you could also just use wait VIs to wait for 14 s after writing true to it and then write false:

sequence.png

This list of options continues. Good luck!

 

(The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense) (not actually attached, just pictured)

 

 

 

0 Kudos
Message 4 of 4
(2,248 Views)