2011-08-05 19:53:42 +00:00
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* @file attenuator_classes.h
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attenuator Synthesis
|
|
|
|
*
|
|
|
|
* From Qucs
|
2021-06-08 19:39:47 +00:00
|
|
|
* Modified for KiCad
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ATTENUATORFUNC_H
|
|
|
|
#define ATTENUATORFUNC_H
|
|
|
|
|
2021-10-08 14:28:09 +00:00
|
|
|
// Forward declare the bitmaps enum from bitmaps/bitmap_list.h
|
|
|
|
enum class BITMAPS : unsigned int;
|
|
|
|
|
2020-10-13 01:55:32 +00:00
|
|
|
class wxString;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
enum ATTENUATORS_TYPE {
|
|
|
|
PI_TYPE,
|
|
|
|
TEE_TYPE,
|
|
|
|
BRIDGE_TYPE,
|
|
|
|
SPLITTER_TYPE
|
|
|
|
};
|
|
|
|
|
|
|
|
class ATTENUATOR
|
|
|
|
{
|
|
|
|
public:
|
2012-11-12 16:19:10 +00:00
|
|
|
virtual ~ATTENUATOR();
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Calculates the values of components in attenuator.
|
|
|
|
*
|
|
|
|
* @return true if OK, false if some values cannot be calculated.
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
|
|
|
virtual bool Calculate();
|
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Read values stored in config for this attenuator.
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadConfig();
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
/**
|
2021-06-08 19:39:47 +00:00
|
|
|
* Read values stored in config for this attenuator.
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
2020-01-13 01:44:19 +00:00
|
|
|
void WriteConfig();
|
2021-06-08 19:39:47 +00:00
|
|
|
|
|
|
|
protected:
|
Fix source comment/doc typos (follow-up)
Found via `codespell -q 3 -S *.po,./thirdparty -L aactual,acount,aline,alocation,alog,anormal,anumber,aother,apoints,aparent,aray,dout,einstance,modul,ot,overide,serie,te,,tesselate,tesselator,tht`
2021-07-03 22:37:31 +00:00
|
|
|
// The constructor is protected, because this class is not intended to be instantiated.
|
2021-06-08 19:39:47 +00:00
|
|
|
ATTENUATOR( ATTENUATORS_TYPE Topology );
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxString m_Name; // Identifier for configuration.
|
|
|
|
int m_ResultCount; // Number of value to calculate, and therefore display
|
|
|
|
bool m_Error; // Set to true if values cannot 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 Attenuation has meaning
|
|
|
|
double m_MinimumATT; // Minimum 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)
|
2021-10-08 14:28:09 +00:00
|
|
|
BITMAPS m_SchBitmapName; // The schema of this attenuator
|
2021-06-08 19:39:47 +00:00
|
|
|
wxString* m_FormulaName; // The HTML/markdown text name of the formula
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ATTENUATORS_TYPE m_Topology;
|
|
|
|
double Lmin, L, A; // internal variable for temporary use
|
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
|