Spectrum Software
spacer
Industrial Strength Simulation
select:

divider

 

News:

Spectrum Software has released Micro-Cap 11, the eleventh generation of our SPICE circuit simulator.

For users of previous Micro-Cap versions, check out the new features available in the latest version. For those of you who are new to Micro-Cap, take our features tour to see what Micro-Cap has to offer.

 

divider

 

Importing PWL Data From A File

 

The piecewise linear capability of the Voltage Source component is useful for defining waveforms that do not adhere to any standard expressions. The PWL function uses time versus voltage data pairs in order to define the waveform of the source. Typically, the data is typed directly into the VALUE attribute of the Voltage Source component. However, if there is a lot of data to be entered, this can be time consuming. Micro-Cap has a File keyword that can be used within the PWL definition which provides a method to retrieve the time versus voltage data directly from a file. The syntax for the File keyword is as follows:

FILE="filename"

This statement can be typed directly into the PWL text field within the Attribute dialog box of the Voltage Source as shown in the figure below.

PWL file defined for a voltage source

In this example, the PWL data is stored in a file called PSK2.CSV. Since no path has been specified for the file, the PSK2.CSV file would need to be located in the Data path that is specified in Micro-Cap. The Data path can be defined by selecting the Paths command under the File menu and editing the Data field in the Paths dialog box that comes up. This path defaults to the Data folder when Micro-Cap is first installed. A path can also be specified within the File keyword definition such as:

FILE="C:\MYFILES\PSK2.CSV"

The file being referenced must contain only the time versus voltage data points. Each line in the file should have just a single data point. The PSK2.CSV file contains the following information:

0.0000000000000000E+000,-3.6977854932234928E-032
7.9999999999999998E-012,-8.0424771926479972E-005
1.6000000000000000E-011,-1.6084954382044749E-004
3.1999999999999999E-011,-3.2169908738079547E-004
6.3999999999999999E-011,-6.4339817268079501E-004
1.2800000000000000E-010,-1.2867963287152221E-003
...
...
...
7.9958359616359067E-005,-4.1785107382121828E-001
7.9968359616359061E-005,-3.1774869751689055E-001
7.9978359616359056E-005,-2.1744562432477649E-001
7.9988359616359051E-005,-1.1700520781574002E-001
7.9998359616359046E-005,-1.6490888309627784E-002
8.0000000000000007E-005,-1.6490888309627784E-002

This file contains 8158 data points which would have been taken an excessively long amount of time to enter manually. CSV files such as these can easily be created in programs such as Excel.

The resulting transient analysis is shown in the figure below. The PWL voltage source is producing 80us of a PSK modulated waveform.

PWL file output

One other advantage to using the File keyword is that the waveform data can be modified by third party programs at any time without having to change the circuit in Micro-Cap. Simply run the transient analysis again to view how the modified waveform works with the circuit.

The PWL file feature is also available within the Current Source component.

 
Download Winter 2011 Circuit Files
Return to the main Newsletter page