Ask Your Question
0

Question about API in Fortran

asked 2022-09-11 22:40:24 -0500

anonymous user

Anonymous

updated 2022-09-12 06:26:32 -0500

perolofl gravatar image

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?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2022-09-12 06:51:50 -0500

perolofl gravatar image

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).

edit flag offensive delete link more

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 gravatar imagedat ( 2022-09-12 19:59:38 -0500 )edit

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

perolofl gravatar imageperolofl ( 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 gravatar imagedat ( 2022-09-18 20:01:08 -0500 )edit

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

perolofl gravatar imageperolofl ( 2022-09-20 04:09:47 -0500 )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-09-11 22:40:24 -0500

Seen: 53 times

Last updated: Sep 12