plcpeople / honcho

Multiple PLC connection manager for Node.JS using nodes7/nodePCCC/mcprotocol
MIT License
21 stars 7 forks source link

Example for Multiple CPU Configuration and Usage of Tagsets #5

Open noviyigrok opened 6 years ago

noviyigrok commented 6 years ago

Hello,

Firstly, I'd like to thank to people who are involved in these projects.

I am using nodes7 and honcho to communicate with 2 Siemens PLCs.

Honcho seems like a very helpful manager to make things easier for multiple CPU systems but I haven't completely understand its capabilities yet.

I have created a config object and a tag file .txt for each controller and also I have created a subscription and a tag array to read data continuously for each of them.

config1 = { defaultController: 'TESTPLC1', tagFileDir: '.', controllers: [ { host: '192.168.1.2', connection_name: 'TESTPLC1', port: 102, slot: 2, type: 'nodes7', tagfile: './testplctags1.txt' } ] } };

config2 = { defaultController: 'TESTPLC2', tagFileDir: '.', controllers: [ { host: '192.168.1.3', connection_name: 'TESTPLC2', port: 102, slot: 2, type: 'nodes7', tagfile: './testplctags2.txt' } ] } };

honcho.configure(config1, function(){ honcho.createSubscription(tags1, readDone, 500); });

honcho.configure(config2, function(){ honcho.createSubscription(tags2, readDone, 500); });

tags1 = ['CPU1_TAG1', 'CPU1_TAG2']
tags2 = ['CPU2_TAG1', 'CPU2_TAG2']

And both text files contained same addresses DB1,REAL0 and DB1,REAL4

Using this configuration I managed to read data from each controller but when i tried to write data, sometimes value was written to wrong controller with the same tag address (DB1,REAL0)

honcho.write('CPU1_TAG1', '50.0')

I also tried to configure these 2 CPUs into one config object and all tags into one array.

config = { defaultController: 'TESTPLC1', tagFileDir: '.', controllers: [ { host: '192.168.1.2', connection_name: 'TESTPLC1', port: 102, slot: 2, type: 'nodes7', tagfile: './testplctags1.txt' }, { host: '192.168.1.3', connection_name: 'TESTPLC2', port: 102, slot: 2, type: 'nodes7', tagfile: './testplctags2.txt' }, ] } };

taglist = ['CPU1_TAG1', 'CPU1_TAG2', 'CPU2_TAG1', 'CPU2_TAG2']

honcho.configure(config, function(){ honcho.createSubscription(taglist, readDone, 500); });

This resulted, only reading values on the default controller which is TESTPLC1 and an error for TESTPLC2 tags 'Not on Default Controller and None Specified' and 'Undefined controller'

It would be very useful to have some examples that explains multiple CPU configurations in the same config object and usage of tagsets for ease of use.

Best Regards.

ajitrishabh commented 5 years ago

any success on connecting multiple CPU's?

noviyigrok commented 5 years ago

any success on connecting multiple CPU's?

I haven't tried since.

plcpeople commented 5 years ago

OK I finally pushed a commit that has a proper example for multiple controllers. The first way you were trying it (multiple configurations) is not supported, the second way (with multiple controller objects in the array) is right, but when you add a tag to the tagset (CPU2_TAG2) you would want to call it 'TESTPLC2/CPU2_TAG2' and you can only define defaultController once. You may want to just not use defaultController and always specify the PLC name. Please give this a try.

noviyigrok commented 5 years ago

OK I finally pushed a commit that has a proper example for multiple controllers. The first way you were trying it (multiple configurations) is not supported, the second way (with multiple controller objects in the array) is right, but when you add a tag to the tagset (CPU2_TAG2) you would want to call it 'TESTPLC2/CPU2_TAG2' and you can only define defaultController once. You may want to just not use defaultController and always specify the PLC name. Please give this a try.

Thanks for the reply. I should mention that i don't have access to any PLC or simulation environment right now. So, i won't be able to give this a try. But i would like to hear feedback from anyone who tries this solution.

Best Regards.

ajitrishabh commented 5 years ago

OK I finally pushed a commit that has a proper example for multiple controllers. The first way you were trying it (multiple configurations) is not supported, the second way (with multiple controller objects in the array) is right, but when you add a tag to the tagset (CPU2_TAG2) you would want to call it 'TESTPLC2/CPU2_TAG2' and you can only define defaultController once. You may want to just not use defaultController and always specify the PLC name. Please give this a try.

Thanks for your efforts i will try and let you know the status.