ngscopeclient 0.1-dev+51fbda87c
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
FunctionGenerator Class Referenceabstract

A baseband waveform generator. More...

#include <FunctionGenerator.h>

Inheritance diagram for FunctionGenerator:
Inheritance graph
[legend]
Collaboration diagram for FunctionGenerator:
Collaboration graph
[legend]

Public Types

enum  WaveShape {
  SHAPE_SINE , SHAPE_SQUARE , SHAPE_TRIANGLE , SHAPE_PULSE ,
  SHAPE_DC , SHAPE_NOISE , SHAPE_SAWTOOTH_UP , SHAPE_SAWTOOTH_DOWN ,
  SHAPE_SINC , SHAPE_GAUSSIAN , SHAPE_LORENTZ , SHAPE_HALF_SINE ,
  SHAPE_PRBS_NONSTANDARD , SHAPE_EXPONENTIAL_RISE , SHAPE_EXPONENTIAL_DECAY , SHAPE_HAVERSINE ,
  SHAPE_CARDIAC , SHAPE_STAIRCASE_UP , SHAPE_STAIRCASE_DOWN , SHAPE_STAIRCASE_UP_DOWN ,
  SHAPE_NEGATIVE_PULSE , SHAPE_LOG_RISE , SHAPE_LOG_DECAY , SHAPE_SQUARE_ROOT ,
  SHAPE_CUBE_ROOT , SHAPE_QUADRATIC , SHAPE_CUBIC , SHAPE_DLORENTZ ,
  SHAPE_GAUSSIAN_PULSE , SHAPE_HAMMING , SHAPE_HANNING , SHAPE_KAISER ,
  SHAPE_BLACKMAN , SHAPE_GAUSSIAN_WINDOW , SHAPE_HARRIS , SHAPE_BARTLETT ,
  SHAPE_TAN , SHAPE_COT , SHAPE_SEC , SHAPE_CSC ,
  SHAPE_ASIN , SHAPE_ACOS , SHAPE_ATAN , SHAPE_ACOT ,
  SHAPE_ARB
}
 Predefined waveform shapes.
 
enum  OutputImpedance { IMPEDANCE_HIGH_Z , IMPEDANCE_50_OHM }
 Nominal output impedance for a function generator channel. More...
 
- Public Types inherited from Instrument
enum  InstrumentTypes {
  INST_OSCILLOSCOPE = 0x01 , INST_DMM = 0x02 , INST_PSU = 0x04 , INST_FUNCTION = 0x08 ,
  INST_RF_GEN = 0x10 , INST_LOAD = 0x20 , INST_BERT = 0x40 , INST_MISC = 0x80 ,
  INST_SWITCH_MATRIX = 0x100
}
 

Public Member Functions

virtual bool AcquireData () override
 Pull data from the instrument. More...
 
virtual bool GetFunctionChannelActive (int chan)=0
 Returns true if the function generator channel's output is enabled. More...
 
virtual void SetFunctionChannelActive (int chan, bool on)=0
 Turns a function generator channel on or off. More...
 
virtual bool HasFunctionDutyCycleControls (int chan)
 Determines if the function generator allows control over duty cycles. More...
 
virtual float GetFunctionChannelDutyCycle (int chan)
 Gets the duty cycle for a function generator output. More...
 
virtual void SetFunctionChannelDutyCycle (int chan, float duty)
 Sets the duty cycle for a function generator output. More...
 
virtual float GetFunctionChannelAmplitude (int chan)=0
 Gets the amplitude for a function generator output. More...
 
virtual void SetFunctionChannelAmplitude (int chan, float amplitude)=0
 Sets the amplitude for a function generator output. More...
 
virtual float GetFunctionChannelOffset (int chan)=0
 Gets the DC offset for a function generator output. More...
 
virtual void SetFunctionChannelOffset (int chan, float offset)=0
 Sets the DC offset for a function generator output. More...
 
