-
Notifications
You must be signed in to change notification settings - Fork 9
Instrument Configurations
Having the connections to your instruments hard-coded into your program may be the simplest means of establishings communications. However, if you are building a GUI, you can make full use of the interchangability of different device classes based on type by proving the user with a graphical means to specify the address and instrument driver to use themselves. This can be done using a ConfigGrid
element.
Further to this, extra configuration elements are available for configuring which channels/outputs and settings should be used for both SMU
and TC
instruments.
To create a ConfigGrid
, you need simply instantiate one:
Java
ConfigGrid config = new ConfigGrid("Title");
Python
config = ConfigGrid("Title")
If you have a ConfigStore
object as well, then you can specify it when instantiating so that the configurations stored in the ConfigGrid
are commited to the programs config file and thus will be remembered after quitting and starting again.
Java
ConfigStore store = new ConfigStore("myProgram");
ConfigGrid config = new ConfigGrid("Title", store);
Python
store = ConfigStore("myProgram")
config = ConfigGrid("Title", store)
To add an instrument to the ConfigGrid
, use the addInstrument(...)
method. To do so, you must provide a name for the instrument and the parent class. For example, if I wanted the user to be able to configure any type of SMU
then I would specify SMU.class
in Java or SMU
in Python.
Java
InstrumentConfig<SMU> smu1 = config.addInstrument("SMU 1", SMU.class);
InstrumentConfig<TC> tc1 = config.addInstrument("TC 1", TC.class);
Python
smu1 = config.addInstrument("SMU 1", SMU)
tc1 = config.addInstrument("TC 1", TC)
If we then called
config.show();
we would see:
As we can see, these instrument configurations let us choose which driver class to use for the instrument as well as which address to connect to. The available drivers are determined by which class was specified when adding the instrument. For example, when we specified SMU
as the class for the first one, the choice of drivers was limited to those that descend from SMU
. You can be more restrictive by specifying an individual driver class, meaning the user must connect to a specific make and model of device. For example, if we wrote:
InstrumentConfig<K2450> smu1 = config.addInstrument("SMU 1", K2450.class);
then K2450
would be the only choice in the "Driver" choice-box.
The user can now select which driver and address and upon pressing "Apply", JISA
will attempt to connect to the specified device. The connected instrument can then be retrieved at any time by use of get()
. If nothing has been connected, then this will return null
in Java or None
in Python.
Java
SMU connectedSMU = smu1.get();
TC connectedTC = tc1.get();
if (connectedSMU == null) {
System.out.println("No SMU connected/configured");
}
if (connectedTC == null) {
System.out.println("No TC connected/configured");
Python
connectedSMU = smu1.get()
connectedTC = tc1.get()
if connectedSMU is None:
print("No SMU connected/configured")
if connectedTC is None:
print("No TC connected/configured")
You can programmatically attempt to connected to each instrument (instead of waiting for the user to press "Apply") by use of:
smu1.connect();
tc1.connect();
or get all instruments to connect asynchronously by use of:
config.connectAll();
This is useful if you have a ConfigStore
and want all connections to be automatically established from the stored configurations upon start-up.
Further to simply configuring what make/model of SMU to connect to and where, we can also specify configurations for individual SMU channels based on purpose. For example, let's say we wanted to create a program to perform FET characterisation measurements. We will want to be able to configure which SMU (and SMU channel) will act as source-drain and which one as source-gate.
To do this, the SMUConfig
class exists. This takes all SMU connections defined in a ConfigGrid
and allows the user to then specify which one and, if appropriate, which channel of that instrument should be used for a given purpose, as well as specifying configuration options like voltage and current limits as well as which set of terminals to use.
To create one, instantiate it like so:
// Using all SMU connections from ConfigGrid config
SMUConfig sourceDrain = new SMUConfig("Source-Drain", config);
If we want to store any configuration made using this GUI element to a config store then we need to specify both the store but also a unique identifier for this configuration:
SMUConfig sourceDrain = new SMUConfig("Source-Drain", "sdSMU", store, config);
In the case above, we have told it to store the config into the ConfigStore
object called store
, and save this configuration under the key "sdSMU"
.
Consider the following example:
Java
ConfigGrid config = new ConfigGrid("Connections");
config.addInstrument("SMU 1", SMU.class);
config.addInstrument("SMU 2", SMU.class);
SMUConfig sourceDrain = new SMUConfig("Source-Drain", config);
SMUConfig SourceGate = new SMUConfig("Source-Gate", config);
Grid grid = new Grid("Configurations", sourceDrain, sourceGate);
config.show();
grid.show();
Python
config = ConfigGrid("Connections")
config.addInstrument("SMU 1", SMU)
config.addInstrument("SMU 2", SMU)
sourceDrain = SMUConfig("Source-Drain", config)
sourceGate = SMUConfig("Source-Gate", config)
grid = Grid("Configurations", [sourceDrain, sourceGate])
config.show()
grid.show()
Then we get:
As we can see, these configuration elements allow the user to select which SMU from the ConfigGrid
to use, as well as which channel, set of terminals and limits.
We can then extract an SMU
object from each of these configs that represents the user-selected channel, configured as defined in the config element by use of getSMU()
like so:
Java
SMU sdChannel = sourceDrain.getSMU();
SMU sgChannel = sourceGate.getSMU();
Python
sdChannel = sourceDrain.getSMU()
sgChannel = sourceGate.getSMU()
- Getting Started
- Object Orientation
- Choosing a Language
- Using JISA in Java
- Using JISA in Python
- Using JISA in Kotlin
- Exceptions
- Functions as Objects
- Instrument Basics
- SMUs
- Thermometers (and old TCs)
- PID and Temperature Controllers
- Lock-Ins
- Power Supplies
- Pre-Amplifiers
- Writing New Drivers