November 23, 2024, 05:26:12 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Valve Test Stand, non-haunt

Started by gadget-evilusions, June 04, 2009, 07:18:59 AM

Previous topic - Next topic

gadget-evilusions

Jon,

I have a program request for my industrial day job. I am building a valve test stand. I am not sure if this is possible but here is what I have,

Out0 Solenoid valve (24 v 3 way solenoid valve)
PIN7 Pressure Switch Relay1 (Normally open relay air pressure activated)
PIN6 Pressure Switch Relay2 (Normally open relay air pressure activated)

Order of events:

Solenoid valve on Out0 turned on for 3 seconds
while solenoid valve is on look at PIN 7, if relay closed increment 1st internal counter +1
while solenoid valve is on look at Pin 6, if relay closed increment 2nd internal counter +1
solenoid valve off
display counts in debug screen
repeat 10,000
at end of program counts need to be left on the screen so I can check them after 8 hours of testing.

Let me know if this is possible, but I am sure in your amazingness this is easy. All the electricians are out of our shop for a few days, other wise they probably would have used one of the 100's of plcs we have, but since I am the only one left, I get to use efx-tek products.
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

gadget-evilusions

I forgot, I also need a third counter to show on the debug screen. The total number of times the valve is been told to turn on (times thru the cycle)
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

June 04, 2009, 09:16:19 AM #2 Last Edit: June 04, 2009, 11:51:57 AM by JonnyMac
You will smack yourself in the head when you see how easy this is.  Just keep in mind that the BS1 DEBUG is not great and doesn't allow the transmission of formatting constants like the BS2 does.

' =========================================================================
'
'   File...... Valve_Test.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 04 JUN 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Check1          = PIN7                  ' SETUP = DN
SYMBOL  Check2          = PIN6                  ' SETUP = DN

SYMBOL  Valve           = PIN0


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  cycles          = W0                    ' test cycles
SYMBOL  acc1            = W1                    ' P7 counts
SYMBOL  acc2            = W2                    ' P6 counts


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000001                              ' set output pins

  GOSUB Report


' -----[ Program Code ]----------------------------------------------------

Main:
Main:
  FOR cycles = 1 TO 10000
    Valve = IsOn
    PAUSE 3000
    acc1 = acc1 + Check1
    acc2 = acc2 + Check2
    Valve = IsOff
    GOSUB Report
  NEXT

  DEBUG CR, "Test complete."

The_End:                                        ' prevent sleep mode
  GOTO The_End


' -----[ Subroutines ]-----------------------------------------------------

Report:
  DEBUG CLS, "Valve Tester", CR, CR
  DEBUG      "Cycles........ ", #cycles, CR
  DEBUG      "Check1 (P7)... ", #acc1, CR
  DEBUG      "Check2 (P6)... ", #acc2, CR
  RETURN

' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

And FWIW... we're not a "haunt" company, we're a controls company that has a really good time working with friends in the haunt indursty.  You'd be surprised how many general industrial customers we have; our Prop-1, Prop-2, and Prop-SX controllers have replaced a lot of PLCs.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

I just said non-haunt because every program you have ever done for me was haunt related.

Thanks very much. That is easier than I thought. I have never used the debug command before, and I couldn't figure out how to get it to up the counts to add up and track.

Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components

JonnyMac

It was so easy I forgot to activate the valve! -- fixed now.  The DEBUG output takes about a second so the loop takes about four seconds.  At 10000 test cycles the test should last about 11 hours.
Jon McPhalen
EFX-TEK Hollywood Office

gadget-evilusions

I noticed. I added that valve, and another that I forgot I needed before you caught it also.


' =========================================================================
'
'   File...... Valve_Test.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2009 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 04 JUN 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------
Brian Warner added Valve #2 and code to cycle valves correctly

' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Check1          = PIN7                  ' SETUP = DN
SYMBOL  Check2          = PIN6                  ' SETUP = DN

SYMBOL  Valve           = PIN0
SYMBOL  Valve2          = PIN1

' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  cycles          = W0                    ' test cycles
SYMBOL  acc1            = W1                    ' P7 counts
SYMBOL  acc2            = W2                    ' P6 counts


' -----[ Initialization ]--------------------------------------------------

Reset:
  PINS = %00000000                              ' clear all
  DIRS = %00000011                              ' set output pins

  GOSUB Report


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR cycles = 1 TO 10000
    Valve = IsOn
    PAUSE 2000
    acc1 = acc1 + Check1
    acc2 = acc2 + Check2
    PAUSE 1000
    Valve = IsOff
    GOSUB Report
    Valve2 = IsOn
    PAUSE 1000
    Valve2 = IsOff
  NEXT

  DEBUG CR, "Test complete."

The_End:                                        ' prevent sleep mode
  GOTO The_End


' -----[ Subroutines ]-----------------------------------------------------

Report:
  DEBUG CLS, "Valve Tester", CR, CR
  DEBUG      "Cycles........ ", #cycles, CR
  DEBUG      "Check1 (P7)... ", #acc1, CR
  DEBUG      "Check2 (P6)... ", #acc2, CR
  RETURN

' -------------------------------------------------------------------------


' -----[ User Data ]-------------------------------------------------------
Brian
Evilusions LLC
www.evilusions.com for all your pneumatic components