virtual float GetFunctionChannelFrequency (int chan)=0
 Gets the frequency for a function generator output. More...
 
virtual void SetFunctionChannelFrequency (int chan, float hz)=0
 Sets the frequency for a function generator output. More...
 
virtual WaveShape GetFunctionChannelShape (int chan)=0
 Gets the waveform shape for a function generator output. More...
 
virtual void SetFunctionChannelShape (int chan, WaveShape shape)=0
 Sets the waveform shape for a function generator output. More...
 
virtual float GetFunctionChannelRiseTime (int chan)
 Gets the rise time for a function generator output (if supported) More...
 
virtual void SetFunctionChannelRiseTime (int chan, float fs)
 Sets the rise time for a function generator output (if supported) More...
 
virtual float GetFunctionChannelFallTime (int chan)
 Gets the fall time for a function generator output (if supported) More...
 
virtual void SetFunctionChannelFallTime (int chan, float fs)
 Sets the fall time for a function generator output (if supported) More...
 
virtual bool HasFunctionRiseFallTimeControls (int chan)=0
 Determines if the function generator allows control over rise/fall times. More...
 
virtual bool HasFunctionImpedanceControls (int chan)
 Determines if the function generator allows control over rise/fall times. More...
 
virtual OutputImpedance GetFunctionChannelOutputImpedance (int chan)
 Gets the currently selected output impedance for a function generator output (if supported) More...
 
virtual void SetFunctionChannelOutputImpedance (int chan, OutputImpedance z)
 Sets the currently selected output impedance for a function generator output (if supported) More...
 
virtual std::vector< WaveShapeGetAvailableWaveformShapes (int chan)=0
 Query the set of available pre-defined waveforms for this generator. More...
 
- Public Member Functions inherited from Instrument
virtual unsigned int GetInstrumentTypes () const =0
 Returns a bitfield describing the set of instrument types that this instrument supports. More...
 
virtual std::string GetName () const =0
 
virtual std::string GetVendor () const =0
 
virtual std::string GetSerial () const =0
 
virtual std::string GetTransportConnectionString ()=0
 Gets the connection string for our transport. More...
 
virtual std::string GetTransportName ()=0
 Gets the name of our transport. More...
 
virtual uint32_t GetInstrumentTypesForChannel (size_t i) const =0
 Returns a bitfield describing the set of instrument types that a given channel supports. More...
 
size_t GetChannelCount () const
 Gets the number of channels (of any type) this instrument has.
 
InstrumentChannelGetChannel (size_t i) const
 Gets a given channel on the instrument. More...
 
virtual std::string GetChannelDisplayName (size_t i)
 Gets the hardware display name for a channel. This is an arbitrary user-selected string. More...
 
virtual void SetChannelDisplayName (size_t i, std::string name)
 Sets the hardware display name for a channel. This is an arbitrary user-selected string. More...
 
InstrumentChannelGetChannelByDisplayName (const std::string &name)
 Gets a channel given the display name.
 
InstrumentChannelGetChannelByHwName (const std::string &name)
 Gets a channel given the hardware name.
 
virtual bool AcquireData ()=0
 Pull data from the instrument. More...
 
virtual YAML::Node SerializeConfiguration (IDTable &table) const
 Serializes this instrument's configuration to a YAML node. More...
 
virtual void LoadConfiguration (int version, const YAML::Node &node, IDTable &idmap)
 Load instrument and channel configuration from a save file. More...
 
virtual void PreLoadConfiguration (int version, const YAML::Node &node, IDTable &idmap, ConfigWarningList &warnings)
 Parse a limited subset of instrument configuration but do not apply it. More...
 

Static Public Member Functions

static std::string GetNameOfShape (WaveShape shape)
 Converts a WaveShape enum to a human readable name. More...
 
static WaveShape GetShapeOfName (const std::string &name)
 Converts a human readable name to a WaveShape. More...
 
