-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
self.forward_open() #27
Comments
could you post the error message and the source code? |
I am trying to run the exact code which you have posted with the changed IP address. |
It looks like you didn't connect with the PLC |
So in "cip_base.py" code in forward_open function do i need to change Connection parameter from default to PLC? |
I don't think so. I tested the connection with different PLCs including SLC
and MicroLogix and I noticed that PLC always responded to the 'Default'
parameter.
Therefor before make any changes I would first make sure the PLC is
available (can you ping it, is the Ethernet port available with a
reasonable configuration, how do you go online with RSLogix?)
Ago
…On Wed, Jul 5, 2017 at 8:56 AM, shah-s ***@***.***> wrote:
So in "cip_base.py" code in forward_open function do i need to change
Connection parameter from default to PLC?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABL5oRziq2zmrZLFPmr3BPUfIMgEIQfdks5sK5XxgaJpZM4OK8i3>
.
|
Yes, I am able to ping to the IP address where PLC is connected. |
Difficult to help without a log file. Delete the existing log file, execute
the script again and send or post the log
…On Wed, Jul 5, 2017 at 10:03 AM, shah-s ***@***.***> wrote:
Yes, I am able to ping to the IP address where PLC is connected.
So what can be the issue for this error?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABL5oU_V0iIdFEyM6RoR2-kFlMmdr3Kzks5sK6W_gaJpZM4OK8i3>
.
|
I did not understood which log file you are talking about. As i am using the exact code of yours for now. |
In the directory were you are executing the script there is a file "SlcDriver.log" which contains debug information and the data packets exchanged. You need to delete this file, and execute the python script again. Once you do so the log file will be recreated with the latest debug information |
it looks like it fail during forward_open but i'm not sure from the image you posted. It is possible to get the entire log file |
Should I send the images of log file? |
here is the pdf version of the log file |
As I suspected the forward_open failed. Which PLC model are you trying to connect and what's the tag you are trying to read? |
PLC model is Micro820 and Tag I am trying to read is DV |
Harggg! I should ask this question at the beginning. Micro models are totally different beast :) So they respond as "Out of Connections" (0x0113 is the status I read from your log) c.open(172.16.2.167, direct_connection=True): |
Thank you, it worked. |
it should be the value of your tag. Make sure to import "pycomm.ab_comm.clx" and not "pycomm.ab_comm.slc" |
okay. thanks a lot for your help! |
No problem |
One last thing,
When i Interrupt the program i get the following as a result.
[image: image]
<https://user-images.githubusercontent.com/29803896/27967949-fde385c6-6312-11e7-839a-ce5abf158c76.png>
And can you explain me how to read data from log file?
[image: image]
<https://user-images.githubusercontent.com/29803896/27967980-2cf50a74-6313-11e7-9f0c-affd204db591.png>
We will get the readings of PLC on log file right?
…On Fri, Jul 7, 2017 at 11:52 AM, Agostino Ruscito ***@***.***> wrote:
No problem
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeBX1H8M3NAVDmmoTGdSAYg-K7pm9ks5sLlRXgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
For the first question: For the second question: |
So how to read value from log file? |
You don't! You read value returned by the read_tag() method and you write using the write_tag() method |
Can you explain what each print statement signifies in "test_slc_only.py"
program.
I am trying to read data from PLC Micro820. It is connected with multiple
appliance so is there any way we can filter out data of particular
appliance?
…On Fri, Jul 7, 2017 at 3:16 PM, Agostino Ruscito ***@***.***> wrote:
You don't! You read value returned by the read_tag() method and you write
using the write_tag() method
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeOAhIrEgUtFITh7pnWvWyTtzTqh9ks5sLoQmgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
If you're trying using a micro820, you need to use the other example "test_clx_comm.py". As @ruscito mentioned, you'll need to make sure you're enabling the direct connection by using In that example you'll see the line This should print out the value returned from c.read_tag() which is a tuple of (value, tag type). Storing the value of read_tags() will allow you to access the 0-th member of the tuple to get the value. |
I got the error "A session need to be registered before to call forward
open"
…On Thu, Jul 13, 2017 at 11:30 AM, Patrick McDonagh ***@***.*** > wrote:
If you're trying using a micro820, you need to use the other example
"test_clx_comm.py". As @ruscito <https://github.com/ruscito> mentioned,
you'll need to make sure you're enabling the direct connection by using
c.open(172.16.2.167, direct_connection=True)
In that example you'll see the line
print(c.read_tag(['ControlWord']))
This should print out the value returned from c.read_tag() which is a
tuple of (value, tag type).
Storing the value of read_tags() will allow you to access the 0-th member
of the tuple to get the value.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeN7rOjaYgFxOJv2hf1DVBFyVyfNyks5sNjgvgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
It would really help us to see the exact code you're using. |
For now using the exact code which is there in "test_clx_comm.py"
As I am in learning phase.
…On Thu, Jul 13, 2017 at 12:39 PM, Patrick McDonagh ***@***.*** > wrote:
It would really help us to see the exact code you're using.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFePZlAmTdrK85Z3pK1CBN9u7HzHk2ks5sNkhAgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
You’re changing the IP address to reflect the IP address of your PLC,
right? Please post the EXACT code you’re using.
|
Can you see the code and let me know if i need to make any changes in that
or not.
On Fri, Jul 14, 2017 at 12:30 AM, Patrick McDonagh <notifications@github.com
… wrote:
You’re changing the IP address to reflect the IP address of your PLC,
right? Please post the EXACT code you’re using.
On July 13, 2017 at 11:42:29 AM, shah-s ***@***.***) wrote:
For now using the exact code which is there in "test_clx_comm.py"
As I am in learning phase.
On Thu, Jul 13, 2017 at 12:39 PM, Patrick McDonagh <
***@***.***
> wrote:
> It would really help us to see the exact code you're using.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#27 (comment)>, or
mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/
AcbFePZlAmTdrK85Z3pK1CBN9u7HzHk2ks5sNkhAgaJpZM4OK8i3
>
> .
>
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110 <(407)%20337-0110>
redmeters.com <http://www.redmeters.com/> *|* ***@***.***
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or
mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACX6EIzZUcVAiVeRXh_
0ixnxCjg_p6yfks5sNkjzgaJpZM4OK8i3>
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeLSUkAmQ0C9e__-aMiSRNU6MRuuoks5sNu7mgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
Do you have a tag named “ControlWord” in your Micro800?
What model of Micro800 are you using? 820? 850?
…On July 17, 2017 at 7:53:54 AM, shah-s ***@***.***) wrote:
Can you see the code and let me know if i need to make any changes in that
or not.
On Fri, Jul 14, 2017 at 12:30 AM, Patrick McDonagh <
***@***.***
> wrote:
> You’re changing the IP address to reflect the IP address of your PLC,
> right? Please post the EXACT code you’re using.
>
>
>
> On July 13, 2017 at 11:42:29 AM, shah-s ***@***.***)
wrote:
>
> For now using the exact code which is there in "test_clx_comm.py"
> As I am in learning phase.
>
> On Thu, Jul 13, 2017 at 12:39 PM, Patrick McDonagh <
> ***@***.***
> > wrote:
>
> > It would really help us to see the exact code you're using.
> >
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <#27 (comment)>,
or
> mute
> > the thread
> > <
> https://github.com/notifications/unsubscribe-auth/
> AcbFePZlAmTdrK85Z3pK1CBN9u7HzHk2ks5sNkhAgaJpZM4OK8i3
> >
> > .
> >
>
>
>
> --
>
>
> Saurabh Shah
> *Information Technology Intern, Red Meters*
> *Direct | *+1 407-337-0110 <(407)%20337-0110>
> redmeters.com <http://www.redmeters.com/> *|* ***@***.***
> *The RM Series Technology & Specifications
> <http://www.redmeters.com/technology/>*
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#27 (comment)>, or
> mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/ACX6EIzZUcVAiVeRXh_
> 0ixnxCjg_p6yfks5sNkjzgaJpZM4OK8i3>
>
> .
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#27 (comment)>,
or mute
> the thread
> <
https://github.com/notifications/unsubscribe-auth/AcbFeLSUkAmQ0C9e__-aMiSRNU6MRuuoks5sNu7mgaJpZM4OK8i3
>
> .
>
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* ***@***.***
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACX6EKO2kHKx8Lm_j0giDFSv-ita-Vcwks5sO1ligaJpZM4OK8i3>
.
|
Micro 820 |
Please post the whole error message you get, including the command used to run the script |
Can you remove the while loop, so it just runs once and post that output? |
Do i need to make any changes in Forward_open() ? |
How can I solve this error?
…On Mon, Jul 17, 2017 at 9:30 AM, Patrick McDonagh ***@***.***> wrote:
Can you remove the while loop, so it just runs once and post that output?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeL4OS1kQHFvSVuZOkd0N26grztopks5sO2HkgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
shah-s I do you have a tag "ControlWord" in your PLC program? |
Tag i am trying to read from my PLC is DV. There is no ControlWord tag in my PLC. |
That's not in the code you posted!! Please post your code as is and a clean log file because the info you are giving are confusing and don't help |
[image: Inline image 1]
[image: Inline image 2]
[image: Inline image 3]
this is the code and the logfile generated
…On Tue, Jul 18, 2017 at 11:12 AM, Agostino Ruscito ***@***.*** > wrote:
That's not in the code you posted!! Please post your code as is and a
clean log file because the info you are giving are confusing and don't help
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeHBtBCTTuTkFnvD4PS9VIczdllmGks5sPMtMgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
It would be really helpful if you posted the actual code, not just a screenshot of it. Plus, your screenshots didn't work. surrounding text with a backticks (`) to format it as code
|
I have attached the txt file of the code i am using, hope this helps you.
from pycomm.ab_comm.clx import Driver as ClxDriver
import logging
from time import sleep
if __name__ == '__main__':
logging.basicConfig(
filename="ClxDriver.log",
format="%(levelname)-10s %(asctime)s %(message)s",
level=logging.DEBUG
)
c = ClxDriver()
print c['port']
print c.__version__
if c.open('192.168.150.60', direct_connection=True):
try:
print(c.read_tag(['DV']))
#print(c.read_tag(['parts', 'ControlWord', 'Counts']))
#print(c.write_tag('Counts', -26, 'INT'))
#print(c.write_tag(('Counts', 26, 'INT')))
#print(c.write_tag([('Counts', 26, 'INT')]))
#print(c.write_tag([('Counts', -26, 'INT'), ('ControlWord', -30, 'DINT'), ('parts', 31, 'DINT')]))
sleep(1)
except Exception as e:
c.close()
print e
pass
# To read an array
r_array = c.read_array("TotalCount", 1750)
for tag in r_array:
print (tag)
c.close(
|
What changes should I make in the code? Do I also need to make changes in
cip_base.py?
…On Tue, Jul 18, 2017 at 1:29 PM, Saurabh Shah ***@***.***> wrote:
I have attached the txt file of the code i am using, hope this helps you.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
shah-s I'm still waiting for the clean log file |
Here is the recent log file.
…On Wed, Jul 19, 2017 at 8:56 AM, Agostino Ruscito ***@***.***> wrote:
shah-s I'm still waiting for the clean log file
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeKnZ0ShzW5MEAWS4qo6TCRXzm9wFks5sPf0DgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
can't see any log file |
I have attached log file. Sorry I forgot to attach it last time. |
as you can see from the picture below the error is "Service not supported" which practically means that the controller dose not recognize the "ReadTag" request (service 4C). Unfortunately I don't have a Micro820 to play with so I can't help; however the "ReadTag" request looks good, so my best guess is with the controller configuration or maybe the tag not been exposed |
So any advice to solve this error? |
Patrick
Can you help me solving the error of Readtag??
…On Tue, Jul 18, 2017 at 11:52 AM, Patrick McDonagh ***@***.*** > wrote:
It would be really helpful if you posted the actual code, not just a
screenshot of it. Plus, your screenshots didn't work.
surrounding text with a backticks (`) to format it as code
like this
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#27 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcbFeNHTfOp9TB4oo4fNVjiEbH6E3nf4ks5sPNTGgaJpZM4OK8i3>
.
--
Saurabh Shah
*Information Technology Intern, Red Meters*
*Direct | *+1 407-337-0110
redmeters.com <http://www.redmeters.com/> *|* s.shah@redmeters.com
*The RM Series Technology & Specifications
<http://www.redmeters.com/technology/>*
|
Now I am getting error "unpack requires a string argument of length 2" |
Hey,
I am trying to run test_slc_only.py but I am getting an error in line
build_common_packet_format(DATA_ITEM['Unconnected'], ''.join(forward_open_msg),ADDRESS_ITEM['UCMM'],)):
Can you please help me in resolving it.
The text was updated successfully, but these errors were encountered: