You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old November 5th, 2018, 12:05 PM   #1
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
cMT-G01 MQTT JSON and Tags

Guys, I am trying to get a MQTT message out of the Maplesystems/Weintek cMT-G01 that is connected to a control logix PLC. Everything seems pretty straightforward and the scope of the project is pretty simple. Just sending status of discrete's. The customer would like other identifying information in the JSON message though and that is giving me a hard time. All the identifying information they would like is alpha numeric and for the life of me I cannot seem to get an address format of ASCII when setting up the publishing address in the cMT-G01. My ideal end result message in JSON would look something like below. The "Active" is my discrete, the other two fields are what I need to fill with ascii values.


{
"d" : {
"UniqueCode" : [ 123ABC ],
"Direction" : [ Left ],
"Active" : [ false ]
},
"ts" : "2018-11-06T00:05:10.932017"
}

Any suggestions? I also have at my disposal a Red Lion CR3000 but have had even less luck using the generic MQTT option that is new to crimson 3.1.
  Reply With Quote
Old November 5th, 2018, 01:42 PM   #2
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
Your not going to be able to change the MQTT(JSON) format that maple uses to publish the information.

How even, you say the customer wants additional information, if that information they want can be as a TAG Value then all you have to do is create a new topic for those tags.

When selecting the tags if you are selection ASCII your will probably have to select an array of 16 bit addresses.
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 5th, 2018, 02:05 PM   #3
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Quote:
Originally Posted by damica1 View Post
When selecting the tags if you are selection ASCII your will probably have to select an array of 16 bit addresses.
I guess this is where I am getting stuck. I realize it needs to be associated with a tag but have not had any luck getting one to output what I needs like [123ABC].
  Reply With Quote
