Ask Your Question

Revision history [back]

Thank you very much Abdul for your explanations. I am facing a similar problem, as I am trying to implement a proprietary electric control for the WTG1. Based on the example in the POM (which I tested successfully for an exciter model), I tried to test a basic model (with constant states) for the renewable machine. However, neither the states of the model are initialized properly, nor the WP/WQ commands are set correctly.

The code of the UDM is:

C
  SUBROUTINE ELECCON(I,ISLOT)

  INCLUDE'COMON4.INS'
  INTEGER I,ISLOT,WMI

  EXTERNAL BADMID,DOCUHD
  INTEGER IB, J, K, L, IBUS, JJ
  LOGICAL NEW
  CHARACTER IM*2

  IF (MODE.EQ.8)
  .  CON_DSCRPT(1) ='Tr'
  .  CON_DSCRPT(2) ='K'
  .  CON_DSCRPT(3) ='Te'
  .  RETURN
  ...FIN

  J=WSTRTIN(1,ISLOT) 
  K=WSTRTIN(2,ISLOT) 
  L=WSTRTIN(3,ISLOT)

  CALL GENCHK(1,'1',MC,'GEN NOT FOUND')
  WMI = WNDNUM(MC)

  IB=NUMTRM(I) 
  IF (IB.LE.0) RETURN 
  IF (MIDTERM)
  .  CALL BADMID(I, IB, 'ELECCON')
  .  RETURN
  ...FIN

  IF (MODE.GT.4)
  .  IM=MACHID(I)
  .  IB=ABS(NUMTRM(I))
  .  IBUS=NUMBUS(IB)

  .  IF (MODE.EQ.6)
  .  .  WRITE(IPRT,507) IBUS,IM, (CON(K) , K=J, J+2)
  .  .  RETURN
  .  ...FIN

  .  IF (MODE.EQ.5)
  .  .  CALL DOCUHD(*1900)
  .  .  JJ=J+2
  .  .  WRITE(IPRT,17)  IBUS,IM,J,JJ,K,K+1
  .  .  WRITE(IPRT,27)  (CON(K) ,K=J,JJ)
  .  ...FIN

  .  NEW=.FALSE.
  .  UNLESS (CON(J).GT.2.*DELT .AND. CON(J) .LT.0.2)
  .  .  PRINT-HEADING
  .  .  WRITE(IPRT,107) CON(J)
  .  ...FIN
  .  UNLESS (NEW) RETURN
  ...FIN   

  IF (MODE.EQ.1)
  .  STATE(K) = 1.0
  .  STATE(K+1) = 1.0
  .  RETURN
  ...FIN

  IF (MODE.EQ.2)
  .  DSTATE(K) = 0
  .  DSTATE(K+1) = 0
  .  RETURN
  ...FIN

  IF (MODE.EQ.3)
  .  WPCMND(WMI) = STATE(K)
  .  WQCMND(WMI) = STATE(K+1)
  .  RETURN
  ...FIN

  IF (MODE.EQ.4)
  .  NINTEG=MAX(NINTEG,K+1)
  .  RETURN
  ...FIN  

17   FORMAT(//6X,'** ELECCON',' **  BUS   NAME   BSKV MACH',
 *       '    C O N S     S T A T E S'/,
 *       I23,3X,A2,3X,2(I7,'-',A6))
27   FORMAT(/21X,'TR K TE'/F24.3,F8.1,F8.3)
97   FORMAT(//' BUS',I7,'  MACHINE ',A,':')
107  FORMAT(' TR=',F10.4)
507  FORMAT(I6,' ''USRMDL''',2X,A2,' ''DEMOEX''',1X,4G13.5,/7X,5G13.5,'/')

1900 RETURN

  TO PRINT-HEADING
  .  UNLESS (NEW)
  .  .  NEW=.TRUE.
  .  .  CALL DOCUHD(*1900)
  .  .  WRITE(IPRT,97) IBUS,IM
  .  ...FIN
  ...FIN

  END

And the corresponding .dyr (with the test-generator at bus 1 and the equivalent source at bus 3) is:

   1    'WT3G1'  1     1           0.18          30.0          0.0      
         0.1000        450    /
   1    'USRMDL' 1 'ELECCON' 102  0  0 3 2 0 0.05 100. 0.4 /
   3    'GENCLS' 1     0.0         0.0    /

With your experience, can you tell where exactly there is an error? I spent the last days looking for it...

Thanking you in advance