不学无术 发表于 2017-10-12 16:25:24

关于计算线路感应电压模型讨论

用MODELS计算线路感应电压:程序如下:
MODEL indloss
CONST
Tmax {VAL:500}
n {VAL:2}
c {VAL:3.e8}
I0 {VAL:1}
eps0 {val:8.85e-12}
INPUT UAP,UBP
DATA Y,XA,XB
z {DFLT:10}
Im       {DFLT:3e4}
tc       {DFLT:5e-5}
th       {DFLT:2e-6}
v      {DFLT:1.5e8}
sigma    {DFLT:0.001}
epsr   {DFLT:10}
OUTPUT UrA,UrB
VAR UindA0,UindB0,g1,g2,
UindAD,UindBD,Ui0,UiD,
UrA,UrB,Tr,k,i,AB,dt,uk,
b,L,x,tau,a1,b1,c1,c2,c3
FUNCTION F0(x,tr):= (c*tr-x)/(y*y+(b*(c*tr-x))**2)
FUNCTION F1(x,tr):= (x+b*b*(c*tr-x))/sqrt((v*tr)**2+(1-b*b)*(x*x+y*y))
FUNCTION F2(x,tr):= x+b*b*(c*tr-x)+sqrt((v*tr)**2+(1-b*b)*(x*x+y*y))
FUNCTION F3(x,tr):= (v*tr+sqrt((v*tr)**2+(1-b*b)*(x*x+y*y)))/sqrt(x*x+y*y)
FUNCTION t0(x):= sqrt(x*x+y*y)/c
HISTORY
UrA {dflt:0}
UrB {dflt:0}
UAP {dflt:0}
UBP {dflt:0}
DELAY CELLS DFLT: (XA-XB)/(c*timestep)+1
INIT
k:=sqrt(eps0*epsr/(PI*sigma*dt))
dt:= timestep b:=v/c L:=XA-XB tau:=L/c
a1:=Im/(I0*th)
b1:=0.5*th/(tc-th)+1
c1:=a1*k*dt/sqrt(epsr)
c2:=-1.073*k+0.2153*(k**3)+4/3
c3:=-0.2153*(k**3)+1/6
FOR AB:=1 TO 2 DO
if AB=1 then
x:=XA else x:=-XB
endif
FOR i:=0 TO Tmax DO
Tr:=i*dt
if Tr>t0(x)
then
if Tr>t0(x-L)+tau
then
Ui0:=f0(x,Tr)*(f1(x,Tr)-f1(x-L,Tr-tau))
UiD:=ln( f2(x,Tr)/f2(x-L,Tr-tau) )-1/b*ln( f3(x,Tr)/f3(x-L,Tr-tau) )
else
Ui0:=f0(x,Tr)*(f1(x,Tr)+1)
UiD:=ln( f2(x,Tr)*f0(x,Tr) )-1/b*ln( f3(x,Tr)/(1+b) )
endif
else
Ui0:=0, UiD:=0
endif
if AB=1 then
UindA0:=Ui0
UindAD:=UiD
g1:=a1*dt
if i>0
then
g2:=a1*sqrt(eps0/(PI*sigma*Tr))*dt
endif
else
UindB0:=Ui0
UindBD:=UiD
endif
ENDFOR
ENDFOR
i:=Tmax
WHILE i>1 DO
uk:=0
FOR Tr:=1 TO i-1 DO
uk:=uk+UindA0*g1
uk:=uk+UindB0*g1

uk:=uk+UindAD*g2

uk:=uk+UindBD*g2

ENDFOR
UindA0:=uk+0.5*UindA0*g1
UindB0:=uk+0.5*UindB0*g1
UindAD:=uk+(UindAD*c2+UindAD*c3)*c1
UindBD:=uk+(UindBD*c2+UindBD*c3)*c1
i:=i-1
ENDWHILE
Tr:=trunc(th/dt)

FOR i:=Tmax TO Tr BY -1 DO
UindA0:=UindA0-b1*UindA0
UindB0:=UindB0-b1*UindB0
UindAD:=UindAD-b1*UindAD
UindBD:=UindBD-b1*UindBD
endif
ENDFOR
ENDINIT
EXEC
FOR i:=1 to n DO
UrA:=60*I0*b*(z*UindA0 - UindAD) +2*delay(UBP,tau-dt,1)-delay(UrB,tau,1)
UrB:=60*I0*b*(z*UindB0 - UindBD) +2*delay(UAP,tau-dt,1)-delay(UrA,tau,1)
ENDFOR
ENDEXEC
ENDMODEL

程序报错如下
KILL = 422.The present statement is interpreted as a value assignment statement, and the preceding name is interpreted as a
variable to which a value is being assigned.The identification of this variable is interpreted as complete, and should now be
followed by ":=", in the following format:
   variable_identification := expression

本人已经仔细检查了每个等式都加:=了,不知道为什么还是不行,有兴趣的可以仿真一下,大家交流交流。

twjcly 发表于 2017-10-12 20:36:41

Exa 15就是原模型 自己对照看下

不学无术 发表于 2017-10-13 14:02:25

我看到你发的帖子了,但是已修改里面的参数,整个模型就不一样了,如果想修改sigma参数,你知道怎么改吗,改完之后模型不变

twjcly 发表于 2017-10-16 11:34:08

对,要重新修改MODEL的界面呢,在Edit definitions里面,修改Data和NOdes界面,增加变量,更改变量的节点位置。另外你点回复帖子,这样你回复了我都看不到。

twjcly 发表于 2017-10-16 11:34:49

不学无术 发表于 2017-10-13 14:02
我看到你发的帖子了,但是已修改里面的参数,整个模型就不一样了,如果想修改sigma参数,你知道怎么改吗, ...

每层楼下面有个回复,不是大的回复。
页: [1]
查看完整版本: 关于计算线路感应电压模型讨论

招聘斑竹