ICCAP导入说明

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

一、单文本(TXT格式)的读取范例:读取如下txt文件数据并进行图形显示:注意:头三行为注释,共5列数据,每列针对一个VGS,每列的每个数据对应不同的VDS。VGS从0.9V变化到3.3V,步进为600mV,共5个点;VDS从0,变化到15.3V,步进为150mV,共103个点。显然,如上有两个扫描变量。一个是VDS是主变量,一个是VGS是次变量。于是,在ICCAP中设置步骤如下:1、新建一个DUT。2、在Measure/Simulate中,设置Input,如上分析有两个变量,设置如下图,这步设置是为了程序编程和POLT显示做准备的。VD的SweepOrder设为1,即主参数;VG的SweepOrder设为2,即次参数。3、程序编写:先新建一个程序文件,如图:点击右边的Browse,会跳出如图的对话框,选PEL-Program即可。确定则为如下:Execute是程序的执行按钮,而View则可看程序返回值。代码如下:UPDATE_EXPLICIT!thisPELprogramreadsdatafromamdifformattedfile!withthecolumnsLINPUTenterpathoffileyouwant,mdiffile,mdiffileLINPUTenterheadline,head_line,head_linepath2setup=/read_mdif/mdif__3/readsweep1=USERC_num_of_points(1,path2setup)sweep2=USERC_num_of_points(2,path2setup)!ThisistodefinethecorrectdatasizeforthisSetup,!forlatercopy2pasteTherefore,updatethedatasizeICCAP_FUNC(VD,Redisplay)COMPLEXtmp_ids[sweep1*sweep2]r_stream=USERC_open(VAL$(mdiffile),r)!skiptheheaderlinesi=0WHILEihead_line!replacebythenumberoflinestoskipdummy=USERC_readstr(r_stream,0,%*[^\n]%*1[\n],string)i=i+1ENDWHILEICCAP_FUNC(/,StatusWindow)!bringsstatuswindowtotopleveli=0WHILEisweep1k=0WHILEksweep2tmp_ids[sweep1*k+i]=USERC_readnum(r_stream,0,%lf)PRINTreadingline;sweep1*k+i;,i.e.ids=;tmp_ids[sweep1*k+i]k=k+1ENDWHILEi=i+1ENDWHILEdummy=USERC_close(r_stream)!avoidunnecessarydatabehindthistransformRETURNtmp_ids语句说明:1LINPUTenterpathoffileyouwant,mdiffile,mdiffile此语句是跳出对话框,要求需要加载数据的文件路径,把输入的路径值赋给mdiffile,而前一个mdiffile会记录这个路径,把它变为默认值,下次输入则不再需要重新输入路径了。2path2setup=/read_mdif/mdif__3/read此语句是把工程路径赋给path2setup,为了便于后面sweep1,sweep2的取值。这个路径来源于上图的标题栏红线标注的值。3sweep1=USERC_num_of_points(1,path2setup)此语句将工程的SweepOrder为1的Input的步长赋给sweep1,这里也就是VD。4r_stream=USERC_open(VAL$(mdiffile),r)此语句是打开mdiffile所指文件,并将文件的id赋给r_stream,以代表这一文件。这里的r,是指用只读方式打开,下面的例子还会设计到以写的方式打开。5WHILEihead_line!replacebythenumberoflinestoskipdummy=USERC_readstr(r_stream,0,%*[^\n]%*1[\n],string)i=i+1ENDWHILE此语句是读文本中的注释信息。6WHILEisweep1k=0WHILEksweep2tmp_ids[sweep1*k+i]=USERC_readnum(r_stream,0,%lf)PRINTreadingline;sweep1*k+i;,i.e.ids=;tmp_ids[sweep1*k+i]k=k+1ENDWHILEi=i+1ENDWHILE此语句用于数据的读取,是整个程序的核心。7tmp_ids[sweep1*k+i]=USERC_readnum(r_stream,0,%lf)此语句用于数据的读取,遇到空格,本数据读取结束;遇到回车,本数据读取结束并换行。8dummy=USERC_readstr(r_stream,0,%*[^\n]%*1[\n],string)此语句用于读取字符串,注意string必须要在SetupVariables中定义。9RETURNtmp_ids此语句是返回tmp_ids的值。4、SetupVariables设置设置如下:5、PLOT设置点击DisplayPlot,显示图形如下:注:对于单文本s2p格式的读取,如上,代码不变。二、多文本(S2P格式)的读取范例:读取如下文件的多个文件数据:步骤如下:1、使用文件转换软件,将文件路径转换为文本格式:(在同文件夹中)输入要转换的文件路径。转换后如下:可以在C:\下生成switchdialog_result.txt,记录了文件的路径。2、在ICCAP中设置简略如下:代码如下:UPDATE_EXPLICIT!thisPELprogramreadsdatafromamdifformattedfile!withthecolumns!freqREAL(S11)IMAG(S11)REAL(S21)IMAG(S21)REAL(S12)IMAG(S12)REAL(S22)IMAG(S22)LINPUTenterpathoftxtrecordingpath,mdiffile,mdiffileLINPUTenterheadlines,head_line,head_line!ThisistodefinethecorrectdatasizeforthisSetup,!forlatercopy2pasteTherefore,updatethedatasizeICCAP_FUNC(freq,Redisplay)COMPLEXtmp_r.22[sweep1]COMPLEXtmp_i.22[sweep1]COMPLEXtmp_a.22[sweep2*sweep1]path2setup=/read_mdif/mdif__1/readsweep1=USERC_num_of_points(1,path2setup)sweep2=USERC_num_of_points(2,path2setup)r_stream1=USERC_open(VAL$(mdiffile),r)!PRINTr_stream1=;r_stream1!skipthe7headerlinescout_f=0WHILEcout_fsweep2PRINTr_stream1=;r_stream1dummy=USERC_readstr(r_stream1,0,%s,string)PRINTdummy=;dummyPRINTstring=;stringr_stream=USERC_open(VAL$(string),r)PRINTr_stream=;r_streami=0WHILEihead_line!replace'7'bythenumberoflinestoskipdummy=USERC_readstr(r_stream,0,%*[^\n]%*1[\n],string)i=i+1ENDWHILEICCAP_FUNC(/,StatusWindow)!bringsstatuswindowtotopleveli=0WHILEisweep1tmp=USERC_readnum(r_stream,0,%lf)PRINTreadingline;i;,i.e.freq=;tmptmp_r.11[i]=USERC_readnum(r_stream,0,%lf)tmp_i.11[i]=USERC_readnum(r_stream,0,%lf)tmp_r.12[i]=USERC_readnum(r_stream,0,%lf)tmp_i.12[i]=USERC_readnum(r_stream,0,%lf)tmp_r.21[i]=USERC_readnum(r_stream,0,%lf)tmp_i.21[i]=USERC_readnum(r_stream,0,%lf)tmp_r.22[i]=USERC_readnum(r_stream,0,%lf)tmp_i.22[i]=USERC_readnum(r_stream,0,%lf*[^\n]%*1[\n])!Note:ifyoualsowanttoreadDCbiasesetc.,!simplydefineanotherdatafieldwithaCOMPLEX!statement,andapplymoreUSERC_readnum'shere.i=i+1ENDWHILEd=0WHILEdsweep1tmp_a.11[cout_f*sweep1+d]=tmp_r.11[d]+j*tmp_i.11[d]tmp_a.12[cout_f*sweep1+d]=tmp_r.12[d]+j*tmp_i.12[d]tmp_a.21[cout_f*sweep1+d]=tmp_r.21[d]+j*tmp_i.21[d]tmp_a.22[cout_f*sweep1+d]=tmp_r.22[d]+j*tmp_i.22[d]d=d+1ENDWHILEdummy=USERC_close(r_stream)cout_f=cout_f+1ENDWHILEdummy=USERC_close(r_stream1)!avoidunnecessarydatabehindthistransformRETURNtmp_a显示如下:三、单文本(TXT格式)的导出其他类同,代码如下:UPDATE_EXPLICIT!thisPELprogramreadsdatafromamdifformattedfile!withthecolumns!freqREAL(S11)IMAG(S11)REAL(S21)IMAG(S21)REAL(S12)IMAG(S12)REAL(S22)IMAG(S22)mdiffile=c:\export.txt!ThisistodefinethecorrectdatasizeforthisSetup,!forlatercopy2pasteTherefore,updatethedatasizeICCAP_FUNC(freq,Redisplay)COMPLEXtmp_vgs[nr_pts]COMPLEXtmp_ids[nr_pts]VTO=1r_stream=USERC_open(VAL$(mdiffile),w)!PRINTr_stream=;r_stream!skipthe7headerlinesi=0!testWHILEinr_ptstmp_vgs[i]=itmp_ids[i]=nr_pts*ii=i+1ENDWHILE!endtesti=0WHILEinr_ptswrite_result=USERC_write(r_stream,0,vgs=&V

1 / 14
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功