Spice model architecture and Spice Model Editor rework
Description
Currently, Spice models that can be assigned to symbols are described by just 5 strings (stored in fields), aggregated in a plain struct, that are later merely concatenated into Spice commands during netlist export. Each model processed the same way (apart from some if statements). This MR changes the internal architecture to instead store models in objects deriving from a polymorphic SIM_MODEL class, allowing to handle each model differently, in the usual obiect-oriented fashion.
The old models are automatically (on the fly when Spice Model Editor is opened) converted to raw (plaintext) models implemented in a SIM_MODEL_SPICE class (all classes named SIM_MODEL_* derive from SIM_MODEL), preserving the original behavior.
Some device models, primarily semiconductors (which have just too many parameters), are implemented using a generic SIM_MODEL_NGSPICE class that sources its model descriptions (mostly the parameters) from eeschema/sim/ngspice_models.cpp that was mostly automatically extracted from Ngspice with a Bash script.
The remaining models are implemented in SIM_MODEL_BEHAVIORAL (behavioral devices: RLC, voltage sources, current sources), SIM_MODEL_IDEAL (ideal RLC), SIM_MODEL_PASSIVE (non-ideal RLC), SIM_MODEL_SOURCE (voltage and current sources), SIM_MODEL_SUBCKT (Spice subcircuits), SIM_MODEL_TLINE (transmission lines), SIM_MODEL_XSPICE (XSPICE devices, not implemented yet) classes.
The Spice netlist exporter and the Spice Model Editor dialog are completely rewritten to use SIM_MODEL objects.
Minimum Ngspice version is ngspice-37.
Files
New files under the eeschema/ directory:
netlist_exporters/netlist_exporter_spice.{cpp,h}hold the newNETLIST_EXPORTER_SPICEclass that implements the new Spice exporter.eeschema/netlist_exporter/netlist_exporter_pspice.{cpp,h}that contained the old exporter is deleted.dialogs/dialog_sim_model_base.{cpp,h}anddialogs/dialog_sim_model.{cpp,h}hold the new Spice Model Editor dialog,DIALOG_SIM_MODEL.dialogs/dialog_spice_model_base.{cpp,h,fbp}anddialogs/dialog_spice_model_base.{cpp,h,fbp}that contained the old dialog are deleted.sim/ngspice_models.cppholdSIM_MODEL_NGSPICEmodel descriptions, which were automatically extracted from Ngspice.sim/sim_property.{cpp,h}holdSIM_PROPERTY, a subclass ofwxStringProperty, used to display model parameters in Spice Model Editor.sim/sim_library.{cpp,h}hold theSIM_LIBRARYabstract class that represents a model library.sim/sim_library_spice.{cpp,h}holdSIM_LIBRARY_SPICE, an implementation ofSIM_LIBRARY(the only one so far), which represents a Spice netlist file with models.sim/sim_model.{cpp,h}holdSIM_MODEL, the base class for all models.sim/sim_model_*.{cpp,h}hold subclasses ofSIM_MODEL.sim/sim_value.{cpp,h}holdSIM_VALUE(abstract class) and its implementations.sim/spice_grammar.hholds the PEG grammar used to parse Spice netlists.
Some QA tests for the new features are created under the qa/ directory.