We are in need of a Custom Test Step which reads all SCPI Instruments (with different VISA Address), where we need to access SCPI Instruments parallely (Open and send a SCPI command).
However the open() method opens up the SCPI instrument one after the other. Is there a way I can open instruments (with different VISA Address) parallely.
For example I tried opening intruments as follows in different tasks assuming there are 3 instruments
var instruments = InstrumentSettings.Current;
if (instruments != null && instruments.Count > 0)
{
var inst1 = instruments[0] as ScpiInstrument;
Task.Run(() =>
{
try
{
MessageBox.Show("1");
inst1.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Log.Error(ex.Message);
}
});
var inst2 = instruments[1] as ScpiInstrument;
Task.Run(() =>
{
try
{
MessageBox.Show("2");
inst2.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Log.Error(ex.Message);
}
});
var inst3 = instruments[2] as ScpiInstrument;
Task.Run(() =>
{
try
{
MessageBox.Show("3");
inst3.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Log.Error(ex.Message);
}
});