Importing Measured Data into Spice.
To get scope data into Spice, the data is converted to a piecewise linear voltage or current source.
The example here use a Hantek 6022BE oscilloscope and LTspice, but it can be used with other oscilloscopes and spice variants too.
The acsii export files from the scope has the following format:
#CHANNEL:CH1 #CLOCK=50.0mS #SIZE=1047552 #UNITS:V 0.0000 0.0000 #CHANNEL:CH2 #CLOCK=50.0mS #SIZE=1047552 #UNITS:V 0.0627 0.0000Clock is the horizontal Time/Division.
|Time/Div.||Sample-rate||Samples/channel||Total sample time|
|1 µs to 2 µs||48 MHz||1016||21 µs|
|5 µs||16 MHz||130048||8.1 ms|
|10 µs||8 MHz||130048||16 ms|
|20 µs||4 MHz||130048||33 ms|
|50 µs to 2 ms||1 MHz||130048||130 ms|
|5 ms to 20 ms||1 MHz||523264||520 ms|
|50 ms to 100 ms||1 MHz||1047552||1.1 s|
|200 ms||500 kHz||1047552||2.1 s|
|500 ms||200 kHz||1047552||5.1 s|
|1 s to 5000 s||100 kHz||1047552||11 s|
As the table above shows, this scope always output a fixed file length ( it can actually output a 2 million line .xls file, but I do not have anything that can read it ).
I many cases this is a lot more data than you need, so reduce the amount of data to what you need.
Copy-paste all data to the same spread-sheet, reduce the number of lines to what you need, add time information and information for spice.
|1||#CHANNEL:CH1||#CHANNEL:CH2||Time||Channel 1 Spice data||Channel 2 Spice data|
|2||#CLOCK=50.0mS||#CLOCK=50.0mS||Note that 1. and last lines|
are different from the rest.
|Note that 1. and last lines|
are different from the rest.
|6||0||0||0||Vchannel1 CH1 0 pwl(0 0||Vchannel2 CH2 0 pwl(0 0|
|7||0||0||0.000001||+ 0.000001 0||+ 0.000001 0|
|8||0||0.0314||0.000002||+ 0.000002 0||+ 0.000002 0.0314|
|9||0||0.0314||0.000003||+ 0.000003 0||+ 0.000003 0.0314|
|10||0||0.0314||0.000004||+ 0.000004 0||+ 0.000004 0.0314|
|11||0||0.0314||0.000005||+ 0.000005 0||+ 0.000005 0.0314|
|12||0||0.0314||0.000006||+ 0.000006 0||+ 0.000006 0.0314|
|13||0||0.0314||0.000007||+ 0.000007 0 )||+ 0.000007 0.0314 )|
This is a Spice voltage source named "Vchannel1" with output on nodes "CH1" and "0".
Copy D6 to D13 to an ascii file and save it as f.ex. "Channel 1.cir".
In your Spice file , include the directive: ".include Channel 1.cir", and you have your measured waveform on node "CH1".
An example of importing measured data into Spice.
This web-page, including but not limited to all text, drawings and photos, is the intellectual property of Poul Petersen, and is Copyright ©.
Reproduction or re-publication by any means whatsoever is strictly prohibited under International Copyright laws.
The author grants the reader the right to use this information for personal use only.
Any commercial use is prohibited without express written authorization from Poul Petersen.
The information is provided on an "as-is" basis and is believed to be correct, however any use of the information is your own responsibility.
This web-site may contain links to web-sites outside Poul Petersen domain ( www.poulpetersen.dk ).
Poul Petersen has no control over and assumes no responsibility for the content of any web-site outside Poul Petersen own domain.
Poul Petersen notes index
Poul Petersen diy index
|Copyright © Poul Petersen 2019..2020. Last update: 20200118.||Valid HTML!|