Analysis - General
How can I import a waveform from one circuit into the analysis of another circuit?
The Import operator is designed for this purpose. The Import operator can import a waveform from an output text file that has been created by Micro-Cap or by another SPICE program. The following example imports the output waveform, V(Out), of the circuit, WAVEOUT.CIR, into the analysis of the circuit, WAVEIN.CIR. The example will be done in transient analysis, but this procedure can be used in AC and DC analysis as well.
Load the file WAVEOUT.CIR. Go to the Analysis menu and click on Transient Analysis. The Transient Analysis Limits dialog box will appear. For each waveform, there is a set of icons for the waveform options. Click on the numeric output icon for the waveform V(Out). When enabled, this will write the results of the waveform into the numeric output file. Set the value in the Number of Points field. This value determines the number of data points that are to be written in the text file. Note that in AC analysis, the Frequency Step must be changed from Auto for this to have an effect. The number of data points in the text file controls the accuracy of the imported waveform. Setting this field to 1000 should cover most waveforms. Run the analysis, and then click on the Transient menu and choose Numeric Output. This will load up the file, WAVEOUT.TNO, which is the numeric output file that was just created. In this file will be operating point information, and two columns of tabular data that represent time and V(Out). Go to the File menu and choose Save As. Save this file to a different name such as WAVEOUT.OUT. This doesn't have to be done, but it prevents the file from being overwritten if you run the transient analysis again. Load the file WAVEIN.CIR. Go to the Analysis menu and click on Transient Analysis. On a new waveform line, place the following into the Y Expression field:
The syntax of the Import operator is:
where f is the file name, and y is the waveform that is to be imported from the file f. The X expression must be T. Run the analysis, and the waveform V(Out) will be plotted along with any other waveforms that have been defined.
There are two other things that the user needs to be aware of in using the Import operator. First of all, the X expression for the Import operator is limited. For transient analysis, the X expression must be T. For AC analysis, the X expression must be F. For DC analysis, the X expression must be the voltage or current of the Input 1 source being swept. Also, when creating the numeric output file in Micro-Cap, the waveform name is truncated to 9 characters. For example, if you are saving the waveform dB(V(Out)) to the numeric output file, it will actually place the waveform in the file as dB(V(Out). When you try to import this, it will complain due to the mismatched parentheses. The numeric output file must be manually edited so that the waveform name will be valid. Two ways to fix the above waveform would be to change the header in the numeric output file to either of the following: dB(V(Out)) or dB(VOut), and then use the new name in the Import operator. The waveform name in the Import operator must match exactly with the waveform header, and the parentheses must match.