Modbus Timeout Errors


joza921

Recommended Posts

Hello Admin, i have one question. I made a daqfactory SCADA, in their scada i have more sequence. I have problem with two sequence.
One sequence is used to start the second sequence if it turns off. In the second sequence i read data from the plc. When I clicked button start, both sequence is started. After half an hour i have error, error is "Socket error on init; 10022. After these errors i continue reading data an after 10 minute i have second errors, error is: P - Modbus timeout errors in second sequence - uncaught error in sequence second sequence, and i can't again started second sequence. I can started this sequence when i turn off software and again open this software.

Thanks for help

Link to comment
Share on other sites

I have this i first sequence:

delay(0.2)
while(1)
    delay(2)
   if(Sequence.Preuzimanje_podataka.Running()== 0)
    device.PLC1214.UnlockPort()
    device.PLC1214.InitComm()
    delay(2)
    beginseq(Preuzimanje_podataka)
   else
   endif
endwhile

and when second sequence have timeout errors this don't work.

Link to comment
Share on other sites

Does the second sequence actually stop?  You really should just do proper error handling in the other sequence.  You can prevent a sequence from ever stopping on its own by using try/catch blocks:

 

while(1)

   try

      // do a bunch of stuff

   catch()

      ? strLastError

   endcatch

   delay(1)

endwhile

 

No matter what error occurs between the try and catch, the sequence will continue running.  The problem with using two sequences is synchronization.

Link to comment
Share on other sites

Thanks, but i don't use the channel, i use the V.channel, for example: 

 

Private.In  = Device.PLC1214.ReadHoldingU16(0,41441,62)
V.Kut_mjerenja.AddValue(Private.In[0])
 
Is this the way it  works with V.channel?
 
Yes the second sequence is in the stop, and the first sequence starts second sequence and second sequence starts, but after the second  starting the error appears : P - Modbus timeout errors in second sequence - uncaught error in sequence second sequence
Link to comment
Share on other sites

If I understand your question, then yes.  Try/catch is just error handling.

 

As for the V.Channel, you just want to use =:

 

V.Kut_mjerenja = in[0]

 

I would avoid the two sequence approach and use try/catch.  Feel free to post the read sequence and I can tell you how to add the try/catch.

Link to comment
Share on other sites

Sorry, i will paste here.

 

 
//Preuzimanje podataka od plc-a
 
while(1)
   try
   delay(0.8)
   Private.In  = Device.PLC1214.ReadHoldingU16(0,44110,1)
V.Ana_Preuzimanje_podataka.AddValue(Private.In[0])
//delay(0.05)
Private.In  = Device.PLC1214.ReadHoldingU16(0,44109,1)
V.Sklopka_OK.AddValue(Private.In[0])
delay(0.05)
      private In1
In1 = Device.PLC1214.ReadHoldingU16(0,43815,1)
V.Greske_cil.AddValue(In1[0])
.....
Link to comment
Share on other sites

Its not the pasting that is the issue, its your indentation.  You should indent (default is 3 spaces in DAQFactory) every time you have:

 

while

for

if

else

try

catch

switch (optional, can indent case instead)

case

 

and outdent an equivilent amount every time you do:

 

endwhile

endfor

endif

else (you outdent the else, then indent the next line)

catch (same here, outdent the catch, then indent the next line)

endcatch

endswitch

 

This is programming 101 and as such we make it a requirement before we will evaluate any customer code.  To not indent properly makes code next to unreadable.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.