update PCB calculator Zdiff calc. Associated with #9077

adding new messages to the array

increasing the message count

add function and variable declaration

adding main functions

update UI layout to reflect changes
This commit is contained in:
JonRB 2021-09-12 02:40:27 +01:00 committed by J RB
parent a5247471f7
commit bffff6c1bf
8 changed files with 21352 additions and 21272 deletions

View File

@ -886,23 +886,17 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_bmCMicrostripZoddZeven = new wxStaticBitmap( m_panelTransline, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizerHelpBitmaps->Add( m_bmCMicrostripZoddZeven, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10 );
m_fgSizerZcomment = new wxFlexGridSizer( 0, 2, 0, 15 );
m_fgSizerZcomment = new wxFlexGridSizer( 0, 1, 0, 15 );
m_fgSizerZcomment->AddGrowableCol( 0 );
m_fgSizerZcomment->AddGrowableCol( 1 );
m_fgSizerZcomment->SetFlexibleDirection( wxBOTH );
m_fgSizerZcomment->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextZdiff = new wxStaticText( m_panelTransline, wxID_ANY, _("Zdiff = Zodd * 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextZdiff->Wrap( -1 );
m_staticTextZdiff->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgSizerZcomment->Add( m_staticTextZdiff, 0, wxALL, 5 );
m_staticTextZcommon = new wxStaticText( m_panelTransline, wxID_ANY, _("Zcommon = Zeven / 2"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextZcommon = new wxStaticText( m_panelTransline, wxID_ANY, _("Zcommon = Zeven / 2"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER_HORIZONTAL );
m_staticTextZcommon->Wrap( -1 );
m_staticTextZcommon->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgSizerZcomment->Add( m_staticTextZcommon, 0, wxALL, 5 );
m_fgSizerZcomment->Add( m_staticTextZcommon, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
bSizerHelpBitmaps->Add( m_fgSizerZcomment, 0, wxEXPAND, 5 );
@ -1055,7 +1049,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
sbMessagesSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelTransline, wxID_ANY, _("Results") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTranslResults;
fgSizerTranslResults = new wxFlexGridSizer( 7, 2, 0, 0 );
fgSizerTranslResults = new wxFlexGridSizer( 8, 2, 0, 0 );
fgSizerTranslResults->AddGrowableCol( 1 );
fgSizerTranslResults->SetFlexibleDirection( wxBOTH );
fgSizerTranslResults->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
@ -1116,6 +1110,14 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_Message7->Wrap( -1 );
fgSizerTranslResults->Add( m_Message7, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_left_message8 = new wxStaticText( sbMessagesSizer->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_left_message8->Wrap( -1 );
fgSizerTranslResults->Add( m_left_message8, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
m_Message8 = new wxStaticText( sbMessagesSizer->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_Message8->Wrap( -1 );
fgSizerTranslResults->Add( m_Message8, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
sbMessagesSizer->Add( fgSizerTranslResults, 1, wxEXPAND, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -199,7 +199,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
UNIT_SELECTOR_FREQUENCY* m_choiceUnit_Frequency;
wxStaticBitmap* m_bmCMicrostripZoddZeven;
wxFlexGridSizer* m_fgSizerZcomment;
wxStaticText* m_staticTextZdiff;
wxStaticText* m_staticTextZcommon;
wxStaticText* m_phys_prm1_label;
wxTextCtrl* m_Phys_prm1_Value;
@ -239,6 +238,8 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
wxStaticText* m_Message6;
wxStaticText* m_left_message7;
wxStaticText* m_Message7;
wxStaticText* m_left_message8;
wxStaticText* m_Message8;
wxButton* m_buttonTransLineReset;
wxPanel* m_panelViaSize;
wxStaticText* m_staticTextHoleDia;

View File

@ -216,11 +216,11 @@ void PCB_CALCULATOR_FRAME::SetPrmBgColor( enum PRMS_ID aPrmId, const KIGFX::COLO
*/
void PCB_CALCULATOR_FRAME::SetResult( int aLineNumber, const wxString& aText )
{
#define MSG_CNT_MAX 7
#define MSG_CNT_MAX 8
wxStaticText* messages[MSG_CNT_MAX] =
{ m_Message1, m_Message2, m_Message3,
m_Message4, m_Message5, m_Message6,
m_Message7
m_Message7, m_Message8
};
wxASSERT( ( aLineNumber >= 0 ) && ( aLineNumber < MSG_CNT_MAX ) );

View File

@ -48,6 +48,7 @@ C_MICROSTRIP::C_MICROSTRIP() : TRANSLINE(),
s( 0.0 ), // spacing of lines
Z0_e_0( 0.0 ), // static even-mode impedance
Z0_o_0( 0.0 ), // static odd-mode impedance
Zdiff( 0.0), // differential impedance
Z0e( 0.0 ), // even-mode impedance
Z0o( 0.0 ), // odd-mode impedance
c_e( 0.0 ), // even-mode capacitance
@ -595,6 +596,15 @@ void C_MICROSTRIP::line_angle()
}
/*
* diff_impedance() - calculate differential impedance
*/
void C_MICROSTRIP::diff_impedance()
{
Zdiff = 2*Z0_o_0*(1 - 0.48*exp(-0.96*(m_parameters[PHYS_S_PRM] /m_parameters[H_PRM])));
}
void C_MICROSTRIP::syn_err_fun(
double* f1, double* f2, double s_h, double w_h, double e_r, double w_h_se, double w_h_so )
{
@ -815,6 +825,8 @@ void C_MICROSTRIP::calcAnalyze()
attenuation();
/* calculate electrical lengths */
line_angle();
/* calculate diff impedance */
diff_impedance();
}
@ -883,6 +895,7 @@ void C_MICROSTRIP::show_results()
setResult( 5, atten_dielectric_o, "dB" );
setResult( 6, m_parameters[SKIN_DEPTH_PRM] / UNIT_MICRON, "µm" );
setResult( 7, Zdiff, "Ω" );
}

View File

@ -46,6 +46,7 @@ private:
double s; // spacing of lines
double Z0_e_0; // static even-mode impedance
double Z0_o_0; // static odd-mode impedance
double Zdiff; // differential impedance
double Z0e; // even-mode impedance
double Z0o; // odd-mode impedance
double c_e; // even-mode capacitance
@ -79,6 +80,7 @@ private:
void dielectric_losses();
void attenuation();
void line_angle();
void diff_impedance();
void syn_err_fun( double*, double*, double, double, double, double, double );
void synth_width();
void Z0_dispersion();

View File

@ -198,12 +198,12 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType
wxStaticText* left_msg_list[] =
{
m_left_message1, m_left_message2, m_left_message3, m_left_message4, m_left_message5,
m_left_message6, m_left_message7, nullptr
m_left_message6, m_left_message7, m_left_message8, nullptr
};
wxStaticText* msg_list[] =
{
m_Message1, m_Message2, m_Message3, m_Message4, m_Message5, m_Message6, m_Message7, nullptr
m_Message1, m_Message2, m_Message3, m_Message4, m_Message5, m_Message6, m_Message7, m_Message8, nullptr
};
unsigned jj = 0;

View File

@ -306,6 +306,7 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType )
m_Messages.Add( _( "Dielectric losses (even):" ) );
m_Messages.Add( _( "Dielectric losses (odd):" ) );
m_Messages.Add( _( "Skin depth:" ) );
m_Messages.Add( _( "Differential Impedance (Zd):" ) );
AddPrm( new TRANSLINE_PRM( PRM_TYPE_SUBS, H_PRM,
"H", "H", _( "Height of substrate" ), 0.2, true ) );