Hello Guest it is March 28, 2024, 07:52:21 AM

Author Topic: Oxy Fuel Safety timer  (Read 6253 times)

0 Members and 1 Guest are viewing this topic.

Oxy Fuel Safety timer
« on: June 30, 2011, 02:09:46 AM »
Hi all,
I am setting up Mach3 to run with a Oxy Fuel process. I have searched everywhere but can't seem to find any info.

I want to put a simple safety feature in place that cuts off the gas supply if auto ignition haven't been confirmed by the operator within a certain time frame. Since I don't know too much about VB it is a bit difficult... I have read through a lot of posts but I still can't get something. The basic process would be something like this:

Timer countdown 25s (a visible counter would be best)
If "operator have confirmed ignition before " then "resume cycle"
else
STOP

or maybe on different approach:

Timer countdown 25s (a visible counter would be best)
if counter = 0 and confirm = 0 then stop

if counter >= 0 and confirm = 1 then Resume

Any help would be much appreciated.... I've spend many hours trying to work it out but to no avail.

Sinkyster

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Oxy Fuel Safety timer
« Reply #1 on: June 30, 2011, 09:02:16 AM »
A very simple start would be this: Not knowing the method you use to turn on the torch it is a start. It simply counts down and sendstheount to the message bar.

'Countdown timer for AutoTorch light

'(turn on torch)

Message "26"
Sleep(1000)
Message "25"
Sleep(1000)
Message "24"
Sleep(1000)
Message "23"
Sleep(1000)
Message "22"
Sleep(1000)
Message "21"
Sleep(1000)
Message "20"
Sleep(1000)
Message "19"
Sleep(1000)
Message "18"
Sleep(1000)
Message "17"
Sleep(1000)
Message "16"
Sleep(1000)
Message "15"
Sleep(1000)
Message "14"
Sleep(1000)
Message "13"
Sleep(1000)
Message "12"
Sleep(1000)
Message "11"
Sleep(1000)
Message "18"
Sleep(1000)
Message "17"
Sleep(1000)
Message "16"
Sleep(1000)
Message "15"
Sleep(1000)
Message "14"
Sleep(1000)
Message "13"
Sleep(1000)
Message "12"
Sleep(1000)
Message "11"
Sleep(1000)
Message "10"
Sleep(1000)
Message "9"
Sleep(1000)
Message "8"
Sleep(1000)
Message "7"
Sleep(1000)
Message "6"
Sleep(1000)
Message "5"
Sleep(1000)
Message "4"
Sleep(1000)
Message "3"
Sleep(1000)
Message "2"
Sleep(1000)
Message "1"
Sleep(1000)
Message "0"
Sleep(1000)


'(IF signal yes then end)
'(ELSE Shut off torch)
'(END IF)



LET US KNOW if you need further help, (;-)TP

Re: Oxy Fuel Safety timer
« Reply #2 on: June 30, 2011, 09:12:22 AM »
We need a little bit more information. When does the ignition need to be confirmed: at the beginning of a cycle, and/or periodically throughout the cycle?
Would a messagebox asking for confirmation be appropriate in your situation? How should the confirmation be initiated, do you want it executed from a macro called from the GCode (ie M1001)? Or would it be safer/more desirable to have it run every time you click cycle start so it is executed every time no matter what?
Any other considerations.

Once this info has been provided a suitable solution for your circumstances can be given!
I could just throw out a few possible answers/scripts, but it sounds like you've had enough pain on this one! Let's just get it right the first time.

A dialog must be used to give you control while the box is displayed so you can close the box when the countdown reaches 0 and decrement the counter every second. We'll get something put together for you pretty quickly I think.


Thanks,
Chris
Re: Oxy Fuel Safety timer
« Reply #3 on: June 30, 2011, 11:22:41 AM »
OK. My idea is to start the cycle. Then torch moves to start coordinates, and start the ignition process. The ignition process will first open the LP gas and then the timer must start. Right after it has started i want to start the auto ignition. But as it happens, it doesn't always start and i want to manually confirm that the torch is on. Then when it comes on, it stays on for the whole cycle. I want to ignite only at the beginning of each job.

