Class ScpiPowerSupplyModule
- Namespace
- Loehnert.Lisrt.PowerSupply
- Assembly
- Loehnert.Lisrt.PowerSupply.dll
Represents a power supply controlled via SCPI commands.
public class ScpiPowerSupplyModule : PowerSupplyModuleBase, IHasDeviceLabel, IHasServiceView, IMonitoringPowerSupply, IPowerSupply, ICompositeModule, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
- Inheritance
-
PropertyChangedBaseScpiPowerSupplyModule
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
Examples
This example creates two ScpiPowerSupplyModule instances for a power supply with two outputs.
var serialPort = new SerialPortModule("serialPort") { Encoding = Encoding.ASCII, EndDelimiter = Encoding.ASCII.GetBytes("\r\n") };
var powerSupply1 = ScpiPowerSupplyModule("PowerSupply1", serialPort) { InstrumentNumber = 1 };
var powerSupply2 = ScpiPowerSupplyModule("PowerSupply2", serialPort) { InstrumentNumber = 2 };
Remarks
To use a power supply with multiple outputs, create multiple instances of the ScpiPowerSupplyModule class with the same ICommunication instance. Set the InstrumentNumber of each ScpiPowerSupplyModule instance.
Constructors
ScpiPowerSupplyModule(string, ICommunication)
Initializes a new instance of the ScpiPowerSupplyModule class.
public ScpiPowerSupplyModule(string name, ICommunication communicationPort)
Parameters
name
stringName for the device.
communicationPort
ICommunicationPort for communication with the device.
Remarks
The encoding of the communicationPort
should be ASCII,
and the EndDelimiter should be "\r\n".
Properties
InitializationState
Gets a value indicating whether the object is initialized.
public InitializationState InitializationState { get; }
Property Value
InstrumentNumber
Gets or sets the instrument number.
[Configuration(0, Description = "For only one power supply unit the default value is 0. In case of multiple power supply units, the desired output is selected.")]
public int InstrumentNumber { get; set; }
Property Value
MaximumCurrent
Gets or sets maximum current in ampere.
[Configuration(0, Unit = "A")]
public override double MaximumCurrent { get; set; }
Property Value
MaximumVoltage
Gets or sets maximum voltage in volt.
[Configuration(0, Unit = "V")]
public override double MaximumVoltage { get; set; }
Property Value
ReloadValuesFromDeviceIsActive
Gets or sets a value indicating whether the value setting methods reload the values from the device.
[Configuration(true, Description = "Indicates whether the set point should be read back after a set point change.")]
public bool ReloadValuesFromDeviceIsActive { get; set; }
Property Value
Remarks
Default is false. For example if true, SetpointCurrent sets the value and sets the SetpointCurrent with device value.
SubModules
Gets the sub LisrtModules.
public ILisrtModuleCollection SubModules { get; }
Property Value
Methods
Exit()
De initializes the object.
public void Exit()
Remarks
Sets the voltage to 0V, current to 0A and disables the output.
Initialize()
Initializes the object.
public void Initialize()
MeasureCurrent()
Measures the current.
public double MeasureCurrent()
Returns
- double
The measured current in ampere or 0.0 if disabled.
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
MeasureVoltage()
Measures the voltage.
public double MeasureVoltage()
Returns
- double
The measured voltage in volt or 0.0 if disabled.
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
SetCurrent(double)
Sets the current.
public override void SetCurrent(double current)
Parameters
current
doubleCurrent in ampere to regulate.
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
- ArgumentOutOfRangeException
Thrown when
current
is greater than MaximumCurrent.
SetOutput(bool)
Sets the output.
public override void SetOutput(bool isEnabled)
Parameters
isEnabled
boolState for the output.
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
SetVoltage(double)
Sets the voltage.
public override void SetVoltage(double voltage)
Parameters
voltage
doubleVoltage in volt to regulate.
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
- ArgumentOutOfRangeException
Thrown when
voltage
is greater than MaximumVoltage.
SetVoltageAndCurrent(double, double)
Sets the voltage, current and enables the output.
public override void SetVoltageAndCurrent(double voltage, double current)
Parameters
Exceptions
- NotInitializedException
Thrown when the module is not initialized.
- ArgumentOutOfRangeException
Thrown when
voltage
is greater than MaximumVoltage orcurrent
is greater than MaximumCurrent.