build_mod 3.22 KB
#!/bin/bash
#
# This is a script to build a library of cable models from
# a set of test cases
#
#    Copyright (C) 2015  Chris Smartt
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version. See license.txt for more details. 
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.   

source gnuplot_functions 

# get the path to the TEST_CASE directory- note a special method is used in cygwin...
if [ "$OSTYPE" == "cygwin" ]; then
  TEST_CASE_DIRECTORY=$( cygpath -m $(pwd) )
else
  TEST_CASE_DIRECTORY=$( pwd )
fi

PROJECT_DIRECTORY=$( dirname ${TEST_CASE_DIRECTORY} )

LIBRARY_OF_MODELS_TOP_LEVEL="${TEST_CASE_DIRECTORY}/MOD_SPACE_CABLES"

LIBRARY_OF_CABLE_MODELS="${LIBRARY_OF_MODELS_TOP_LEVEL}/CABLE"

LIBRARY_OF_BUNDLE_MODELS="${LIBRARY_OF_MODELS_TOP_LEVEL}/BUNDLE"

LIBRARY_OF_SPICE_MODELS="${LIBRARY_OF_MODELS_TOP_LEVEL}/SPICE"

SYMBOL_DIR="${LIBRARY_OF_MODELS_TOP_LEVEL}/SPICE/SYMBOL"

# the following keeps the circuit symbols in the local directory
#SYMBOL_DIR="./"
# the following puts circuit symbols in the gschem directory
#SYMBOL_DIR="/usr/share/gEDA/sym/local"

EXECUTABLE_DIR="${PROJECT_DIRECTORY}/bin"

NGSPICE_SUFFIX="_Ngspice.cir"

# 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_CASE_LIST="
TWISTED_PAIR_CABLE_MODELS
SPICE_MODEL_TP_AWG_20_ESCC_3901002_V34
SPICE_MODEL_TP_AWG_20_ESCC_3901019_V14
SPICE_MODEL_TP_AWG_20_ESCC_3901025_V10
SPICE_MODEL_TP_AWG_22_ESCC_3901002_V33
SPICE_MODEL_TP_AWG_22_ESCC_3901019_V13
SPICE_MODEL_TP_AWG_22_ESCC_3901025_V09
SPICE_MODEL_TP_AWG_24_ESCC_3901002_V32
SPICE_MODEL_TP_AWG_24_ESCC_3901019_V12
SPICE_MODEL_TP_AWG_24_ESCC_3901025_V08
SHIELDED_TWISTED_PAIR_CABLE_MODELS
SPICE_MODEL_STP_RS422_AWG_26_ESCC_3902002_V24
SPICE_MODEL_STP_AWG_26_ESCC_3901025_V12
SPACEWIRE_CABLE_MODELS
SPICE_MODEL_SPACEWIRE_AWG_28_ESCC_3902003_V1
SPICE_MODEL_SPACEWIRE_AWG28_V1_SHIELDING_EFFECTIVENESS
SPICE_MODEL_SPACEWIRE_AWG_26_ESCC_3902003_V2
SPICE_MODEL_SPACEWIRE_AWG26_V2_SHIELDING_EFFECTIVENESS
SPICE_MODEL_LOW_MASS_SPACEWIRE_AWG_28_ESCC_3902004_V1
SPICE_MODEL_LOW_MASS_SPACEWIRE_SHIELDING_EFFECTIVENESS
SPICE_MODEL_LOW_MASS_SPACEWIRE_SHIELDING_EFFECTIVENESS_10x10cm
SPACEWIRE_CONNECTOR
SPICE_MODEL_SPACEWIRE_CONNECTOR
"

# Loop over the specified test cases

for TEST_CASE in $TEST_CASE_LIST
do

# Check that the test case directory exists  

  if [ ! -d "$TEST_CASE" ]; then
    
    echo "${TEST_CASE} *** FAILED ***: does not exist" >> status
    continue
    
  fi
  
  echo "Running test case: ${TEST_CASE}"
  
  cd $TEST_CASE
  
  cp *.cable_spec ${LIBRARY_OF_CABLE_MODELS}

  cp *.bundle_spec ${LIBRARY_OF_BUNDLE_MODELS}

  cp *.spice_model_spec ${LIBRARY_OF_SPICE_MODELS}
  
  cd ..

done