attenuator_classes.h 2.84 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/**
 *     @file attenuator_classes.h
 */

/*
 *     Attenuator Synthesis
 *
 *     From Qucs
 *      Modified for Kicad
 */

#ifndef ATTENUATORFUNC_H
#define ATTENUATORFUNC_H

15
#include <wx/config.h>
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include <wx/bitmap.h>

enum ATTENUATORS_TYPE {
    PI_TYPE,
    TEE_TYPE,
    BRIDGE_TYPE,
    SPLITTER_TYPE
};

class ATTENUATOR
{
protected:
    ATTENUATORS_TYPE m_Topology;
public:
    wxString         m_Name;                // Identifier for config
    int m_ResultCount;                      // Number of value to calculate, and therefore display
    bool             m_Error;               // Set to true if values acnnot be calculated
    double           m_Zin;                 // Impedance of source
    bool             m_Zin_Enable;          // Set to true when impedance of source has meaning
    double           m_Zout;                // Impedance of load
    double           m_Attenuation;         // Attenuation in dB
    bool             m_Attenuation_Enable;  // Set to true when Attenuatiopn has meaning
    double           m_MinimumATT;          // Minimun attenuation in dB from parameters
    double           m_R1;                  // value of R1
    double           m_R2;                  // value of R2
    double           m_R3;                  // value of R3 (if any)
    wxBitmap*        m_SchBitMap;           // The schema of this attenuator
    wxBitmap*        m_FormulaBitMap;       // The formula used to calcualte this attenuator

protected:
    double           Lmin, L, A; // internal variable for temporary use


protected:
50
    // The constructor is protected, because this class is not intended to be instancied
51 52
    ATTENUATOR( ATTENUATORS_TYPE Topology );
public:
53
    virtual ~ATTENUATOR();
54 55 56 57 58 59 60 61 62 63 64 65 66

    /**
     * Function Calculate
     * calculates the values of components in attenuator
     * @return true if ok, false if some values cannot be calculated
     */
    virtual bool Calculate();

    /**
     * Function ReadConfig
     * Read values stored in config for this attenuator
     * @param aConfig = the config to use
     */
67
    void         ReadConfig( wxConfigBase* aConfig );
68 69 70 71 72 73

    /**
     * Function WriteConfig
     * Read values stored in config for this attenuator
     * @param aConfig = the config to use
     */
74
    void         WriteConfig( wxConfigBase* aConfig );
75 76 77 78
};

class ATTENUATOR_PI : public ATTENUATOR
{
79 80 81
public:
    ATTENUATOR_PI();
    ~ATTENUATOR_PI(){};
82 83 84 85 86
    virtual bool Calculate();
};

class ATTENUATOR_TEE : public ATTENUATOR
{
87 88 89
public:
    ATTENUATOR_TEE();
    ~ATTENUATOR_TEE(){};
90 91 92 93 94
    virtual bool Calculate();
};

class ATTENUATOR_BRIDGE : public ATTENUATOR
{
95 96 97
public:
    ATTENUATOR_BRIDGE();
    ~ATTENUATOR_BRIDGE(){};
98 99 100 101 102
    virtual bool Calculate();
};

class ATTENUATOR_SPLITTER : public ATTENUATOR
{
103 104 105
public:
    ATTENUATOR_SPLITTER();
    ~ATTENUATOR_SPLITTER(){};
106 107 108 109
    virtual bool Calculate();
};

#endif  // ATTENUATORFUNC_H