Automatically export all reports in batch
Hello,
I typically run many simulations in batch mode with accompanying java macros that set up the conditions; these simulations have many reports. I'm looking for a way to export all reports after simulation convergence (in batch mode) into a csv file. I have found a java macro which exports all reports to a csv file by running it manually on a simulation, but I need to run it automatically and only after convergence. Currently, the last command in my setup macros (which I use with each simulation in batch mode) is to RUN the simulation. How do I go about running the report export macro before the simulation closes (and moves on to the next simulation) in batch mode? Thanks Attached is the report export macro I got from cd-adapco's java hut (author:Sangamesh) Quote:
|
I forgot that I can play a macro from within a macro. All I had to do was add the following line to the end of my conditioning macro:
new StarScript(getActiveSimulation(),new java.io.File(resolvePath("Report_to_csv.java"))).p lay(); |
Not 100% sure if I understand what you are doing. Just run a macro once the simulation run finishes? I wrote a couple of macros a few months ago to do stuff after each iteration or timestep, maybe they are helpful to you.
First I toyed around with the observer pattern: Quote:
Then I used another approach by making my macro run the simulation itself timestep by timestep. You would probably have to adjust your stopping criteria since you obviously have your own ones based on convergence. I simplified it and put comments where you can do things a) after every step and b) after last step: Quote:
|
Thanks for your contribution Sebastian, but as you can read from my 2nd post, I figured it out ...
|
Oh alright, that came across like some kind of extra information. Guess I shouldn't try to answer threads in a hurry shortly before calling it a day ;)
|
This thread that it already has some time it's quite useful to export the reports into an excel spreadsheet in batch mode. The code in the 1st post worked brilliantly to me to export all the reports from my simulations.
But here's my question and hopefully someone can help me to find an answer because my Java knowledge is 0 and I do not know how to find or write myself the right code to export the Plots monitor into an excel file. The thing is that I have a series of simulations and I would like to generate an excel file with the plots results for each simulation in batch mode. Hope that I made myself clear, so if you need some extra info, please let me know it. Any help or guidance on this, I would really appreciate it!:) |
Export single reports, java api issues
Hello !
I am sorry I have to revive this thread again, but in case someone is looking for a way to extract single Reports by specifying the Report Name, this might help you: Code:
// STAR-CCM+ macro: reportExtractor.java |
Where is the .csv File ?
Can someone tell me where i will find the .csv file after running the macro??
I thought it would be at the same place as my simulation, but there is nothing. |
if you do not specify an absolute path, the relative path points to the current work directory.
This should be the location from which the starccm binary is started. If you are running windows, have a look into your home directory (such as C:/Users/Marcel/) The sim object has a method which tells in which directory it is located. Here is an example to export all plots to the location of the sim file Code:
Simulation simulation_0 = getActiveSimulation(); |
Quote:
If you are running windows, have a look into your home directory (such as C:/Users/Marcel/)" I tried and in my case it was at the folder where the .java macro was |
All times are GMT -4. The time now is 06:51. |