How to unload a module sharing variables and routines with other modules

Luxrobotic
✭✭
Hi everybody,
I'm facing a problem ! I need to update a module which contain varaibles and routines shared with other modules.
So I want to use UnLoad and Load instructions, but of course, if the module isn't present in the system, I have semantic errors. So I can't execute the Load instruction.
Is there a possibility to Reload the module ?
Any idea ?
Thanks
Regards
Cornet Raymond
Manager
LUXROBOTIC programming Sàrl
+352 621 354 570
[email protected]
http://www.luxrobotic.com
PC HP ZBook 17 G3
intel Core i7 6700HQ 2.59 GHz
RAM 16GB
HDD 1TB
NVIDIA Quadro M1000M
Cornet Raymond
Manager
LUXROBOTIC programming Sàrl
+352 621 354 570
[email protected]
http://www.luxrobotic.com
PC HP ZBook 17 G3
intel Core i7 6700HQ 2.59 GHz
RAM 16GB
HDD 1TB
NVIDIA Quadro M1000M
Post edited by Luxrobotic on
0
Best Answer
-
Hi Cornet,
You should be able to use Load and UnLoad or StartLoad and WaitLoad, but the module you are unloading needs to have been loaded with a load instruction from within RAPID.
The following code only works because the module to be unloaded was loaded in RAPID to begin with:
There are 3 modules, and it looks like persistents are maintained throughout, although I think variables will be initialised again.MODULE MainModule VAR loadsession tempLoad; PROC Main() TPErase; ! Module must have been initially loaded with load instruction Load \Dynamic, "HOME:/RemoveModule.MOD"; ! execute routine 1 %"Routine1"%; ! load replacement module StartLoad \Dynamic, "HOME:/TempModule.MOD", tempLoad; ! Unload existing module WaitLoad \UnloadPath:="HOME:/RemoveModule.MOD", tempLoad \CheckRef; ! execute routine 1 %"Routine1"%; ERROR TpWrite "Err"; TRYNEXT; ENDPROC ENDMODULE
MODULE RemoveModule PERS num nVar1; VAR string sVar2 := "asd"; PROC Routine1() ! Do Stuff nVar1 := 1; TpWrite "set nVar1 to " \num:=nVar1; ENDPROC ENDMODULE
MODULE TempModule PERS num nVar1; VAR string sVar2; PROC Routine1() ! Do Stuff TpWrite " "; TPWrite "Value of nVar1 is " \Num:=nVar1; nVar1 := 2; TPWrite "Set Value of nVar1 to " \Num:= nVar1; ENDPROC ENDMODULE
Execute the unload from your main task ideally while there is no other execution to be safe,
Good Luck,
Harry
1
Answers
-
You can disable "Check unresolved references" then you won't get any syntax error for missing variables och procs. But the program will stop if trying to read / write any missing data.Systemintegrator - Web / C# / Rapid / Robotstudio
If I helped, please press Vote Up0 -
Forge_Engineering said:Hi Cornet,
You should be able to use Load and UnLoad or StartLoad and WaitLoad, but the module you are unloading needs to have been loaded with a load instruction from within RAPID.
The following code only works because the module to be unloaded was loaded in RAPID to begin with:
There are 3 modules, and it looks like persistents are maintained throughout, although I think variables will be initialised again.MODULE MainModule VAR loadsession tempLoad; PROC Main() TPErase; ! Module must have been initially loaded with load instruction Load \Dynamic, "HOME:/RemoveModule.MOD"; ! execute routine 1 %"Routine1"%; ! load replacement module StartLoad \Dynamic, "HOME:/TempModule.MOD", tempLoad; ! Unload existing module WaitLoad \UnloadPath:="HOME:/RemoveModule.MOD", tempLoad \CheckRef; ! execute routine 1 %"Routine1"%; ERROR TpWrite "Err"; TRYNEXT; ENDPROC ENDMODULE
MODULE RemoveModule PERS num nVar1; VAR string sVar2 := "asd"; PROC Routine1() ! Do Stuff nVar1 := 1; TpWrite "set nVar1 to " \num:=nVar1; ENDPROC ENDMODULE
MODULE TempModule PERS num nVar1; VAR string sVar2; PROC Routine1() ! Do Stuff TpWrite " "; TPWrite "Value of nVar1 is " \Num:=nVar1; nVar1 := 2; TPWrite "Set Value of nVar1 to " \Num:= nVar1; ENDPROC ENDMODULE
Execute the unload from your main task ideally while there is no other execution to be safe,
Good Luck,
HarryHi,with some litte customization it works fine.hanks a lotRegards
Cornet Raymond
Manager
LUXROBOTIC programming Sàrl
+352 621 354 570
[email protected]
http://www.luxrobotic.com
PC HP ZBook 17 G3
intel Core i7 6700HQ 2.59 GHz
RAM 16GB
HDD 1TB
NVIDIA Quadro M1000M0
Categories
- All Categories
- 5.4K RobotStudio
- 375 UpFeed
- 15 Tutorials
- 12 RobotApps
- 286 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 241 ScreenMaker
- 2.7K Robot Controller
- 266 IRC5
- 40 OmniCore
- 6 RCS (Realistic Controller Simulation)
- 3 RobotStudio AR Viewer
- 722 RAPID Programming
- 15 Wizard Easy Programming
- 107 Collaborative Robots
- 3 Job listings