static std::string GetNameOfImpedance (OutputImpedance imp)
 Converts an OutputImpedance enum to a human readable name. More...
 
static OutputImpedance GetImpedanceOfName (const std::string &name)
 Converts a human readable name to an OutputImpedance. More...
 

Protected Member Functions

void DoSerializeConfiguration (YAML::Node &node, IDTable &table)
 Serializes this instrument's configuration to a YAML node. More...
 
void DoLoadConfiguration (int version, const YAML::Node &node, IDTable &idmap)
 Load instrument and channel configuration from a save file. More...
 
void DoPreLoadConfiguration (int version, const YAML::Node &node, IDTable &idmap, ConfigWarningList &list)
 Validate instrument and channel configuration from a save file. More...
 

Additional Inherited Members

- Public Attributes inherited from Instrument
std::string m_nickname
 Optional user-selected nickname of the instrument. More...
 
- Protected Attributes inherited from Instrument
std::list< sigc::slot< void(YAML::Node &, IDTable &)> > m_serializers
 List of methods which need to be called to serialize this node's configuration.
 
std::list< sigc::slot< void(int, const YAML::Node &, IDTable &)> > m_loaders
 List of methods which need to be called to deserialize this node's configuration.
 
std::list< sigc::slot< void(int, const YAML::Node &, IDTable &, ConfigWarningList &)> > m_preloaders
 List of methods which need to be called to pre-load this node's configuration.
 
std::vector< InstrumentChannel * > m_channels
 Set of all channels on this instrument.
 

Detailed Description

A baseband waveform generator.

Member Enumeration Documentation

◆ OutputImpedance

Nominal output impedance for a function generator channel.

Enumerator
IMPEDANCE_HIGH_Z 

Channel expects to drive a high-impedance load.

IMPEDANCE_50_OHM 

Channel expects to drive a 50-ohm load.

Member Function Documentation

◆ AcquireData()

bool FunctionGenerator::AcquireData ( )
overridevirtual

Pull data from the instrument.

Returns
True if waveform was acquired, false if connection lost or other serious error

Implements Instrument.

Reimplemented in LeCroyFWPOscilloscope, LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, TektronixHSIOscilloscope, and TektronixOscilloscope.

◆ DoLoadConfiguration()

void FunctionGenerator::DoLoadConfiguration ( int  version,
const YAML::Node &  node,
IDTable idmap 
)
protected

Load instrument and channel configuration from a save file.

Parameters
versionFile format version
nodeYAML node for the instrument
idmapMap of object IDs to objects

◆ DoPreLoadConfiguration()

void FunctionGenerator::DoPreLoadConfiguration ( int  version,
const YAML::Node &  node,
IDTable idmap,
ConfigWarningList list 
)
protected

Validate instrument and channel configuration from a save file.

This function is allowed to load low-risk settings that are unlikely to cause damage to an attached DUT, but not increase output amplitude or perform riskier configuration changes.

Parameters
versionFile format version
nodeYAML node for the instrument
idmapMap of object IDs to objects
listWarnings generated during the preload process

◆ DoSerializeConfiguration()

void FunctionGenerator::DoSerializeConfiguration ( YAML::Node &  node,
IDTable table 
)
protected

Serializes this instrument's configuration to a YAML node.

Parameters
nodeOutput YAML node for the instrument
idmapMap of object IDs to objects

◆ GetAvailableWaveformShapes()

virtual std::vector< WaveShape > FunctionGenerator::GetAvailableWaveformShapes ( int  chan)
pure virtual

Query the set of available pre-defined waveforms for this generator.

Parameters
chanChannel index
Returns
Vector of supported WaveShape's

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetFunctionChannelActive()

virtual bool FunctionGenerator::GetFunctionChannelActive ( int  chan)
pure virtual

Returns true if the function generator channel's output is enabled.

