[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TRNSYS-users] controlling the passage to the next time steps



Hello,

The co-simulator with ESP-r available in TRNSYS 17 and 18 implements something that is similar to what you are trying to do, if I understand correctly.

Once TRNSYS has converged for a time step, Type 130 checks that the iterations between the 2 programs have converged, and if that is not the case, Type 130 “forces” TRNSYS to continue iterating at the current time step.

Perhaps you can take a look at Type 130 and how it interacts with the Kernel to see whether you can use that for what you are trying to achieve.

The part I am not sure to understand is that in the co-simulation case, it makes sense to force additional iterations because the inputs coming from ESP-r will be different so the TRNSYS results after new iterations will be different. In your case, I am not sure what would cause TRNSYS to find different results, but I am probably missing something.

In any case, I hope this helps.

 

Michaël Kummert

Polytechnique Montréal

 

 

 

From: Pierre Jaboyedoff via TRNSYS-users <trnsys-users@lists.onebuilding.org>
Sent: July 9, 2021 08:35
To: trnsys-users@lists.onebuilding.org
Cc: pierre.jaboyedoff@effinart.ch
Subject: [TRNSYS-users] controlling the passage to the next time steps

 

In trnsys 13.1, i had (long time ago ..) modified the kernel of TRNSYS (see below).

The reason was to be able to check if the control routine developed was converging to the correct physical case (e.g. solar, then auxiliary etc …). If not then i was getting TRNSYS to restart the iteration on the same time step until the correct control case was obtained.

 

Has anybody done something similar for TRNSYS 17.2 ?

I have started looking for this, it seems to be located between, exec.for, trnsys.for, etc …

 

Thanks in advance,

 

Pierre Jaboyedoff

Head of BEEP PMTU Switzerland (www.beepindia.org)

Effin’Art

Associate

Chemin de Pré-Fleuri 6

Entrance at the back, 3rd floor on the left

CH-1006 Lausanne

Tel : 00 41 21 616 11 00

Mobile : 00 41 79 668 50 88

pierre.jaboyedoff@effinart.ch

 

 

 

 

 

 

 

 

 

 

 

-------------------------------------------------------------------------

-------------------------------------------------------------------------

in blockdat

 

C MODIF  PJ BEGIN

                COMMON /CHKSTEP/ ireiter, icas, icaschk

                COMMON /sunsp/ tsunsp, tset, tmax, tload, tsto, text

C MODIF  PJ END

-------------------------------------------------------------------------

 

 

 

-------------------------------------------------------------------------

-------------------------------------------------------------------------

in main

-------------------------------------------------------------------------

 

c modif  pj begin

                COMMON /CHKSTEP/ IREITER , icas, icaschk

                COMMON /sunsp/ tsunsp, tset, tmax, tload, tsto, text

c modif  pj end

 

-------------------------------------------------------------------------

 

C ********************** MAIN SIMULATION LOOP **************************

100   IF (DONE) GO TO 999

      CALL CLOCK(TIME,DONE,2)

C  modif  pj begin

c added label 10001 used for reiter of the time step

10001 IF (NDERIV.EQ.0) THEN

c modif  pj end

 

-------------------------------------------------------------------------

 

370       CONTINUE

         ENDIF

 

C       SWITCH PREDICTED AND CORRECTED VALUES

        I = PRED

        PRED = CORR

        CORR = I

        INTG = 2

        IF (IRECUR.GT.0) INTG = 3

        IF ((IRECUR.GT.0.OR.NCALLS.GT.0).AND.(ICT.EQ.0)) GO TO 200

 

C ************************************************************

C MODIF  PJ BEGIN (LABELED COMMON ADDED IN BLOCKDAT_M.FOR, )

c control_iter retuen a variable reiter (in common labelled CHKSTEP)       

C REITER =0 GO ON TO NEXT TIME STEP

C        =1 REITER ON THE SAME TIME STEP

      call control_iter(time)

                if (ireiter .gt. 0) then

                ireiter=ireiter+1

                icasmain=icas

                               icaschkm=icaschk

                timereit=max(0.,time)

c              WRITE(*,*) "reiter ", timereit, icasmain, icaschkm

                tsunspm=tsunsp

                tsetm=tset

                tloadm=tload

                tmaxm=tmax

                stom=tsto

                textm=text

c              write (*,*) "  tsunsp=", tsunspm, "  tset=",tsetm," text=",textm

c              write (*,*) "  tload=", tloadm, "  tmax=",tmaxm," tsto=",tsto 

c              write (*,*) icasmain

c              write (*,*) icaschkm

c             CALL PRINT(TIME,DONE)

                goto 10001

                endif

C MODIF  PJ END

 

-------------------------------------------------------------------------

-------------------------------------------------------------------------

 

 

 

-------------------------------------------------------------------------

-------------------------------------------------------------------------

in exec

-------------------------------------------------------------------------

c modif  pj begin

                COMMON /CHKSTEP/ IREITER, icas, icaschk

c modif  pj end

-------------------------------------------------------------------------

 

110         INFO(7,J) = -1

        ELSE

          DO 111 J = 1, NUNITS

            CALL(J) = CALL1(J)

c modif  pj begin

c added info(7,j) =0 for the case where one wants to reiter on the same

c time step

                if (ireiter .le. 0) then

                      INFO(7,J) = -1

                else

                               CALL(J) = .TRUE.

                      INFO(7,J) = 0

                endif

111   continue     

c modif  pj end

-------------------------------------------------------------------------

-------------------------------------------------------------------------

 

 

 

-------------------------------------------------------------------------

-------------------------------------------------------------------------

In my own control routine

 

c modif  pj begin

                COMMON /CHKSTEP/ IREITER, icas, icaschk

                COMMON /sunsp/ tsunsp, tset, tmax, tload, tsto, text

                SAVE /sunsp/

c modif  pj end

 

 

 

Pierre Jaboyedoff

Head of BEEP PMTU Switzerland (www.beepindia.org)

Effin’Art

Associate

Chemin de Pré-Fleuri 6

Entrance at the back, 3rd floor on the left

CH-1006 Lausanne

Tel : 00 41 21 616 11 00

Mobile : 00 41 79 668 50 88

pierre.jaboyedoff@effinart.ch