RobotStudio event

IRC5/ unload and load problem

Options

I have a problem of unload and load files.
My machine needs to unload old file and load a new one very often. However,
it often met with unload errors and need to try again and again. I can be sure
mu unload and load path is the same and of no problem.(Of course,before first time
unload,working memory does not have that file so it will be unload error and try again it will
be OK)

 Is that because of IRC5 is so fast so that we need to add a waittime between unload
 and load?

 

  My Code:
   
   PROC My_Do_Loading()
    !MyFileName is a string already declared in another module
    VAR bool Errorcounter:=FALSE;

    Errorcounter:=FALSE;
    boolload:=FALSE;
    ! WaitTimeInPos, 0.2;
    TPWrite "Loading"+MyFileName;
    UnLoad "/hd0a/"File:="MyDir/"+MyFileName;
    boolload:=TRUE;
    Load "/hd0a/"File:="MyDir/"+MyFileName;
    IF Errorcounter=TRUE THEN
      UnLoad "/hd0a/"File:="MyDir/"+MyFileName;    & nbsp;
      Load "/hd0a/"File:="MyDir/"+MyFileName;
    ENDIF
    MyFileName:="FALSE";
    TIME := CTime();
    !TPErase;
  ERROR
    IF boolload=TRUE AND Errorcounter=FALSE THEN
      WaitTime 1;
      Errorcounter:=TRUE;
      TRYNEXT;
    ELSEIF boolload=TRUE THEN
      TPWrite "Error Loading "+MyFileName;
      PulseDOHighPLength:=2,doErrLoadMoMy;
      MyFileName:="FALSE";
      EXIT;
    ENDIF

Comments

  • RussD
    Options
    Maybe you can try using the instructions StartLoad and WaitLoad, see the RAPID documentation for more information.
    Russell Drown
  • memphiss
    Options

    Thank you Russell for the quick help.

     I still not clear about the difference of static mode and dynamic mode of StartLoad.What I need to do is unload a *.sys system module and load a new one under auto production mode.

      What is the difference between static and dynamic?

     

     

  • RussD
    Options

    I couldn't find an exact definition of these anywhere, but it seems to have to do with how "deeply embedded" into the Program Server is the module.

    Basically it seems a statically loaded system module is an integrated component of the loaded RAPID system, i.e. it is always present unless you unload that module, while a statically loaded program module is an integrated part of the loaded RAPID program, i.e. it is always present until you unload the program.

    A dynamically loaded module then seems to be a part of the current execution context, i.e. it is only available while you are actively executing your main routine. If you move the program pointer back to main, your dynamically loaded modules are unloaded and you must reload them again as needed during execution.

    I inferred this from reading the description of the affects of Moving PP to main and Opening a new program in the Rapid Reference Manual under the instruction Load.

    Can anyone else offer a more formal definition than this?

    Russell Drown