next up previous contents
Next: Appendix B - Noise Up: Appendices Previous: Appendices   Contents

Appendix A - Binary Data Files Contents and Output Data Structures

CCICAP can produce binary data output files when the FILE record is included and will produce binary data output files when one or more plots are requested. Two types of binary files are produced, one for the normal analysis DATA and one for the data produced by any VARY records. The files are unformatted FORTRAN data files.

The first type of data file, the file which results from an AC or TRANsient request, is named DATAmmnn.AC or DATAmmnn.TR. The number mm (between 00 and 99) refers to the circuit number of the run. The first circuit described is numbered 00, the circuit described after the first NEXT record is numbered 01, etc. The number nn (between 00 and 99) refers to the circuit alteration number. The original circuit is numbered alteration 00, the circuit resulting at the first ALTGO record is numbered 01, etc.

In the first type of data file the first record consists of three FORTRAN 4 byte integers

N1, N2, N3

where N1 is the number of data sets which are to follow in the file, N2 is the number of dependent variables in each of the sets, and N3 is a format descriptor related to the units of the data which follows.

N3 is defined as follows:

Let bit-n refer to the n'th bit of the 32 bit integer value N3 where bit- is the lsb, etc.

Then

bit-0 = 1 => results are from an AC analysis, for which:

bit-0 = 1 => results are from a TRAN analysis, for which:

The subsequent records are the data sets which consist of single precision FORTRAN reals:

Independent variable 1, data1, data2, ..., dataN2.

Independent variable 2, data1, data2, ..., dataN2.

...

Independent variableN1, data1, data2, ..., dataN2.

The ordering of the variables is the same as that in the ASCII file created during the analysis.

For example, an AC analysis with two requested V or I outputs, a single requested calculated response, two requested element sensitivities, a worst case sensitivity, and a noise output would produce data sets and an ASCII output data structure with the following composition:



Position Variable
1 Frequency : independent variable
2 First output : real part, magnitude, or dB
3 First output : imaginary part or phase
4 Second output : real part, magnitude, or dB
5 Second output : imaginary part or phase
6 Calculated response: real part, magnitude, or dB
7 Calculated response: imaginary part or phase
8 First sensitivity : real part
9 First sensitivity : imaginary part
10 Second sensitivity : real part
11 Second sensitivity : imaginary part
12 Worst case sens. : value
13 Worst case sens. : no imag. part, set = 0.0
14 Noise output : volts/$\sqrt{Hz}$ or amps/$\sqrt{Hz}$ or dB[volts/$\sqrt{Hz}$] or dB[amps/$\sqrt{Hz}$]
15 Integrated noise : volts or amps



The binary files are created by FORTRAN unformatted writes. The data can be recovered by FORTRAN unformatted reads such as:

c open the input file ... 

      open(luin, file = infile) 

c read in the data structure integers 

c n1, n2, n3 are 4 byte integers 

      read(luin) n1, n2, n3 

c read in the data ... 

      do i = 1, n1 

c read in one record of data

        do j = 1, n2 + 1 

          read(luin) xt(j) 

        end do

c extract the independent variable

        x(i) = xt(1) 

c extract the dependent variables

        do j = 2, n2 + 1 

          y(i, j - 1) = xt(j) 

        end do 

      end do

where 'infile' defines the name of the CCICAP generated file from which data is recovered. After the above statements, x(i) will contain the i'th value of the independent variable and y(i, j) will contain the N2 independent variables associated with x(i).

A slightly different format is used for data resulting from any VARY requests. All VARY data resulting from a given circuit or circuit alteration is stored in a single file named VARYmmnn.AC or VARYmmnn.TR where mm and nn are as described for the DATAmmnn files above. The first record in the file consists of four four-byte FORTRAN integers

N1, N2, N3, N4

where N1 is not currently used (set to one), N2 is the number of dependent variables in each data set, N3 is the same as described above for the AC or TRANsient results data files, and N4 is the number of VARY elements in the run that produced the VARY data file.

Each VARY analysis produces N_VARY data sets with N2 dependent variables. The second record in the file consists of N4 four-byte FORTRAN integers whose value equals the number of intervals requested on the VARY records.

The third and subsequent records consist of N2 + 1 FORTRAN single precision reals. Each record records the value of the independent variable (the VARY element) followed by the values of the N2 dependent variables that result.


next up previous contents
Next: Appendix B - Noise Up: Appendices Previous: Appendices   Contents
Bob Smither 2008-11-19