Ask Your Question
0

How to obtain and hold the value of STATE/VAR at a certain time?

asked 2022-11-23 00:56:27 -0600

dat gravatar image

In WECC model 'REECAU1', it shows that if voltage_dp=1, STATE(K+2) and STATE(K+3) will be frozen and the value of Iqcmd will be changed from STATE(K+3) to (STATE(K+3)+Iqv) for Thld seconds. I wonder how to achieve this in FORTRAN?

It seems that CALL DSRVAL in API call get the certain time. However, how can I get the value of STATE at that time? IF I use VAR(L) to store the value, it would be changed over time since VAR(L) is a variable array.

As for set some value for seconds, I think it could be

IF(A<TIME<A+Thld) Iqcmd=STATE(K+3)+Iqv

Is it correct?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2023-09-26 08:15:57 -0600

aiden gravatar image

just set dstate=0, and the relative state value will be frozen, so can hold the value for any more time u want

edit flag offensive delete link more

Comments

dat don't want to freeze the state, just preseve the state value at a certain time in a var.

perolofl gravatar imageperolofl ( 2023-09-26 09:25:42 -0600 )edit
0

answered 2022-11-24 10:35:55 -0600

perolofl gravatar image

Do you want to write your own user moderl version of REECAU1?

The simulation time is already available in variable TIME, so there is no need for DSRVAL.

At each time step the value of the STATE is in the STATE array. I don't understand the question.

edit flag offensive delete link more

Comments

REECAU1 is just an example. I'm trying to write a LVRT model. My question is: 1.As the value of STATE is stored at each time step, how could I return it? If I want to get the value of STATE(3) at 1 second, what should I write in FORTRAN?

dat gravatar imagedat ( 2022-11-24 18:41:59 -0600 )edit

2.If I want to know when is the ETERM of a machine less than 0.2 for the first time, what should I write in FORTRAN? By writing ‘IF(ETERM>0.2) CALL DSRVAL(TIME,RVAL,IERR)’ , I can get TIME when ETERM=0.2. But if ETERM rises to 0.2, RVAL would update agin.

dat gravatar imagedat ( 2022-11-24 18:49:55 -0600 )edit

Why are you using DSRVAL to get the time? It is already available in common variable TIME.

perolofl gravatar imageperolofl ( 2022-11-25 00:59:54 -0600 )edit

Yes, you are right. I realize that ‘IF(ETERM>0.2) VAR(L)=TIME)’ works too. But it would be changed as well when ETERM rises to 0.2, since VAR(L) will be updated in MODE2/3. How could I store and hold TIME?

dat gravatar imagedat ( 2022-11-25 01:11:05 -0600 )edit

In other posts, I saw that one could get the value of varibles at TIME-DELT. I don't find the way to achieve this.

dat gravatar imagedat ( 2022-11-25 01:16:08 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: 2022-11-23 00:56:27 -0600

Seen: 885 times

Last updated: Sep 26 '23