joza921 Posted April 2, 2015 Share Posted April 2, 2015 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 More sharing options...
AzeoTech Posted April 2, 2015 Share Posted April 2, 2015 You probably need to add script to reinitialize the port. Its simply: device.myDevice.initcomm() where myDevice is the name of your device. Link to comment Share on other sites More sharing options...
joza921 Posted April 2, 2015 Author Share Posted April 2, 2015 I have device.Mydevice.initcomm () i the first sequence and unlock port. Link to comment Share on other sites More sharing options...
joza921 Posted April 2, 2015 Author Share Posted April 2, 2015 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 endifendwhile and when second sequence have timeout errors this don't work. Link to comment Share on other sites More sharing options...
AzeoTech Posted April 6, 2015 Share Posted April 6, 2015 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 More sharing options...
joza921 Posted April 7, 2015 Author Share Posted April 7, 2015 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 More sharing options...
joza921 Posted April 7, 2015 Author Share Posted April 7, 2015 Another question, if i use try/catch blocks, can i read data in this sequence? Link to comment Share on other sites More sharing options...
AzeoTech Posted April 7, 2015 Share Posted April 7, 2015 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 More sharing options...
joza921 Posted April 7, 2015 Author Share Posted April 7, 2015 Is this correct? scada.txt Link to comment Share on other sites More sharing options...
AzeoTech Posted April 8, 2015 Share Posted April 8, 2015 Can you please use proper indenting and resubmit. Perhaps it was just from the cut and paste, but the code as written is basically unreadable because it is not indented properly. Link to comment Share on other sites More sharing options...
joza921 Posted April 8, 2015 Author Share Posted April 8, 2015 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 More sharing options...
AzeoTech Posted April 8, 2015 Share Posted April 8, 2015 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 More sharing options...
joza921 Posted April 8, 2015 Author Share Posted April 8, 2015 I will put *ctl format. Is that better? Example.ctl Link to comment Share on other sites More sharing options...
AzeoTech Posted April 9, 2015 Share Posted April 9, 2015 The indentation is still not correct, but I can view it a little better. It looks like you have it correct, though you do not need to use UnlockPort() at all since you are using the Modbus driver which handles this for you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.