Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add drivers for SRS SIM928 and Advantech PCIE-1751 #566

Merged
merged 6 commits into from
May 8, 2017

Conversation

antsr
Copy link
Contributor

@antsr antsr commented Apr 10, 2017

Changes proposed in this pull request:

  • add a VisaInstrument driver for Stanford Research Systems SIM928 module inside a SIM900 mainframe
  • add a driver for Advantech PCIE-1751 DIO card that uses cffi for calling methods from the DLL

@giulioungaretti @WilliamHPNielsen

modules = []
for i in range(1,10):
if CTCR & 1 != 0:
modules.append(i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code assumes that if there is a module in the slot, it must be a SIM928, while this is not always the case. Having an additional check here for a SIM928 solves this problem. For example:

model = self.get_idn(i)['model']
if model == 'SIM928:
    modules.append(i)

def get_voltage(self, i):
return float(self.ask_module(i, 'VOLT?'))

def set_smooth(self, voltagedict, equitime=False, verbose=False):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very useful function! We usually give the SIM modules a name, such as top_gate, and then forget about the slot number it is in. Would it make sense for the voltagedict to also allow parameter names as keys? It can then retrieve the corresponding slot?

self.add_parameter('IDN{}'.format(i),
label="IDN of module {}".format(i),
get_cmd=partial(self.get_idn, i))
self.add_parameter('voltage{}'.format(i), unit='V',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually give the modules names, such as top_gate etc. Perhaps a way to also give custom names to the SIM modules would be useful? For instance, an optional kwarg that is a dict with items of the form slot: name?

@nulinspiratie
Copy link
Contributor

Hey @antsr thanks a lot for the PR! We also use the SIM928 voltage sources, and this driver would definitely be useful. I had a few comments, some of them I also addressed in the code.

  • SIM modules are not necessary SIM928, an additional check such as a get_idn would solve this.
  • The ability to give custom names to the voltage parameters would be useful
  • The voltagedict arg in set_smooth uses the slots as keys. As we usually think of the modules in terms of their names, having the possibility to provide the parameter names would be useful.
  • Once a SIM slot is stuck due to an error, a reset command is needed to unfreeze it
  • A way to combine modules into a new parameter would be very useful. We often perform DC scans with these slots which we want to run as fast as possible. If we use the normal CombinedParameter, it will iteratively set each of the modules to the desired parameter. Instead, a combined parameter can send the commands to the different modules in a single GPIB command.

If you want to implement any of this and would like some help, let me know!

Add the option of naming SIM928 modules and properly document the class.
Make minor changes to follow PEP8 style.
@antsr
Copy link
Contributor Author

antsr commented Apr 11, 2017

Hi @nulinspiratie, thanks for the feedback. I think the additions you proposed would indeed be very useful. I added the possibility to name the SIM928 modules -- would such implementation suit your needs? If you could tell me the commands you use to reset the modules reliably, I could easily also add it to the driver.

@nulinspiratie
Copy link
Contributor

Hey @antsr the naming of slots looks good! The reset command for a single slot is SRST {slot_number}, where {slot_number} should be replaced

Copy link
Contributor

@giulioungaretti giulioungaretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you could fix the errors from codacy

from functools import partial
import collections
import os
import logging
Copy link
Contributor

@giulioungaretti giulioungaretti May 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the convetion of

log = logging.getLogger(__name__)  

to get nicer logggin per module!

raise Exception(' '.join(errors + warnings))
return errors + warnings

@classmethod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a static method ?

@giulioungaretti
Copy link
Contributor

@antsr looking good, thanks for the contribution.
After the fixes request land it's ready to merge.

Copy link
Contributor

@giulioungaretti giulioungaretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@antsr
Copy link
Contributor Author

antsr commented May 8, 2017

I left a few unused variables in in the SIM928 driver, where it made sense to have all the status bits named as in the manual. Otherwise I addressed all the change suggestions and codacy issues.

@giulioungaretti
Copy link
Contributor

@antsr yes, good call! Clarity wins in this case!

Merging!

@giulioungaretti giulioungaretti merged commit 9694806 into microsoft:master May 8, 2017
giulioungaretti pushed a commit that referenced this pull request May 8, 2017
Author: Ants Remm <ants.remm@gmail.com>

    driver: add SRS SIM928 and Advantech PCIE-1751 (#566)
@antsr antsr deleted the driver/sim928_pcie1751 branch May 8, 2017 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants