Weekly Backup with Recovery in RAPID/Wöchentliches Backup mit Nachholung in RAPID
Hi everyone,
I’m trying to create a RAPID program that triggers an automatic backup on my ABB robot every Tuesday. If the robot is powered off on that day, the backup should be executed as soon as it’s powered back on.
Any suggestions on how to best implement this in RAPID?
Thanks in advance!
Cheers
locorococ
0
Best Answer
-
Below is some code I have used in the past. I get the time from the system in second. This needs to run in the background task. You will need to setup a system input on the robot as a backup signal. It should be noted there is a more proper way to do this where it is backed up to a computer instead, but I am less familiar with that part of the program and prefer for my backups to be on a USB with the robot. Look at the system parameters manual for information on the system inputs... One more note I say system input but am using an output. You will either need to do a cross connection from a digital output to a digital input to get this to work, or... you can create an input, set up the system input, then switch the signal to a digital output and it will let you use digital outputs as a system input that way. I have no idea if this will be patched out, I pray not because I have been using it for 7 years.
PERS dnum Lasttimetaken:=10;
FUNC dnum System_Time() !This caculates the system time in seconds VAR bool Check; VAR dnum math{3}; VAR dnum time; VAR string date; date:=Cdate(); !Parcing the string from the cdate command into year,month, and day respectively Check:=StrtoVal(StrPart(date,1,4),math{1}); Check:=StrtoVal(StrPart(date,6,2),math{2}); Check:=StrtoVal(StrPart(date,9,2),math{3}); !taking the time provided by the date, and adding the hour, minutes, and seconds to get system time time:=(math{1}-1970)*31536000+math{2}*2592000+math{3}*86400+NumtoDnum(GetTime(\Hour)*3600+GetTime(\min)*60+GetTime(\Sec)); RETURN time; ERROR RETURN Last_Time_Ran;
ENDFUNC PROC AutoBackup() VAR num weekday; weekday:= GetTime(\WDay); IF weekday=2 OR (Lasttimetaken+ SecInWeek)<System_Time() THEN Set robotbackup; Lasttimetaken:=System_Time(); ELSEIF weekday<>2 THEN Reset robotbackup; ENDIF ENDPROC1
Answers
-
revans said:Below is some code I have used in the past. I get the time from the system in second. This needs to run in the background task. You will need to setup a system input on the robot as a backup signal. It should be noted there is a more proper way to do this where it is backed up to a computer instead, but I am less familiar with that part of the program and prefer for my backups to be on a USB with the robot. Look at the system parameters manual for information on the system inputs... One more note I say system input but am using an output. You will either need to do a cross connection from a digital output to a digital input to get this to work, or... you can create an input, set up the system input, then switch the signal to a digital output and it will let you use digital outputs as a system input that way. I have no idea if this will be patched out, I pray not because I have been using it for 7 years.PERS dnum Lasttimetaken:=10;FUNC dnum System_Time()!This caculates the system time in secondsVAR bool Check;VAR dnum math{3};VAR dnum time;VAR string date;date:=Cdate();!Parcing the string from the cdate command into year,month, and day respectivelyCheck:=StrtoVal(StrPart(date,1,4),math{1});Check:=StrtoVal(StrPart(date,6,2),math{2});Check:=StrtoVal(StrPart(date,9,2),math{3});!taking the time provided by the date, and adding the hour, minutes, and seconds to get system timetime:=(math{1}-1970)*31536000+math{2}*2592000+math{3}*86400+NumtoDnum(GetTime(\Hour)*3600+GetTime(\min)*60+GetTime(\Sec));RETURN time;ERRORRETURN Last_Time_Ran;ENDFUNCPROC AutoBackup()VAR num weekday;weekday:= GetTime(\WDay);IF weekday=2 OR (Lasttimetaken+ SecInWeek)<System_Time() THENSet robotbackup;Lasttimetaken:=System_Time();ELSEIF weekday<>2 THENReset robotbackup;ENDIFENDPROC0
-
@revans
i almost understand everything, everything makes sense to me after looking and working with your programm for couple of days. But those three lines, i dont know what happens there, could you please explain it to me? I am talking about:
PERS dnum Lasttimetaken:=10;RETURN time;ERRORRETURN Last_Time_Ran;
What are you doing here? i dont get it.
Thanks again very muchPost edited by locrococ on0 -
There is a bit of a mistake in that code. Where you see Last_Time_Ran, that was meant to be Lasttimetaken. I typed this up a little too quick I guess. That variable represents the last time a backup was taken. This acts as a check to see if the backup was already taken this week.
I often run this code in my very sensitive background task that sends the robot into sys failure if the code stops. For that reason, all of my not critical things like backups have a error recovery that at least returns a value that won't cause issues. So the return time makes it so the function returns the calculated value, but if the calculations run into an error caused by the string parsing or the robot time has not been setup, this would prevent my background task from crashing.
It will be a few more days, but I will try to make a video covering how I would do this and link it here.1 -
revans said:There is a bit of a mistake in that code. Where you see Last_Time_Ran, that was meant to be Lasttimetaken. I typed this up a little too quick I guess. That variable represents the last time a backup was taken. This acts as a check to see if the backup was already taken this week.
I often run this code in my very sensitive background task that sends the robot into sys failure if the code stops. For that reason, all of my not critical things like backups have a error recovery that at least returns a value that won't cause issues. So the return time makes it so the function returns the calculated value, but if the calculations run into an error caused by the string parsing or the robot time has not been setup, this would prevent my background task from crashing.
It will be a few more days, but I will try to make a video covering how I would do this and link it here.
I am currently facing the issue of trying to deploy the AutoBackup to all of our robots, and it works for most of them. However, we also have robots with Robware version 05.xx.xx in our facility, and for those, RobotStudio keeps giving me the following error message: "2600-101012/RAPID/T_ROB1/AutoBackup(41,12): Type error (56): Type signaldo for the left operand of the operator "=" or "<>" is not of type "value" or "semi-value"." This issue does not occur with newer versions. What do I need to do differently to make it work? Do you or anyone else have any ideas?0 -
Hey @locrococ
Sorry for the delayed response, I am on a different brand for a bit, so I don't check back as often.
If I remember correctly, the robotware 5 robots do not do an automatic type conversion from signals to numbers like it does in robotware 6. To make that work, you can use the function DOutput("Signal here") and that should convert it so it does the comparison.
That is mostly a guess without seeing your code right now. I don't see anywhere in the code I have that is doing a comparison to a signal. Good luck.
1 -
revans said:Hey @locrococ
Sorry for the delayed response, I am on a different brand for a bit, so I don't check back as often.
If I remember correctly, the robotware 5 robots do not do an automatic type conversion from signals to numbers like it does in robotware 6. To make that work, you can use the function DOutput("Signal here") and that should convert it so it does the comparison.
That is mostly a guess without seeing your code right now. I don't see anywhere in the code I have that is doing a comparison to a signal. Good luck.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings