Modification of Method Deck Layout at Run Time

Hi Everyone,

Does anyone have a way to dynamically set the deck layout of a method similar to the Daily maintenance method, but without requiring modification of the Methods .HSL file?

I’ve been able to modify the .hsl file to allow the method to select the corresponding STAR or STARlet deck layout based on instrument serial number, but I was hoping to have a solution that is able to be incorporated in the .med file so that it’s more clear for programmers.

Thank you

Check out HSLDevLib::DevAddLabware, it lets you add labware to specific coordinates.

Sorry, I’m talking about modifying the methods associated deck layout file not just adding labware to the already associated file.

Hi @Brandon ,

The technique that daily maintenance uses to load dynamic decks can be utilized within method editor, but it does have some limitations due to how Run Control works.

When a system / deck layout is loaded, the ML_STAR device is generated automatically, and it is a global value. Resources on a layout are also considered global and both will cause an error if you try to load more than one system at a time.

How you can “change” a layout of a method requires the main method to be inherently deck layout free and therefore no ML_STAR device.

image

Within the main method, you can create a new ML_STAR device using the following HSL Code:

device ML_STAR(t_strDeckLayoutPath,"ML_STAR",hslTrue);

This needs to be within it’s own HSL block (meaning surrounded by {}) and you need call a submethod that has the device ML_STAR as an input variable. Your method must stem from this submethod or series of submethods because the ML_STAR device will be unloaded as soon as the HSL block is done. See below an example of this execution.

image

Since your deck layout is not loaded within the method editor, that means you cannot utilize any deck sequences as there is no deck to pull from. So you would need to create new iterations for deck sequences at run time. This can be done using the HSLDevLib “DevGetSequence” function as long as you know the name of the sequence on the deck.

Due to the complexity of how you must structure your method to accommodate this technique it is more recommended to change out the layout within the method editor using the Instruments and Smart Steps menu as opposed to at run time.

Hopefully this sheds some light on how this could be structured within a method.

6 Likes

Hello @Brandon ,

I am really interested in learning how u r doing this part in HSL? As we have several methods which run this way and will love to solve the problem.

@BrandonBare_Hamilton : thanks for great explanation

Hi @Kalpesh,

It’s more or less how @BrandonBare_Hamilton explained, but just at the beginning of the hsl file and assuming there is a default layout that the method should use. The limitation I ran into is exactly what he described where I was having to duplicate the deck layout and sequences for each instrument and adjust each time.

Sorry if it’s not clear, i can write a more detailed description later.

1 Like

I think you can check the instrument type like daily maintenance, then copy the corresponding deck layout file to layout of method, and call Shell command to run the methods (HxRun.exe -t method_path). In this way, your method should work on two layouts, which means the sequence names of two layout should be the same.

#include "HSLML_STARLib.hsl"
method main()
{
      variable instrumentNr;
      object fso;
      variable layoutFile("");
      instrumentNr = HSLML_STAR::GetInstrumentType(); 
      fso.CreateObject("Scripting.FileSystemObject");    
      // Star IVD
      fso.DeleteFile(layoutFile);
      if (instrumentNr == 0){
         fso.CopyFile("STAR layout",layoutFile);
      }
      else{
         fso.CopyFile("STARlet layout",layoutFile);
      }
     fso.ReleaseObject();
     Shell("C:\\Program Files (x86)\\HAMILTON\\Bin\\HxRun.exe -t \"C:\\Program Files (x86)\\HAMILTON\\Methods\\Test\\Method1.med\"", hslShow, hslAsynchronous);
}

So this was the currently implementation that I tested for it, but again you still need to make sure and update each layout file independently. But now that im thinking about it, is there a way to force both layout files to open when the method is open?

#include "HSLML_STARLib.hsl"

function DetermineLayoutFile() variable
{
   variable instrumentType;
   variable strLayoutFile;
   
   instrumentType = HSLML_STAR::GetInstrumentType();

   if (instrumentType ==0){
      strLayoutFile = "Method_STAR.lay";
      }
   if (instrumentType ==1){
      strLayoutFile = "Method_STARlet.lay";
      }
return(strLayoutFile);
}
#include "Method_STAR.res"
#include "Method_STARlet.res"
global device ML_STAR (DetermineLayoutFile(), "ML_STAR", hslTrue);
1 Like

I think you’d better use the system blank deck layout, add every labware in code (AddLabwareToDeckSite) and generate the sequences in code too. Put all the insrument step like initialization to sub methods (without decklayout), and call these steps with sub methods. I think in this way these will be no deck layout files and no need to handle with two layout files.

But this will be very complex to handle with the sites and child labwares of every loaded labware in code, and you have to use function of DevGetTemplateLabwareNames and DevGetPositionLabwareNameAt in HSLDevLib.

Last, if you changed the method, the hsl file will be generated again automatically, and above codes you added will lost.