README.md 5.72 KB

The TEST_CASES directory contains a number of test cases which are designed to test the functionality of the Spice cable model buliding project.

The script generate_spice_cable_bundle_model automatically generates spice cable bundle models, validation test circuits and analytic results for multi-conductor cable test cases. The Spice model results are plotted against the analytic solution for both frequency domain and transient analyses. The process also calculates a figure of merit for the model based on the difference between the analytic and spice model data using the code 'compare_results'.

In order to run the test cases you will need the following to be installed: ngspice gnuplopt

The script may need to be changed for your system. It is set up by default to work with a library of cable models in the TEST_CASES directory. This may be changed to suit the user by for example:

LIBRARY_OF_MODELS_TOP_LEVEL="/home/user/LIBRARY_OF_CABLE_MODELS"

The user may also want to specify a directory for the circuit symbols produced by the system. The default action is to keep these in the directory where the cable models are developed. This may be changed by setting SYMBOL_DIR. For example for use by gshem you may need to following:

SYMBOL_DIR="/usr/share/gEDA/sym/local"

(NOTE: you may need to change ownership of SYMBOL_DIR with something like the following command:
sudo chown chris:chris /usr/share/gEDA/sym/local)

Test cases are found in directories at this level. In each test case directory the following files should exist:

  1. A number of files (or zero if they already exist in the library) for cable specification information *.cable_spec

  2. Zero or a maximum of one file for cable bundle specification *.bundle_spec

  3. One (and only one) file for the spice cable bundle specification *.spice_model_spec

The automatic testing script is run using the following command:

generate_spice_cable_bundle_model action

action is the process to perform:

action=run NAME : Generate cable models, bundle model and Spice bundle model and validation spice model as required for the test case NAME. Run ngspice on the validation model and compare the spice result against the analytic solution

action=plot NAME : Plot the results of the spice validation model and analytic solution to x11 terminal

action=plot_wxt NAME : Plot the results of the spice validation model and analytic solution to wxt terminal

action=plot_jpg NAME : Plot the results of the spice validation model and analytic solution to .jpg file

action=plot_ref NAME : Plot the spice validation model results against
reference results to x11 terminal

action=plot_ref_wxt NAME : Plot the spice validation model results against
reference results to wxt terminal

action=plot_ref_jpg NAME : Plot the spice validation model results against
reference results to jpg file

action=plot_bundle NAME : Plot the bundle cross section to x11 terminal

action=plot_bundle_wxt NAME : Plot the bundle cross section to wxt terminal

action=plot_bundle_jpg NAME : Plot the bundle cross section to jpg file

action=reference NAME : Update the reference results and the difference between the spice model and validation model
with the current set of results

action=check_error NAME : Quick check that the difference between the spice model and validation model is the same as for the reference data set

action=clean NAME : Remove all files except those required to set up the problem and the reference results.

action=clean_all NAME : Remove all files including the reference results.

NAME can be one of the existing test cases or left blank to run all the test cases

The test case directory should contain the following:

*.cable_spec files as required to specify cables (though cables specified elsewhere could be used to form bundles)

a *.bundle_spec file if required to specify the cable bundle (thoough cable bundles specified elsewhere could be used in the specification of spice cable models)

a *.spice_model_spec file to specifiy the spice cable bundle model (if required)

The action run does the following:

  1. copy *.cable_spec files, *.bundle_spec file and *.spice_model_spec file to the RUN_DIRECTORY

  2. run the code cable_model_builder as required to create the cable models (*.cable)

  3. run the code cable_bundle_model_builder as required to create the cable bundle models (*.bundle)

  4. run the code spice_cable_bundle_model_builder as required to create a. the spice subcircuit model of the bundle (.lib) b. the schematic symbol for the spice subcircuit model (.sym) c. the spice validation model (*.cir) c. the analytic solution of the validation configuration (analytic_solution.dat)

  5. run ngspice on the spice validation model to produce the validation data (spice_solution.dat)

  6. run the code compare_results which provides a numerical measure of the difference between the results of the analytic solution and the spice solution (result_comparison.dat)

Note that when running on widows using cygwin the process may fail due to DOS/UNIX file format issues in the download. This may be fixed with the command:

dos2unix generate_spice_cable_bundle_model