Valve Control with "Event" statement


Kemp
 Share

Recommended Posts

Subject: Valve control with “Event” statement.

I am a novice at creating a control system using DaqFactory and a U3 LabJack.

I have designed a system consisting of a number of pipe valves in a closed loop and open-loop configuration. Each valve is controlled through the DAQFactory program. Each valve is controlled by a separate Channel as a “digital out” device. Each channel (Valve) is operated by a two-position lever switch. Manually the valves/system operates properly and there is no interaction between any of the valves.

The problem is that there are conditions where two specific valves cannot be open at the same time.

I have attempted to control this by creating an “event” in (Valve_1) that prevents (Valve_2) being open or opening when (Valve_1) is open or opens.

Event statement:

            If (Valve-1[0] => 1)  /I incorporated the > on the assumption that Valve_1{[0] might not be exactly equal to 1

                        Valve_2 =0

            endif

this event statement is typical of a number of combinations/statements, that I have tried.

Once this problem is resolved I need to automate the whole system (6 valves) with a prescribed sequence operation program.

Unless you wish to also comment on that program, I will reserve those problems for some future assistance, I suspect.

I appreciate your assistance in helping me resolve this problem.

Link to comment
Share on other sites

Your Event code should mostly work, though I would just write it as:

if (Valve_1[0] )
   Valve_2 = 0
endif

The problem is that there will be a small delay from when Valve_1 opens to when valve_2 closes.  The other problem is that this won't prevent valve_2 from subsequently being opened.

A better method is to use a Test Digital Out channel for each of the valves that act as a proxy to the real valves.  So, lets say you have tValve_1 and tValve_2 which are Test Dig Out channels.  In the tValve_1 Event you would put, say:

if (tValve_1[0])
   Valve_2 = 0
endif
valve_1 = tValve_1[0]

This will cause Valve_2 to close before valve_1 opens.

Then, in tValve_2's event, you put the same sort of thing (assuming that is what you want):

if (tValve_2[0])
   Valve_1 = 0
endif
valve_2 = tValve_2[0]

But you could also make it so if you try and open tValve2 when valve1 is still open, it just doesn't do anything rather than closing valve1:

if (tvalve_2[0]) // we want to open valve2
   if (valve_1[0]) // but valve1 is open
      tvalve_2.addValue(0)  // stick a 0 in tValve2 to indicate that we couldn't open it
      return   // and stop
   endif
endif
// otherwise, we are safe to control valve2:
valve_2 = tValve_2[0]

Using these proxy channels give you the ability to fully validate valve states before you change any valves.  The trick is that you should never be controlling the real I/O channels, Valve_1, Valve_2, etc from anywhere else in DAQFactory, but instead controlling their proxies, tValve_1, tValve_2, etc.  You can still display or log the status of Valve_1, but you shouldn't be controlling it, otherwise you'd be bypassing the checks.

 

Link to comment
Share on other sites

Thank you for you council and recognizing and commenting on the problem of the sequential problems of the valves opening and closing.

Cogitating on the problem overnight and before I received your response, i had started to puzzle on that problem.

I realize my problem/program is very simple compared others on the forum. Learning to write a "DAQ" computer program from a "hard wired" control back groung will be a one step at a time thing. I understand the logic the syntax is another problem.

Sincerely, Kemp

 

 

Link to comment
Share on other sites

Your question is simpler than some, and more complex than others.  Don't downplay your challenges!  The syntax will become more obvious the more you use the program.  Most of our users are none programmers, and either get what they need with little or no programming, or grow into programming while using DAQFactory.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share