IntegraXor SCADA

FORUM

TCP/IP MODBUS Beginner Questions

Communication protocols

TCP/IP MODBUS Beginner Questions

Postby Azat » Tue Jan 05, 2010 11:11 am

Hello everybody!

Im beginner in SCADA and have some questions:

i use Zelio smart relay with Modbus Ethernet extension as PLC
documentation
Ethernet Inputs four 16-bit inputs:
J1 (address 16),
J2 (17),
J3 (18),
J4 (19).
These words may be accessed in read and write modes.
Ethernet Outputs
The Ethernet extension has four 16-bit outputs:
O1 (address 20)
O2 (21),
O3 (22),
O4 (23).
These words may be accessed in read mode only.


i have successful connection to 192.168.1.10:502
and i can see the inputs and outputs but as integer
....some questions:

what is the easiest way to convert integer16 to 16xboolean (or 16 different integers 0,1)
i think it is possible to do it in editor, i tried to enter in setting area of tag address_offset=0
it didnt work :(
maybe i should use some script..... :?

Thanks a lot
Last edited by Azat on Wed Jan 06, 2010 10:24 am, edited 1 time in total.
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questons

Postby Azat » Tue Jan 05, 2010 9:13 pm

Hi
i used some code:
Tech Support
Code: Select all
    function intToBool( Value, Len, IsReversed)
    {
        if (null == Len || 16 < Len) {
            Len = 16;
        }
       
        var data = new Array( Len);
        Value = parseInt( Value);
        for (var i=0; i<Len; i++)
        {
            var idx = (i < 8) ? (i+8) : (i-8);
            var bits = Math.pow(2,idx);
            data[i] = (Value & bits)? 1: 0;
        }
        if (IsReversed) {
            data = data.reverse;
        }
        return data;
    }

    function boolToInt( bit16, bit15, bit14, bit13, bit12, bit11, bit10, bit09,
                       bit08, bit07, bit06, bit05, bit04, bit03, bit02, bit01)
    {
        var data = 0;
        if (bit08) data |= 32768;
        if (bit07) data |= 16384;
        if (bit06) data |= 8192;
        if (bit05) data |= 4096;
        if (bit04) data |= 2048;
        if (bit03) data |= 1024;
        if (bit02) data |= 512;
        if (bit01) data |= 256;
        if (bit16) data |= 128;
        if (bit15) data |= 64;
        if (bit14) data |= 32;
        if (bit13) data |= 16;
        if (bit12) data |= 8;
        if (bit11) data |= 4;
        if (bit10) data |= 2;
        if (bit09) data |= 1;

        return data;
    }





and i tried to add some code
Code: Select all
var data1=intToBool( gettag( 'O1'), 16, 1);
settag( 'PO1_1', data1);


but it didnt work
maybe i entered wrong parameters in intToBool function.... :?

Please help

PS one more question:
we have 128 tags limit for I/O...including virtual device tags or not?

Thanks a lot :)
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questions

Postby khlee » Wed Jan 06, 2010 10:40 am

Hi,

The output of intToBool function is an array. Therefore you cannot set the result into tag "PO1_1".

I assume "PO1_1" is the first bit of int16 tag "O1". What you can do is:

Code: Select all
var data1=intToBool( gettag( 'O1'), 16, 1);
settag( 'PO1_1', data1[0]);


The following bit will be:
Code: Select all
settag( 'PO1_2', data1[1]);


For your second question, only physical (external I/O) tags are counted. You may use as many virtual tag as you wish.


Thank you.
khlee
 
Posts: 19
Joined: Tue Dec 09, 2008 5:08 am

Re: TCP/IP MODBUS Beginner Questions

Postby Azat » Wed Jan 06, 2010 9:07 pm

Hi, khlee
Thanks for answer!
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questions

Postby Azat » Thu Jan 07, 2010 9:31 pm

Hello
just a few questions:

1. why i cant use settag command in Object properties-->script field?

2. what is the easiest way to create button such as:
click on it == it will change value of some tag to 1
click on it once more == tag=0 and etc.
now i use 2 buttons one start the other is stop...

thanks a lot.
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questions

Postby Azat » Thu Jan 07, 2010 10:16 pm

Pardon
settag is working
but i have a script error if i try to enter
Code: Select all
var data=gettag('PJ2_1');
if (data==0) {
        setTag('PJ2_1', 1);
    }
    else {
       setTag('PJ2_1', 0);
    }


What is the problem?
Thanks a lot and im sorry thats my fault.... :?
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questions

