ngscopeclient 0.1-dev+51fbda87c
RidenPowerSupply.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
36#ifndef RidenPowerSupply_h
37#define RidenPowerSupply_h
38
44 : public virtual SCPIPowerSupply
45 , public virtual ModbusInstrument
46{
47public:
49 virtual ~RidenPowerSupply();
50
51 //Device information
52 virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override;
53
54 //Device capabilities
55 virtual bool SupportsIndividualOutputSwitching() override;
56 virtual bool SupportsVoltageCurrentControl(int chan) override;
57
58 //Read sensors
59 virtual double GetPowerVoltageActual(int chan) override; //actual voltage after current limiting
60 virtual double GetPowerVoltageNominal(int chan) override; //set point
61 virtual double GetPowerCurrentActual(int chan) override; //actual current drawn by the load
62 virtual double GetPowerCurrentNominal(int chan) override; //current limit
63 virtual bool GetPowerChannelActive(int chan) override;
64
65 //Configuration
66 virtual void SetPowerVoltage(int chan, double volts) override;
67 virtual void SetPowerCurrent(int chan, double amps) override;
68 virtual void SetPowerChannelActive(int chan, bool on) override;
69 virtual bool IsPowerConstantCurrent(int chan) override;
70
71protected:
72 enum Registers : uint8_t
73 {
74 REGISTER_MODEL = 0x00,
75 REGISTER_SERIAL = 0x02,
76 REGISTER_FIRMWARE = 0x03,
77
78 REGISTER_TEMP_C = 0x05,
79 REGISTER_TEMP_F = 0x07,
80
81 REGISTER_V_SET = 0x08,
82 REGISTER_I_SET = 0x09,
83 REGISTER_V_OUT = 0x0A,
84 REGISTER_I_OUT = 0x0B,
85
86 REGISTER_WATT = 0x0D,
87 REGISTER_V_INPUT = 0x0E,
88 REGISTER_LOCK = 0x0F,
89 REGISTER_ERROR = 0x10,
90
91 REGISTER_ON_OFF = 0x12
92 };
93
94public:
95 static std::string GetDriverNameInternal();
96 POWER_INITPROC(RidenPowerSupply);
97};
98
99#endif
Base class for instruments using Modbus communication protocol.
Definition: ModbusInstrument.h:44
A Riden RD6006 power supply or other equivalent model.
Definition: RidenPowerSupply.h:46
RidenPowerSupply(SCPITransport *transport)
Initialize the driver.
Definition: RidenPowerSupply.cpp:49
static std::string GetDriverNameInternal()
Return the constant driver name "riden_rd".
Definition: RidenPowerSupply.cpp:77
virtual bool SupportsVoltageCurrentControl(int chan) override
Determines if the power supply supports voltage/current control for the given channel.
Definition: RidenPowerSupply.cpp:95
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: RidenPowerSupply.cpp:82
virtual bool SupportsIndividualOutputSwitching() override
Determines if the power supply supports switching individual output channels.
Definition: RidenPowerSupply.cpp:90
An SCPI-based power supply.
Definition: SCPIPowerSupply.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47