Sign in to follow this  
Followers 0
soundwave

CJ1M & SCU41 - Modbus 2 Slaves

28 posts in this topic

Hello all, could anyone inform me of the common method used when polling two daisy chained instruments using modbus. I have a project which requires the PLC to act as a modbus master for 2 power meters and ALSO as a slave to another modbus connection using both ports on a SCU41 (The slave will be another post down the track!) So far i have been polling one modbus slave (Schneider PM500 power meter) with a CJ1M CPU23 using a SCU41-V1 card. I plan to add another modbus slave (another PM500) using the same network. Modbus network | |------Power Meter | |-------Power Meter | |------SCU41-V1 i use a timer to execute the protocol macro PMCR(260). PMCR(260) #0110____where the #0xxx is the port the #x1xx is the serial port and #xx10 the unit. #0002 ___Execute Read Modbus I am unsure of when and how the PCMR(260) command is executed, how long it takes to execute and how to tell when it has finished executing. So, the Questions I have are related to communicating to both slaves while using the same modbus network. 1. Can I use a different internal logical port to poll the second power meter. In this case I would have the program run both PCMR(260) instructions in sequential rungs. This method sounds like it has problems with both logical ports communicating. 2. Should I use the PCMR(260) command only once and just change the information like node address, data to be received when selecting another device on the modbus network. This would be like switching between power meters by changing the node address that the protocol macro executes. 3. I use a timer to execute the PCMR(260) instruction. How would I know when the instruction has finished/transmitting/receiving/ waiting on the modbus network. Do people use the status bits to determine when it has finished executing? So that another command can be executed? Is the timer method the most common form? Sorry guys, lots of questions and not enough knowledge at the moment. I do have the modbus working and polling one power meter and I am getting good results from this however I now need to finetune a bit. The information I need is real time monitoring but is not system critical therefore update times of 10ms?? Would be plenty

Share this post


Link to post
Share on other sites
10 ms for three devices???? You've got to be kidding. PMCR Executing Bit Bit 15 of n+9 and n+19 where n= 1500 + (Unit No.*25) Example: Unit 1 would be 1534.15 and 1511.15 See this for Modbus Master and Slave PMCR: Modbus Protocol Macro for Master and Slave @ MrPLC.com Look at the ladder out of this one for an example on how to initiate and determine when a PMCR finishes: ASCII Generic Protocol Macro @ MrPLC.com

Share this post


Link to post
Share on other sites
The 10ms was a guesstimate! I haven't dealt with modbus before this so i do not no it's speed limitations + SCU41 limitations + CPU limitations but hopefully this will not be a concern. I should have worded this way "the modbus is not system critical and I would prefer reliable data instead of refresh speed of data" I plan to use the second serial port on the SCU41 for the second modbus network where the this PLC is the slave.

Share this post


Link to post
Share on other sites
You're too quick. I was in the process of editing above. Take a second look.

Share this post


Link to post
Share on other sites
bigpond.net....hmm... Do you know Sleepy Wombat or BobB?

Share this post


Link to post
Share on other sites
Yes i am from australia. sorry i know neither sleepy wombat or bobb are they similar fields of work? or the bigpond thing because it is owned by a company called telstra (which is partly owned by government). Telstra own major portions of all communication networks in australia. Thanks for all the info i will review this a stuff more before i post again, but in particular the protocol executing flag looks like one i will have to investigate further.

Share this post


Link to post
Share on other sites
I know BobB works on generating systems. He should chime in here later on.

Share this post


Link to post
Share on other sites
Hi Jay & soundwave. Not a problem but time is. Give me a day or so and I will post some details. Main thing is that the 2 devices have different address numbers. I normally use the RS232 port with an Advantek Adam 4520 in the line. RS232/485 isolated - no nasty voltages then. Requires a 24VDC piower supply though. Post ASAP.

Share this post


