-
Notifications
You must be signed in to change notification settings - Fork 13
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
Updating API module #106
Conversation
AnHeuermann
commented
Oct 5, 2023
- 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
if !isnothing(stopTime) | ||
exp *= "stopTime = $stopTime," | ||
end |
There was a problem hiding this comment.
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
.
@@ -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) |
There was a problem hiding this comment.
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()