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

Set methods dictionary input #98

Open
AnHeuermann opened this issue Sep 7, 2023 · 0 comments
Open

Set methods dictionary input #98

AnHeuermann opened this issue Sep 7, 2023 · 0 comments

Comments

@AnHeuermann
Copy link
Member

For the set methods documented in https://openmodelica.github.io/OMJulia.jl/dev/modelicaSystem/#Set-Methods

Two setting possibilities are accepted using setXXXs(),where "XXX" can be any of above functions.

  1. setXXX("Name=value") string of keyword assignments
  2. setXXX(["Name1=value1","Name2=value2","Name3=value3"]) array of string of keyword assignments

having tuples of names and values as string or array of strings is a bit strange.

I suggest to add higher level methods for the set methods with dictionaries instead of a list of strings

parameters = Dict("x"=>1, "y"=>7.0, "z"=>"hello")
setParameters(omc, parameters)

function setParameters(omc, parameters::Dict{Any}, verbose::Bool = true)
  name = ["$(p[1])=$(p[2])" for p in collect(parameters)]
  setParameters(omc, name, verbose)
end
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

No branches or pull requests

1 participant