pcb_calculator: fix a message and Coverity warnings
This commit is contained in:
parent
02e20f1a22
commit
8a1220128b
|
@ -58,8 +58,7 @@ double IEC60664::GetClearanceForRMSVoltage( const double aVRMS, const FIELD aFie
|
|||
switch( aField )
|
||||
{
|
||||
case FIELD::INHOMOGENEOUS:
|
||||
{
|
||||
if( aVRMS <= 0.028 )
|
||||
if( aVRMS <= 0.028 )
|
||||
return 0.001;
|
||||
if( aVRMS <= 0.053 )
|
||||
return 0.002;
|
||||
|
@ -157,9 +156,10 @@ double IEC60664::GetClearanceForRMSVoltage( const double aVRMS, const FIELD aFie
|
|||
return 80.0;
|
||||
if( aVRMS <= 35.4 )
|
||||
return 80.0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FIELD::HOMOGENEOUS:
|
||||
{
|
||||
if( aVRMS <= 0.028 )
|
||||
return 0.001;
|
||||
if( aVRMS <= 0.053 )
|
||||
|
@ -258,13 +258,14 @@ double IEC60664::GetClearanceForRMSVoltage( const double aVRMS, const FIELD aFie
|
|||
return 80.0;
|
||||
if( aVRMS <= 148.5 )
|
||||
return 80.0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
return -1; // Out of range
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,7 +278,6 @@ double IEC60664::GetClearanceToWithstandTransientVoltage( const double
|
|||
switch( aField )
|
||||
{
|
||||
case FIELD::INHOMOGENEOUS:
|
||||
{
|
||||
if( aPD <= POLLUTION_DEGREE::PD1 )
|
||||
{
|
||||
if( aVoltage <= 0.33 )
|
||||
|
@ -345,9 +345,10 @@ double IEC60664::GetClearanceToWithstandTransientVoltage( const double
|
|||
return 130;
|
||||
if( aVoltage <= 100 )
|
||||
return 170;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FIELD::HOMOGENEOUS:
|
||||
{
|
||||
if( aPD <= POLLUTION_DEGREE::PD1 )
|
||||
{
|
||||
if( aVoltage <= 0.33 )
|
||||
|
@ -415,13 +416,14 @@ double IEC60664::GetClearanceToWithstandTransientVoltage( const double
|
|||
return 35;
|
||||
if( aVoltage <= 100 )
|
||||
return 45;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
return -1; // Out of range
|
||||
}
|
||||
|
||||
double IEC60664::GetClearanceToWithstandPeaks( const double aVoltage, const FIELD aField )
|
||||
|
@ -431,7 +433,6 @@ double IEC60664::GetClearanceToWithstandPeaks( const double aVoltage, const FIEL
|
|||
switch( aField )
|
||||
{
|
||||
case FIELD::INHOMOGENEOUS:
|
||||
{
|
||||
if( aVoltage <= 0.04 )
|
||||
return 0.001;
|
||||
if( aVoltage <= 0.06 )
|
||||
|
@ -492,9 +493,10 @@ double IEC60664::GetClearanceToWithstandPeaks( const double aVoltage, const FIEL
|
|||
return 77;
|
||||
if( aVoltage <= 50 )
|
||||
return 100;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FIELD::HOMOGENEOUS:
|
||||
{
|
||||
if( aVoltage <= 0.04 )
|
||||
return 0.001;
|
||||
if( aVoltage <= 0.06 )
|
||||
|
@ -563,10 +565,11 @@ double IEC60664::GetClearanceToWithstandPeaks( const double aVoltage, const FIEL
|
|||
return 35;
|
||||
if( aVoltage <= 100 )
|
||||
return 45;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -579,7 +582,6 @@ double IEC60664::GetRatedImpulseWithstandVoltage()
|
|||
switch( m_overvoltageCat )
|
||||
{
|
||||
case OV_CATEGORY::OV_I:
|
||||
{
|
||||
if( voltage <= 50 )
|
||||
return 330;
|
||||
if( voltage <= 100 )
|
||||
|
@ -596,9 +598,10 @@ double IEC60664::GetRatedImpulseWithstandVoltage()
|
|||
return 4000;
|
||||
if( voltage <= 1500 )
|
||||
return 6000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OV_CATEGORY::OV_II:
|
||||
{
|
||||
if( voltage <= 50 )
|
||||
return 500;
|
||||
if( voltage <= 100 )
|
||||
|
@ -615,10 +618,11 @@ double IEC60664::GetRatedImpulseWithstandVoltage()
|
|||
return 6000;
|
||||
if( voltage <= 1500 )
|
||||
return 8000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OV_CATEGORY::OV_III:
|
||||
{
|
||||
if( voltage <= 50 )
|
||||
if( voltage <= 50 )
|
||||
return 800;
|
||||
if( voltage <= 100 )
|
||||
return 1500;
|
||||
|
@ -634,9 +638,10 @@ double IEC60664::GetRatedImpulseWithstandVoltage()
|
|||
return 8000;
|
||||
if( voltage <= 1500 )
|
||||
return 10000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case OV_CATEGORY::OV_IV:
|
||||
{
|
||||
if( voltage <= 50 )
|
||||
return 1500;
|
||||
if( voltage <= 100 )
|
||||
|
@ -653,13 +658,14 @@ double IEC60664::GetRatedImpulseWithstandVoltage()
|
|||
return 12000;
|
||||
if( voltage <= 1500 )
|
||||
return 15000;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
return -1; // Out of range
|
||||
}
|
||||
|
||||
|
||||
|
@ -1237,14 +1243,16 @@ double IEC60664::ComputeClearanceDistance( const POLLUTION_DEGREE aPD, const FIE
|
|||
const double aAltitude )
|
||||
{
|
||||
// Based on IEC60664-1 : 2020-05 chart G.1
|
||||
double frequency = 50;
|
||||
|
||||
#if 0 // Not handled in IEC60664-1
|
||||
double frequency = 50;
|
||||
bool coatedOrPotted = false;
|
||||
|
||||
if( frequency > 30e3 )
|
||||
return -1; // Requires 60664-3
|
||||
if( coatedOrPotted )
|
||||
return -1; // Requires 60664-4
|
||||
#endif
|
||||
|
||||
double clearance1 = GetClearanceToWithstandTransientVoltage(
|
||||
( m_insulationType == INSULATION_TYPE::REINFORCED ) ? m_transientVoltage * 1.6
|
||||
|
@ -1270,14 +1278,16 @@ double IEC60664::ComputeCreepageDistance( const POLLUTION_DEGREE aPD, const MATE
|
|||
{
|
||||
// Based on IEC60664-1 : 2020-05 chart H.1
|
||||
|
||||
|
||||
#if 0 // Not handled in IEC60664-1
|
||||
double frequency = 50;
|
||||
bool coatedOrPotted = false;
|
||||
|
||||
if( frequency > 30e3 )
|
||||
return -1; // Requires 60664-3
|
||||
|
||||
if( coatedOrPotted )
|
||||
return -1; // Requires 60664-4
|
||||
#endif
|
||||
|
||||
double creepage = GetBasicCreepageDistance( m_RMSvoltage, aPD, aMG );
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <bitmaps.h>
|
||||
|
||||
|
||||
#include <i18n_utility.h> // For _HKI definition in eseries_help.h
|
||||
#include <i18n_utility.h> // For _HKI definition in iec60664_help.h
|
||||
wxString iec60664help =
|
||||
#include "iec60664_help.h"
|
||||
|
||||
|
@ -52,6 +52,8 @@ PANEL_ELECTRICAL_SPACING_IEC60664::PANEL_ELECTRICAL_SPACING_IEC60664(
|
|||
m_panelHelp->SetPage( msg );
|
||||
|
||||
m_creepageclearanceBitmap->SetBitmap( KiBitmap( BITMAPS::creepage_clearance ) );
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,8 +113,6 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::LoadSettings( PCB_CALCULATOR_SETTINGS* a
|
|||
|
||||
void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateTransientImpulse()
|
||||
{
|
||||
wxString string = m_ratedVoltage->GetValue();
|
||||
double value = 0;
|
||||
IEC60664::OV_CATEGORY ovc;
|
||||
|
||||
switch( m_OVCchoice->GetSelection() )
|
||||
|
@ -123,6 +123,9 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateTransientImpulse()
|
|||
default: ovc = IEC60664::OV_CATEGORY::OV_IV; break;
|
||||
}
|
||||
|
||||
wxString string = m_ratedVoltage->GetValue();
|
||||
double value = 0;
|
||||
|
||||
if( string.ToDouble( &value ) )
|
||||
{
|
||||
IEC60664 cal;
|
||||
|
@ -186,8 +189,6 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateClearanceCreepage()
|
|||
&& m_peakVoltage->GetValue().ToDouble( &peakV )
|
||||
&& m_RMSVoltage->GetValue().ToDouble( &RMSV ) )
|
||||
{
|
||||
wxString string;
|
||||
|
||||
IEC60664 cal;
|
||||
cal.SetPollutionDegree( pd );
|
||||
cal.SetMaterialGroup( mg );
|
||||
|
@ -204,7 +205,7 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateClearanceCreepage()
|
|||
double creepage = cal.GetCreepageDistance();
|
||||
double clearange = cal.GetClearanceDistance();
|
||||
|
||||
string = "";
|
||||
wxString string;
|
||||
|
||||
if( groove >= 0 )
|
||||
string << groove;
|
||||
|
@ -213,7 +214,7 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateClearanceCreepage()
|
|||
|
||||
m_minGrooveWidth->SetValue( string );
|
||||
|
||||
string = "";
|
||||
string.Clear();
|
||||
|
||||
if( creepage >= 0 )
|
||||
string << creepage;
|
||||
|
@ -222,7 +223,7 @@ void PANEL_ELECTRICAL_SPACING_IEC60664::CalculateClearanceCreepage()
|
|||
|
||||
m_creepage->SetValue( string );
|
||||
|
||||
string = "";
|
||||
string.Clear();
|
||||
|
||||
if( clearange >= 0 )
|
||||
string << clearange;
|
||||
|
|
|
@ -21,7 +21,7 @@ PANEL_ELECTRICAL_SPACING_IEC60664_BASE::PANEL_ELECTRICAL_SPACING_IEC60664_BASE(
|
|||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_stTitle = new wxStaticText( m_scrolledWindow, wxID_ANY, _("Insulation coordination for equipment within low-voltage supply systems"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_stTitle = new wxStaticText( m_scrolledWindow, wxID_ANY, _("Insulation for equipment within low-voltage supply systems"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_stTitle->Wrap( -1 );
|
||||
m_stTitle->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
|
||||
|
||||
|
@ -163,7 +163,7 @@ PANEL_ELECTRICAL_SPACING_IEC60664_BASE::PANEL_ELECTRICAL_SPACING_IEC60664_BASE(
|
|||
|
||||
fgSizer11->Add( m_staticText112, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
wxString m_insulationTypeChoices[] = { _("Functional"), _("Basic"), _("Reinforced"), wxEmptyString, wxEmptyString };
|
||||
wxString m_insulationTypeChoices[] = { _("Functional"), _("Basic"), _("Reinforced") };
|
||||
int m_insulationTypeNChoices = sizeof( m_insulationTypeChoices ) / sizeof( wxString );
|
||||
m_insulationType = new wxChoice( sbSizerMiddle->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_insulationTypeNChoices, m_insulationTypeChoices, 0 );
|
||||
m_insulationType->SetSelection( 0 );
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Insulation coordination for equipment within low-voltage supply systems</property>
|
||||
<property name="label">Insulation for equipment within low-voltage supply systems</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
@ -1518,7 +1518,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"Functional" "Basic" "Reinforced" "" ""</property>
|
||||
<property name="choices">"Functional" "Basic" "Reinforced"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
|
Loading…
Reference in New Issue