HeatingElement.h 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#ifndef HeatingElement_h
#define HeatingElement_h

#include "Arduino.h"

#define HEATING_ELEMENT_DEFAULT_WINDOW_SIZE       1000
#define HEATING_ELEMENT_MAX_WATTAGE               3000.0          // Minimum = 2000.0
#define HEATING_ELEMENT_AC_FREQUENCY_HZ           50.0

//#define HEATING_ELEMENT_MAX_HEAT_PWM_INTEGER      5
//#define HEATING_ELEMENT_MAX_HEAT_PWM_FLOAT        5.0

class HeatingElement
{
  public:
  	HeatingElement( int iOutputPin, int uiOffValue, int uiOnValue );

  	void shutDown();
  	double process();
  	double process( double dWattage );

  	boolean isStatusElement();
  	double getWattage();
  	void setWattage( double dWattage );

  	double getNullWattage();
  	double getOneSixthWattage();
  	double getOneThirdWattage();
  	double getHalfWattage();
  	double getTwoThirdWattage();
  	double getMaxWattage();

  private:

  	double ulWattToWindowTime( double ulAppliedWatts );    
    
    int                     _iOutputPin;
    int                     _uiOffValue;
João Lino's avatar
João Lino committed
39
    int                     _uiOnValue;
40 41 42 43 44 45 46 47
    boolean                 _bStatusElement;
    int                     _iWindowSize;             // Time frame to operate in
    unsigned long           _windowStartTime;
    double                  _dWattPerPulse;
    double                  _dWattage;
};

#endif