Developing a MTC Adapter for Fanuc 18i

Posted By Luiz Eduardo 4/27/2016 8:00:07 AM
Add to Favorites0
Author Message
Luiz Eduardo
 Posted 4/27/2016 8:00:07 AM
Forum Expert

Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)

Group: Forum Members
Last Active: 11/29/2016 4:51:39 PM
Posts: 2, Visits: 53
851
Hi everyone,

I'm starting in adapters development and initially I am using as a reference the adapter available on the MTConnect Institute Github (C ++ SDK and .NET Adapter). But, I have many doubts. I need to develop an adapter to capture data from a CNC machine tool with Fanuc 18i-ta controller (Focas 1). One of the main issues that I'm not able to solve is how I do the association of C ++ adapter (Github) with the functions of Focas 2 protocol library Fwlib32 ? Did you guys could help me clarify that or give any idea? Some technical reference ?

Many Thanks
Versex
 Posted 4/28/2016 7:27:42 AM
Forum Expert

Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)

Group: Forum Members
Last Active: 5/20/2016 5:55:12 AM
Posts: 2, Visits: 51
826
Hi Luiz,

I have actually been developing an adapter for Fanuc systems using C#. I will post the code in C++ to make it a bit easier and no need to translate between languages. The way it's setup is you will declare a new Event, Sample or Condition and provide a name for it.

Sample FeedRate;
FeedRate.setName("feed_rate");

This will declare a new Sample and it will give it the name feed_rate. This is the name that MTConnect will use to display the information. You will then need to add it to the adapter. So declare a new adapter and then add the event to the adapter.


Adapter *mAdapter;
mAdapter->addDatum(mFeedRate);


You will do this for each sample, event or condition that you wish to monitor. I have mine setup in a loop that constantly makes calls to Focas and then adds the values to the events and samples.

// FOCAS var
OBDACT *fr = new ODBACT;

// FOCAS Call
cnc_actf(hFanucMonitor, &fr);

// Add returned value to our FeedRate Sample
FeedRate.setValue(fr.data);

Now that we have added our data to the FeedRate Sample, we can tell the adapter that we want to send out all the information that has changed.

// Send changed values
mAdapter->SendChangedData();

Now assuming you have the agent (The program that reads all the data from the adapter) configured and running, you should be able to open up a browser and go to http://127.0.0.1:5000/current and see all the values that you are monitoring in your adapter. Here is a sample of what mine looks like.
http://mtconnectforum.com/Uploads/Images/558a3fd6-0811-4b5b-875f-66d8.PNG



If you need information on getting the agent up and running, you can go to https://github.com/mtconnect/cppagent

Scroll down the page a bit and all the steps to getting it configured are shown. Let me know if you need anything else. I will try my best to help.
Luiz Eduardo
 Posted 5/2/2016 4:22:15 PM
Forum Expert

Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)Forum Expert - (851 reputation)

Group: Forum Members
Last Active: 11/29/2016 4:51:39 PM
Posts: 2, Visits: 53
851
Hi Versex,

Thank you for your help!

I was trying to use the MTConnect Github C++ template to develop the Adapter to a Fanuc 18i Adapter. But now, I started the development of the same Adapter with .NET SDK in CSharp, because I have more domain in that language. As you are making the same thing, maybe you can help me with it too.


I want to map the fwlib32 library (Focas 2) function for the DataItems AVALABILITY/CONTROLLER_MODE/EXECUTION/EMERGENCY_STOP, but I have doubts respect to the equivalence between the DataItem status and the values of the ODBST struct of the method cnc_statinfo(...). For example:


That is the ODBST struct (class for C#)


typedef struct odbst {     short  dummy ;       /* Not used                        */     short  tmmode ;      /* T/M mode selection              */     short  aut ;         /* AUTOMATIC/MANUAL mode selection */     short  run ;         /* Status of automatic operation   */     short  motion ;      /* Status of axis movement,dwell   */     short  mstb ;        /* Status of M,S,T,B function      */     short  emergency ;   /* Status of emergency             */     short  alarm ;       /* Status of alarm                 */     short  edit ;        /* Status of program editing       */} ODBST ;
aut
AUTOMATIC/MANUAL mode selection
0 : MDI
1 : MEMory
2 : ****
3 : EDIT
4 : HaNDle
5 : JOG
6 : Teach in JOG
7 : Teach in HaNDle
8 : INC·feed
9 : REFerence
10 : ReMoTe
11 : TEST(test operation mode)
run
Status of automatic operation
0 : ****(reset)
1 : STOP
2 : HOLD
3 : STaRT
4 : MSTR(during retraction and re-positioning of tool retraction and recovery, and operation of JOG MDI)
.....

Which are the correspondences between ODBST.run values (0:***(reset); 1:STOP; etc.) and MTConnect's tag EXECUTION (Active/Interrupted/Ready/Stopped), for example?

The same question for the others tags...

Waiting for your response...

Many thanks!

Luiz
Versex
 Posted 5/5/2016 6:28:32 PM
Forum Expert

Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)Forum Expert - (826 reputation)

Group: Forum Members
Last Active: 5/20/2016 5:55:12 AM
Posts: 2, Visits: 51
826
Hi Luiz,

Sorry about the delayed reply. I haven't been on here in a few days. As to your question, the tags are really a judgement call. In the grand scheme of things, they don't really matter if you are programming your own client. We are programming both the adapter and client so I didn't use those tags myself. However, if I was to use them I would pair them as follows: Stopped-Estop, Interrupted-Alarm, Active-Start, Feed_Hold-Hold. As for Program_Completed, Program_Stopped and Program_Optional_Stop, you will probably have to build some logic around it to be able to determine when those occur. I have used the parts counter do determine when the program was successfully completed and I kept track of the cycle time and if it resets to 0 and the parts counter did not increase, then I count that as a program stopped. If you need help go ahead and write me on Gmail. I usually check that multiple times a day. versiano@gmail.com

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top

Advertisements