The steps must be something like this:
Torch on
Timer on
Igniter on

The Operator must confirm [torch OK] before the timer hits 0 or the machine will go to STOP or RESET state. And if the Operator did confirm, the G-Code must continue...

I would prefer a macro being called for that, yes! See image for how I pictured it to be in mach3.
Just a BTN with Yellow LED flashing(while not confirmed) and green LED that comes on when confirmed. At the btm is the counter in a DRO.

Maybe a MSG popup only when operator did not confirm? That way thay i can leave a small message to tel the operator what he did wrong...

I think it can't be too difficult, I just don't know how exactly..  :)

Thanks for you replies!
Re: Oxy Fuel Safety timer
« Reply #4 on: July 01, 2011, 05:39:16 AM »
...here is the image  ;)
Re: Oxy Fuel Safety timer
« Reply #5 on: July 01, 2011, 11:46:04 AM »
Heres the script to replace the cycle start button!

Note that cycle start can also be run from other screens, so you might want to direct them to this script as well.

********** CODE **********
Const CR = 13
Const LF = 10

Const msgboxBtnOK = 0
Const msgboxBtnOkCancel = 1
Const msgboxBtnAbortRetryIgnore = 2
Const msgboxBtnYesNoCancel = 3
Const msgboxBtnYesNo = 4
Const msgboxBtnRetryCancel = 5
Const msgboxIconStop = 16
Const msgboxIconQuestion = 32
Const msgboxIconExclamation = 48
Const msgboxIconInformation = 64
Const msgboxDefaultbtnFirst = 0
Const msgboxDefaultbtnSecond = 256
Const msgboxDefaultbtnThird = 512
Const msgboxDefaultbtnFourth = 768
Const msgboxApplicationModal = 0
Const msgboxSystemModal = 4096

Const btnCycleStart = 1000

Const ConfirmedLED = 1001   'change to your LED number

Sub Main
   Dim TimerStart, TimerNow As Long
   Dim Confirmed As Boolean
   Dim NewLine, Message, Title As String
   Dim Answer As Integer
   Dim Timeout As Integer

   NewLine = Chr(13) & Chr(10)
   Timeout = 25      'set timout time in seconds

   SetUserLED(ConfirmedLED, 0)
   DoOEMButton(btnCycleStart)
   TimerStart = Timer

   Do
      Confirmed = CBool(GetUserLED(ConfirmedLED))
      Sleep(250)   'check about 4 times per second to reduce CPU load
      TimerNow = Timer
   Loop While Not Confirmed And TimerNow - TimerStart < Timeout

   If Not Confirmed Then
      Message = "Operator failed to confirm ignition." & NewLine & NewLine & "Operation Aborted!"
      Title = "Error"
                Answer = MsgBox(Message, msgboxBtnOK + msgboxIconStop, Title)

   End If

End Sub
********** CODE **********
Re: Oxy Fuel Safety timer
« Reply #6 on: July 03, 2011, 06:21:01 PM »
I didn't put in the countdown, but you can output TimerNow - TimerStart to a DRO or UserLabel.

Also at the end of the If Not Confirmed block you should add a command to stop or feedhold or other applicable actions if you don't get confirmation.

If you need more information or you want some clarification on the code let me know. I didn't have much time when I did it so it's not commented very well.

Chris
Re: Oxy Fuel Safety timer
« Reply #7 on: July 04, 2011, 02:53:10 AM »
Thnx Chris, I'll take a look today!  ;)
Re: Oxy Fuel Safety timer
« Reply #8 on: July 04, 2011, 09:03:59 AM »
Sargon,

Maybe it's better if you could clarify it... I'm still learning... :)
apart from that, i have 3 qstns:
1. how would the code for the countdown look like? Something like this?
timeleft = Timernow - Timerstart
setUSERDRO(1056, timeleft) ?  '1056 is my userDRO ID

