25extern const char* PsRegulationModesNames[];
28#ifdef PS_SUBSYSTEM_ENABLED
43extern const char* PsStatesNames[];
111 PS_Channel(
float minVolt,
float maxVolt, uint8_t minOvpLevel, uint8_t maxOvpLevel,
float minOvpDelay,
float maxOvpDelay,
float minOcpLevel,
float maxOcpLevel,
float minOcpDelay,
float maxOcpDelay,
float minOppLevel,
float maxOppLevel,
float minOppDelay,
float maxOppDelay);
Containing the base class for all channels.
Containing different defines for device configuration.
Containing the functions to control the MCP492x DACs.
enum PsStates PsStates_t
Available power supply states.
PsRegulationModes
Available power supply regulation modes.
Definition PS_Channel.h:20
@ PS_REG_MODE_FIX
Power supply channel is not regulated (neither constant voltage nor constant current).
Definition PS_Channel.h:21
@ NUM_PS_REG_MODE_ELEMENTS
The last element is used to determine the number of elements in the enumeration.
Definition PS_Channel.h:23
@ PS_REG_MODE_CV
Power supply channel is only constant voltage regulated (not constant current).
Definition PS_Channel.h:22
enum PsRegulationModes PsRegulationModes_t
Available power supply regulation modes.
PsStates
Available power supply states.
Definition PS_Channel.h:35
@ PS_STATE_OCP
Power supply state over current protection.
Definition PS_Channel.h:39
@ NUM_PS_STATE_ELEMENTS
The last element is used to determine the number of elements in the enumeration.
Definition PS_Channel.h:41
@ PS_STATE_OVP
Power supply state over voltage protection.
Definition PS_Channel.h:38
@ PS_STATE_OPP
Power supply state over power protection.
Definition PS_Channel.h:40
@ PS_STATE_OVL
Power supply state overload.
Definition PS_Channel.h:37
@ PS_STATE_CV
Power supply state constant voltage.
Definition PS_Channel.h:36
Channel(ChannelTypes_t channelType)
Constructor of the Channel class.
Definition Channel.h:48
bool SetRegulationMode(PsRegulationModes_t regulationMode)
Set the RegulationMode property of the PS channel.
Definition PS_Channel.cpp:194
static void PSOppLevelChanged(void *channel)
Callback function that can be used for user interface controls modifying the OppLevel property.
Definition PS_Channel.cpp:426
Parameter< float > OppDelay
Time after which the over power protection kicks in.
Definition PS_Channel.h:84
static void PSOvpStateChanged(void *channel)
Callback function that can be used for user interface controls modifying the OvpState property.
Definition PS_Channel.cpp:391
static void PSRegulationModeChanged(void *channel)
Callback function that can be used for user interface controls modifying the RegulationMode property.
Definition PS_Channel.cpp:358
bool SetOvpLevel(uint8_t ovpLevel)
Set the OvpLevel property of the PS channel.
Definition PS_Channel.cpp:232
void ClearProtections()
Clear the protections for the power supply channel and return to the CV state.
Definition PS_Channel.cpp:167
float _setVoltage
Voltage to which the output should be set.
Definition PS_Channel.h:65
static void PSOcpLevelChanged(void *channel)
Callback function that can be used for user interface controls modifying the OcpLevel property.
Definition PS_Channel.cpp:405
Parameter< bool > Enabled
Is the channel enabled or not.
Definition PS_Channel.h:71
Parameter< float > Voltage
Voltage of the power supply channel.
Definition PS_Channel.h:72
volatile uint16_t TimeCounter_OvpDelay_ms
Time counter used to measure how long the channel has an over voltage.
Definition PS_Channel.h:90
volatile PsStates_t PsState
Current state of the power supply channel.
Definition PS_Channel.h:68
bool GetOppState()
Get the OppState property of the PS channel.
Definition PS_Channel.h:277
static void PSOcpDelayChanged(void *channel)
Callback function that can be used for user interface controls modifying the OcpDelay property.
Definition PS_Channel.cpp:419
bool SetOppState(bool oppState)
Set the OppState property of the PS channel.
Definition PS_Channel.cpp:330
Parameter< uint8_t > OvpLevel
OVP trip level in percentage of the Voltage.
Definition PS_Channel.h:75
Parameter< bool > OvpState
Is the over voltage protection for the channel enabled or not.
Definition PS_Channel.h:74
static void PSVoltageChanged(void *channel)
Callback function that can be used for user interface controls modifying the Voltage property.
Definition PS_Channel.cpp:376
bool SetOcpState(bool ocpState)
Set the OcpState property of the PS channel.
Definition PS_Channel.cpp:288
Parameter< float > OcpLevel
OCP trip level in Ampere.
Definition PS_Channel.h:79
bool GetEnabled()
Get the Enabled property of the PS channel.
Definition PS_Channel.h:169
float GetOcpDelay()
Get the OcpDelay property of the PS channel.
Definition PS_Channel.h:253
bool SetOcpLevel(float ocpLevel)
Set the OcpLevel property of the PS channel.
Definition PS_Channel.cpp:274
Parameter< float > OcpDelay
Time after which the over current protection kicks in.
Definition PS_Channel.h:80
static void PSEnabledChanged(void *channel)
Callback function that can be used for user interface controls modifying the Enabled property.
Definition PS_Channel.cpp:366
Parameter< float > OppLevel
OPP trip level in Watt.
Definition PS_Channel.h:83
float GetVoltage()
Get the Voltage property of the PS channel.
Definition PS_Channel.h:181
volatile PsRegulationModes_t RegulationMode
Current regulation mode of the power supply channel.
Definition PS_Channel.h:69
bool IsProtectionActive()
Check if at least one protection is active (OVP, OCP, OPP)
Definition PS_Channel.h:139
PsRegulationModes_t GetRegulationMode()
Get the RegulationMode property of the PS channel.
Definition PS_Channel.h:157
bool SetVoltage(float voltage)
Set the Voltage property of the PS channel.
Definition PS_Channel.cpp:218
void DoRegulationISR()
This method is called periodically based on the device timer ISR (multiples of the device timer perio...
Definition PS_Channel.cpp:61
bool SetOcpDelay(float ocpDelay)
Set the OcpDelay property of the PS channel.
Definition PS_Channel.cpp:302
static void PSOppDelayChanged(void *channel)
Callback function that can be used for user interface controls modifying the OppDelay property.
Definition PS_Channel.cpp:440
PsStates_t GetPsState()
Return the current state of this channel.
Definition PS_Channel.h:145
PS_Channel(float minVolt, float maxVolt, uint8_t minOvpLevel, uint8_t maxOvpLevel, float minOvpDelay, float maxOvpDelay, float minOcpLevel, float maxOcpLevel, float minOcpDelay, float maxOcpDelay, float minOppLevel, float maxOppLevel, float minOppDelay, float maxOppDelay)
Constructor of the PS_Channel.
Definition PS_Channel.cpp:17
volatile float MeasuredVoltage
Measured Voltage for this channel.
Definition PS_Channel.h:86
static void PSOcpStateChanged(void *channel)
Callback function that can be used for user interface controls modifying the OcpState property.
Definition PS_Channel.cpp:412
bool GetOcpState()
Get the OcpState property of the PS channel.
Definition PS_Channel.h:241
bool SetEnabled(bool enabled)
Set the Enabled property of the PS channel.
Definition PS_Channel.cpp:206
void UpdateOutput()
Set the voltage at the output of this channel to the value calculated by the PID regulator if the out...
Definition PS_Channel.cpp:49
float GetOppLevel()
Get the OppLevel property of the PS channel.
Definition PS_Channel.h:265
volatile uint16_t TimeCounter_OcpDelay_ms
Time counter used to measure how long the channel has an over current.
Definition PS_Channel.h:91
uint8_t GetOvpLevel()
Get the OvpLevel property of the PS channel.
Definition PS_Channel.h:193
Parameter< bool > OppState
Is the over power protection for the channel enabled or not.
Definition PS_Channel.h:82
void SwitchOffOutput()
Set the voltage at the output of this channel to zero.
Definition PS_Channel.cpp:44
bool SetOppLevel(float oppLevel)
Set the OppLevel property of the PS channel.
Definition PS_Channel.cpp:316
float GetOppDelay()
Get the OppDelay property of the PS channel.
Definition PS_Channel.h:289
bool SetOvpDelay(float ovpDelay)
Set the OvpDelay property of the PS channel.
Definition PS_Channel.cpp:260
Parameter< float > OvpDelay
Time after which the over voltage protection kicks in.
Definition PS_Channel.h:76
static void PSOvpDelayChanged(void *channel)
Callback function that can be used for user interface controls modifying the OvpDelay property.
Definition PS_Channel.cpp:398
bool SetOvpState(bool ovpState)
Set the OvpState property of the PS channel.
Definition PS_Channel.cpp:246
volatile float MeasuredCurrent
Measured Current for this channel.
Definition PS_Channel.h:87
volatile uint16_t TimeCounter_OppDelay_ms
Time counter used to measure how long the channel has an over power.
Definition PS_Channel.h:92
bool GetOvpState()
Get the OvpState property of the PS channel.
Definition PS_Channel.h:205
bool SetOppDelay(float oppDelay)
Set the OppDelay property of the PS channel.
Definition PS_Channel.cpp:344
float _PIDVoltErrorSum
PID voltage regulator error sum.
Definition PS_Channel.h:63
float GetOcpLevel()
Get the OcpLevel property of the PS channel.
Definition PS_Channel.h:229
static void PSOppStateChanged(void *channel)
Callback function that can be used for user interface controls modifying the OppState property.
Definition PS_Channel.cpp:433
float GetOvpDelay()
Get the OvpDelay property of the PS channel.
Definition PS_Channel.h:217
volatile float MeasuredPower
Measured Power for this channel.
Definition PS_Channel.h:88
float _PIDVoltErrorLast
PID voltage regulator last error.
Definition PS_Channel.h:64
static void PSOvpLevelChanged(void *channel)
Callback function that can be used for user interface controls modifying the OvpLevel property.
Definition PS_Channel.cpp:384
void CheckProtections()
Check if one of the protections for the power supply channel is tripped and update the PsState accord...
Definition PS_Channel.cpp:127
Parameter< bool > OcpState
Is the over current protection for the channel enabled or not.
Definition PS_Channel.h:78
Class used to bundle min, max, default and the current values for parameters.
Definition Parameter.h:17