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

Get flat model without constants #1809

Open
weberscode opened this issue Oct 26, 2023 · 8 comments
Open

Get flat model without constants #1809

weberscode opened this issue Oct 26, 2023 · 8 comments

Comments

@weberscode
Copy link

Hi all,

i would like to externally optimize or vary parameters. For i export the model as fmu and optimize it. To externally call and set a model parameter this must be a parameter and not a constant within the flat model. So here is the question?

When i use the thermal zone model and set any of the following parameter

  • ThermalZones.ReducedOrder.RC.FourElements.VAir
  • ThermalZones.ReducedOrder.RC.FourElements.AWin
  • ThermalZones.ReducedOrder.RC.FourElements.ATransparent
  • ThermalZones.ReducedOrder.RC.FourElements.AExt
  • ThermalZones.ReducedOrder.RC.FourElements.AInt
  • ThermalZones.ReducedOrder.RC.FourElements.AFloor
  • ThermalZones.ReducedOrder.RC.FourElements.ARoof

to a value of my record, then the record value and some on its dependant values change to constant during the flattening process. A i said, i need them as a parameter to be externally optimized.

How could i solve this problem?

kr Simon

@weberscode
Copy link
Author

I additionally tried it with model SimpleRoomFourElements and now think different. I think the problem is not that I overwrite the variables from the record to VAir, but that generally in RC.FourElements VAir is converted from a parameter type to the constant type after flattening. Why could that happen? What can i do to write on VAir without change to constant type.

@weberscode
Copy link
Author

A final before doesn't fix either:

ThermalZones.ReducedOrder.RC.FourElements thermalZoneFourElements( final VAir=VAir,

@weberscode
Copy link
Author

When i try a simple capacity the flattening doesn't change the type to constant.

parameter Real sysParam.VAir = 52.5; parameter Real sysParam.hConExt = 3; parameter Real VAir = 52.5; parameter Real hConExt = 3; parameter Modelica.Units.SI.HeatCapacity heatCapacitor.C = 1000.0*VAir

@weberscode
Copy link
Author

I all,

i made my own ThermalZones.RC.FourElements according to yours and then removed the ThermSplitter model for solarGain and internalGain. Then it flattened without changing the type to constant. Perhaps the problem is with the function splitFacVal

@weberscode
Copy link
Author

weberscode commented Oct 27, 2023

now i tried it with splitFactor={{AArray[1]},{AArray[2]},{AArray[3]}} ./ sum(AArray) and removed only the ThermSplitterSolRad --> still the change from parameter to constant --> i think its only cause of the ThermSplitter model that the compiler thinks this matrix would change the number of states and not only the value so it changes it to constant and with it all the areas and parameters depending on AArray --> thats my final result. What do you think?

@weberscode
Copy link
Author

so, ... i think i got the villain ...

dimension must be declared as:
final parameter Integer dimension = size(AArray,1)

instead of

final parameter Integer dimension = sum({if A>0 then 1 else 0 for A in AArray})

@mlauster
Copy link
Member

mlauster commented Oct 27, 2023 via email

@mlauster
Copy link
Member

mlauster commented Oct 27, 2023 via email

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