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

Re: [TRNSYS-users] GenOpt



Hi Miroslava,

I struggled with this same problem, hopefully my solution will help you.

GenOpt has an option where you can define 'FirstCharacterAt' in the ObjectiveFunctionLocation section of your .ini file. This allows you to extract two outputs from one line of text.

Here is an example from my work that might help you: (In my opinion, the GenOpt manual does a poor job of explaining how to use 'FirstCharacterAt'!)

My output text file looks like this: (I want to read kWh_total and BTU_total from the last line of the file)


TIME                                         ,kWh_total                                 ,BTU_total                ,
  +0.0000000000000000E+00,  +0.0000000000000000E+00,  +0.0000000000000000E+00,
  +8.7600000000000000E+03,  +9.6507009364595826E+04,  +3.5498954575250727E+08,


In order to read kWh_total and BTU_total into GenOpt as objective functions, I define my the ObjectiveFunctionLocation of my .ini file as follows:


 ObjectiveFunctionLocation {
        Name1      = "BTU";
        Delimiter1 = "," ; 
FirstCharacterAt1 = 52;
Name2 = "kWh";
Delimiter2 = ",";
FirstCharacterAt2 = 26;
    }



GenOpt reads files by starting at the bottom of the file. The 'FirstCharacterAt' parameter tells GenOpt where to look for the Delimiter that you have defined. So, for my first objective function (BTU), I defined FirstCharacterAt to be 52, which is one position to the left of the delimiter for the BTU data. (i.e., just to the left of the comma in the string ',  +3.5498954575250727E+08') I did the same for the kWh output, but this time the FirstCharacterAt position is 26, which is just to the left of the comma delimiter for the kWh output.

I think it is probably easier to have both outputs in one file. If you have two output files, GenOpt will only read the second output file if it can't find the Objective Function in the first output file. Having two output files doesn't really simplify anything, you still have to figure out how to define your Delimiter and ObjectiveFunctionLocation so that two values can be read.

I hope that helps! Please reply if something does not make sense.
-Graham











On Sat, May 5, 2012 at 11:04 AM, Miroslava Kavgic <miroslava.kavgic@gmail.com> wrote:
Dear all,

I'am using GenOpt with TRNSYS for optimization of  building. My first cost function on which optimization should be performed is Qheat and the second cost function that should serve as restriction function (penalty) is PPD (predicted percent of dissatisfied people), and both functions are calculated by TRNSYS. However I'am having trouble with writing the .ini file so both functions could be red by GenOpt. Namely, GenOpt only reads the first one (Qheat) while it ignores the second one, even thoug it exists in the output file after the first one. 


For example, if Name1=''Qheat''; Delimiter1=''04032000000000000E+0004''; (simulate only winter season),
how Name and Delimiter of the second cost function should be defined, that is of the PPD function? 
More precisely I don't know how to define Delimiter of the second function in order to be red by GenOpt. 
Should both function be in the same output file or in the separate output files? 

Thank you very much!!!

Kind Regards,

Miroslava Kavgic

--
Miroslava Kavgic Dipling, MSc
PhD Candidate
 
Bartlett School of Graduate Studies
University College London (UCL)
Central House
14 Upper Woburn Place
London     WC1H 0NN    UK
 
E-mail:miroslava.kavgic@gmail.com

_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@cae.wisc.edu
https://mailman.cae.wisc.edu/listinfo/trnsys-users