First time here? We are a friendly community of Power Systems Engineers. Check out the FAQ!

Ask Your Question
0

Question about API in Fortran

asked Sep 12 '2

anonymous user

Anonymous

updated Sep 12 '2

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?

1 answer

Sort by » oldest newest most voted
0

answered Sep 12 '2

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

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 gravatar imagedat (Sep 13 '2)

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

perolofl gravatar imageperolofl (Sep 14 '2)

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 (Sep 19 '2)

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

perolofl gravatar imageperolofl (Sep 20 '2)

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.
Want to format code in your answer? Here is a one minute demo on Youtube

Add Answer

[hide preview]

Question Tools

1 follower

Stats

Asked: Sep 12 '2

Seen: 222 times

Last updated: Sep 12 '22