hephy-dd / diode-measurement

IV/CV measurements for silicon sensors.
GNU General Public License v3.0
0 stars 2 forks source link

CLS resets Initialization of Brandbox Switch #104

Closed prakhub closed 3 months ago

prakhub commented 3 months ago

After the initializing the switch

https://github.com/hephy-dd/diode-measurement/blob/ef06b805224ebbf3d82fb0fa0bd57a5ab1c4a9ed/diode_measurement/measurement/__init__.py#L344 The clear state signal is sent to the Switch Box. https://github.com/hephy-dd/diode-measurement/blob/ef06b805224ebbf3d82fb0fa0bd57a5ab1c4a9ed/diode_measurement/measurement/__init__.py#L356 However, maybe unexpectedly, the clear state command also changes the switch states and sets the switchbox to the default I-V mode.

*CLS - Clear status (Relays are set to IV mode)

In the default "I-V" mode, some switches are already closed.

Later, in the configure action, only the switches to be closed are sent as a command: https://github.com/hephy-dd/diode-measurement/blob/ef06b805224ebbf3d82fb0fa0bd57a5ab1c4a9ed/diode_measurement/driver/brandbox.py#L56

This means that the switches which are closed via *CLS are never opened again and the configuration of the switch box is wrong.

prakhub commented 3 months ago

In my opinion, there are two possible fixes:

arnobaer commented 3 months ago

So this is unexpected! Maybe the better option to overcome this behavior would be to explicitly call open_all_channels() in the BrandBox drivers configure() method:

def configure(self, options: dict) -> None:
    self.open_all_channels()
    channels = options.get("channels", [])
    self.close_channels(channels)