Closed AleSgueglia closed 3 years ago
Hello,
You are right, there is no FAST-OAD-specific way to configure an OpenMDAO recorder, but you may still do it using your knowledge of OpenMDAO, and a part of FAST-OAD that we did not advertise yet, but is nonetheless part of the official (thus maintained) API of FAST-OAD.
Assuming you have a configuration file, you can do:
import fastoad.api as oad
import openmdao.api as om
conf = oad.FASTOADProblemConfigurator("path/to/your/conf_file.yml") # reads the configuration file
conf.write_needed_inputs("your/data_source.xml") # you may skip this step if you already generated your input file
problem = conf.get_problem(read_inputs=True) # here you get an OpenMDAO problem (with only a few additions)
# Here you may add your recorder using the OpenMDAO way
recorder = om.SqliteRecorder("record.sqlite")
problem.model.add_recorder(recorder)
problem.model.recording_options['includes'] = ['*']
# You run the problem normally
problem.setup()
problem.run_model()
# To get FAST-OAD outputs, you have to use the method we have added
# to our slightly modified Problem class:
problem.write_outputs()
Please let me know it you can work with that.
And if you want a more straight-forward solution, I would be interested to have some suggestions on the way we should make such feature available. Would you have this settings in the configuration file? What syntax you think would be useful?
Hello, thank for the reply: indeed it has been useful to me to discover this nice feature!
To answer your final question, in my opinion a good way to implement the recorder in FAST OAD would be to add it as an option that can be declared in the configuration file, in a similar manner as the optimisation driver.
Best regards, Alessandro
Thanks for the feedback.
To answer your final question, in my opinion a good way to implement the recorder in FAST OAD would be to add it as an option that can be declared in the configuration file, in a similar manner as the optimisation driver.
I take the occasion to write some thoughts about that:
Actually, as you know, recorders in OpenMDAO are not set like the optimisation driver. You can set recorders for problem, driver, solvers, or systems. And strictly speaking, add_recorder()
allows to define several recorders for a same entity. But we may forget this last possibility and simply use a recorder = ...
syntax in the configuration file that could be placed at the desired level in the configuration file.
After that, we should handle the recording_options
, which will probably have to be a structure on its own, like:
recording_options:
excludes :
- private:*
- *useless*
record_inputs : false
And to be complete, we will have to allow to set a case prefix when running the problem.
Hello, is there any possibility today to use the OpenMDAO recorder for tracking the variables within FAST OAD? I found it very useful when working in OpenMDAO to log the results, but it seems that in FAST OAD there is not the possibility to use it yet.
Thanks in advance for the reply.
Regards, Alessandro Sgueglia