way lube pump timer

More
08 Oct 2020 19:21 #185384 by lllars
way lube pump timer was created by lllars
Hi, I'm looking for some guidance on how to setup a timer to run my lube pump. It is a simple "showa" brand pump that pumps oil when plugged in. I have it wired up through a relay and controlled by my mesa 7i95 using ssr output #1 (hm2_7i95.0.ssr.00.out-01). I've currently got it linked to mist coolant in my hal file, and can see that it turns on/off as expected when I press the mist coolant button.

I'd like to have the pump run automatically for 30 sec after every 20 min of machine motion. What do I need in my hal file to make that happen?

Please Log in or Create an account to join the conversation.

More
08 Oct 2020 19:28 #185387 by lllars
Replied by lllars on topic way lube pump timer
I did find a possible solution here, but I'm not sure how I would actually implement it: forum.linuxcnc.org/38-general-linuxcnc-q...9724-lube-pump#63605

Please Log in or Create an account to join the conversation.

More
09 Oct 2020 00:36 #185411 by Himarc3D
Replied by Himarc3D on topic way lube pump timer
I dont have experience using LCNC yet, maybe someone can help you with your example but have you tried classic ladder?
I think with just 5 rungs you can do what you want and few more rungs you can implement fault logic.
check the manual for classic ladder at the end have timer example (over internet have hundreds for plc).
read this advice from rootboy from thsi thread (fresh one)
forum.linuxcnc.org/38-general-linuxcnc-q...-old-time-programmer
Ill start today play with classic ladder, im finishing checking all I/O of my card to see if i understand how things work.
try it, wrote something and people can help you better i think.

Please Log in or Create an account to join the conversation.

More
09 Oct 2020 07:50 #185438 by rootboy
Replied by rootboy on topic way lube pump timer
Hey lllars,

Here's a program that should work for you.

First the variables:

%IW0 Your on-time count. Designed to be passed from LinuxCNC to ClassicLadder.
%IW1 Your off-time count. Designed to be passed from LinuxCNC to ClassicLadder.
%W2 CL internal working register for the on-time count setpoint.
%W3 CL internal working register for the off-time count setpoint.
%W4 On-time current count, while this register is > 0 the luber is on.
%W5 Off-time current count, while this register is > 0 the luber is off.

%TM0 Free-running (self-resetting) 1 second timer. Fires %B0 for one scan each second.
%B0 Adds a count to either %W4 or %W5.
%B1 Toggle bit that directs the count generated by %B0 to either %W4 or %W5.
%B2 Uhhh, an enable bit that I forgot to link up in a .hal file. Sorry, it's late. :) Either add a pin to drive it, or delete it from the PLC program.

%Q0 the output to the luber.

So it works this way:

1) Pre-load %W2 and %W3 with 30 and 1200 respectively to create a minimum value based on the 30 second on, 20 minute off requirement.

2) If you decide to add the functionality to adjust the on-off times from LinuxCNC the next rung after the %W2 pre-load will load your modified value. The same applies to %W3. You don't have to use this feature, but it's there if you want it.

3) %TM0 is a 100ms timer with a preset of 10, making it a 1 second timer. It counts up to 1 second and then resets itself. Over and over again.

4) If the accumulated count (%W4) is greater than the preset (%W2), and %B1 is on, zero out %W4 and toggle %B1 off.

5) Apply the same logic to %W5 and %W3 to toggle %B1 on.

This will create a cycle of %B1 being on for 30 seconds, then being off for 1200 seconds (20 minutes).

6) While %W4 is greater than 0 turn the luber coil on.


If you would like any additional features, or have me fix something (like %B2 for example...) feel free to ask.


John

File Attachment:

File Name: custom_pos...0-09.hal
File Size:0 KB

File Attachment:

File Name: Oiler.clp
File Size:7 KB
Attachments:
The following user(s) said Thank You: Himarc3D

Please Log in or Create an account to join the conversation.

More
09 Oct 2020 16:06 #185485 by Mike_Eitel
Replied by Mike_Eitel on topic way lube pump timer
@rootboy
Just that you know.
It is possible to fidle in the clp file with an editor.
Not very comportable but possible. ;-)
IIRC i did that for speaking variable names
Mike

Please Log in or Create an account to join the conversation.

More
09 Oct 2020 16:26 #185491 by Todd Zuercher
Replied by Todd Zuercher on topic way lube pump timer
I've done the same to modify some Modbus settings that weren't in the gui.

Please Log in or Create an account to join the conversation.

More
10 Oct 2020 01:17 #185526 by rootboy
Replied by rootboy on topic way lube pump timer
Yup, in the LinuxCNC programmer's guide it specifies that:

"It seems sometimes when saving the modbus port name the data is saved corrupted...the work around is to edit the .clp file by hand."

When I was running into the problem with subsequent rungs not being saved, because I didn't know that there had to be a label assigned to each rung after the first one, I took a look at the .clp file.

And quickly closed it again. :)

As a side note, this exercise reminded me to ask Thurston what did he have in the way of a lube system for his lathe. Turns out that it has a Showa pump as well. Seems like I've got the lube system sorted then...

Out of curiosity, how do you guys work on CL "offline"? I have no hardware here at the house, so I took the axis sim example and edited its .hal file to include the CL components, and then I start up LinuxCNC. I can then run CL from the command line. Kind of a kludge, but it works.

Please Log in or Create an account to join the conversation.

More
10 Oct 2020 03:27 #185543 by lllars
Replied by lllars on topic way lube pump timer
Thanks John. Would you explain what else I need to put in my hal file for this to work? I see the custom_postgui file you attached, but there must be more to it right? I must need to at least tell it where to find oiler.clp? And do I need to define any other variables?

Also is the 20 minutes counting down anytime linuxcnc is running, or just when the machine is in motion? And will it remember how far it has counted down or the the timer get reset when the machine is restarted?

Please Log in or Create an account to join the conversation.

More
10 Oct 2020 03:37 #185544 by rootboy
Replied by rootboy on topic way lube pump timer
Hi lllars,

You're more than welcome. :)

As long as the machine is on, it's lubing. And you did specify "during machine motion". My bad, it was late, I just missed it.

It will take a bit of time (probably just a few hours), but let me go through the program and add this to it.

It turns out that we have the same setup, so I'm benefitting myself as well. :)

Please Log in or Create an account to join the conversation.

More
10 Oct 2020 05:25 - 10 Oct 2020 05:49 #185555 by rootboy
Replied by rootboy on topic way lube pump timer
Not sure what pin I should be using, but I think that either:

vel_xy.out or vel_xyz.out

should do.

So I added both of them in custom_postgui.hal:

#JEW Uncomment the one that you need
#net vel_xy.out => classicladder.0.s32in-06
#net vel_xyz.out => classicladder.0.s32in-06

The next thing that I will have to figure out is what is a good threshold velocity to run the luber timer.

Right now it's 10, which will work as a first guess I suppose. I can try it out on the lathe tomorrow.

The rung that I added is the one that drives the %B2 output coil.


Enjoy,

John

PS, I just updated Oiler.clp. But the forum seems to save the last file so I had to rename them. Delete the "1" from the filename.

File Attachment:

File Name: custom_postgui1.hal
File Size:0 KB

File Attachment:

File Name: Oiler1.clp
File Size:7 KB
Attachments:
Last edit: 10 Oct 2020 05:49 by rootboy. Reason: Brain fart...

Please Log in or Create an account to join the conversation.

Time to create page: 0.133 seconds
Powered by Kunena Forum