Old November 5th, 2018, 03:04 PM   #4
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
OK, so you have to create a ASCII Object as shown in picture. (Now depending on how large you need this object to be will determine on how many 16 bit words will be involved.

So if I create an ASCII object at address LW-100 and it is 4(16 bit words Long)

Then when you assign the address to the MQTT topic it will be LW-100 and 4 words long.

This way the topic knows to read 4 (16 bit words starting at address LW-100).

Does this make sense to you.

Let me know,
Attached Images
File Type: jpg ASCII Sample.jpg (80.0 KB, 84 views)
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 5th, 2018, 03:19 PM   #5
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
P.S.
ASCII is much harder to deal with, if it was me I would try to develop some type of "Numeric" values that I could use.

Example: LEFT = 1, RIGHT = 2.
Active = 0(False) or 1(True)
Unique Code = "Try to figure out a code that you could use and be represented by a "16 Bit WORD"

Example: How many different "Unique Values" will you have? A 16 bit word could equate to 65535 different codes.

So 1 could = Blue
2 would = Red
3 = Black
20 = Small - Black
30 = Large - Red
40 = Medium - Blue.

Several ways, as I said just some ideas.
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 5th, 2018, 05:42 PM   #6
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Unfortunately the cMT-G01 gateway does not have any of the HMI functions unless I am missing something. So I am unable to create any objects. A virtual HMI would be a nice addition to the gateway which is probably a different unit.

I was considering something similar to a code or converting to binary. Luckily the customer made it easy for me and I am just going to put the data I need in the "Name" field for the address and just associate a bool to it.


All in all even though the functions are a little limited, the gateway and software was pretty easy to setup. I like how they handle the MQTT messaging.

Wish I could get results from the CR3000, think Red Lion has some work to do on the MQTT side of things.
  Reply With Quote
Old November 5th, 2018, 06:23 PM   #7
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
Is the only reason your using the cMT-G01 is to publish MQTT Data?

If so, you may want to look at using one of the small HMI's, because all of maple systems hmi's will publish MQTT Data.

So as another example the HMI5043LB could be used just as the "Edge" gateway.
Something to think about, with an HMI you won't have any of the limitations that the cMT-G01 will have.

It retails for $295.00 USD.
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 6th, 2018, 09:07 AM   #8
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Yeah basically just to publish MQTT. Just something to remember when/if I ever do another project like this.
  Reply With Quote
Old November 28th, 2018, 11:22 AM   #9
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Quote:
Originally Posted by damica1 View Post
OK, so you have to create a ASCII Object as shown in picture. (Now depending on how large you need this object to be will determine on how many 16 bit words will be involved.

So if I create an ASCII object at address LW-100 and it is 4(16 bit words Long)

Then when you assign the address to the MQTT topic it will be LW-100 and 4 words long.

This way the topic knows to read 4 (16 bit words starting at address LW-100).

Does this make sense to you.

Let me know,

@damica1

Thought I had this taken care of but IT didn't like the message so I am back to trying to find a way to format like this.

I do not have an HMI model available to test but I have one selected in EBpro and am trying to figure out how it will get the value. Would I make a string in the PLC with my identifying information like "Left" and have the ASCII object read that or is there a way to have a static value in the ASCII object without it reading from something or getting input from a user on the HMI?

I was hoping I could make the object and input a static value (one that would not change during power down or one it would revert to if power is lost and restored) that I could address to the MQTT tag, but it looks like you would have to key it in from the HMI, or read from the PLC.
  Reply With Quote
Old November 29th, 2018, 09:28 PM   #10
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
I do think you could store a "String" in the plc and have an ASCII object read out that TAG. I also think you could make your ASCII Object Static (But that would have to be done with a "MACRO".) This may actually be the easiest way.

Can you explain again exactly what you need? I have forgotten all about this post and I have not studied anything more about the cMT-G01.

I will help all I can, but I do want to say that Maple Support is some of the BEST I have ever worked with.
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 30th, 2018, 09:18 AM   #11
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Quote:
Originally Posted by damica1 View Post
I do think you could store a "String" in the plc and have an ASCII object read out that TAG. I also think you could make your ASCII Object Static (But that would have to be done with a "MACRO".) This may actually be the easiest way.

Can you explain again exactly what you need? I have forgotten all about this post and I have not studied anything more about the cMT-G01.

I will help all I can, but I do want to say that Maple Support is some of the BEST I have ever worked with.
That's interesting because I have not been able to get a hold of them for three days now via phone or email response. Basically I need some static identification information along with the status of my discrete inputs. Sections are broke down like "ABC123". I created a string in the PLC and when I try to use the address in the cMT-G01 all I can select is the DATA portion of the string which it pulls in as SINT then I am able to give it an element count for ABC123 of 6 it does not recognize that this should be ASCII and what I end up with is decimal representation of my STRING.

ABC123 = [65, 66, 67, 49, 50, 51]

I do not have the cMT-SRV model but when I create a project with one and an ASCII object using the same string it seems to pull it in the same way as a SINT with element count so I am assuming I would end up with the same results.

Quite possible I am missing something here, they claim you can bring in all tags controller, program user defined etc but I always get errors when trying.
  Reply With Quote
Old November 30th, 2018, 02:01 PM   #12
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
Snyd1, I have emailed you the MQTTmanual for (EBPro/cMT-g01) I think this should clear some things up.

I have not worked with the cMT-g01 unit, so there is probably some things I am not aware of, and I try to avoid ASCII just because it is very confusing to work with. But let me try to explain a few points.


Each (2) letters will be a (16bit word) (Example DA= (1)-16bit word. so if you know you are going to be working with 8 letters you will need to set aside 4 words.

Also if you are working with 4 tags each a 8 letter ascii value you will have to create an array of 32 words, now they have to be consecutive in order (This means if you start your array at LW-100 address then the next 32 addresses is what the ASCII object will read for the 4 tags.

Am I making any sense?
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 30th, 2018, 02:28 PM   #13
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
Page 14 of the manual I just sent you. Notice 4 elements which will equal 2(16 bit words) and since the address starts at LW-30 the HMI knows to read from 30 through 31.
Attached Images
File Type: jpg MQTT_String_Data.jpg (87.4 KB, 38 views)
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old November 30th, 2018, 02:38 PM   #14
Snyd1
Member
United States

Snyd1 is offline
 
Join Date: Jun 2018
Location: Missouri
Posts: 48
Yes I have noticed that, and is why I am a little frustrated for the life of me I cannot get STRING as an option and have yet to find a way to even make a local tag address type as string
  Reply With Quote
Old November 30th, 2018, 02:45 PM   #15
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
I will look at over the weekend.

Have a great weekend.
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:24 AM.


.