38 m_BoardClassUnits( 0 ), m_ColorCodeTolerance( 0 ), m_Electrical(), m_LastPage( 1 ),
39 m_Regulators(), m_cableSize(), m_wavelength(), m_TrackWidth(), m_TransLine(), m_ViaSize()
52 const std::array<std::string, 4> att_names = {
"att_pi",
"att_tee",
53 "att_bridge",
"att_splitter" };
55 for(
const auto& att_name : att_names )
57 std::string
path =
"attenuators." + att_name;
224 const std::array<std::string, 8> transline_names = {
"MicroStrip",
"CoPlanar",
"GrCoPlanar",
225 "RectWaveGuide",
"Coax",
"Coupled_MicroStrip",
"StripLine",
"TwistedPair" };
227 for(
const auto&
name : transline_names )
232 std::string
path =
"trans_line." +
name +
".";
304 ret &= fromLegacy<int>( aCfg,
"BrdClass_selection",
"board_class_units" );
305 ret &= fromLegacy<int>( aCfg,
"CC_selection",
"color_code_tolerance" );
306 ret &= fromLegacy<int>( aCfg,
"Page_selection",
"last_page" );
308 ret &= fromLegacy<int>( aCfg,
"Att_selection",
"attenuators.type" );
311 nlohmann::json::json_pointer ptr =
314 const std::array<std::string, 4> att_names = {
"att_pi",
"att_tee",
315 "att_bridge",
"att_splitter" };
318 for(
const auto& att : att_names )
320 aCfg->SetPath(
"Attenuators/" + att );
321 ptr.push_back( att );
323 if( aCfg->Read(
"Attenuation", &val ) )
324 ( *m_internals )[ptr][
"attenuation"] = val;
326 if( aCfg->Read(
"Zin", &val ) )
327 ( *m_internals )[ptr][
"zin"] = val;
329 if( aCfg->Read(
"Zout", &val ) )
330 ( *m_internals )[ptr][
"zout"] = val;
333 aCfg->SetPath(
"../.." );
337 ret &= fromLegacy<int>( aCfg,
"ElectSpacing_selection",
"electrical.spacing_units" );
338 ret &=
fromLegacyString( aCfg,
"ElectSpacing_voltage",
"electrical.spacing_voltage" );
345 ret &=
fromLegacyString( aCfg,
"RegulName",
"regulators.selected_regulator" );
346 ret &= fromLegacy<int>( aCfg,
"RegulType",
"regulators.type" );
347 ret &= fromLegacy<int>( aCfg,
"RegulLastParam",
"regulators.last_param" );
352 ret &= fromLegacy<int>( aCfg,
"TW_Track_Len_Unit",
"track_width.track_len_units" );
353 ret &=
fromLegacyString( aCfg,
"TW_Resistivity",
"track_width.resistivity" );
354 ret &=
fromLegacyString( aCfg,
"TW_ExtTrack_Width",
"track_width.ext_track_width" );
355 ret &= fromLegacy<int>( aCfg,
"TW_ExtTrack_Width_Unit",
"track_width.ext_track_width_units" );
356 ret &=
fromLegacyString( aCfg,
"TW_ExtTrack_Thickness",
"track_width.ext_track_thickness" );
357 ret &= fromLegacy<int>( aCfg,
"TW_ExtTrack_Thickness_Unit",
358 "track_width.ext_track_thickness_units" );
359 ret &=
fromLegacyString( aCfg,
"TW_IntTrack_Width",
"track_width.int_track_width" );
360 ret &= fromLegacy<int>( aCfg,
"TW_IntTrack_Width_Unit",
"track_width.int_track_width_units" );
361 ret &=
fromLegacyString( aCfg,
"TW_IntTrack_Thickness",
"track_width.int_track_thickness" );
362 ret &= fromLegacy<int>( aCfg,
"TW_IntTrack_Thickness_Unit",
363 "track_width.int_track_thickness_units" );
365 ret &= fromLegacy<int>( aCfg,
"Transline_selection",
"trans_line.selection" );
368 nlohmann::json::json_pointer ptr =
375 const std::array<std::string, 8> transline_names = {
"MicroStrip",
"CoPlanar",
"GrCoPlanar",
376 "RectWaveGuide",
"Coax",
"Coupled_MicroStrip",
"StripLine",
"TwistedPair" };
378 for(
const auto&
name : transline_names )
381 aCfg->SetPath(
name );
382 ptr.push_back(
name );
384 while( aCfg->GetNextEntry( key, index ) )
388 dest.Replace(
"translineprm", wxEmptyString );
390 if( dest.EndsWith(
"unit" ) )
392 dest.Replace(
"unit", wxEmptyString );
393 aCfg->Read( key, &units );
394 ptr.push_back(
"units" );
396 ( *m_internals )[ptr].push_back( { { dest.ToStdString(), units } } );
402 aCfg->Read( key, &value );
403 ptr.push_back(
"values" );
405 ( *m_internals )[ptr].push_back( { { dest.ToStdString(), value } } );
412 aCfg->SetPath(
".." );
417 ret &= fromLegacy<int>( aCfg,
"VS_Hole_Dia_Unit",
"via_size.hole_diameter_units" );
418 ret &=
fromLegacyString( aCfg,
"VS_Plating_Thickness",
"via_size.thickness" );
419 ret &= fromLegacy<int>( aCfg,
"VS_Plating_Thickness_Unit",
"via_size.thickness_units" );
421 ret &= fromLegacy<int>( aCfg,
"VS_Via_Length_Unit",
"via_size.length_units" );
423 ret &= fromLegacy<int>( aCfg,
"VS_Pad_Dia_Unit",
"via_size.pad_diameter_units" );
424 ret &=
fromLegacyString( aCfg,
"VS_Clearance_Dia",
"via_size.clearance_diameter" );
425 ret &= fromLegacy<int>( aCfg,
"VS_Clearance_Dia_Unit",
426 "via_size.clearance_diameter_units" );
428 "via_size.characteristic_impedance" );
429 ret &= fromLegacy<int>( aCfg,
"VS_Characteristic_Impedance_Unit",
430 "via_size.characteristic_impedance_units" );
432 ret &=
fromLegacyString( aCfg,
"VS_Resistivity",
"via_size.plating_resistivity" );
433 ret &=
fromLegacyString( aCfg,
"VS_Permittivity",
"via_size.permittivity" );
434 ret &=
fromLegacyString( aCfg,
"VS_Temperature_Differential",
"via_size.temp_rise" );
435 ret &=
fromLegacyString( aCfg,
"VS_Pulse_Rise_Time",
"via_size.pulse_rise_time" );
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
virtual bool MigrateFromLegacy(wxConfigBase *aCfg) override
Migrates from wxConfig to JSON-based configuration.
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
bool fromLegacyString(wxConfigBase *aConfig, const std::string &aKey, const std::string &aDest)
Translates a legacy wxConfig string value to a given JSON pointer value.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
Represents a map of <std::string, Value>.
std::map< std::string, double > TL_PARAM_MAP
Map of TRANSLINE_PRM id to value.
PCB_CALCULATOR_SETTINGS()
CORROSION_TABLE m_CorrosionTable
TRANSMISSION_LINE m_TransLine
ATTENUATORS m_Attenuators
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
std::map< std::string, int > TL_PARAM_UNITS_MAP
Map of TRANSLINE_PRM id to units selection.
const int pcbCalculatorSchemaVersion
! Update the schema version whenever a migration is required
#define DEFAULT_REGULATOR_RESTOL
#define DEFAULT_REGULATOR_IADJ_MAX
#define DEFAULT_REGULATOR_IADJ_TYP
#define DEFAULT_REGULATOR_R2
#define DEFAULT_REGULATOR_R1
#define DEFAULT_REGULATOR_VREF_TYP
#define DEFAULT_REGULATOR_VREF_MIN
#define DEFAULT_REGULATOR_VREF_MAX
#define DEFAULT_REGULATOR_VOUT_TYP
std::unordered_map< std::string, ATTENUATOR > attenuators
wxString conductorTemperature
wxString conductorMaterialResitivity
wxString conductorThermalCoef
wxString threshold_voltage
double iec60664_RMSvoltage
int iec60664_materialGroup
int iec60664_insulationType
double iec60664_transientOV
double iec60664_ratedVoltage
int iec60664_pollutionDegree
wxString selected_regulator
int int_track_width_units
wxString int_track_thickness
int int_track_thickness_units
int ext_track_thickness_units
int ext_track_width_units
wxString ext_track_thickness
std::map< std::string, TL_PARAM_MAP > param_values
Transline parameters, per transline type.
std::map< std::string, TL_PARAM_UNITS_MAP > param_units
Transline parameter units selections, per transline type.
int characteristic_impedance_units
wxString characteristic_impedance
wxString plating_resistivity
wxString clearance_diameter
int clearance_diameter_units