0

Question about API in Fortran

When I use a call like WINDMIND, how could I get and use the output value?

In API.pdf, it shows the Fortran syntax:CALL WINDMIND(IBUS, ID, STRING1, STRING2, IVAL, IERR)

So, I write:

CALL WINDMIND(2,'1','WGEN','STATE',IVAL,IERR)

In order to get the output, IVAL, I write the below code in my understanding:

VAR(L)=IVAL
VAR(L+1)=IERR
VAR(L+2)=VAR(IVAL)
VAR(L+3)=VAR(IERR)

I put all these codes in a GUST model ,MODE 3, and in .dyr I write

2 'USRMDL' 1 'API' 106 0 0 0 0 4

All other models in .dyr are offical models like REECAU1...

However, when I start dynamic simulation, all the VARs are 0.

How to solve this problem?

anonymous user
asked 2022-09-11 22:40:24 -0500
perolofl's avatar
3.8k
perolofl
updated 2022-09-12 06:26:32 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Variable IVAL will contain the index of the first STATE for the wind generator model at bus 2, machine 1.

The third VAR should be VAR(L+2) = STATE(IVAL)

Variable IERR is zero when the call is succesful. It is wrong to assign VAR(L+3) = VAR(IERR), since VAR array doesn't have index 0. Remove the statement for VAR(L+3).

perolofl's avatar
3.8k
perolofl
answered 2022-09-12 06:51:50 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks a lot! I will have a try on 'VAR(L+2)=STATE(IVAL)' I have another question about your comment: how can I know the value of IERR? Could it be VAR(L+1)=IERR?

dat's avatar dat (2022-09-12 19:59:38 -0500) edit

Yes, you can use VAR(L+1) = IERR

perolofl's avatar perolofl (2022-09-14 10:12:01 -0500) edit

I succeed in getting the index and value of the first STATE for the wind generator model. Besides, if I want to get the the second index and value, should I write another call or just use IVAL+1? Thanks again for your help!!

dat's avatar dat (2022-09-18 20:01:08 -0500) edit

Yes, use VAR(L+3) = STATE(IVAL+1)

perolofl's avatar perolofl (2022-09-20 04:09:47 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer