My githup project of SharpHamilton: using C# to control Hamilton STAR

In this forum, I know pyhamilton and PytomatedLiquidHandling, which use python to control STAR line. I also developed a project to control STAR line with C# code. Here I share it, maybe some one can use it for your application.

https://github.com/weihuajiang/SharpHamilton

Different from pyhamilton and PytomatedLiquidHandling, there is no method or hsl file, only one dll file is involved, and venus-styled error handling is also supported.

The programming is simple, you can control STAR with following code

ML_STAR = new STARCommand();
ML_STAR.Init(deck, hwnd, false);
ML_STAR.Start();
ML_STAR.Initialize();
ML_STAR.Channel.PickupTip(tips);
ML_STAR.Channel.Aspirate(samples, 150, aspParam);
ML_STAR.Channel.Dispense(samples, 150, dispParam);
ML_STAR.Channel.EjectTip();
ML_STAR.End();

Venus-styled error handling is supported, and you can do it like following

ErrorRecoveryOptions options = new ErrorRecoveryOptions();
options.Add(MainErrorEnum.InsufficientLiquidError, new ErrorRecoveryOption() { Recovery = RecoveryAction.Bottom });
ML_STAR.Channel.Aspirate(smples, 150, aspParam, AspirateMode.Aspiration, options);

This tool supports simulation, pause/resume, and 3D deck layout display.

And more functions in venus was implemented, including deck layout manipulation, set tip trakcing speed, get last liquid class, computer container volume, anti-droplet control and clot detection with MAD.

6 Likes

Importing the Hamilton DLLs into C# is a very interesting idea

1 Like

Hi,

It looks super cool for many reasons. I will try it next week.
Is it compatible with Venus 5/6 and the vantage line ?

Thank you,

1 Like

I think it is not proper to talk about this, so please delete this post for me, and also I delete the code in github.

We develop this, for we have thousands lines of method/hsl code for STAR and C# code for application, it is a terriable experience to develop and maintan these codes. The application was too complex (app - rpc - COM - method/hsl - COM - device), and peformance is bad for memory usage(x86 app) and rpc problem. One code will simplify the development and maintanence (app - device).

1 Like

Well I still think that it’s an amazing achievement and I hope you and your team are proud

Cheers!

I don’t think it is an achievement, it is only one of several attempts that we did to fix problems with huge method/hsl and C# codes. We did this to prevent our system from becoming legacy code, that no one can work on it. But we did not apply it to our system for workload and risk of replacing method/hsl code.

Lab Automation is not for the weak.

Anything that progresses the state of affairs even slightly is an achievement worth celebrating.

We, as lab auto engineers, have been given the unenviable task of providing solutions to today’s most complex challenges with the worst possible set of tools.

You may not see it as an achievement but it is to me.

Cheers.

2 Likes

Hi, sorry to hear you changed your mind about publicizing this. You’re welcome to edit the original post, or I can do this for you if you’re not sure how to do this. Feel free to private message me if you have any questions or concerns.

I don’t think I follow the reasoning you gave. Even if it’s a suboptimal solution I think a lot of people would learn from the code you shared. If it’s a safety or confidentiality issue, we would certainly prefer you not share code that could cause problems in those areas. Otherwise we want people to learn from each other as much as possible.

5 Likes

I add SharpHamilton to RoslynPad, with which you can write C# script to control Hamilton STAR/STARlet/STARplus. I have tested in venus 4.4, but I think it will ok for venus 6. you can download it from following link RoslynPad. I uploaded this tool to windows store, later you can get it from windows store after approved by store.

For RoslynPad has many modern IDE feature, so write C# script will be easier. Also RoslynPad support nuget, you can get more powerful library from nuget.

4 Likes