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

adding parameters with indices in the path #430

Open
tboiger opened this issue Jul 29, 2021 · 2 comments
Open

adding parameters with indices in the path #430

tboiger opened this issue Jul 29, 2021 · 2 comments

Comments

@tboiger
Copy link

tboiger commented Jul 29, 2021

in buildingspy the function "s.simulate" generates a mos run-file and runs the file;
in the mos-file there is written something like

simulateModel(modelname, startTime=0, stopTime=31536000, method="Cvode - variable order", tolerance=0.0001, resultFile="Inffeldgasse13_1", numberOfIntervals=8760);

if s.addParameters is used, it is something like
simulateModel('modelname(multizone.VAir=30000)', ...)
or
simulateModel('modelname(multizone.zoneParam[1].gWin=0.6)', ...)

the problem is that writing the parameters in parenthesis after the model works as long as the parameter is accessible with dots only, but if there is an index, it doesn't work anymore, because Dymola obviously can't handle indices inside the parenthesis.

Our solution so far is to use the Python Interface of Dymola to access the parameters:

We use the function 'simulateExtendedModel' from the Interface, where parameters can be given extra this way

simulateExtendedModel(modelname, ..., initialNames=['multizone.zoneParam[1].gWin'], initialValues=[0.6], resultFile=path)

Here it works with indices too. We save the file to a given path and then import the results with buildingspy.

A solution for buildingspy would be to give the option to either generate a mos run-file with simulateModel or a mos run-file with simulateExtendedModel depending on if parameters are added or not

@mwetter
Copy link
Member

mwetter commented Jul 30, 2021

@tboiger : Would the simulateExtendedModel command also work with a redeclare statement, for example to redeclare the medium or to redeclare a model?

@mwetter
Copy link
Member

mwetter commented Jul 30, 2021

Another issue with using simulateExtendedModel is that some parameter are already evaluated during translation and then cannot be modified. For example,

simulateExtendedModel(problem="IBPSA.Fluid.FixedResistances.Validation.PressureDropsSeries", initialNames={"res[1].dp_nominal"}, initialValues={10}, tolerance=1e-06, resultFile="PressureDropsSeries");
Warning: Setting res[1].dp_nominal has no effect in model.
After translation you can only set literal start-values and non-evaluated parameters.

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

2 participants