Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAST-OAD should warn when an input file contains a variable that will be overwritten #507

Open
christophe-david opened this issue Feb 7, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@christophe-david
Copy link
Contributor

Describe the bug
When FAST-OAD is given an XML input file with variables that are not expected inputs, it does not feed the OAD problem with them, but simply copies these variables into the XML output file. This is an intended behavior to allow keeping variables along a chained process.

However, if a variable in the XML input file is an output, the XML output file will contain the actual output value, and then the original value will be lost without warning.

To Reproduce
Content of input.xml:

<FASTOAD_model>
    <a>10.0</a>
    <b>10.0</b>
    <c>5.0</c>
</FASTOAD_model>

Code:

import fastoad.api as oad
import openmdao.api as om

problem = oad.FASTOADProblem()

problem.model.add_subsystem("sys", om.ExecComp("a=b+c"), promotes=["*"])

problem.input_file_path = "input.xml"
problem.output_file_path = "output.xml"

problem.read_inputs()
problem.setup()
problem.run_model()
problem.write_outputs()

Obtained in output.xml, with a new value for a (correct but overwritten):

<FASTOAD_model>
  <a is_input="False">15.0</a> 
  <b is_input="True">10.0</b>
  <c is_input="True">5.0</c>
</FASTOAD_model>

Expected behavior
A warning should be issued when such a situation is encountered.
Since the most likely reason for it to happen is that the user thought the variable was an input, it would help to spot the error.

Environment

  • FAST-OAD v1.6.0
@christophe-david christophe-david added the bug Something isn't working label Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant