yinxu951 发表于 2013-12-25 14:33:55

PSCAD中STORX的指针问题

如下图所示,PSCAD的几个公共数组,用来传递共享变量用。


PSCAD的help里面,关于该数组的使用,如下所示:
SUBROUTINE U_USERSUB(...)!! Retrieving the variable values from the STORx array indexes! before calculations:!      X_OLD = STORF(NSTORF)      Y_OLD = STORF(NSTORF + 1)      Z_OLD = STORI(NSTORI)!   ... (Main body of subroutine)!! Saving the values of variables to the STORx arrays (near the end ! of the subroutine):!      STORF(NSTORF) = X      STORF(NSTORF + 1) = Y      STORI(NSTORI) = Z!! Increment the respective pointers (very important):!       NSTORF = NSTORF + 2      NSTORI = NSTORI + 1!      RETURN       END!

请问为什么程序结束之前,两个指针NSTORF 、NSTORI 为什么加一个数值呢?不是每个time step的时候,指针都会复位吗?

MaydayShine 发表于 2013-12-25 15:42:28

为了防止后面程序破坏你这个程序的指针

yinxu951 发表于 2013-12-25 21:03:37

回复 2# MaydayShine


   是说这个子程序运行完后,之后的一个程序可能会调用这个指针吗?

redplum 发表于 2013-12-26 00:19:47

怎么有点像MCS-51单片机

周沭铭 发表于 2013-12-26 09:16:46

学习一下

MaydayShine 发表于 2013-12-26 09:20:55

回复 3# yinxu951


   按照我的理解是这样的。

古木子 发表于 2013-12-26 10:13:25

xuexile

yinxu951 发表于 2014-1-6 14:55:06

回复 6# MaydayShine


   ::handshake::

gezhi3lee 发表于 2014-8-19 21:13:07

看不懂啊
页: [1]
查看完整版本: PSCAD中STORX的指针问题

招聘斑竹