Hello Guest it is December 02, 2022, 10:38:23 AM

Author Topic: Mach4 automatic ways oiler  (Read 1607 times)

0 Members and 1 Guest are viewing this topic.

Mach4 automatic ways oiler
« on: July 22, 2019, 07:03:44 AM »
Dear people,

I am using mach4 to retrofit an machine. There is an oiling system on the machine to oil the ways where the axis ride on. I want to turn on the oiler for a set time when the machine reaches an certain total run time.

The only problem is that I am unsure what variable I need to use from the mach4 API. I am also unsure how to program a counter in Lua.
If someone knows or has some ideas, feel free to reply

Thanks in advance
Re: Mach4 automatic ways oiler
« Reply #1 on: July 22, 2019, 08:07:48 AM »
Why not do a Bing or Google image search for
"ladder diagram for way lube timer"
and then emulate the ladder code using the PMC scripting/ladder feature in Mach4 to write the code for you?
Might help you learn and understand how timers and lua works.
would be a good test and lesson.
Re: Mach4 automatic ways oiler
« Reply #2 on: July 23, 2019, 09:44:31 AM »
Why not do a Bing or Google image search for
"ladder diagram for way lube timer"
and then emulate the ladder code using the PMC scripting/ladder feature in Mach4 to write the code for you?
Might help you learn and understand how timers and lua works.
would be a good test and lesson.

Thanks I totally forgot about the pcm editor. Tried a diagram which turns on when the controller is enabled and then generated a Lua code.
The code worked flawlessly. Thanks again.
Re: Mach4 automatic ways oiler
« Reply #3 on: July 24, 2019, 10:02:40 PM »
Glad you got it working.
Post your code to help others that may have the same question.
Chad Byrd
Re: Mach4 automatic ways oiler
« Reply #4 on: July 25, 2019, 04:09:54 AM »
For the people wanting to use a similair code. Here is the lua file. I can't upload a pmc file.

The program is activated when the controller is enabled.  The first timer will determine at which interval the pump is enabled and the second timer sets how long the pump is activated before it will be deactivated and the interval timer will be reset.
The timers are both set to 10 seconds.

Re: Mach4 automatic ways oiler
« Reply #5 on: July 25, 2019, 01:51:47 PM »
I forgot to add that the program is made to control the outputs on an output device. The device I use is the csmio-ip/a. I could send the pcm program via mail if someone wants it.  Then you can change the outputs to your device and makes it easier to change the time of the timers.

Just let me know if you want the pcm program. I will change the names/variables to English instead of Dutch.

Offline Chaoticone

*
  • *
  •  5,626 5,626
  • Precision Chaos
    • View Profile
Re: Mach4 automatic ways oiler
« Reply #6 on: July 25, 2019, 04:07:01 PM »
I just added pmc to the allowed attachment file type list............. if you want to try attaching it again. I'm pretty sure it was added before as pcm. If computers are so smart I don't know why they don't know what we were trying to say.  ;D

Garbage in = garbage out.
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Mach4 automatic ways oiler
« Reply #7 on: July 25, 2019, 08:49:24 PM »
I just added pmc to the allowed attachment file type list............. if you want to try attaching it again. I'm pretty sure it was added before as pcm. If computers are so smart I don't know why they don't know what we were trying to say.  ;D


ROFLMAO :)

Garbage in = garbage out.
We never have the time or money to do it right the first time, but we somehow manage to do it twice and then spend the money to get it right.
Re: Mach4 automatic ways oiler
« Reply #8 on: July 26, 2019, 06:37:02 AM »
Guys, Here is the Pmc file for the ways oiler with english variables. The pump is enabled after 15 min controller enabled time. The oilpump will be activated for 1 minute.

Inside the Pmc file are two time on delays. The upper on determines the time interval that activates the oilpump and the lower one sets the time how long the oil pump is enabled.

Hope this helps some people out.
Re: Mach4 automatic ways oiler
« Reply #9 on: July 26, 2019, 08:11:40 AM »
Just a heads up on what I found on sharing, testing and using pmc files:

File names need to have no spaces, as function names are created on generating the Lua file.
During simulation I noticed NO update on outputs on diagnostics tab
also I had to edit the data for contacts and coils for Device and Object as they came up blank.
In live Simulation mode still have to use the space bar to update the simulation of ladder diagram.

thanks for following though and sharing as we all learn by experiences of others.

photos show comparisons of the original, my edited version and what I referenced.

and thanks to Chaoticone for adding PMC file uploads  ::)