2. Where should that code be put in?

3. You say I need to replace the cycle start button script. I use Machscreen for editing, can I just change the cycle start button with all these script in there?

Cheers!
Re: Oxy Fuel Safety timer
« Reply #9 on: July 04, 2011, 06:28:37 PM »
Sinkyster:

1) See code below. Much easier to decipher when it has comments!

2) Also see code below!

3) In machscreen click the button and change it's function from Cycle Start to the Execute VBScript function. Paste in the code and change it to fit your needs. The code is now embedded into the CycleStart button.

Enjoy!

**********CODE**********
Option Explicit            'Require variables to be defined by DIM before using. Reduces typing mistakes and headaches dramatically.

Const CR = 13            'Carriage Return
Const LF = 10            'Line Feed

'message box constants
Const msgboxBtnOK = 0
Const msgboxBtnOkCancel = 1
Const msgboxBtnAbortRetryIgnore = 2
Const msgboxBtnYesNoCancel = 3
Const msgboxBtnYesNo = 4
Const msgboxBtnRetryCancel = 5

Const msgboxIconStop = 16
Const msgboxIconQuestion = 32
Const msgboxIconExclamation = 48
Const msgboxIconInformation = 64

Const msgboxDefaultbtnFirst = 0
Const msgboxDefaultbtnSecond = 256
Const msgboxDefaultbtnThird = 512
Const msgboxDefaultbtnFourth = 768

Const msgboxApplicationModal = 0
Const msgboxSystemModal = 4096

'mach3 OEM button constants
Const btnCycleStart = 1000
Const btnFeedHold = 1001
Const btnRewind = 1002
Const btnStop = 1003

'user defined interfaces
Const ConfirmedLED = 1001        'change to your LED number
Const CountdownDRO = 1056


Sub Main
   Dim TimerStart, TimerNow As Long
   Dim Confirmed As Boolean
   Dim NewLine, Message, Title As String   'variables for msgbox
   Dim Answer As Integer
   Dim TimeElapsed, TimeRemaining, Timeout As Integer

   NewLine = Chr(CR) & Chr(LF)      '<CR><LF>
   Timeout = 25               'set confirmation timout time in seconds

   SetUserLED(ConfirmedLED, 0)      'reset LED to off state
   DoOEMButton(btnCycleStart)      'initiate cycle start
   TimerStart = Timer         'set starting timer. Timer is elapsed seconds since midnight.

   'loop through this block until we get confirmation or timeout
   Do
      Confirmed = CBool(GetUserLED(ConfirmedLED))   'Retrieve LED status and convert to boolean
      Sleep(250)            'check about 4 times per second to reduce CPU load
      TimerNow = Timer         'set current timer value
      TimeElapsed = TimerNow - TimerStart   'calculations have been broken down into small steps to
      TimeRemaining = Timeout - TimeElapsed   'make it easy to follow
      SetUserDRO(CountdownDRO, TimeRemaining)   'display countdown
   Loop While Not Confirmed And TimeRemaining > 0

   'If we didn't get confirmation in time then do the following
   If Not Confirmed Then
      'set variables for message box
      Message = "Operator failed to confirm ignition." & NewLine & NewLine & "Operation Aborted!"
      Title = "Error"
      'display message box. Answer will be the position of the button that was clicked (ie 1 for first button, 2 for second.)
      Answer = MsgBox(Message, msgboxBtnOK + msgboxIconStop, Title)

      'perform shutdown operations.
      DoOEMButton(btnFeedhold)   'Feedhold to stop machine nicely
      Sleep(500)         'Wait for half second to ensure we came to a smooth stop. Reduce if it's too much.
      DoOEMButton(btnStop)      'Full Stop.
      DoOEMButton(btnRewind)      'Rewind code ready to retry
      'Add anything else you need to do (like maybe torch off, LP off, etc)
      
      Exit Sub         'Exit script
   End If
   
   'add anything you want to do if we do get confirmation before timeout
   
End Sub
**********CODE**********