You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
5.5 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #ifndef _PCB_CALCULATOR_SETTINGS_H
  24. #define _PCB_CALCULATOR_SETTINGS_H
  25. #include <array>
  26. #include <unordered_map>
  27. #include <settings/app_settings.h>
  28. // Deafult value for TI LM317
  29. #define DEFAULT_REGULATOR_RESTOL "1"
  30. #define DEFAULT_REGULATOR_R1 "0.240"
  31. #define DEFAULT_REGULATOR_R2 "0.720"
  32. #define DEFAULT_REGULATOR_VREF_MIN "1.20"
  33. #define DEFAULT_REGULATOR_VREF_TYP "1.25"
  34. #define DEFAULT_REGULATOR_VREF_MAX "1.30"
  35. #define DEFAULT_REGULATOR_VOUT_TYP "5"
  36. #define DEFAULT_REGULATOR_IADJ_TYP "50"
  37. #define DEFAULT_REGULATOR_IADJ_MAX "100"
  38. class PCB_CALCULATOR_SETTINGS : public APP_SETTINGS_BASE
  39. {
  40. public:
  41. struct ATTENUATOR
  42. {
  43. double attenuation;
  44. double zin;
  45. double zout;
  46. };
  47. struct ATTENUATORS
  48. {
  49. int type;
  50. std::unordered_map<std::string, ATTENUATOR> attenuators;
  51. };
  52. struct ELECTRICAL
  53. {
  54. int spacing_units;
  55. wxString spacing_voltage;
  56. double iec60664_ratedVoltage;
  57. int iec60664_OVC;
  58. double iec60664_RMSvoltage;
  59. double iec60664_transientOV;
  60. double iec60664_peakOV;
  61. int iec60664_insulationType;
  62. int iec60664_pollutionDegree;
  63. int iec60664_materialGroup;
  64. int iec60664_pcbMaterial;
  65. double iec60664_altitude;
  66. };
  67. struct REGULATORS
  68. {
  69. wxString resTol;
  70. wxString r1;
  71. wxString r2;
  72. wxString vrefMin;
  73. wxString vrefTyp;
  74. wxString vrefMax;
  75. wxString voutTyp;
  76. wxString iadjTyp;
  77. wxString iadjMax;
  78. wxString data_file;
  79. wxString selected_regulator;
  80. int type;
  81. int last_param;
  82. };
  83. struct CABLE_SIZE
  84. {
  85. int diameterUnit;
  86. int linResUnit;
  87. int frequencyUnit;
  88. int lengthUnit;
  89. int currentDensityChoice;
  90. wxString conductorMaterialResitivity;
  91. wxString conductorTemperature;
  92. wxString conductorThermalCoef;
  93. };
  94. struct WAVELENGTH
  95. {
  96. double permittivity;
  97. double permeability;
  98. double frequency;
  99. int frequencyUnit;
  100. int periodUnit;
  101. int wavelengthVacuumUnit;
  102. int wavelengthMediumUnit;
  103. int speedUnit;
  104. };
  105. struct TRACK_WIDTH
  106. {
  107. wxString current;
  108. wxString delta_tc;
  109. wxString track_len;
  110. int track_len_units;
  111. wxString resistivity;
  112. wxString ext_track_width;
  113. int ext_track_width_units;
  114. wxString ext_track_thickness;
  115. int ext_track_thickness_units;
  116. wxString int_track_width;
  117. int int_track_width_units;
  118. wxString int_track_thickness;
  119. int int_track_thickness_units;
  120. };
  121. /// Map of TRANSLINE_PRM id to value
  122. typedef std::map<std::string, double> TL_PARAM_MAP;
  123. /// Map of TRANSLINE_PRM id to units selection
  124. typedef std::map<std::string, int> TL_PARAM_UNITS_MAP;
  125. struct TRANSMISSION_LINE
  126. {
  127. int type;
  128. /// Transline parameters, per transline type
  129. std::map<std::string, TL_PARAM_MAP> param_values;
  130. /// Transline parameter units selections, per transline type
  131. std::map<std::string, TL_PARAM_UNITS_MAP> param_units;
  132. };
  133. struct VIA_SIZE
  134. {
  135. wxString hole_diameter;
  136. int hole_diameter_units;
  137. wxString thickness;
  138. int thickness_units;
  139. wxString length;
  140. int length_units;
  141. wxString pad_diameter;
  142. int pad_diameter_units;
  143. wxString clearance_diameter;
  144. int clearance_diameter_units;
  145. wxString characteristic_impedance;
  146. int characteristic_impedance_units;
  147. wxString applied_current;
  148. wxString plating_resistivity;
  149. wxString permittivity;
  150. wxString temp_rise;
  151. wxString pulse_rise_time;
  152. };
  153. struct CORROSION_TABLE
  154. {
  155. wxString threshold_voltage;
  156. bool show_symbols;
  157. };
  158. PCB_CALCULATOR_SETTINGS();
  159. virtual ~PCB_CALCULATOR_SETTINGS() {}
  160. virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
  161. protected:
  162. virtual std::string getLegacyFrameName() const override { return "pcb_calculator"; }
  163. public:
  164. ATTENUATORS m_Attenuators;
  165. int m_BoardClassUnits;
  166. int m_ColorCodeTolerance;
  167. ELECTRICAL m_Electrical;
  168. int m_LastPage;
  169. REGULATORS m_Regulators;
  170. CABLE_SIZE m_cableSize;
  171. WAVELENGTH m_wavelength;
  172. TRACK_WIDTH m_TrackWidth;
  173. TRANSMISSION_LINE m_TransLine;
  174. VIA_SIZE m_ViaSize;
  175. CORROSION_TABLE m_CorrosionTable;
  176. };
  177. #endif