Postby khlee » Fri Jan 08, 2010 1:53 am

Hi

I assume you use the code in Inkscape script animation. The correct function name should be setTag and getTag, even though in server script you can use both.

However, if you still facing this problem after corrected the function name, please copy the error message to us. It will help us to understand your problem even better.

An addition to the code you pasted, it might introduce problem if you try to check a boolean tag with "0" and "1" (although setting 1 or 0 to boolean tag will automatically interpret as true or false). Try using true/false instead. For example:

Code: Select all
var data=getTag('PJ2_1');
if (data==false) {                      // it is better to check the data with correct datatype
    setTag('PJ2_1', true);
}
else {
   setTag('PJ2_1', false);
}


Thank you.
khlee
 
Posts: 19
Joined: Tue Dec 09, 2008 5:08 am

Re: TCP/IP MODBUS Beginner Questions

Postby Azat » Sun Jan 10, 2010 8:11 pm

Hi, khlee
its working perfect, thanks for support!!! :D

some questions:
1. some problems with web task on my laptop:
on desktop web starts perfectly with explorer 8
but on laptop i have explorer 6 (i cant update it, because network administrator will kill me if i do.... ;) )
so i decided to use firefox ver 3.5.6
in post-launch i entered "firefox.exe" "<HOMEPAGE>index.html"
but it doesnt start :?:
i have an error
failed to initialize web server...0x80070005. Access denied.
failed to start web server


i understand that it is the problem of my laptop...could you give me some hint where to put check mark to allow start localhost...

2. Please clarify the situation with license:
i started some project on me laptop and get the license.
and now i want to continue project on desktop PC and license is not working...so i have to get new one?

3. is it possible to make some new page opening above the existing page?
i mean: we have some figure called as motor double click and some small menu(page) is opened with information and some buttons Start/Stop, local/remote control, status of the motor on/off, set points if it is with frequency converter and etc. but it should be above the main window and operator is able to see hole diagram....
i suppose its possible but i dont know how to start...
Please help
Thanks a lot for support!
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Re: TCP/IP MODBUS Beginner Questions

Postby khlee » Mon Jan 11, 2010 8:26 am

Hi,

Below are the answers:

1. The web server cannot be started is most probably due to you have another web server running on your computer. Try turn off Apache (or any web server using Apache) and IIS.

2. Yes, since licenses are tied to hardware. So, you should register only on deployment machine, and do not need to register on development machine.

3. In Inkscape, when you create an object, under Object Properties (aka animation window), you may use popup or open to achieve your purpose.

Thank you.

Regards,

KHL
khlee
 
Posts: 19
Joined: Tue Dec 09, 2008 5:08 am

Re: TCP/IP MODBUS Beginner Questions

Postby Azat » Sun Jan 17, 2010 4:33 pm

Hi there!
Thanks for answering my dump questions.

1. i had edited area01.svg and then specified some object on overview.svg with popup source==area01.svg
then run the project--> click on object--->IntegraXor SVG loader window appears but animation in this window doesnt start
to run the animation i right click inside the window and select refresh several times....

What can be the problem?

2. i use one output tag (PJ2_1) to allow PLC operate.
but when i have device.Zelio.status.connected==false (communication error) PJ2_1 still is true, and PLC is working, but it have to stop.However i cant change it because device is disconnected.

i have an idea to use one of the otputs of PLC and outputs of SCADA in feedback in PLC.
PLC sends some signal and waits for response X seconds if this value doesnt come in --->PLC stops....

But maybe You suggest something easier :)

3. i had a new device PM710MG (power meter with RS485 communication ability)
also i added the ACE 909-2 converter RS232/RS485
and connect them as shown in attachment
register of PM710 starts with 4000-4108 as integers, longintegers and etc
setpoints of PM710:
address==1
baud==19200
parity==even

i used the settings of COM1 as
name=MbusDevice
Protocol==igmb.dll
Timer==SEC01
Address==1
Setting==
address_offset=-1
baudrate=19200
bytesize=8
parity=even
reverse_32bit=0
reverse_64bit=1
reverse_double=1
reverse_long=1
stop=1
txmode=rtu
width_32bit=1
width_64bit=1
width_double=1
width_long=1

then added some tags and run the project.
messages:
connection to COM1 successful and established
but then
I/O auto: Failed to read MbusDevice, address 4033, 1 int16 item....timeout tead from port.....

What is the problem???

Thanks a lot!!!
Azat
 
Posts: 8
Joined: Tue Jan 05, 2010 10:19 am

Next

Return to Driver / IO



cron