2011-08-05 19:53:42 +00:00
|
|
|
/*
|
|
|
|
* transline.h - base for a transmission line class definition
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Stefan Jahn <stefan@lkcc.org>
|
2018-06-07 13:30:35 +00:00
|
|
|
* Modifications 2018 for Kicad: Jean-Pierre Charras
|
2011-08-05 19:53:42 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this package; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TRANSLINE_H
|
|
|
|
#define __TRANSLINE_H
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
#include <gal/color4d.h>
|
|
|
|
|
|
|
|
#define TRANSLINE_OK 0
|
|
|
|
#define TRANSLINE_WARNING 1
|
|
|
|
#define TRANSLINE_ERROR 2
|
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
// IDs for lines parameters used in calculation:
|
|
|
|
// (Used to retrieve these parameters from UI.
|
|
|
|
// DUMMY_PRM is used to skip a param line in dialogs. It is not really a parameter
|
|
|
|
enum PRMS_ID
|
|
|
|
{
|
2020-08-07 00:09:33 +00:00
|
|
|
UNKNOWN_ID = -1,
|
|
|
|
EPSILONR_PRM, // dielectric constant
|
|
|
|
TAND_PRM, // Dielectric Loss Tangent
|
|
|
|
RHO_PRM, // Conductivity of conductor
|
|
|
|
H_PRM, // height of substrate
|
|
|
|
TWISTEDPAIR_TWIST_PRM, // Twists per length
|
2011-08-05 19:53:42 +00:00
|
|
|
H_T_PRM,
|
2020-08-07 00:09:33 +00:00
|
|
|
STRIPLINE_A_PRM, // Stripline : distance from line to top metal
|
|
|
|
T_PRM, // thickness of top metal
|
2011-08-05 19:53:42 +00:00
|
|
|
ROUGH_PRM,
|
2020-08-07 00:09:33 +00:00
|
|
|
MUR_PRM, // magnetic permeability of substrate
|
2011-08-05 19:53:42 +00:00
|
|
|
TWISTEDPAIR_EPSILONR_ENV_PRM,
|
2020-08-07 00:09:33 +00:00
|
|
|
MURC_PRM, // magnetic permeability of conductor
|
|
|
|
FREQUENCY_PRM, // Frequency of operation
|
|
|
|
Z0_PRM, // characteristic impedance
|
2011-08-05 19:53:42 +00:00
|
|
|
Z0_E_PRM,
|
|
|
|
Z0_O_PRM,
|
2020-08-07 00:09:33 +00:00
|
|
|
ANG_L_PRM, // Electrical length in angle
|
2011-08-05 19:53:42 +00:00
|
|
|
PHYS_WIDTH_PRM,
|
2020-08-07 00:09:33 +00:00
|
|
|
PHYS_DIAM_IN_PRM, // Inner diameter of cable
|
|
|
|
PHYS_S_PRM, // width of gap between line and ground
|
|
|
|
PHYS_DIAM_OUT_PRM, // Outer diameter of cable
|
|
|
|
PHYS_LEN_PRM, // Length of cable
|
2011-08-05 19:53:42 +00:00
|
|
|
DUMMY_PRM
|
|
|
|
};
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
|
|
|
|
// IDs for lines parameters used in calculation that are not given by the UI
|
|
|
|
enum EXTRA_PRMS_ID
|
|
|
|
{
|
|
|
|
EXTRA_PRMS_START = DUMMY_PRM - 1,
|
|
|
|
SIGMA_PRM, // Conductivity of the metal
|
|
|
|
SKIN_DEPTH_PRM, // Skin depth
|
|
|
|
LOSS_DIELECTRIC_PRM, // Loss in dielectric (dB)
|
|
|
|
LOSS_CONDUCTOR_PRM, // Loss in conductors (dB)
|
|
|
|
CUTOFF_FREQUENCY_PRM, // Cutoff frequency for higher order modes
|
|
|
|
EPSILON_EFF_PRM, // Effective dielectric constant
|
|
|
|
EXTRA_PRMS_COUNT,
|
|
|
|
};
|
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
class TRANSLINE
|
|
|
|
{
|
2020-08-07 00:09:33 +00:00
|
|
|
public:
|
|
|
|
TRANSLINE();
|
2011-08-05 19:53:42 +00:00
|
|
|
virtual ~TRANSLINE();
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
const char* m_Name;
|
|
|
|
void setProperty( enum PRMS_ID aPrmId, double aValue );
|
|
|
|
double getProperty( enum PRMS_ID aPrmId );
|
|
|
|
|
|
|
|
|
2021-10-10 15:03:24 +00:00
|
|
|
void getProperties();
|
|
|
|
void checkProperties();
|
2020-08-07 00:09:33 +00:00
|
|
|
void setResult( int, double, const char* );
|
|
|
|
void setResult( int, const char* );
|
|
|
|
bool isSelected( enum PRMS_ID aPrmId );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
void Init();
|
|
|
|
virtual void synthesize();
|
2021-10-10 15:03:24 +00:00
|
|
|
virtual void calc() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Computation for analysis
|
2020-08-07 00:09:33 +00:00
|
|
|
*/
|
|
|
|
virtual void calcAnalyze(){};
|
2021-10-10 15:03:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Computation for synthesis
|
2020-08-07 00:09:33 +00:00
|
|
|
**/
|
2021-10-10 15:03:24 +00:00
|
|
|
virtual void calcSynthesize() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows synthesis results and checks for errors / warnings.
|
2020-08-07 00:09:33 +00:00
|
|
|
**/
|
2021-10-10 15:03:24 +00:00
|
|
|
virtual void showAnalyze() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows analysis results and checks for errors / warnings.
|
2020-08-07 00:09:33 +00:00
|
|
|
**/
|
2021-10-10 15:03:24 +00:00
|
|
|
virtual void showSynthesize() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows results
|
2020-08-07 00:09:33 +00:00
|
|
|
**/
|
2021-10-10 15:03:24 +00:00
|
|
|
virtual void show_results() {}
|
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
void analyze();
|
2021-10-10 15:03:24 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
KIGFX::COLOR4D errCol = KIGFX::COLOR4D( 1, 0.63, 0.63, 1 );
|
|
|
|
KIGFX::COLOR4D warnCol = KIGFX::COLOR4D( 1, 1, 0.57, 1 );
|
|
|
|
KIGFX::COLOR4D okCol = KIGFX::COLOR4D( 1, 1, 1, 1 );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
protected:
|
2020-08-07 00:09:33 +00:00
|
|
|
double m_parameters[EXTRA_PRMS_COUNT];
|
2018-06-07 13:18:56 +00:00
|
|
|
|
2020-08-07 00:09:33 +00:00
|
|
|
bool minimizeZ0Error1D( double* );
|
2011-08-05 19:53:42 +00:00
|
|
|
double skin_depth();
|
|
|
|
void ellipke( double, double&, double& );
|
|
|
|
double ellipk( double );
|
2020-08-07 00:09:33 +00:00
|
|
|
void setErrorLevel( PRMS_ID, char );
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __TRANSLINE_H */
|