Ladder99 / fanuc-driver

Configurable Fanuc Focas data collector and post processor.
Apache License 2.0
72 stars 25 forks source link

Fanuc 31i B - Shows Spindle 1 Production, State Data only on Driver Startup #103

Closed ezioauditore0101 closed 10 months ago

ezioauditore0101 commented 10 months ago

Hello! I am connecting to a DMG Mori machine powered with Fanuc 31i Model B with 3 spindles. When I connected for the first time, all data was coming in rightly. Without any changes, after driver restart I am getting state, production, gcode, alarms, messages only for Spindle 2. Spindle 1 is triggered when I start the driver (information is correct). No updates were done to config.yml

MRIIOT commented 10 months ago

Hi. Can you turn up verbose logging in nlog.config and send the log?

ezioauditore0101 commented 10 months ago

Uppdated the response.

MRIIOT commented 10 months ago

@ezioauditore0101 the logs I am looking for are driver.2023-11-17.log. Do you see those?

ezioauditore0101 commented 10 months ago

attaching the file. The program was already running so I restarted the driver and hence immediately you will see GCode entries.

Driver restarted on 2023-11-20 10:48:10 -> DMG/state/1 received on 2023-11-20 10:48:23 ; not after. Same applicable for /tool/1 /messages/1 /production/1 etc. driver.2023-11-20-after-restart.txt

MRIIOT commented 10 months ago

All I can tell from the logs is that reading active program pointer is failing with error 13.

CNC execution denied
- No program is executed.
- CNC is in DNC/M198 or RISC operation.
- STL signal is ON.(FS30i/31i/32i, 0i-D/F, PMi-A)
- CNC is in the emergency stop.(FS30i/31i/32i, 0i-D/F, PMi-A)

I would suggest commenting out as many collectors as you can to isolate the issue.

collectors:
      - l99.driver.fanuc.collectors.MachineInfo, fanuc
      #- l99.driver.fanuc.collectors.Alarms, fanuc
      #- l99.driver.fanuc.collectors.Messages, fanuc
      - l99.driver.fanuc.collectors.StateData, fanuc
      #- l99.driver.fanuc.collectors.ToolData, fanuc
      - l99.driver.fanuc.collectors.ProductionData, fanuc
      #- l99.driver.fanuc.collectors.ProductionDataExternalSubprogramDetails, fanuc
      #- l99.driver.fanuc.collectors.GCodeData, fanuc
      #- l99.driver.fanuc.collectors.AxisData, fanuc
      #- l99.driver.fanuc.collectors.SpindleData, fanuc
      #- l99.driver.fanuc.collectors.Macro, fanuc
      #- l99.driver.fanuc.collectors.Pmc, fanuc
ezioauditore0101 commented 10 months ago

Thanks for your response, I will try now and get back to you with report of this.

ezioauditore0101 commented 10 months ago

This time production has also not updated. Please find CONFIG, LOG and MQTT screen capture. (Extension changed for uploading) Config - config.machines.txt Broker - Web capture_21-11-2023_21043_3 109 134 21 Log file - driver.2023-11-21.txt

MRIIOT commented 10 months ago

It doesn't look like your logging is set to TRACE. We should be seeing a lot more in the log. Can you turn up all the loggers to TRACE?

ezioauditore0101 commented 10 months ago

I have made all from Debug to TRACE and generated a log; machine to refer is DMG. driver.2023-11-22.txt nlog.config.txt Web capture_22-11-2023_101217_3 109 134 21

MRIIOT commented 10 months ago

What is "MQTT IP" ? Did you replace the IP address with 'MQTT IP' before sending the log?

"l99.driver.fanuc.transports.MQTT, fanuc": {
        "topic": "fanuc/{{machine.Id}}/{{veneer.Name}}{{if veneer.SliceKey}}/{{veneer.SliceKey}}{{end}}",
        "net": {
          "type": "tcp",
          "ip": "MQTT IP",
          "port": 1883
        },
        "anonymous": false,
        "user": "MQTT_USER",
        "password": "MQTT_PASS"
      },
MRIIOT commented 10 months ago

Everything looks fine, except the fact that we supposedly are connected to tcp://MQTT IP:1883 broker, but I don't think 'MQTT IP' is valid. This would explain no messages arriving at broker.

If you sanitized the log and there was a real IP address then what I am seeing is that the MQTT client is connected to the broker and messages are being published. You might want to validate this with a Wireshark trace on the computer running Fanuc driver.

2023/11/22 09:55:46.590|INFO|[DMG] Connecting broker 'tcp://MQTT IP:1883/DMG': MQTT IP:1883 |l99.driver.fanuc.transports.MQTT|
2023/11/22 09:55:46.641|INFO|[DMG] Connected broker 'tcp://MQTT IP:1883/DMG': MQTT IP:1883 |l99.driver.fanuc.transports.MQTT|
2023/11/22 09:55:49.910|TRACE|1700627149910 PUB 416b => fanuc/DMG/state/1
{
  "observation": {
    "time": 1700627149906,
    "machine": "DMG",
    "name": "state",
    "marker": [
      {
        "type": "path",
        "number": 1
      }
    ]
  },
  "state": {
    "time": 2752.4673,
    "data": {
      "mode": "AUTOMATIC",
      "execution": "ACTIVE",
      "aut": 1,
      "run": 3,
      "motion": 0,
      "mstb": 0,
      "emergency": 0,
      "alarm": 0,
      "timers": {
        "poweron_min": 1277297,
        "operating_min": 750712,
        "cutting_min": 324065
      },
      "override": {
        "feed": 100,
        "rapid": 0,
        "spindle": 100
      },
      "modal": {
        "m1": 1369,
        "m2": 369,
        "m3": 0,
        "t": 0
      }
    }
  }
} |l99.driver.fanuc.transports.MQTT|

Kind of strange that this block of code is not throwing an exception: https://github.com/Ladder99/fanuc-driver/blob/d538eefe789b73757ca6127cba582e8f369bf049/fanuc/transports/MQTT.cs#L168-L197

ezioauditore0101 commented 10 months ago

Actually yes, I updated my MQTT Broker IP to "MQTT IP" along with username and password.

ezioauditore0101 commented 10 months ago

Also, I am getting the FIRST ENTRY for SPINDLE 1 whenever the driver starts, which is referred in the screenshot I shared. You will see "fanuc/DMG/production/1" on an entry above where the driver started for very first time, while "fanuc/DMG/production/2" is appearing frequently (on-change).

MRIIOT commented 10 months ago

Ok, I think I know what you mean. Which fanuc-driver Windows release are you using? Can you share the DMG config again?

MRIIOT commented 10 months ago

Sounds like this might be your issue https://github.com/Ladder99/fanuc-driver/issues/92

ezioauditore0101 commented 10 months ago

rebuilt with updated version. problem has been resolved. thank you very much!