MycilaJSY 13.0.0
Arduino / ESP32 library for the JSY1031, JSY-MK-163, JSY-MK-193, JSY-MK-194, JSY-MK-227, JSY-MK-229, JSY-MK-333 families single-phase and three-phase AC bidirectional meters from Shenzhen Jiansiyan Technologies Co, Ltd.
Loading...
Searching...
No Matches
Mycila::PhaseControlDimmer Class Reference
Inheritance diagram for Mycila::PhaseControlDimmer:
Collaboration diagram for Mycila::PhaseControlDimmer:

Public Member Functions

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.
bool isPowerLUTEnabled () const
 Check if the power LUT is enabled.
bool isOnline () const override
 Returns true if the dimmer is online.
bool setDutyCycle (float dutyCycle) override
 Set the power duty, eventually remapped by the power LUT if enabled.
float getPowerRatio () const override
Public Member Functions inherited from Mycila::Dimmer
virtual bool begin ()
virtual void end ()
virtual const char * type () const
void setDutyCycleLimit (float limit)
 Set the power duty cycle limit of the dimmer. The duty cycle will be clamped to this limit.
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 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.
float getDutyCycleLimit () const
 Get the power duty cycle limit of the dimmer.
float getDutyCycleMin () const
 Get the remapped "0" of the dimmer duty cycle.
float getDutyCycleMax () const
 Get the remapped "1" of the dimmer duty cycle.
bool isEnabled () const
 Check if the dimmer is enabled (if it was able to initialize correctly).
void setOnline (bool online)
 Set the online status of the dimmer.
void on ()
 Turn on the dimmer at full power.
void off ()
 Turn off the dimmer.
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.
float getDutyCycle () const
 Get the power duty cycle configured for the dimmer by teh user.
float getDutyCycleMapped () const
 Get the remapped power duty cycle from the currently user set duty cycle.
float getDutyCycleFire () const
 Get the real firing duty cycle (conduction duty cycle) applied to the dimmer in the range [0, 1].
bool calculateHarmonics (float *array, size_t n) const
bool calculateMetrics (Metrics &metrics, float gridVoltage, float loadResistance) const

Protected Member Functions

bool _calculateDimmerHarmonics (float *array, size_t n) const override
Protected Member Functions inherited from Mycila::Dimmer
virtual bool _apply ()

Static Protected Member Functions

static uint16_t _lookupFiringDelay (float dutyCycle)
Static Protected Member Functions inherited from Mycila::Dimmer
static float _contrain (float amt, float low, float high)

Protected Attributes

bool _powerLUTEnabled = false
Protected Attributes inherited from Mycila::Dimmer
bool _enabled = false
bool _online = false
float _dutyCycle = 0.0f
float _dutyCycleFire = 0.0f
float _dutyCycleLimit = 1.0f
float _dutyCycleMin = 0.0f
float _dutyCycleMax = 1.0f

Additional Inherited Members

Static Public Member Functions inherited from Mycila::Dimmer
static uint16_t getSemiPeriod ()
 Get the semi-period in us used for the power LUT calculations. If LUT is disabled, returns 0.
static 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.
Static Protected Attributes inherited from Mycila::Dimmer
static uint16_t _semiPeriod = 0

Detailed Description

Definition at line 10 of file MycilaDimmerPhaseControl.h.

Constructor & Destructor Documentation

◆ ~PhaseControlDimmer()

virtual Mycila::PhaseControlDimmer::~PhaseControlDimmer ( )
inlinevirtual

Definition at line 12 of file MycilaDimmerPhaseControl.h.

Member Function Documentation

◆ _calculateDimmerHarmonics()

bool Mycila::PhaseControlDimmer::_calculateDimmerHarmonics ( float * array,
size_t n ) const
inlineoverrideprotectedvirtual

Reimplemented from Mycila::Dimmer.

Definition at line 107 of file MycilaDimmerPhaseControl.h.

◆ _lookupFiringDelay()

uint16_t Mycila::PhaseControlDimmer::_lookupFiringDelay ( float dutyCycle)
staticprotected

Definition at line 42 of file MycilaDimmerPhaseControl.cpp.

◆ enablePowerLUT()

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

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.

Parameters
enable: true to enable, false to disable

Definition at line 24 of file MycilaDimmerPhaseControl.h.

◆ getPowerRatio()

float Mycila::PhaseControlDimmer::getPowerRatio ( ) const
inlineoverridevirtual

Reimplemented from Mycila::Dimmer.

Definition at line 76 of file MycilaDimmerPhaseControl.h.

◆ isOnline()

bool Mycila::PhaseControlDimmer::isOnline ( ) const
inlineoverridevirtual

Returns true if the dimmer is online.

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.

Reimplemented from Mycila::Dimmer.

Definition at line 39 of file MycilaDimmerPhaseControl.h.

◆ isPowerLUTEnabled()

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

Check if the power LUT is enabled.

Definition at line 29 of file MycilaDimmerPhaseControl.h.

◆ setDutyCycle()

bool Mycila::PhaseControlDimmer::setDutyCycle ( float dutyCycle)
inlineoverridevirtual

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

Parameters
dutyCyclethe power duty cycle in the range [0.0, 1.0]

Reimplemented from Mycila::Dimmer.

Definition at line 50 of file MycilaDimmerPhaseControl.h.

Field Documentation

◆ _powerLUTEnabled

bool Mycila::PhaseControlDimmer::_powerLUTEnabled = false
protected

Definition at line 103 of file MycilaDimmerPhaseControl.h.


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