|
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.
|

Data Structures | |
| struct | Metrics |
Public Member Functions | |
| 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. | |
| void | enablePowerLUT (bool enable) |
| Enable or disable the use of power LUT for this 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 | isEnabled () const |
| Check if the dimmer is enabled (if it was able to initialize correctly). | |
| bool | isOnline () const |
| Returns true if the dimmer is online. | |
| 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. | |
| bool | setDutyCycle (float dutyCycle) |
| Set the power duty. | |
| 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 |
| virtual bool | calculateMetrics (Metrics &metrics, float gridVoltage, float loadResistance) const |
Static Public Member Functions | |
| 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. | |
Protected Member Functions | |
| virtual bool | _apply () |
| virtual bool | _calculateHarmonics (float *array, size_t n) const |
Static Protected Member Functions | |
| static uint16_t | _lookupFiringDelay (float dutyCycle, uint16_t semiPeriod) |
| static float | _contrain (float amt, float low, float high) |
| static bool | _calculatePhaseControlHarmonics (float dutyCycleFire, float *array, size_t n) |
| static bool | _calculatePhaseControlMetrics (Metrics &metrics, float dutyCycleFire, float gridVoltage, float loadResistance) |
Protected Attributes | |
| 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 |
| bool | _powerLUTEnabled = false |
Static Protected Attributes | |
| static uint16_t | _semiPeriod = 0 |
Definition at line 22 of file MycilaDimmer.h.
|
inlinevirtual |
Definition at line 35 of file MycilaDimmer.h.
|
inlineprotectedvirtual |
Definition at line 300 of file MycilaDimmer.h.
|
inlineprotectedvirtual |
Definition at line 301 of file MycilaDimmer.h.
|
inlinestaticprotected |
Definition at line 318 of file MycilaDimmer.h.
|
inlinestaticprotected |
Definition at line 357 of file MycilaDimmer.h.
|
inlinestaticprotected |
Definition at line 314 of file MycilaDimmer.h.
|
staticprotected |
Definition at line 44 of file MycilaDimmer.cpp.
|
inlinevirtual |
Reimplemented in Mycila::CycleStealingDimmer, Mycila::DFRobotDimmer, Mycila::PWMDimmer, and Mycila::ThyristorDimmer.
Definition at line 37 of file MycilaDimmer.h.
|
inline |
Definition at line 247 of file MycilaDimmer.h.
|
inlinevirtual |
Definition at line 275 of file MycilaDimmer.h.
|
inline |
Enable or disable the use of power LUT for this 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.
| enable | : true to enable, false to disable |
Definition at line 106 of file MycilaDimmer.h.
|
inlinevirtual |
Reimplemented in Mycila::CycleStealingDimmer, Mycila::DFRobotDimmer, Mycila::PWMDimmer, and Mycila::ThyristorDimmer.
Definition at line 41 of file MycilaDimmer.h.
|
inline |
Get the power duty cycle configured for the dimmer by teh user.
Definition at line 222 of file MycilaDimmer.h.
|
inline |
Get the real firing duty cycle (conduction duty cycle) applied to the dimmer in the range [0, 1].
Definition at line 237 of file MycilaDimmer.h.
|
inline |
Get the power duty cycle limit of the dimmer.
Definition at line 84 of file MycilaDimmer.h.
|
inline |
Get the remapped power duty cycle from the currently user set duty cycle.
Definition at line 227 of file MycilaDimmer.h.
|
inline |
Get the remapped "1" of the dimmer duty cycle.
Definition at line 94 of file MycilaDimmer.h.
|
inline |
Get the remapped "0" of the dimmer duty cycle.
Definition at line 89 of file MycilaDimmer.h.
|
inlinestatic |
Get the semi-period in us used for the power LUT calculations. If LUT is disabled, returns 0.
Definition at line 120 of file MycilaDimmer.h.
|
inline |
Check if the dimmer is enabled (if it was able to initialize correctly).
Definition at line 136 of file MycilaDimmer.h.
|
inline |
Check if the dimmer is off.
Definition at line 176 of file MycilaDimmer.h.
|
inline |
Check if the dimmer is on.
Definition at line 181 of file MycilaDimmer.h.
|
inline |
Check if the dimmer is on at full power.
Definition at line 186 of file MycilaDimmer.h.
|
inline |
Returns true if the dimmer is online.
A dimmer is considered online if it is enabled, marked online, and, if power LUT is enabled, it must have a valid semi-period set.
Definition at line 142 of file MycilaDimmer.h.
|
inline |
Check if the power LUT is enabled.
Definition at line 111 of file MycilaDimmer.h.
|
inline |
Turn off the dimmer.
Definition at line 171 of file MycilaDimmer.h.
|
inline |
Turn on the dimmer at full power.
Definition at line 166 of file MycilaDimmer.h.
|
inline |
Set the power duty.
| dutyCycle | the power duty cycle in the range [0.0, 1.0] |
Definition at line 193 of file MycilaDimmer.h.
|
inline |
Set the power duty cycle limit of the dimmer. The duty cycle will be clamped to this limit.
| limit | the power duty cycle limit in the range [0.0, 1.0] |
Definition at line 53 of file MycilaDimmer.h.
|
inline |
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.
| max | Set the new "1" value for the power duty cycle. The duty cycle in the range [0.0, 1.0] will be remapped to [min, max]. |
Definition at line 76 of file MycilaDimmer.h.
|
inline |
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.
| min | Set the new "0" value for the power duty cycle. The duty cycle in the range [0.0, 1.0] will be remapped to [min, max]. |
Definition at line 65 of file MycilaDimmer.h.
|
inline |
Set the online status of the dimmer.
This flag can be used to temporarily disable the dimmer when not connected to the grid
Definition at line 148 of file MycilaDimmer.h.
|
inlinestatic |
Set the semi-period of the grid frequency in us for this dimmer. This is mandatory when using power LUT.
Typical values are 10000 for 50Hz and 8333 for 60Hz.
The value can also come from MycilaPulseAnalyzer
Definition at line 127 of file MycilaDimmer.h.
|
inlinevirtual |
Definition at line 42 of file MycilaDimmer.h.
|
protected |
Definition at line 290 of file MycilaDimmer.h.
|
protected |
Definition at line 291 of file MycilaDimmer.h.
|
protected |
Definition at line 292 of file MycilaDimmer.h.
|
protected |
Definition at line 294 of file MycilaDimmer.h.
|
protected |
Definition at line 293 of file MycilaDimmer.h.
|
protected |
Definition at line 287 of file MycilaDimmer.h.
|
protected |
Definition at line 288 of file MycilaDimmer.h.
|
protected |
Definition at line 296 of file MycilaDimmer.h.
|
staticprotected |
Definition at line 298 of file MycilaDimmer.h.