[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sensitivity analysis with GenOpt: attachments
You already received this message but without the attachements. Sorry.
This time it should be there.
Please note that the attached type does not replace GenOpt. It is just a
simple printer routine.
Dear all
You might want to consider using GenOpt for parametric studies (too).
GenOpt is available from LBL (http://SimulationResearch.lbl.gov) and may
be used for both optimization and sensitivity analysis. It is not easy
to get into it, but once you are familiar with GenOpt you may take
advantage of the many features it offers.
In order to gather results and parameters used from subsequent TRNSYS
simulations in the same file, I have written a primitive type (type180).
(GenOpt does that too, but using type180 provides a bit more
flexibility). If anyone is interested in using this little helper, it is
attached (type180.for is the code and type180.for is some explanation
and an extract from the deck that illustrates the use of the type.)
Because it was not my intention to distribute it, it was not developed
to perfection. The feature that is most obviously lacking is mentioned
in file "type180.dck".
Peter
--
Peter Vogelsanger
Systemtechnik und Speicher, Institut für Solartechnik SPF
Hochschule für Technik Rapperswil, Oberseestr.10, CH-8640 Rapperswil
Tel +41 55 222 48 23, Fax +41 55 222 48 44, http://www.solarenergy.ch
SUBROUTINE TYPE180(TIME,XIN,OUT,T,DTDT,PAR,INFO,ICNTRL,*)
C**************************************************************************
C MSSP: Mulitple Sequential Simulations Printer
C WRITES INPUTS OF SEVERAL SUBSEQUENT SIMULATIONS INTO A FILE
C CLOSES FILE AFTER EVERY RECORD
C
C PETER VOGELSANGER, APRIL 2004
C V1 : 18 APRIL 2004: OUTPUT FILENAME IS INVARIABLY: "OUTPUT.MSS"
C
C
C**************************************************************************
C PARAMETERS:
C 1: FORTRAN LOGICAL UNIT NUMBER OF FILE
C 2: NUMBER OF VALUES TO BE PRINTED (<=50)
C 3: 1ST CODE FOR PART OF FILE NAME DECLARATION (FUTURE CONSIDERATION)
C 4: 2ND CODE FOR PART FOR FILE NAME DECLARATION (FUTURE CONSIDERATION)
C 5: 3RD CODE FOR PART FOR FILE NAME DECLARATION (FUTURE CONSIDERATION)
C 6: 4TH CODE FOR PART FOR FILE NAME DECLARATION (FUTURE CONSIDERATION)
C 7: 5TH CODE FOR PART FOR FILE NAME DECLARATION (FUTURE CONSIDERATION)
C
C INPUTS:
C 1: ENABLE PRINTING
C 2 ... 51: VALUES TO BE PRINTED (MAX = 50)
C
DOUBLE PRECISION XIN,OUT,ATEMP
C REAL ATEMP
C INTEGER NVAL
DIMENSION PAR(7),XIN(51),OUT(50),INFO(15),ATEMP(50)
C
IF(INFO(7).EQ.-1) THEN
C DO THE USUAL TRNSYS STUFF IF THIS IS THE FIRST CALL OF THE SIMULATION
C NUMBER OF PARAMS, INPUTS, DERIVATIVES, OUTPUTS
NP=7
NI=INT(PAR(2)+1.1)
ND=0
C IF INFO(9) IS 2: CALLED ONLY AFTER INPUTS HAVE CONVERGED
INFO(9) = 2
C OPEN (UNIT = PAR(1), FILE = 'OUTPUT.MSS', STATUS = 'UNKNOWN')
CALL TYPECK(1,INFO,NI,NP,ND)
RETURN 1
ENDIF
C
C PRINT IF ENABLED SIGNAL (INPUT 1) IS 1 (>0.5)
C
IF(INFO(7).GE.0) THEN
IF(XIN(1).GT.0.5) THEN
OPEN (UNIT = PAR(1)
. , FILE = 'OUTPUT.MSS'
. , STATUS = 'UNKNOWN'
. , ACCESS = 'APPEND'
. , CARRIAGECONTROL = 'NONE'
. )
C CLOSE (UNIT = PAR(1))
WRITE(PAR(1),1000) TIME
CLOSE (UNIT = PAR(1))
OPEN (UNIT = PAR(1)
. , FILE = 'OUTPUT.MSS'
. , STATUS = 'UNKNOWN'
. , ACCESS = 'APPEND'
. , CARRIAGECONTROL = 'NONE'
. )
DO J = 1,PAR(2)
ATEMP(J) = XIN(J+1)
END DO
WRITE(PAR(1),1001) (CHAR(9),ATEMP(J),J=1,PAR(2))
CLOSE (UNIT = PAR(1))
OPEN (UNIT = PAR(1)
. , FILE = 'OUTPUT.MSS'
. , STATUS = 'UNKNOWN'
. , ACCESS = 'APPEND'
C . , CARRIAGECONTROL = 'NONE'
. )
WRITE(PAR(1),1002)
CLOSE (UNIT = PAR(1))
ENDIF
ENDIF
c 1001 FORMAT (F13.5,(1X,1PE10.3))
1000 FORMAT (F13.5)
C 1000 FORMAT (SP,1PE12.5)
1001 FORMAT (50(A1,SP,1PE12.5))
c 1001 FORMAT (TR3,1PE10.3)
C 1001 FORMAT (1X,1PE10.3)
1002 FORMAT (X)
RETURN 1
END
* ABOUT TYPE 180:
* 1. YOU ARE FREE TO USE THIS TYPE. THE USUAL DISCLAIMER APPLIES.
* 2. ANY CHANGE ADDED THAT MAY BE OF INTEREST TO OTHERS IS SUPPOSED TO BE
* COMMUNICATED TO THE AUTHOR (peter.vogelsanger@xxxxxxxxxxxxxx)
*
* The subroutine prints into one file which is invariably named "output.mss"
* located in the default or working directory.
* In the current version there may be no ASSIGN statement for "output.mss"
* in the deck, or printing will be incorrect.
* The most obvious improvement would be to allow an ASSIGN statement to set
* path and filename in the deck.
***********************
* Extract from the deck that illustrates the use of type 180:
EQUATIONS 1
FlMSS = GT(time,(tSimEnd - dtSim))
UNIT 18 TYPE 180 MULTIPLE SEQUENTIAL SIMULATIONS PRINTER (element MSS)
PARAMETERS 7
* 1 fortran logical unit number of file
* remember: do not set any ASSIGN command for that file in the deck
18
* 2 number of values to be printed, apart from time
* remember: not more that 50 values may be printed
25
* 3 .. 7: not used
0 0 0 0 0
INPUTS 26
* 1 enable: printing if enable>0.5
FlMSS
* 2 ... 51 remember not more that 50 values may be printed; not more than 51 inputs are allowed
Z RSADA RDSA RSADcL RDScL RSADcP RDScP RSADP RDSP
EfA1B EfA1D UAHcN Zd2i UAHdN Zd1i UASAmb mcN TCtrCOff dTCtrC TSpOn
PpBN PpCN PpAN FPpA PpCtr
* INPUT INITIAL VLAUES
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
* OUTPUTS: printing in a file only: there are no outputs.