diff --git a/qa/data/eeschema/issue12505.kicad_pro b/qa/data/eeschema/issue12505.kicad_pro new file mode 100644 index 0000000000..2c6160f27d --- /dev/null +++ b/qa/data/eeschema/issue12505.kicad_pro @@ -0,0 +1,340 @@ +{ + "board": { + "3dviewports": [], + "design_settings": { + "defaults": { + "board_outline_line_width": 0.1, + "copper_line_width": 0.2, + "copper_text_size_h": 1.5, + "copper_text_size_v": 1.5, + "copper_text_thickness": 0.3, + "other_line_width": 0.15, + "silk_line_width": 0.15, + "silk_text_size_h": 1.0, + "silk_text_size_v": 1.0, + "silk_text_thickness": 0.15 + }, + "diff_pair_dimensions": [], + "drc_exclusions": [], + "rules": { + "min_copper_edge_clearance": 0.0, + "solder_mask_clearance": 0.0, + "solder_mask_min_width": 0.0 + }, + "track_widths": [], + "via_dimensions": [] + }, + "layer_presets": [], + "viewports": [] + }, + "boards": [], + "cvpcb": { + "equivalence_files": [] + }, + "erc": { + "erc_exclusions": [], + "meta": { + "version": 0 + }, + "pin_map": [ + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 2 + ], + [ + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 2, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2 + ], + [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 2 + ], + [ + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 2, + 0, + 0, + 1, + 0, + 2, + 2, + 2, + 2 + ], + [ + 0, + 2, + 0, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 0, + 2, + 1, + 1, + 0, + 0, + 1, + 0, + 2, + 0, + 0, + 2 + ], + [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ] + ], + "rule_severities": { + "bus_definition_conflict": "error", + "bus_entry_needed": "error", + "bus_to_bus_conflict": "error", + "bus_to_net_conflict": "error", + "conflicting_netclasses": "error", + "different_unit_footprint": "error", + "different_unit_net": "error", + "duplicate_reference": "error", + "duplicate_sheet_names": "error", + "endpoint_off_grid": "warning", + "extra_units": "error", + "global_label_dangling": "warning", + "hier_label_mismatch": "error", + "label_dangling": "error", + "lib_symbol_issues": "warning", + "missing_bidi_pin": "warning", + "missing_input_pin": "warning", + "missing_power_pin": "error", + "missing_unit": "warning", + "multiple_net_names": "warning", + "net_not_bus_member": "warning", + "no_connect_connected": "warning", + "no_connect_dangling": "warning", + "pin_not_connected": "error", + "pin_not_driven": "error", + "pin_to_pin": "warning", + "power_pin_not_driven": "error", + "similar_labels": "warning", + "simulation_model_issue": "error", + "unannotated": "error", + "unit_value_mismatch": "error", + "unresolved_variable": "error", + "wire_dangling": "error" + } + }, + "libraries": { + "pinned_footprint_libs": [], + "pinned_symbol_libs": [] + }, + "meta": { + "filename": "Spice_value_substitution_regression.kicad_pro", + "version": 1 + }, + "net_settings": { + "classes": [ + { + "bus_width": 12, + "clearance": 0.2, + "diff_pair_gap": 0.25, + "diff_pair_via_gap": 0.25, + "diff_pair_width": 0.2, + "line_style": 0, + "microvia_diameter": 0.3, + "microvia_drill": 0.1, + "name": "Default", + "pcb_color": "rgba(0, 0, 0, 0.000)", + "schematic_color": "rgba(0, 0, 0, 0.000)", + "track_width": 0.25, + "via_diameter": 0.8, + "via_drill": 0.4, + "wire_width": 6 + } + ], + "meta": { + "version": 3 + }, + "net_colors": null, + "netclass_assignments": null, + "netclass_patterns": [] + }, + "pcbnew": { + "last_paths": { + "gencad": "", + "idf": "", + "netlist": "", + "specctra_dsn": "", + "step": "", + "vrml": "" + }, + "page_layout_descr_file": "" + }, + "schematic": { + "annotate_start_num": 0, + "drawing": { + "dashed_lines_dash_length_ratio": 12.0, + "dashed_lines_gap_length_ratio": 3.0, + "default_line_thickness": 6.0, + "default_text_size": 50.0, + "field_names": [], + "intersheets_ref_own_page": false, + "intersheets_ref_prefix": "", + "intersheets_ref_short": false, + "intersheets_ref_show": false, + "intersheets_ref_suffix": "", + "junction_size_choice": 3, + "label_size_ratio": 0.375, + "pin_symbol_size": 25.0, + "text_offset_ratio": 0.15 + }, + "legacy_lib_dir": "", + "legacy_lib_list": [], + "meta": { + "version": 1 + }, + "net_format_name": "", + "ngspice": { + "fix_include_paths": true, + "meta": { + "version": 0 + }, + "model_mode": 0, + "workbook_filename": "" + }, + "page_layout_descr_file": "", + "plot_directory": "", + "spice_current_sheet_as_root": false, + "spice_external_command": "spice \"%I\"", + "spice_model_current_sheet_as_root": true, + "spice_save_all_currents": false, + "spice_save_all_voltages": false, + "subpart_first_id": 65, + "subpart_id_separator": 0 + }, + "sheets": [ + [ + "a83dad98-6bdf-4131-a8e5-eafd5abfb1e2", + "" + ] + ], + "text_variables": {} +} diff --git a/qa/data/eeschema/issue12505.kicad_sch b/qa/data/eeschema/issue12505.kicad_sch new file mode 100644 index 0000000000..bb65419c1a --- /dev/null +++ b/qa/data/eeschema/issue12505.kicad_sch @@ -0,0 +1,282 @@ +(kicad_sch (version 20230121) (generator eeschema) + + (uuid a83dad98-6bdf-4131-a8e5-eafd5abfb1e2) + + (paper "A4") + + (lib_symbols + (symbol "Device:R" (pin_numbers hide) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "R" (at 2.032 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Value" "R" (at 0 0 90) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at -1.778 0 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "R res resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Resistor" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_fp_filters" "R_*" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "R_0_1" + (rectangle (start -1.016 -2.54) (end 1.016 2.54) + (stroke (width 0.254) (type default)) + (fill (type none)) + ) + ) + (symbol "R_1_1" + (pin passive line (at 0 3.81 270) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -3.81 90) (length 1.27) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + (symbol "Simulation_SPICE:0" (power) (pin_names (offset 0)) (in_bom yes) (on_board yes) + (property "Reference" "#GND" (at 0 -2.54 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "0" (at 0 -1.778 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_keywords" "simulation" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "0V reference potential for simulation" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "0_0_1" + (polyline + (pts + (xy -1.27 0) + (xy 0 -1.27) + (xy 1.27 0) + (xy -1.27 0) + ) + (stroke (width 0) (type default)) + (fill (type none)) + ) + ) + (symbol "0_1_1" + (pin power_in line (at 0 0 0) (length 0) hide + (name "0" (effects (font (size 1.016 1.016)))) + (number "1" (effects (font (size 1.016 1.016)))) + ) + ) + ) + (symbol "Simulation_SPICE:VSIN" (pin_numbers hide) (pin_names (offset 0.0254)) (in_bom yes) (on_board yes) + (property "Reference" "V" (at 2.54 2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "VSIN" (at 2.54 0 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Pins" "1=+ 2=-" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Params" "dc=0 ampl=1 f=1k ac=1" (at 2.54 -2.54 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Sim.Type" "SIN" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Device" "V" (at 0 0 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (property "ki_keywords" "simulation ac vac" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "ki_description" "Voltage source, sinusoidal" (at 0 0 0) + (effects (font (size 1.27 1.27)) hide) + ) + (symbol "VSIN_0_0" + (arc (start 0 0) (mid -0.635 0.6323) (end -1.27 0) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (arc (start 0 0) (mid 0.635 -0.6323) (end 1.27 0) + (stroke (width 0) (type default)) + (fill (type none)) + ) + (text "+" (at 0 1.905 0) + (effects (font (size 1.27 1.27))) + ) + ) + (symbol "VSIN_0_1" + (circle (center 0 0) (radius 2.54) + (stroke (width 0.254) (type default)) + (fill (type background)) + ) + ) + (symbol "VSIN_1_1" + (pin passive line (at 0 5.08 270) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "1" (effects (font (size 1.27 1.27)))) + ) + (pin passive line (at 0 -5.08 90) (length 2.54) + (name "~" (effects (font (size 1.27 1.27)))) + (number "2" (effects (font (size 1.27 1.27)))) + ) + ) + ) + ) + + (junction (at 88.9 88.9) (diameter 0) (color 0 0 0 0) + (uuid 2934c2df-d750-4949-9bb5-2d5234f61386) + ) + + (wire (pts (xy 73.66 88.9) (xy 88.9 88.9)) + (stroke (width 0) (type default)) + (uuid 06af46a6-6f60-4f17-95ae-2a85a89f02a6) + ) + (wire (pts (xy 73.66 85.09) (xy 73.66 88.9)) + (stroke (width 0) (type default)) + (uuid 3994ae78-2922-4b57-9640-0a60aa70de44) + ) + (wire (pts (xy 73.66 74.93) (xy 73.66 77.47)) + (stroke (width 0) (type default)) + (uuid 64862433-7a80-4ff4-8655-18367894528a) + ) + (wire (pts (xy 73.66 74.93) (xy 88.9 74.93)) + (stroke (width 0) (type default)) + (uuid 8d2c5f9b-5bc9-4d6f-9ddd-e2fce9531195) + ) + (wire (pts (xy 88.9 86.36) (xy 88.9 88.9)) + (stroke (width 0) (type default)) + (uuid ac6a6b32-a43c-4495-b132-b2f68491aae2) + ) + (wire (pts (xy 88.9 74.93) (xy 88.9 76.2)) + (stroke (width 0) (type default)) + (uuid ef4780da-ee88-4f68-8d6d-920c658bcaf7) + ) + (wire (pts (xy 88.9 88.9) (xy 88.9 91.44)) + (stroke (width 0) (type default)) + (uuid f145de0f-02ed-4631-85ea-7126ccf81633) + ) + + (text ".param AMPLITUDE = 311" (at 100.33 68.58 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid 635addab-320b-4473-a695-87acbe5b6b13) + ) + (text ".tran 10u 50m" (at 74.93 100.33 0) + (effects (font (size 1.27 1.27)) (justify left bottom)) + (uuid fdf8d8af-7f01-4162-b5a0-310e453d3df9) + ) + + (symbol (lib_id "Simulation_SPICE:VSIN") (at 88.9 81.28 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid 8d070f0b-31df-409a-8ac3-a30f48c45f47) + (property "Reference" "V1" (at 92.71 79.3392 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Value" "VSIN" (at 92.71 81.8792 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Footprint" "" (at 88.9 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 88.9 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Pins" "1=+ 2=-" (at 88.9 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Params" "dc=0 ampl={AMPLITUDE} f=50 td=0 theta=0 ac=1" (at 92.71 84.4192 0) + (effects (font (size 1.27 1.27)) (justify left)) + ) + (property "Sim.Type" "SIN" (at 88.9 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Sim.Device" "V" (at 88.9 81.28 0) + (effects (font (size 1.27 1.27)) (justify left) hide) + ) + (pin "1" (uuid 6928d0d3-5a72-440a-9712-6a5bd7f30d88)) + (pin "2" (uuid 9ccf5512-7159-4bcb-a54f-02505d3593c8)) + (instances + (project "Spice_value_substitution_regression" + (path "/a83dad98-6bdf-4131-a8e5-eafd5abfb1e2" + (reference "V1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Device:R") (at 73.66 81.28 0) (mirror x) (unit 1) + (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced) + (uuid bc97be6a-b1c8-49cd-b524-3bc3b0e7eaba) + (property "Reference" "R1" (at 71.12 80.645 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Value" "R" (at 71.12 83.185 0) + (effects (font (size 1.27 1.27)) (justify right)) + ) + (property "Footprint" "" (at 71.882 81.28 90) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 73.66 81.28 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 9583f53a-330c-4331-8084-d213cdeefc72)) + (pin "2" (uuid c885426e-31db-4b90-a482-8448735e8f3b)) + (instances + (project "Spice_value_substitution_regression" + (path "/a83dad98-6bdf-4131-a8e5-eafd5abfb1e2" + (reference "R1") (unit 1) + ) + ) + ) + ) + + (symbol (lib_id "Simulation_SPICE:0") (at 88.9 91.44 0) (unit 1) + (in_bom yes) (on_board yes) (dnp no) + (uuid db9187b8-77aa-4b3a-9e92-959a7418c546) + (property "Reference" "#GND01" (at 88.9 93.98 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Value" "0" (at 88.9 93.98 0) + (effects (font (size 1.27 1.27))) + ) + (property "Footprint" "" (at 88.9 91.44 0) + (effects (font (size 1.27 1.27)) hide) + ) + (property "Datasheet" "~" (at 88.9 91.44 0) + (effects (font (size 1.27 1.27)) hide) + ) + (pin "1" (uuid 4672061b-800b-4ebc-b5c0-6036660d567a)) + (instances + (project "Spice_value_substitution_regression" + (path "/a83dad98-6bdf-4131-a8e5-eafd5abfb1e2" + (reference "#GND01") (unit 1) + ) + ) + ) + ) + + (sheet_instances + (path "/" (page "1")) + ) +) diff --git a/qa/unittests/eeschema/sim/test_sim_regressions.cpp b/qa/unittests/eeschema/sim/test_sim_regressions.cpp index 7b3352660a..97fe3a174e 100644 --- a/qa/unittests/eeschema/sim/test_sim_regressions.cpp +++ b/qa/unittests/eeschema/sim/test_sim_regressions.cpp @@ -139,4 +139,17 @@ BOOST_FIXTURE_TEST_CASE( DualNMOSAmp, TEST_SIM_REGRESSIONS_FIXTURE ) } +BOOST_FIXTURE_TEST_CASE( VariableSubstitutions, TEST_SIM_REGRESSIONS_FIXTURE ) +{ + LOCALE_IO dummy; + + const MOCK_PGM_BASE& program = static_cast( Pgm() ); + MOCK_EXPECT( program.GetLocalEnvVariables ).returns( ENV_VAR_MAP() ); + + TestNetlist( "issue12505" ); + TestTranPoint( 0.015, { { "V(Net-_R1-Pad2_)", -311 } } ); + TestTranPoint( 0.025, { { "V(Net-_R1-Pad2_)", 311 } } ); +} + + #endif // KICAD_SPICE