OMJulia.jl icon indicating copy to clipboard operation
OMJulia.jl copied to clipboard

Set methods dictionary input

Open AnHeuermann opened this issue 2 years ago • 0 comments

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

AnHeuermann avatar Sep 07 '23 07:09 AnHeuermann