Confusing Error with pH Washer Initialize (_SendFirmwareCommand) - Solved

I am trying to initialize my pH washer module in simulation mode, but I’m getting an error from _SendFirmwareCommand which is a private function in the washer module .hsl.

2023-02-27 13:38:41> LIBRARY: Hamilton pH Station Washer Module : Initialize -_SendFirmwareCommand - start; i_strCommand = ‘M1OC’, i_strParameter = ‘oc0op"1111"od100’, i_blnSimulationMode = 1, i_intTraceLevel = 2
2023-02-27 13:38:41> SYSTEM : Execute method - error; An error occurred while running Vector. The error description is: C:\Program Files (x86)\HAMILTON\Library\Hamilton pH Module\Hamilton pH Station Washer Module.hsl(1001) : left hand side of expression is not a number (0x23 - 0x2 - 0x4)

This is odd because seemingly none of these parameters are user-defined besides SimulationMode. Could I have selected the wrong name for the washer module in the configuration window? There is no guidance on what the right name would be.

Thank you massively for any help with this confusing error! I’d also be really interested to know if anyone else out there has used the Hamilton pH module and what your experience has been.

@WilliamCham_Hamilton @EricSindelar_Hamilton @NickHealy_Hamilton

Update
See below for the solution! I think this is a bug in the .hsl for the pH module washer

This error also occurs if I select “Check” in the pH module configuration window (ie, the configuration demo method that installs with the pH module). I’m assuming Check means that Venus will try to send an identical firmware command as if it were initializing.

Holy cow I think I fixed it in the washer module .hsl

I had to initialize the o_strErrorCode variable by adding the line:

variable o_strErrorCode("");

in _SendFirmwareCommand where local variables get declared.

The answer to this question got me started on fixing the problem:
https://forums.pylabrobot.org/t/venus-questions/314/38?u=stefan

@Stefan - Thanks for pointing this out, I have seen that style bug crop up in HSL libraries from time to time. Fun fact, while some types of parameters for functions written in method editor (local sub method or SMT function) can have the parameter directions input, in/out, or output, HSL functions only support input and in/out. Unassigned variables in VENUS default to integer value 0 if not otherwise assigned or initialized, so the line of code throwing the exception was probably mad about unmatched variable types for an operation that requires types to be conserved.

What is the most recent version commented in that HSL file’s version history (in the header)?

-Nick

1 Like

Very interesting!

The last version comment is:

//* 2019-10-11 v1.6 BHuf adapted commands to MFX 2.0
//* changed velocity from 1000 to 300

Looks like you are running the most recent. Looking at the HSL, it looks like this error only occurs in simulation (as the code that ultimately will assign a value only gets executed for non-simulated runs).

I will let the driver team know. Thanks.

-Nick

2 Likes