Parameters
chanChannel index

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetFunctionChannelAmplitude()

virtual float FunctionGenerator::GetFunctionChannelAmplitude ( int  chan)
pure virtual

Gets the amplitude for a function generator output.

Parameters
chanChannel index
Returns
Amplitude, in Vpp

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetFunctionChannelDutyCycle()

float FunctionGenerator::GetFunctionChannelDutyCycle ( int  chan)
virtual

Gets the duty cycle for a function generator output.

Parameters
chanChannel index
Returns
Duty cycle, in range [0, 1]

Reimplemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

◆ GetFunctionChannelFallTime()

float FunctionGenerator::GetFunctionChannelFallTime ( int  chan)
virtual

Gets the fall time for a function generator output (if supported)

Parameters
chanChannel index
Returns
Fall time, in fs

Reimplemented in LeCroyOscilloscope, and OwonXDGFunctionGenerator.

◆ GetFunctionChannelFrequency()

virtual float FunctionGenerator::GetFunctionChannelFrequency ( int  chan)
pure virtual

Gets the frequency for a function generator output.

Parameters
chanChannel index
Returns
Frequency, in Hz

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetFunctionChannelOffset()

virtual float FunctionGenerator::GetFunctionChannelOffset ( int  chan)
pure virtual

Gets the DC offset for a function generator output.

Parameters
chanChannel index
Returns
Offset, in volts

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetFunctionChannelOutputImpedance()

FunctionGenerator::OutputImpedance FunctionGenerator::GetFunctionChannelOutputImpedance ( int  chan)
virtual

Gets the currently selected output impedance for a function generator output (if supported)

Parameters
chanChannel index
Returns
Output impedance

Reimplemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

◆ GetFunctionChannelRiseTime()

float FunctionGenerator::GetFunctionChannelRiseTime ( int  chan)
virtual

Gets the rise time for a function generator output (if supported)

Parameters
chanChannel index
Returns
Rise time, in fs

Reimplemented in LeCroyOscilloscope, and OwonXDGFunctionGenerator.

◆ GetFunctionChannelShape()

virtual WaveShape FunctionGenerator::GetFunctionChannelShape ( int  chan)
pure virtual

Gets the waveform shape for a function generator output.

Parameters
chanChannel index
Returns
Waveform shape

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ GetImpedanceOfName()

FunctionGenerator::OutputImpedance FunctionGenerator::GetImpedanceOfName ( const std::string &  name)
static

Converts a human readable name to an OutputImpedance.

Parameters
nameInput name
Returns
The OutputImpedance corresponding to that name

◆ GetNameOfImpedance()

string FunctionGenerator::GetNameOfImpedance ( OutputImpedance  imp)
static

Converts an OutputImpedance enum to a human readable name.

Parameters
shapeOutputImpedance value
Returns
String name

◆ GetNameOfShape()

string FunctionGenerator::GetNameOfShape ( WaveShape  shape)
static

Converts a WaveShape enum to a human readable name.

Parameters
shapeInput WaveShape value
Returns
String name

◆ GetShapeOfName()

FunctionGenerator::WaveShape FunctionGenerator::GetShapeOfName ( const std::string &  name)
static

Converts a human readable name to a WaveShape.

Parameters
nameInput name
Returns
The WaveShape corresponding to that name

◆ HasFunctionDutyCycleControls()

bool FunctionGenerator::HasFunctionDutyCycleControls ( int  chan)
virtual

Determines if the function generator allows control over duty cycles.

If this function returns false, GetFunctionChannelDutyCycle() will always return 0.5, and SetFunctionChannelRiseTime() and SetFunctionChannelDutyCycle() is a no-op.

Parameters
chanChannel index
Returns
True if duty cycle control is available, false if unavailable

Reimplemented in RSRTO6Oscilloscope, and SiglentVectorSignalGenerator.

◆ HasFunctionImpedanceControls()

bool FunctionGenerator::HasFunctionImpedanceControls ( int  chan)
virtual

Determines if the function generator allows control over rise/fall times.

If this function returns false, GetFunctionChannelOutputImpedance() will always return IMPEDANCE_50_OHM and SetFunctionChannelOutputImpedance() is a no-op.

Reimplemented in SiglentVectorSignalGenerator.

◆ HasFunctionRiseFallTimeControls()

virtual bool FunctionGenerator::HasFunctionRiseFallTimeControls ( int  chan)
pure virtual

Determines if the function generator allows control over rise/fall times.

If this function returns false, GetFunctionChannelRiseTime() and GetFunctionChannelFallTime() will always return 0, and SetFunctionChannelRiseTime() and SetFunctionChannelFallTime() are no-ops.

Parameters
chanChannel index
Returns
True if rise/fall time control is available, false if unavailable

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ SetFunctionChannelActive()

virtual void FunctionGenerator::SetFunctionChannelActive ( int  chan,
bool  on 
)
pure virtual

Turns a function generator channel on or off.

Parameters
chanChannel index
onTrue to enable output, false to disable

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ SetFunctionChannelAmplitude()

virtual void FunctionGenerator::SetFunctionChannelAmplitude ( int  chan,
float  amplitude 
)
pure virtual

Sets the amplitude for a function generator output.

Parameters
chanChannel index
amplitudeOutput amplitude, in Vpp

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ SetFunctionChannelDutyCycle()

void FunctionGenerator::SetFunctionChannelDutyCycle ( int  chan,
float  duty 
)
virtual

Sets the duty cycle for a function generator output.

Parameters
chanChannel index
dutyDuty cycle, in range [0, 1]

Reimplemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

◆ SetFunctionChannelFallTime()

void FunctionGenerator::SetFunctionChannelFallTime ( int  chan,
float  fs 
)
virtual

Sets the fall time for a function generator output (if supported)

Parameters
chanChannel index
fsFall time, in fs

Reimplemented in LeCroyOscilloscope, and OwonXDGFunctionGenerator.

◆ SetFunctionChannelFrequency()

virtual void FunctionGenerator::SetFunctionChannelFrequency ( int  chan,
float  hz 
)
pure virtual

Sets the frequency for a function generator output.

Parameters
chanChannel index
hzFrequency, in Hz

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ SetFunctionChannelOffset()

virtual void FunctionGenerator::SetFunctionChannelOffset ( int  chan,
float  offset 
)
pure virtual

Sets the DC offset for a function generator output.

Parameters
chanChannel index
amplitudeOffset, in volts

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.

◆ SetFunctionChannelOutputImpedance()

void FunctionGenerator::SetFunctionChannelOutputImpedance ( int  chan,
OutputImpedance  z 
)
virtual

Sets the currently selected output impedance for a function generator output (if supported)

Parameters
chanChannel index
zOutput impedance

Reimplemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, and TektronixOscilloscope.

◆ SetFunctionChannelRiseTime()

void FunctionGenerator::SetFunctionChannelRiseTime ( int  chan,
float  fs 
)
virtual

Sets the rise time for a function generator output (if supported)

Parameters
chanChannel index
fsRise time, in fs

Reimplemented in LeCroyOscilloscope, and OwonXDGFunctionGenerator.

◆ SetFunctionChannelShape()

virtual void FunctionGenerator::SetFunctionChannelShape ( int  chan,
WaveShape  shape 
)
pure virtual

Sets the waveform shape for a function generator output.

Parameters
chanChannel index
shapeDesired output waveform

Implemented in LeCroyOscilloscope, OwonXDGFunctionGenerator, PicoOscilloscope, RigolFunctionGenerator, RSRTO6Oscilloscope, SiglentSCPIOscilloscope, SiglentVectorSignalGenerator, and TektronixOscilloscope.


The documentation for this class was generated from the following files: