53 int m_voltageRangeIndex;
54 std::vector<std::string> m_voltageRangeNames;
56 int m_currentRangeIndex;
57 std::vector<std::string> m_currentRangeNames;
61 float m_committedSetPoint;
62 std::string m_setPoint;
65 : m_loadEnabled(
false)
66 , m_voltageRangeIndex(0)
67 , m_currentRangeIndex(0)
69 , m_committedSetPoint(0)
75 : m_loadEnabled(load->GetLoadActive(chan))
76 , m_mode(load->GetLoadMode(chan))
81 Unit volts(Unit::UNIT_VOLTS);
82 auto vranges = load->GetLoadVoltageRanges(chan);
84 m_voltageRangeNames.push_back(volts.
PrettyPrint(v));
85 m_voltageRangeIndex = load->GetLoadVoltageRange(chan);
88 Unit amps(Unit::UNIT_AMPS);
89 auto iranges = load->GetLoadCurrentRanges(chan);
92 m_currentRangeIndex = load->GetLoadCurrentRange(chan);
103 if(m_load ==
nullptr)
106 m_committedSetPoint = m_load->GetLoadSetPoint(m_chan);
109 Unit volts(Unit::UNIT_VOLTS);
110 Unit amps(Unit::UNIT_AMPS);
111 Unit watts(Unit::UNIT_WATTS);
112 Unit ohms(Unit::UNIT_OHMS);
116 m_setPoint = amps.
PrettyPrint(m_committedSetPoint);
120 m_setPoint = volts.
PrettyPrint(m_committedSetPoint);
124 m_setPoint = watts.
PrettyPrint(m_committedSetPoint);
128 m_setPoint = ohms.
PrettyPrint(m_committedSetPoint);
138 std::shared_ptr<Load> m_load;
145 LoadDialog(std::shared_ptr<SCPILoad> load, std::shared_ptr<LoadState> state,
Session* session);
148 virtual bool DoRender();
150 std::shared_ptr<SCPILoad> GetLoad()
153 void RefreshFromHardware();
174 std::vector<std::future<LoadChannelUIState> > m_futureUIState;
Generic dialog box or other popup window.
Definition: Dialog.h:44
UI state for a single load channel.
Definition: LoadDialog.h:49
void RefreshSetPoint()
Pulls the set point from hardware.
Definition: LoadDialog.h:100
Definition: LoadDialog.h:143
std::shared_ptr< SCPILoad > m_load
The load we're controlling.
Definition: LoadDialog.h:165
void ChannelSettings(size_t channel)
Run settings for a single channel of the load.
Definition: LoadDialog.cpp:162
double m_tstart
Timestamp of when we opened the dialog.
Definition: LoadDialog.h:162
Session * m_session
Session handle so we can remove the load when closed.
Definition: LoadDialog.h:159
std::shared_ptr< LoadState > m_state
Current channel stats, live updated.
Definition: LoadDialog.h:168
std::vector< std::string > m_channelNames
Set of channel names.
Definition: LoadDialog.h:171
std::vector< LoadChannelUIState > m_channelUIState
Channel state for the UI.
Definition: LoadDialog.h:177
LoadMode
Operating modes for the load.
Definition: Load.h:62
@ MODE_CONSTANT_VOLTAGE
Draw as much current as needed for the input voltage to drop to the specified level.
Definition: Load.h:67
@ MODE_CONSTANT_CURRENT
Draw a constant current regardless of supplied voltage.
Definition: Load.h:64
@ MODE_CONSTANT_POWER
Draw a constant power regardless of supplied voltage.
Definition: Load.h:73
@ MODE_CONSTANT_RESISTANCE
Emulate a fixed resistance.
Definition: Load.h:70
A Session stores all of the instrument configuration and other state the user has open.
Definition: Session.h:95
A unit of measurement, plus conversion to pretty-printed output.
Definition: Unit.h:57
std::string PrettyPrint(double value, int sigfigs=-1, bool useDisplayLocale=true) const
Prints a value with SI scaling factors.
Definition: Unit.cpp:587