CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Thu Oct 19, 2017 7:15 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Mar 14, 2017 9:21 am 
Offline

Joined: Fri Nov 18, 2016 11:55 am
Posts: 6
Hello,
I have a question and i hope you can help me. I want to use Python (see Code below) to get the deviceadress of my CPU an than use this address to login into the CPU via the Test Manager.

If i use the code i get the right information out of the CPU but if i try to use " deviceaddress " out of Pythonscript in my Testscript, the Testmanager says the Format is invalid.
Is this error because the Address is of type "string", or do i have to use a other way to get the address out of the script?

Best regards

Sebastian

Code:
# Find device object
found = projects.primary.find('PLC_AC500_V3',True) #('PLC_7', True)
assert(found and len(found) == 1, 'No or more than one device found')
dev = found[0]
#print (dev)

# ==============  Find gateway
gw = online.gateways['Gateway-1']


deviceid      = dev.get_device_identification()
#print (deviceid)
devicegateway = dev.get_gateway()
#print (devicegateway)
deviceaddress = dev.get_address()
print (deviceaddress)  # => Output 03C8.9000.2DDC.C0A8.090B



print 'type',type(deviceaddress)


Top
   
PostPosted: Tue Mar 14, 2017 2:06 pm 
Offline
Frequent User
Frequent User

Joined: Tue Nov 13, 2012 9:20 am
Posts: 217
Hi Sebastian.

Sebastian_abb wrote:
Hello,
I have a question and i hope you can help me. I want to use Python (see Code below) to get the deviceadress of my CPU an than use this address to login into the CPU via the Test Manager.

If i use the code i get the right information out of the CPU but if i try to use " deviceaddress " out of Pythonscript in my Testscript, the Testmanager says the Format is invalid.
Is this error because the Address is of type "string", or do i have to use a other way to get the address out of the script?

For what reason do you want to get the device address through the Scripting and use it to login through the Test Manager?

If the communication path for the device is already configured then you can just login with your test script. If you want to use the Scripting API for the gateways to scan the network and find a suitable device then you can just configure the communication path through Scripting and also just login in the test script.

BR
Martin

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Tue Mar 14, 2017 3:29 pm 
Offline

Joined: Fri Nov 18, 2016 11:55 am
Posts: 6
Hi Martin,

thanks for the quick answer. I need the address because I use Unit Test´s with the Testmanager and for this Type of test the Testmanager needs the Deviceaddress. The second reason is that i work with the Automation Builder from ABB and with different versions of the Automationbuilder the deviceaddress changes and so i have to read it out with every Version i use my test on.

Best regards
Sebastian


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited