Skip to content

Conversation

baggepinnen
Copy link
Contributor

Analysis points are supposed to be used with RealInput/RealOutput, and those both have an inner variable called u. This PR attempts to connect other kinds of components as well, but throws an error if there is more than one state variable, in which case which one is referred to by the AP is ambiguous.

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Merging #134 (e0b2f44) into main (a821c7a) will decrease coverage by 0.08%.
The diff coverage is 54.54%.

@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
- Coverage   65.34%   65.25%   -0.09%     
==========================================
  Files          33       33              
  Lines        1434     1439       +5     
==========================================
+ Hits          937      939       +2     
- Misses        497      500       +3     
Impacted Files Coverage Δ
src/Blocks/analysis_points.jl 76.13% <54.54%> (-1.06%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

namespace[] = ns
apr[] = ap
(ap.out.u ~ ap.in.u + d), d
(ap_var(ap.out) ~ ap_var(ap.in) + d), d
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also compare that their variable names equal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is only a single variable, I figured it was unambiguous no matter what it was called. If there were more than one variable, I threw an error instead. This happens already in the ap_var function.

The reasoning for allowing any one variable is to make it more likely that it will work for user-defined components etc. without the user having built the components using our RealInput/RealOutput components.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the matching based on name rather than type is a bit unfortunate in any case. An alternative approach would be to store the variable name in the analysis point, and default to u if none was provided. I'm not sure for about how the syntax for this would look though.

@YingboMa YingboMa merged commit 8869de7 into SciML:main Jan 5, 2023
@baggepinnen baggepinnen deleted the ap_var branch January 5, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants