2011-08-05 19:53:42 +00:00
|
|
|
/**
|
|
|
|
* @file attenuator_classes.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attenuator Synthesis
|
|
|
|
*
|
|
|
|
* From Qucs
|
|
|
|
* Modified for Kicad
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ATTENUATORFUNC_H
|
|
|
|
#define ATTENUATORFUNC_H
|
|
|
|
|
2020-10-13 01:55:32 +00:00
|
|
|
class wxBitmap;
|
|
|
|
class wxString;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
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
|
2019-09-29 15:25:56 +00:00
|
|
|
wxString* m_FormulaName; // The HTML/markdown text name of the formula
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
double Lmin, L, A; // internal variable for temporary use
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2012-11-12 16:19:10 +00:00
|
|
|
// The constructor is protected, because this class is not intended to be instancied
|
2011-08-05 19:53:42 +00:00
|
|
|
ATTENUATOR( ATTENUATORS_TYPE Topology );
|
|
|
|
public:
|
2012-11-12 16:19:10 +00:00
|
|
|
virtual ~ATTENUATOR();
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadConfig();
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function WriteConfig
|
|
|
|
* Read values stored in config for this attenuator
|
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void WriteConfig();
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ATTENUATOR_PI : public ATTENUATOR
|
|
|
|
{
|
2012-11-12 16:19:10 +00:00
|
|
|
public:
|
|
|
|
ATTENUATOR_PI();
|
|
|
|
~ATTENUATOR_PI(){};
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool Calculate() override;
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ATTENUATOR_TEE : public ATTENUATOR
|
|
|
|
{
|
2012-11-12 16:19:10 +00:00
|
|
|
public:
|
|
|
|
ATTENUATOR_TEE();
|
|
|
|
~ATTENUATOR_TEE(){};
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool Calculate() override;
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ATTENUATOR_BRIDGE : public ATTENUATOR
|
|
|
|
{
|
2012-11-12 16:19:10 +00:00
|
|
|
public:
|
|
|
|
ATTENUATOR_BRIDGE();
|
|
|
|
~ATTENUATOR_BRIDGE(){};
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool Calculate() override;
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class ATTENUATOR_SPLITTER : public ATTENUATOR
|
|
|
|
{
|
2012-11-12 16:19:10 +00:00
|
|
|
public:
|
|
|
|
ATTENUATOR_SPLITTER();
|
|
|
|
~ATTENUATOR_SPLITTER(){};
|
2016-09-24 18:53:15 +00:00
|
|
|
virtual bool Calculate() override;
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ATTENUATORFUNC_H
|