numat / alicat

Python driver and command line tool for Alicat mass flow controllers.
GNU General Public License v2.0
21 stars 27 forks source link

Driver does not support FP-25 air quality monitors #30

Open hairem opened 1 year ago

hairem commented 1 year ago

All I am trying to do is get a reading: from cal import Old_tables from alicat import FlowMeter

flow = FlowMeter(port="/dev/ttyUSB0") value = flow.get() print(str(value)) and I get the error message: Traceback (most recent call last): File "test.py", line 6, in value = flow.get() File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 127, in get for k, v in zip(self.keys, values)} File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 127, in for k, v in zip(self.keys, values)} ValueError: could not convert string to float: '2022-12-01'

alexrudd2 commented 1 year ago

Can you add a print(values) to line 113?

        command = '{addr}\r'.format(addr=self.address)
        line = self._write_and_read(command, retries)
        spl = line.split()
        address, values = spl[0], spl[1:]
      ++print(values)

It looks like this flowmeter may be returning a date, which I haven't seen before. unfortunately, I don't have one at hand to test.

alexrudd2 commented 1 year ago

Also, what's the serial number? Alicat tech support can tell you exactly what that model will output over serial. Sometimes @marinapalese lurks in this repo, also.

hairem commented 1 year ago

Sn: 278608 It's a FP-25BT

On Fri, Dec 2, 2022, 13:23 Alex @.***> wrote:

Also, what's the serial number? Alicat tech support can tell you exactly what that model will output over serial. Sometimes @marinapalese https://github.com/marinapalese lurks in this repo, also.

— Reply to this email directly, view it on GitHub https://github.com/numat/alicat/issues/30#issuecomment-1335856868, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQY2DIFVUNICBEVMJBWEN3WLJSDPANCNFSM6AAAAAASRESRMU . You are receiving this because you authored the thread.Message ID: @.***>

hairem commented 1 year ago

it doesn't support just reading the outputs? isn't it a mass flow meter?

alexrudd2 commented 1 year ago

OK, that's interesting. Didn't even know this device existed! This repository does not support anything other than the M- and MC-series differential pressure flow meters/controllers. I would merge a PR extending to other devices, but cannot provide support for other devices we don't have.

The manual is provided here: https://documents.alicat.com/manuals/Alicat_FP-25_Calibrator_Manual.pdf

Page 42 lists the serial communications format. Screenshot 2022-12-05 at 11 25 21 AM

Note the date/time at the front of the data frame, and pressure source/humidity at the end. Those are what's confusing the existing driver, which does not know about them.

hairem commented 1 year ago

I have been using the serial lines directly before using this library but the putout shifts with time. Thank you for the help.

alexrudd2 commented 1 year ago

I'm sorry I can't help directly. I think you have a couple of options. (1) Fork this repository and extend the functionality yourself, using the manual above. (2) Contact Alicat support - @marinapalese / marina.palese@alicat.com would be my first contact (3) Contact @JosephHickey1 (JosephRHickey@Outlook.com) and ask him about his repository Alicat-Python. I know very little about it but believe the intention was to make a more generalized controller. I do not know his current relationship with Alicat - he used to be employed there but no longer. Perhaps he is available as a contract programmer? (4) Look through the manual and see if there is a way of disabling the "extra" data on the device to avoid confusing the driver as-is. (I see this as unlikely)

I'm happy to review / merge any code generated by the above strategies. Good luck :)

hairem commented 1 year ago

I will probably just make my own library for the project I am working on, was just trying to use what was already available. Or maybe I will do as you suggest and branch this library for my project, it is an in-house script so I have no plans to sell or distribute it.

hairem commented 1 year ago

As for the device, we just ordered these maybe 2 years ago, and are the standard we have in the office. I'm surprised you are unaware of them. Are these some kind of special meters?

hairem commented 1 year ago

After adding the print line I get this now: ['0000000', '2022-12-05', '0010:46:41', '+0755.3', '+0000.5', '+754.86', '+018.72', 'P', '+00.001', '+00.001', '049', 'RHAir'] Traceback (most recent call last): File "/home/pi/.local/bin/alicat", line 10, in sys.exit(run()) File "/home/pi/.local/lib/python3.7/site-packages/alicat/init.py", line 48, in run command_line(args) File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 567, in command_line state = flow_controller.get() File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 390, in get state = FlowMeter.get(self, retries) File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 128, in get for k, v in zip(self.keys, values)} File "/home/pi/.local/lib/python3.7/site-packages/alicat/serial.py", line 128, in for k, v in zip(self.keys, values)} ValueError: could not convert string to float: '2022-12-05'

the string is output but so is the error about it not being formated right PROGRESS!!

alexrudd2 commented 1 year ago

As for the device, we just ordered these maybe 2 years ago, and are the standard we have in the office. I'm surprised you are unaware of them. Are these some kind of special meters?

I don't work for Alicat, we just buy (some of) their equipment. We use another vendor for humidity logging.

hairem commented 1 year ago

Oh, my bad. They linked to you so I thought you worked for them.

hairem commented 1 year ago

I got it to work, somewhat, but commenting out the lines 114-127. now I get "['0000000', '2022-12-05', '0011:32:10', '+0755.1', '+0000.4', '+754.73', '+019.20', 'P', '+00.000', '+00.000', '049', 'RHAir'] None "

alexrudd2 commented 1 year ago

Use the manual (or screenshot I posted above) to update this code: https://github.com/numat/alicat/blob/5cbe7aea6b05ff56d60fdb973833d9e13e0cbf80/alicat/serial.py#L40

JosephHickey1 commented 1 year ago

Pushing a stable version of the Alicat-Python was actually my last hurrah with Alicat but I'm still around and happy to support the library as I can. Bill Nick at Alicat is currently the caretaker for the program though in case issues like this pop up on the future.

As Alex has said, updating the self.keys list to include the time and date information should resolve this. Alternatively, the other library should dynamically retrieve the keys when the program does initialization for the first time for the device.

hairem commented 1 year ago

Again, thank you for all your help.