Hello Guest it is September 26, 2023, 04:14:43 AM

Author Topic: Machine / Production State  (Read 999 times)

0 Members and 1 Guest are viewing this topic.

Offline wz2b

*
  •  12 12
    • View Profile
Machine / Production State
« on: September 22, 2021, 09:24:19 AM »
I am trying to build a sort of OEE / KPI dashboard that should include this machine.  To do that, I need to somehow pull out the machine state.  I can see two possible ways to do this:

  - Via the DLL interface, i.e. the Plugin SDK
  - Via Modbus

I think the easiest way would be to do it using modbus, but to do that I think I would have to develop a simple brain that reads the machine status and then writes it to an external modbus device.  I have been searching the forums to try to figure out machine state and I found this:

   https://www.machsupport.com/forum/index.php/topic,36548.msg250379.html#msg250379

that lists a bunch of useful states: IDLE, RUN, JOG, HOME ... maybe that would be a good place to start.  From that, I think I could build a pretty simple cycle counter as well, and count the number of cycles that completed normally vs. ended in some kind of error.

My questions are:

  • Where can I find this machine state variables accessible from within a Brain?
  • If I use the SDK / DLL method instead, how do I access this MC_STATE?


Re: Machine / Production State
« Reply #1 on: November 18, 2021, 07:31:49 PM »
Hi,
I think you are confusing Mach4 and Mach3, they are quite different internally.

State= Idle , or State=Run are all concepts that are confined to Mach4. You don't have or need an SDK in Mach4 there is
a built-in API that can interrogate Machs internal state.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline wz2b

*
  •  12 12
    • View Profile
Re: Machine / Production State
« Reply #2 on: November 19, 2021, 03:36:07 PM »
Hi there,

I definitely have Mach4.
https://photos.app.goo.gl/bG6DY1nJj54rLteX9
but it's an older version.  instead of Mach4API it has Mach4IPC.DLL.

I would LIKE to do it with the built-in API but how then do I get the data OUT?  That's my problem.  The lua install doesn't have the sockets library.  The modbus plugin does work but it doesn't seem really able to read values out of the core.  I don't really want modbus, anyway.

Does anybody know if me having just Mach4IPC.dll is the clue here?  If IPC means what IPC usually means, it sounds like that might be the way, and I just need an older set of headers to link again.



Re: Machine / Production State
« Reply #3 on: November 19, 2021, 04:25:34 PM »
Hi,
 until recently I had an even earlier version of Mach4 on my machine PC, and it has an API, and always has had it.

Look in Mach4Hobby/Docs folder for Mach4CoreAPI.chm. Open it and there you have Machs API. You can also open it from
the Help Docs button from Machs screen.

Use this API:
Code: [Select]
LUA Syntax:
mcState, rc = mc.mcCntlGetState(
MINSTANCE mInst)


It will return the numeric value of the machine state.......easy.....one line......easy!.
If you wish to communicate that to another device or PC or to the internet or whatever then use one of the comms protocols provided.

Modbus is one of the simplest and one that I am most familiar with. The machine state is loaded to a register and that register is communicated over Modbus.....easy.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'