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

Updating API module #106

Merged
merged 1 commit into from
Oct 5, 2023
Merged

Conversation

AnHeuermann
Copy link
Member

  • Adding ScriptingError error
  • Throw errors instead of prints when failing
  • special treatment of stopTime for API.simulate
  • More documentation

  - Adding ScriptingError error
  - Throw errors instead of prints when failing
  - special treatment of stopTime for API.simulate
  - More documentation
Comment on lines +154 to +156
if !isnothing(stopTime)
exp *= "stopTime = $stopTime,"
end
Copy link
Member Author

Choose a reason for hiding this comment

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

This special treatment of stopTime is stupid, but I couldn't figure out a way to change this without changing omc itself. The scripting documentation in the User's Guide is wrong.

input Real stopTime = 1.0 "the stop time of the simulation. = 1.0";

The default value isn't 1.0 but the value specified in the experiment annotation. But there is no value one can provide to the scripting call to get the same behavior as not specifying stopTime.

@AnHeuermann AnHeuermann self-assigned this Oct 5, 2023
@@ -62,8 +106,12 @@ module API
)

exp = join(["loadFile", "(", "fileName", "=", modelicaString(fileName), ",", "encoding", "=", modelicaString(encoding), ",", "uses", "=", uses,",", "notify", "=", notify,",", "requireExactVersion", "=", requireExactVersion,")"])
return sendExpression(omc, exp)
success = OMJulia.sendExpression(omc, exp)
Copy link
Contributor

Choose a reason for hiding this comment

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

@AnHeuermann I see that you are using a better error reporting, but in our mos scripts we always use getErrorString()

loadFile("XXX"); 
getErrorString();

but from users point of view the API should give error msg without the use of getErrorString()

@CLAassistant
Copy link

CLAassistant commented Oct 5, 2023

CLA assistant check
All committers have signed the CLA.

@AnHeuermann AnHeuermann merged commit 59a8f08 into OpenModelica:master Oct 5, 2023
6 checks passed
@AnHeuermann AnHeuermann deleted the api-fixes branch October 5, 2023 12:53
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.

3 participants