Link to post
Share on other sites
Here are 2 links at this site - the first sample code I use fro reading from a Modbus RTU device - includes manipulation of data to get it in the right order, the second the actual CX-Protocol macro submitted by Sleepy Wombat for downloading into the serial board. It includes a manual for setting everything up. Use the manual and see what I have done with PMCR and manipulating data. You may or may not have to manipulate data in this way, depends on the device. Basically, just use the code for the PMCR and the completion flags to set up the next read. Modbus RTU receive code sample Modbus Protocol Macro Have fun.
1 person likes this

Share this post


Link to post
Share on other sites
Thanks, BobB.

Share this post


Link to post
Share on other sites
Alright BobB!! I believe this is similar to the operations required for the PM500 power meter. I had trouble yesterday afternoon with some of the PCMR execution/logic, I have since moved to updating electrical schematics. I think monday will be the next heavy programming session! The finished program is for an emergency 300kW diesel, and the rest is simple switchgear to isolate mains and supply the bus. thanks again BobB and i will post further advances here

Share this post


Link to post
Share on other sites
Hello, Thanks for the example of coding that is required BobB. I have ended up with a similar structure to you code. I am happy to email this to you when i have completed the code so that you may review it and incase you find comething that may breach your intellectual property. Anyhow moving along 1.......... The first hickup i had was that a timer was required before the PCMR instruction for it to execute properly. This is exactly the same as your PCMR instruction BobB except with a timer replacing the P_On contacts. Without the timer the PCMR instruction does not execute correctly. I will investigate this further. I had also used the comms busy set bit in your code to get around this bob but this did not work. Is this why you need a comms set bit? does the PCMR executing bit 1509.15 (in my case) not do this for me. 2.......... I also attempted to change the receive address in the PCMR instruction as a variable address. the PCMR instruction did not execute properly. It appears the PCMR instruction requires a specified Dxxxx address and not a variable mnenomic. i.e. i used Modbus_Store_address for the recieve location of modbus data. I changed this address when another instrument was to be polled (using the same PCMR instruction) The PCMR then failed to execute. 3........ Is there a limit on the PLC to how many words you can read across a modbus network. OR is it instrument dependent as i can get max 90 words it appears from the PM500 4........ The trace function in CX Protocol has been a great help!!

Share this post


Link to post
Share on other sites
Just a note to 2............. While the PLc is in Monitor Mode I can successfully In the setup word to send on the modbus network - change the read address of the data in the instrument - change the number of words to be read from the instrument In the PCMR instruction - change the store address of the data received in the PCMR instruction Is it strange i can't then use the same PCMR instruction for all data tranfers and simply change the node address, data address, number of words to be received and finally change teh store location of the data received.

Share this post


Link to post
Share on other sites
Just a note to 1.......... I had the PLC online and executing the PCMR instruction as shown in the attachment. The send receive lights were on. I then made an online edit and changed the timer instruction preceding the PCMR instruciton and the send receive lights stopped indicating comms problems or failure to execute PCMR instruction Working___But_using_timer.pdf

Share this post


Link to post
Share on other sites
Have my head down at the moment. Will respond later tonight. Regards

Share this post


Link to post
Share on other sites
Thanks Bob, i will keep learning the finer details of the native OMRON language!!

Share this post


Link to post
Share on other sites
Just re-designing 3 main switch boards to perform SCTT (soft transfer) with one set across 2 subs right now. The consultant put in ATS's everywhere. Bloody useless for soft transfer when you a synchronising across 2 ACB's, 1 for the generator system and 1 for the mains. Re-designing using motor operated MCCB's with 24VDC trip coils to open up the load and slowly close to load the generator at an acceptable level of steps after a power failure. Soft transfer both ways will do the job for load testing. There will eventually be 3 sets (2 x 1000 kVa and 1 x 325 kVa). Toys really. Used to larger sets up to 8 mW at 11 kV. There will also eventually be 3 subs. Have to do one at a time I think. Need to chack with the supply authorities. Get the answers in writing too. They turn turtle really quickly. Hope this helps and I have not confused you too much. I have a habit of confusing people. Regards

Share this post


Link to post
Share on other sites
Yes………………………. Yes I found the limit in my program with a short lead to the instrument to be around 100 words. The data I am after ranges from decimal address 768 to 880 so on the border line. I will use 2 read blocks of about 20 words each. Tips are a savior…………………………….. Yes I will change the PVs and SVs in the timer using the new method Strange………………………. The timer was required when I was using the PCMR instruction in a stand alone program. I think the PCMR executing flag was released to early causing conflict when I said the port was free? I have now two PCMR instructions and several move statements and I have removed the P_On contacts. Weird? Misled……………….. I did use a DM for the PCMR instruction. I had for example PCMR____________ PORTS___________ SEQUENCE______ MB_Send __________First Send Word MB_Store__________Store Address of Received words The PCMR instruction did not like the DM address MB_Store but did not mind the word MB_Send. I have given up on this method as it may provide difficult to debug/understand with data shifts and the like. Problem………………………. I now have the sleepy wombat protocols and code, he has a timer in the last file I think he may hold the answer. I have had trouble connecting to the PLC in CX protocol as I can’t seem to change the TYPE of the plc card to SCU41 it is empty at the moment and I get a PLC must be busy notification. I have played around a bit and got to know how and when you can download and upload protocols and comms setups with a protocol strikingly similar to sleepy wombats. Hopeful Solution………………….. I will look into this further as I may need to download the latest protocol to the SCU41 card. But first I need to specify the card type as SCU41 which will allow comms. Thanks................ All the little quirks that come naturally to an experienced programmer are the envy of the beginner. I have only started programming about three weeks ago but have seen ladder in allen bradley (over a colleagues shoulder). I am starting the program with a scaling program and then looking at alarms. We too deal in generators and probably the worst publicity i could give my company is that i work for them! Synchrotech Controls. Inexperience at the helm!!! we often do the toys around 0.2-2MW

Share this post


Link to post
Share on other sites
This should read i have added the P_On contacts!!! and removed the timer in the latest revision. As you also mentioned I will investigate the logic further to have the finish of the first read block initiate the second read block and vice versa. -PCMR instruction start Data Block 1 -Read Data Block 1 -Data Block 1 Received -PCMR instruction Finish -PCMR instruction start Data Clock 2 -Read Data Block 2 -Data Block 2 Received -And Repeat ...

Share this post


Link to post
Share on other sites
Aren't they in Melbourne? Used to make all their own synch check relays, LED CB status indicators and all I think? Had to use a lot of thier gear on an RAAF job. Cost an arm and a leg. I think they did a couple of jobs for the RAAF themselves. Must have been better then.

Share this post


Link to post
Share on other sites
Funny sutff bob and to think you thought the company hadn't advanced, http://forums.mrplc.com/style_images/1/icon6.gif I have worked for them as a graduate for a year now. They designed a few components like that transducers, sync check relays, the funny thing is i will be writing the code for the Led CB status next week. very funny stuff

Share this post


Link to post
Share on other sites
This is what this forum is about!

Share this post


Link to post
Share on other sites
For some reason the link to the icon6.gif does not work for me. Any ideas?

Share this post


Link to post
Share on other sites
I will look into downloading the new modbus protocols today and post after any luck. Off Topic.................. The link was to a smiley!! I am not familiar with adding smilies in a forum. Typically i would find no use but this case was an exception!! They are a good company and both partners are certainly generous and wise in their field. I am sorry you may have had a bad experience with them. About 15 years ago they landed a major project for islands in the torres strait. During this period they developed instruments that could be applied at low cost with the functionality they required. And i reply to Jay,

Share this post


Link to post
Share on other sites
Thanks for all your help, I have not completed the modbus program but have been directed to attack other sections of code that require completion. I will return to this thread when i pursue the modbus further. thanks again gentlemen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0