Skip to content

Class Mycila::PhaseControlDimmer

ClassList > Mycila > PhaseControlDimmer

  • #include <MycilaDimmerPhaseControl.h>

Inherits the following classes: Mycila::Dimmer

Inherited by the following classes: Mycila::DFRobotDimmer, Mycila::PWMDimmer, Mycila::ThyristorDimmer

Public Functions

Type Name
void enablePowerLUT (bool enable)
Enable or disable the use of power LUT for this phase-control dimmer The power LUT provides a non-linear dimming curve that is more aligned with human perception of brightness. If disabled, a linear dimming curve will be used.
virtual float getPowerRatio () override const
virtual bool isOnline () override const
Returns true if the dimmer is online.
bool isPowerLUTEnabled () const
Check if the power LUT is enabled.
virtual bool setDutyCycle (float dutyCycle) override
Set the power duty, eventually remapped by the power LUT if enabled.
virtual ~PhaseControlDimmer ()

Public Functions inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
virtual bool begin ()
bool calculateHarmonics (float * array, size_t n) const
bool calculateMetrics (Metrics & metrics, float gridVoltage, float loadResistance) const
virtual void end ()
float getDutyCycle () const
Get the power duty cycle configured for the dimmer by the user.
float getDutyCycleFire () const
Get the real firing duty cycle (conduction duty cycle) applied to the dimmer in the range [0, 1].
float getDutyCycleLimit () const
Get the power duty cycle limit of the dimmer.
float getDutyCycleMapped () const
Get the remapped power duty cycle from the currently user set duty cycle.
float getDutyCycleMax () const
Get the remapped "1" of the dimmer duty cycle.
float getDutyCycleMin () const
Get the remapped "0" of the dimmer duty cycle.
virtual float getPowerRatio () const
bool isEnabled () const
Check if the dimmer is enabled (if it was able to initialize correctly)
bool isOff () const
Check if the dimmer is off.
bool isOn () const
Check if the dimmer is on.
bool isOnAtFullPower () const
Check if the dimmer is on at full power.
virtual bool isOnline () const
Returns true if the dimmer is online.
void off ()
Turn off the dimmer.
void on ()
Turn on the dimmer at full power.
virtual bool setDutyCycle (float dutyCycle)
Set the power duty.
void setDutyCycleLimit (float limit)
Set the power duty cycle limit of the dimmer. The duty cycle will be clamped to this limit.
void setDutyCycleMax (float max)
Duty remapping (equivalent to Shelly Dimmer remapping feature). Useful to calibrate the dimmer when using for example a PWM signal to 0-10V analog convertor connected to a voltage regulator which is only working in a specific voltage range like 1-8V.
void setDutyCycleMin (float min)
Duty remapping (equivalent to Shelly Dimmer remapping feature). Useful to calibrate the dimmer when using for example a PWM signal to 0-10V analog convertor connected to a voltage regulator which is only working in a specific voltage range like 1-8V.
void setOnline (bool online)
Set the online status of the dimmer.
virtual const char * type () const
virtual ~Dimmer ()

Public Static Functions inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
uint16_t getSemiPeriod ()
Get the semi-period in us used for the power LUT calculations. If LUT is disabled, returns 0.
void setSemiPeriod (uint16_t semiPeriod)
Set the semi-period of the grid frequency in us for this dimmer. This is mandatory when using power LUT.

Protected Attributes

Type Name
bool _powerLUTEnabled = false

Protected Attributes inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
float _dutyCycle = 0.0f
float _dutyCycleFire = 0.0f
float _dutyCycleLimit = 1.0f
float _dutyCycleMax = 1.0f
float _dutyCycleMin = 0.0f
bool _enabled = false
bool _online = false

Protected Static Attributes inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
uint16_t _semiPeriod = 0

Protected Functions

Type Name
virtual bool _calculateDimmerHarmonics (float * array, size_t n) override const

Protected Functions inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
virtual bool _apply ()
virtual bool _calculateDimmerHarmonics (float * array, size_t n) const

Protected Static Functions

Type Name
uint16_t _lookupFiringDelay (float dutyCycle)

Protected Static Functions inherited from Mycila::Dimmer

See Mycila::Dimmer

Type Name
float _contrain (float amt, float low, float high)

Public Functions Documentation

function enablePowerLUT

Enable or disable the use of power LUT for this phase-control dimmer The power LUT provides a non-linear dimming curve that is more aligned with human perception of brightness. If disabled, a linear dimming curve will be used.

inline void Mycila::PhaseControlDimmer::enablePowerLUT (
    bool enable
) 

Parameters:

  • enable : true to enable, false to disable

function getPowerRatio

inline virtual float Mycila::PhaseControlDimmer::getPowerRatio () override const

Implements Mycila::Dimmer::getPowerRatio


function isOnline

Returns true if the dimmer is online.

inline virtual bool Mycila::PhaseControlDimmer::isOnline () override const

A phase-control dimmer is considered online if it is enabled, marked online, and, if power LUT is enabled, it must have a valid semi-period set.

Implements Mycila::Dimmer::isOnline


function isPowerLUTEnabled

Check if the power LUT is enabled.

inline bool Mycila::PhaseControlDimmer::isPowerLUTEnabled () const


function setDutyCycle

Set the power duty, eventually remapped by the power LUT if enabled.

inline virtual bool Mycila::PhaseControlDimmer::setDutyCycle (
    float dutyCycle
) override

Parameters:

  • dutyCycle the power duty cycle in the range [0.0, 1.0]

Implements Mycila::Dimmer::setDutyCycle


function ~PhaseControlDimmer

inline virtual Mycila::PhaseControlDimmer::~PhaseControlDimmer () 

Protected Attributes Documentation

variable _powerLUTEnabled

bool Mycila::PhaseControlDimmer::_powerLUTEnabled;

Protected Functions Documentation

function _calculateDimmerHarmonics

inline virtual bool Mycila::PhaseControlDimmer::_calculateDimmerHarmonics (
    float * array,
    size_t n
) override const

Implements Mycila::Dimmer::_calculateDimmerHarmonics


Protected Static Functions Documentation

function _lookupFiringDelay

static inline uint16_t Mycila::PhaseControlDimmer::_lookupFiringDelay (
    float dutyCycle
) 


The documentation for this class was generated from the following file src/MycilaDimmerPhaseControl.h