Atomic operation or not (RW 6.15.08)
Hi. I have these lines in code and once per week or just random i have error out of bounds so that means there is 0 in array position. That should not be, because I always write number 1,2,3 or 4. There are 4 trolleys.
STATIONS{2}.TrolleyNR could be zero if there are no trolley in this station, but is updated when trolley is in transit in next code preview
"STATIONS{1}.TrolleyInTransitNR" / next lines are run only when TrolleyInTransitNR is not 0
So error happen in line 20 or in function AnyPartsLoaded() because sometimes it tries to access 0 position in array (STATIONS{2}.TrolleyNR is resolved as 0, because is not yet updated from line 10)
I modified the code now to store this value in separate variable and wait if some errors happen again. But i am curious if operation at line 10 is atomic or not.
Stations ad Trolleys are:
Can be a problem, that PERS Station STATIONS{6} is not declared with values, so values are on memory only, but not shown in code? I can update code to show actual value in code too, but it works well without values:
PERS Station STATIONS{6}:=[[1,3,0,TRUE,TRUE],[0,2,0,TRUE,FALSE],[5,0,1,TRUE,FALSE],[0,0,0,TRUE,FALSE],[1,4,0,TRUE,TRUE],[0,0,3,TRUE,FALSE]];
STATIONS{2}.TrolleyNR could be zero if there are no trolley in this station, but is updated when trolley is in transit in next code preview
"STATIONS{1}.TrolleyInTransitNR" / next lines are run only when TrolleyInTransitNR is not 0
10/ STATIONS{2}.TrolleyNR:=STATIONS{1}.TrolleyInTransitNR;
20/ Trolleys{STATIONS{2}.TrolleyNR}.AtStationNr:=2;
30/ STATIONS{2}.PartsLoaded:=AnyPartsLoaded(STATIONS{2}.TrolleyNR);
So error happen in line 20 or in function AnyPartsLoaded() because sometimes it tries to access 0 position in array (STATIONS{2}.TrolleyNR is resolved as 0, because is not yet updated from line 10)
I modified the code now to store this value in separate variable and wait if some errors happen again. But i am curious if operation at line 10 is atomic or not.
Stations ad Trolleys are:
PERS Trolley Trolleys{4}:=[[5,17311,FALSE,809468712,809468729,809468747,809468764,809468781],[4,17311,TRUE,809468814,809468831,809468848,809468866,809468883],[3,17311,TRUE,809468932,809468949,809468966,809468984,809469001],[2,17311,TRUE,0,0,0,0,0]];
PERS Station STATIONS{6};
Can be a problem, that PERS Station STATIONS{6} is not declared with values, so values are on memory only, but not shown in code? I can update code to show actual value in code too, but it works well without values:
PERS Station STATIONS{6}:=[[1,3,0,TRUE,TRUE],[0,2,0,TRUE,FALSE],[5,0,1,TRUE,FALSE],[0,0,0,TRUE,FALSE],[1,4,0,TRUE,TRUE],[0,0,3,TRUE,FALSE]];
Tagged:
0
Categories
- All Categories
- 5.6K RobotStudio
- 401 UpFeed
- 20 Tutorials
- 15 RobotApps
- 303 PowerPacs
- 407 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 353 IRC5
- 74 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 849 RAPID Programming
- 24 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 110 Collaborative Robots
- 5 Job listings