Closed Kanchan-Aggarwal closed 2 years ago
@Kanchn12345 Thanks for raising this ticket. I am facing this error too.
@Kanchn12345 can you verify whether https://github.com/open-ideas/IDEAS/tree/1225_XiSat resolves your issue?
@Mathadon I tried using the above fix, its giving a different error now. Copied the error message below. Please take a look
[2] 14:23:01 Translation Error [IDEAS.Templates.Interfaces.BaseClasses.Structure: 50:3-52:73]: Non-array modification ‘"ThermodynamicTemperature"‘ for array component ‘quantity‘, possibly due to missing ‘each‘.
@Mathadon , Thank you fixing it.
I tried running the model and I am also getting the same error as @YashwanthVellala
@Kanchn12345 @YashwanthVellala can you try again?
@Mathadon Getting a different error now, below is the error message
[2] 14:52:16 Translation Error [IDEAS.Buildings.Components.Interfaces.PartialZone: 254:3-255:43]: Non-array modification ‘false‘ for array component ‘fixed‘, possibly due to missing ‘each‘.
@Mathadon, I am also facing the same error.
@Mathadon Can you please try to fix this as soon as possible
done!
There may be quite a bit more of these missing 'each'. Feel free to add them yourself and report back on where I should add them!
@Mathadon Thanks for the fix, but it isnt working yet. its giving a different error, shown below.
[8] 18:01:35 Translation Error [IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
Earlier, we had fixed the errors related to using 'each' ourselves, we can note and report to you on those errors. Please help to fix these ones.
Also, do you use a different platform or another version of openmodelica ? just to understand, these errors are not due to compatibility problems.
I use dymola for our development and do not use OM.
The error that you report is something that looks less straight forward to fix. Today is the national holiday in Belgium so that will be for later. I can only recommend removing the shading from the building envelope model for now if you want to progress.
@casella the error
[8] 18:01:35 Translation Error
[IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
Seems to be caused by the code
extends IDEAS.Buildings.Validation.BaseClasses.Structure.Bui600(win(
redeclare replaceable IDEAS.Buildings.Components.Shading.Overhang
shaType(
each hWin=2.0,
each wWin=3.0,
each dep=1.0,
each gap=0.35,
wLeft={0.5,4.5},
wRight={4.5,0.5})));
where win
is declared as an array of components
IDEAS.Buildings.Components.Window[2] win(
final A={6,6},
redeclare final parameter IDEAS.Buildings.Validation.Data.Glazing.GlaBesTest glazing,
final inc={IDEAS.Types.Tilt.Wall,IDEAS.Types.Tilt.Wall},
azi={aO+IDEAS.Types.Azimuth.S,aO+IDEAS.Types.Azimuth.S},
redeclare replaceable IDEAS.Buildings.Components.Shading.None shaType,
redeclare final parameter IDEAS.Buildings.Data.Frames.None fraType,
each frac=0)
The purpose of wLeft={0.5,4.5},
is to assign a different value of wLeft
to each instance of win
. As far as I can tell, the syntax is correct (edit: except for missing 'each', solved in 9293da0). But perhaps the standard does not permit such assignments for a replaceable?
The issue may be solved through commit 9293da0 but I doubt that.
@Mathadon I'll try with this commit and let you know. Thanks
@Mathadon Doesn't resolve it. Still the same error.
[4] 12:24:35 Translation Error [IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
@Mathadon On a different note, need your help on FMU in OpenModelica. I am trying to export \IDEAS\Fluid\Examples\SimpleHouse.mo as an FMU to matlab to try few things. I used the below commands as mentioned in the OMtutorials https://openmodelica.org/doc/OpenModelicaUsersGuide/v1.11.0/fmi.html
I also tried with another command translateModelFMU(SimpleHouse, version="2.0"); mentioned here https://build.openmodelica.org/Documentation/OpenModelica.Scripting.translateModelFMU.html /doesnt work as well/
any suggestions ?
Can you simulate SimpleHouse
using OM (without using FMU)? If that results in an error then that's probably the cause for the FMU too since the same code is used. In any case the translateModelFMU
function likely generates an error message that should clarify what the problem is.
I can simulate the SimpleHouse in OpenModelica. Looks like the translate function is throwing some error.
[76] 13:49:43 Scripting Notification
Nonlinear iteration variables with predefined start attribute in NLSJac130. (1) ======================================== 1: weaBus.TWetBul:VARIABLE(min = 0.0 start = 291.15 ) "virtual variable in expandable connector" type: Real
Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
Nonlinear iteration variables with predefined start attribute in NLSJac133. (1) ======================================== 1: weaBus.TWetBul:VARIABLE(min = 0.0 start = 291.15 ) "virtual variable in expandable connector" type: Real
Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
[77] 13:49:43 Syntax Warning Lexer treating \ as \, since \U is not a valid Modelica escape sequence.
[78] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[79] 13:49:43 Syntax Warning Lexer treating \ as \, since \D is not a valid Modelica escape sequence.
[80] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[81] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[82] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[83] 13:49:43 Syntax Warning Lexer treating \ as \, since \F is not a valid Modelica escape sequence.
[84] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[85] 13:49:43 Syntax Warning Lexer treating \ as \, since \S is not a valid Modelica escape sequence.
[86] 13:49:43 Translation Error
Class translateModelFMU not found in scope
[87] 13:49:43 Syntax Warning Lexer treating \ as \, since \U is not a valid Modelica escape sequence.
[88] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[89] 13:49:43 Syntax Warning Lexer treating \ as \, since \D is not a valid Modelica escape sequence.
[90] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[91] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[92] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[93] 13:49:43 Syntax Warning Lexer treating \ as \, since \F is not a valid Modelica escape sequence.
[94] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[95] 13:49:43 Syntax Warning Lexer treating \ as \, since \S is not a valid Modelica escape sequence.
[96] 13:49:43 Scripting Error [C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/index.json: 0:0-0:0]: The package index C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/index.json could not be parsed.
[97] 13:49:43 Scripting Error Failed to load package SimpleHouse (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-64bit/lib/omlibrary;C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/.
[98] 13:49:43 Translation Error
Class SimpleHouse not found in scope
[99] 13:49:43 Translation Error
Class SimpleHouse not found in scope
[100] 13:49:43 Translation Warning [IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3: 2:1-105:25]: Pure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3‘ contains a call to impure function ‘Modelica.Utilities.Streams.readLine‘.
[101] 13:49:43 Translation Warning [IDEAS.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3: 2:1-48:21]: Pure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getLongitudeTMY3‘ contains a call to impure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3‘.
[102] 13:49:43 Translation Warning [IDEAS.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3: 2:1-48:20]: Pure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getLatitudeTMY3‘ contains a call to impure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3‘.
[103] 13:49:43 Translation Warning [IDEAS.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3: 2:1-47:20]: Pure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getTimeZoneTMY3‘ contains a call to impure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3‘.
[104] 13:49:43 Symbolic Warning The model contains alias variables with redundant start and/or conflicting nominal values. It is recommended to resolve the conflicts, because otherwise the system could be hard to solve. To print the conflicting alias sets and the chosen candidates please use -d=aliasConflicts.
[105] 13:49:43 Translation Error Error building simulator. Build log: clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse.o IDEAS_Fluid_Examples_SimpleHouse.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_functions.o IDEAS_Fluid_Examples_SimpleHouse_functions.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_records.o IDEAS_Fluid_Examples_SimpleHouse_records.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_01exo.o IDEAS_Fluid_Examples_SimpleHouse_01exo.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_02nls.o IDEAS_Fluid_Examples_SimpleHouse_02nls.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_03lsy.o IDEAS_Fluid_Examples_SimpleHouse_03lsy.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_04set.o IDEAS_Fluid_Examples_SimpleHouse_04set.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_05evt.o IDEAS_Fluid_Examples_SimpleHouse_05evt.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_06inz.o IDEAS_Fluid_Examples_SimpleHouse_06inz.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_07dly.o IDEAS_Fluid_Examples_SimpleHouse_07dly.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_08bnd.o IDEAS_Fluid_Examples_SimpleHouse_08bnd.c clang -Os -falign-functions -mstackrealign -msse2 -mfpmath=sse -I"C:/Program Files/OpenModelica1.17.0-64bit/include/omc/c/fmi" -DOMC_FMI_RUNTIME=1 -DCMINPACK_NO_DLL=1 "-IC:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources" -c -o IDEAS_Fluid_Examples_SimpleHouse_09alg.o IDEAS_Fluid_Examples_SimpleHouse_09alg.c In file included from IDEAS_Fluid_Examples_SimpleHouse_functions.c:2: In file included from ./IDEAS_Fluid_Examples_SimpleHouse_functions.h:3: In file included from ./meta/meta_modelica.h:49: ./gc/omc_gc.h:218:28: warning: expression result unused [-Wunused-value] GC_register_displacement(0); ^ ./gc/omc_gc.h:222:34: warning: expression result unused [-Wunused-value] GC_set_force_unmap_on_gcollect(1); ^ In file included from IDEAS_Fluid_Examples_SimpleHouse_records.c:4: In file included from ./meta/meta_modelica.h:49: ./gc/omc_gc.h:218:28: warning: expression result unused [-Wunused-value] GC_register_displacement(0); ^ ./gc/omc_gc.h:222:34: warning: expression result unused [-Wunused-value] GC_set_force_unmap_on_gcollect(1); ^ In file included from IDEAS_Fluid_Examples_SimpleHouse_functions.c:7: In file included from ./IDEAS_Fluid_Examples_SimpleHouse_includes.h:4: In file included from C:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources\getTimeSpan.c:12: C:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources/getTimeSpan.h:11:10: fatal error: 'ModelicaUtilities.h' file not found
^~~~~~~~~~~~~~~~~~~~~
2 warnings and 1 error generated.
In file included from IDEAS_Fluid_Examples_SimpleHouse_02nls.c:2:
In file included from ./IDEAS_Fluid_Examples_SimpleHouse_model.h:5:
In file included from ./openmodelica.h:71:
In file included from ./gc/../openmodelica_types.h:149:
./gc/omc_gc.h:218:28: warning: expression result unused [-Wunused-value]
GC_register_displacement(0);
^
./gc/omc_gc.h:222:34: warning: expression result unused [-Wunused-value]
GC_set_force_unmap_on_gcollect(1);
^
make: [
@Mathadon Also, is it likely to have a solution on the AHU model soon ?
There may be quite a bit more of these missing 'each'. Feel free to add them yourself and report back on where I should add them!
Pedantic check in Dymola report these issues as errors. Unfortunately it only reports the first one, so you have to kill them one by one.
[4] 12:24:35 Translation Error [IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
This may be by an OpenModelica bug. I would suggest you to try compiling the model with OpenModelica 1.18.0-beta.1 or with the latest nightly build, if you are still using 1.17.0 it may have been fixed already.
If not, please open a ticket here about that.
i'll try this as well @casella thanks !
I can simulate the SimpleHouse in OpenModelica. Looks like the translate function is throwing some error.
[76] 13:49:43 Scripting Notification
Nonlinear iteration variables with predefined start attribute in NLSJac130. (1)
1: weaBus.TWetBul:VARIABLE(min = 0.0 start = 291.15 ) "virtual variable in expandable connector" type: Real
Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
Nonlinear iteration variables with predefined start attribute in NLSJac133. (1)
1: weaBus.TWetBul:VARIABLE(min = 0.0 start = 291.15 ) "virtual variable in expandable connector" type: Real
Info: Only non-linear iteration variables in non-linear eqation systems require start values. All other start values have no influence on convergence and are ignored. Use "-d=dumpLoops" to show all loops. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=dumpLoops")
These are not errors, just warnings that there are some iteration variables in nonlinear equations that are using a default value as a first guess. If the solver converges, you can ignore this messsage. If it fails, this may be the cause of the failure.
BTW, we are implementing a very nice tool to help you in this case, based on the theory explained in this paper, it should be available later this autumn, at least as an experimental feature. @Mathadon, this could also be interesting for you.
[77] 13:49:43 Syntax Warning Lexer treating \ as \, since \U is not a valid Modelica escape sequence.
[78] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[79] 13:49:43 Syntax Warning Lexer treating \ as \, since \D is not a valid Modelica escape sequence.
[80] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[81] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[82] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[83] 13:49:43 Syntax Warning Lexer treating \ as \, since \F is not a valid Modelica escape sequence.
[84] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[85] 13:49:43 Syntax Warning Lexer treating \ as \, since \S is not a valid Modelica escape sequence.
[86] 13:49:43 Translation Error Class translateModelFMU not found in scope (looking for a function or record).
[87] 13:49:43 Syntax Warning Lexer treating \ as \, since \U is not a valid Modelica escape sequence.
[88] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[89] 13:49:43 Syntax Warning Lexer treating \ as \, since \D is not a valid Modelica escape sequence.
[90] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[91] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[92] 13:49:43 Syntax Warning Lexer treating \ as \, since \I is not a valid Modelica escape sequence.
[93] 13:49:43 Syntax Warning Lexer treating \ as \, since \F is not a valid Modelica escape sequence.
[94] 13:49:43 Syntax Warning Lexer treating \ as \, since \E is not a valid Modelica escape sequence.
[95] 13:49:43 Syntax Warning Lexer treating \ as \, since \S is not a valid Modelica escape sequence.
[96] 13:49:43 Scripting Error [C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/index.json: 0:0-0:0]: The package index C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/index.json could not be parsed.
[97] 13:49:43 Scripting Error Failed to load package SimpleHouse (default) using MODELICAPATH C:/Program Files/OpenModelica1.17.0-64bit/lib/omlibrary;C:/Users/E485898/AppData/Roaming/.openmodelica/libraries/.
[98] 13:49:43 Translation Error Class SimpleHouse not found in scope .
[99] 13:49:43 Translation Error Class SimpleHouse not found in scope .
Not sure about these errors, maybe they are not that important.
[100] 13:49:43 Translation Warning [IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3: 2:1-105:25]: Pure function ‘IDEAS.BoundaryConditions.WeatherData.BaseClasses.getHeaderElementTMY3‘ contains a call to impure function ‘Modelica.Utilities.Streams.readLine‘.
@Mathadon according to the latest rules regarding pure/impure functions I guess you should declare getHeaderElementTMY3 as impure, since it depends on externally loaded data. This ensures the compiler deals with it properly.
@YashwanthVellala your code contains
[98] 13:49:43 Translation Error
Class SimpleHouse not found in scope .
[99] 13:49:43 Translation Error
Class SimpleHouse not found in scope .
I think you need to use translateModelFMU(IDEAS.Fluid.Examples.SimpleHouse)
or translateModelFMU("IDEAS.Fluid.Examples.SimpleHouse")
instead of translateModelFMU(SimpleHouse)
BTW, we are implementing a very nice tool to help you in this case, based on the theory explained in this paper, it should be available later this autumn, at least as an experimental feature. @Mathadon, this could also be interesting for you.
@casella thanks for this info! In my experience we don't often have initial guess problems if the equations are well-defined, unless perhaps for highly non-linear systems. E.g. the sudden closing of a value can cause the initial guess for a flow network to be completely off and can result in numerical problems. Would this tool indicate what equation/variable is the one that is causing problems?
Thank you for the reference to the paper. I will go through it.
@Mathadon I think you need to use translateModelFMU(IDEAS.Fluid.Examples.SimpleHouse) or translateModelFMU("IDEAS.Fluid.Examples.SimpleHouse") instead of translateModelFMU(SimpleHouse) ---> didn't work
I’m pretty sure you’d get different errors though since the error message seemed quite clear about what the problem is?
On a more general note, there are already at least a dozen differente issues in this ticket, which makes it a bit unmanageable if they are not solved overnight.
I would suggest to open separate ones for each issue with a clear title that refers to that.
Thanks!
@casella thanks for this info! In my experience we don't often have initial guess problems if the equations are well-defined,
I guess that's because you don't need to initialize your models in steady-state. In the field of power plant modelling, you normally do, and it's quite a pain.
unless perhaps for highly non-linear systems. E.g. the sudden closing of a value can cause the initial guess for a flow network to be completely off and can result in numerical problems. Would this tool indicate what equation/variable is the one that is causing problems?
Absolutely 😃
@Mathadon can you see the original issue @Kanchn12345 reported earlier is fixed at the earliest ?
@casella the error
[8] 18:01:35 Translation Error [IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
Seems to be caused by the code
extends IDEAS.Buildings.Validation.BaseClasses.Structure.Bui600(win( redeclare replaceable IDEAS.Buildings.Components.Shading.Overhang shaType( each hWin=2.0, each wWin=3.0, each dep=1.0, each gap=0.35, wLeft={0.5,4.5}, wRight={4.5,0.5})));
where
win
is declared as an array of componentsIDEAS.Buildings.Components.Window[2] win( final A={6,6}, redeclare final parameter IDEAS.Buildings.Validation.Data.Glazing.GlaBesTest glazing, final inc={IDEAS.Types.Tilt.Wall,IDEAS.Types.Tilt.Wall}, azi={aO+IDEAS.Types.Azimuth.S,aO+IDEAS.Types.Azimuth.S}, redeclare replaceable IDEAS.Buildings.Components.Shading.None shaType, redeclare final parameter IDEAS.Buildings.Data.Frames.None fraType, each frac=0)
The purpose of
wLeft={0.5,4.5},
is to assign a different value ofwLeft
to each instance ofwin
. As far as I can tell, the syntax is correct (edit: except for missing 'each', solved in 9293da0). But perhaps the standard does not permit such assignments for a replaceable?
I'm not sure. When you instantiate arrays, you can modify individual values of elements (e.g. parameters) by passing arrays of values with the same dimension of the array, or by adding 'each'. However, in this case you are redeclaring a replaceable element; what I understand is that you cannot redeclare individual elements of an array to have different types, they all need to have the same type. So, I would expect that 'each' was not required here, but on the other hand all shaTypes in the array should be the same.
We should ask this question to @perost when he comes back from his vacation mid-August.
On a more general note, there are already at least a dozen differente issues in this ticket, which makes it a bit unmanageable if they are not solved overnight.
I would suggest to open separate ones for each issue with a clear title that refers to that.
Thanks!
That's a fair suggestion. Focussing on a quick solution for now :)
@Mathadon can you see the original issue @Kanchn12345 reported earlier is fixed at the earliest ?
I pushed a workaround by no longer using the (possibly) incorrect syntax in that example. Can you test the code in the pull request?
Just to be clear. I fix these issue on my spare time, which I'll prioritise myself :)
@casella the error
[8] 18:01:35 Translation Error [IDEAS.Buildings.Components.Shading.Overhang: 11:3-13:52]: Type mismatch in binding ‘wLeft = {0.5, 4.5}‘, expected array dimensions [], got [2].
Seems to be caused by the code
extends IDEAS.Buildings.Validation.BaseClasses.Structure.Bui600(win( redeclare replaceable IDEAS.Buildings.Components.Shading.Overhang shaType( each hWin=2.0, each wWin=3.0, each dep=1.0, each gap=0.35, wLeft={0.5,4.5}, wRight={4.5,0.5})));
where
win
is declared as an array of componentsIDEAS.Buildings.Components.Window[2] win( final A={6,6}, redeclare final parameter IDEAS.Buildings.Validation.Data.Glazing.GlaBesTest glazing, final inc={IDEAS.Types.Tilt.Wall,IDEAS.Types.Tilt.Wall}, azi={aO+IDEAS.Types.Azimuth.S,aO+IDEAS.Types.Azimuth.S}, redeclare replaceable IDEAS.Buildings.Components.Shading.None shaType, redeclare final parameter IDEAS.Buildings.Data.Frames.None fraType, each frac=0)
The purpose of
wLeft={0.5,4.5},
is to assign a different value ofwLeft
to each instance ofwin
. As far as I can tell, the syntax is correct (edit: except for missing 'each', solved in 9293da0). But perhaps the standard does not permit such assignments for a replaceable?I'm not sure. When you instantiate arrays, you can modify individual values of elements (e.g. parameters) by passing arrays of values with the same dimension of the array, or by adding 'each'. However, in this case you are redeclaring a replaceable element; what I understand is that you cannot redeclare individual elements of an array to have different types, they all need to have the same type. So, I would expect that 'each' was not required here, but on the other hand all shaTypes in the array should be the same.
We should ask this question to @perost when he comes back from his vacation mid-August.
If that is correct then we indeed made an error against the specification but perhaps this is just a corner case that is not supported yet in OM? It would be great if @perost could clarify this. We can revise the model to avoid this construction if it would be needed. In any case I pushed a workaround for now.
@Mathadon Thanks a lot ! this is working now. i could simulate simplehouse example in IDEAS/Fluid.
thanks ! I still havent figured out how to export FMU from OpenModelica, its still giving the same error.
Aha, this I did not spot last time:
C:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources/getTimeSpan.h:11:10: fatal error: 'ModelicaUtilities.h' file not found
#include <ModelicaUtilities.h>
^~~~~~~~~~~~~~~~~~~~~
@casella as far as I know this file should be provided by OpenModelica? Any idea why it is not found?
@YashwanthVellala you can try to search the openmodelica directories for this file and manually add the containing directory to your PATH variable..
Aha, this I did not spot last time:
C:/Users/E485898/Downloads/IDEAS-1225_XiSat/IDEAS-1225_XiSat/IDEAS/Resources/C-Sources/getTimeSpan.h:11:10: fatal error: 'ModelicaUtilities.h' file not found #include <ModelicaUtilities.h> ^~~~~~~~~~~~~~~~~~~~~
Yeah, sorry, I indeed spotted it myself yesterday, but then got carried away.
I tried the following MWE
model TestModelicaUtilities
function f
input Real x;
output Real y;
external "C";
annotation(Include="
double f(double x)
{
if (x > 0.5)
ModelicaError(\"Too large x\");
return 2*x;
}
");
end f;
Real x;
equation
x = f(time);
end TestModelicaUtilities;
which works fine without the need of any # include
statement. I guess the Modelica environment adds it automatically (from the appropriate path) when it is compiling the C source code of external functions.
In fact #include <xxx.h>
is reserved for standard system headers defined by the C compiler, but ModelicaError.h
is not a standard header like stdio.h
or math.h
, so obviously the compiler complains it doesn't find it.
As I understand it, you need #include "somepath/ModelicaError.h"
in your source code if you want to compile a binary library separately and then have it linked at compile time with the OMC generated code. Otherwise, you don't need the include statement at all.
@YashwanthVellala I have pushed a change that removes the include. Can you try again?
@Mathadon I tried simulating the AHU example using the latest changes made by you. I am still getting this error "10:22:47 Translation Error [IDEAS.Buildings.Components.Interfaces.ZoneInterface: 96:5-101:36]: cardinality may only be used in the condition of an if-statement/equation or an assert."
Please look in to the issue.
Thanks
This piece of code seems to be the culprit:
for i in 1:nPorts loop
assert(cardinality(ports[i])<=2,
"Each element of ports should have zero or one external connections but " +
getInstanceName() +".ports[" + String(i) + "] has " + String(cardinality(ports[i]) - 1) + "." +
" This can cause air to mix at the fluid port, without entering the zone, which is usually unintended.
Instead, increase nPorts and create a separate connection.",
level=AssertionLevel.warning);
end for;
These cardinality operator is used within an assert so I don't see what the problem is but possibly the translator detects String(cardinality(ports[i]) - 1)
as being problematic. I revised this term. Can you try again?
Section 3.7.4.3 of the specification says:
cardinality should only be used in the condition of assert and if-statements
@Mathadon I guess you should remove any reference to cardinality in the message string with something like "too many".
@casella thanks! Upon re-reading the error it is indeed quite specific about what is wrong. I just overlooked the wording. I figured it would be something like that so my fix 44016c6 of before should work.
For the record: I'm a big fan of the cardinality() operator and it would be a pity if it were to be removed.
For the record: I'm a big fan of the cardinality() operator and it would be a pity if it were to be removed.
You should open a ticket here and explain what are your motivations and why you think it would be difficult to remove.
This operator has been deprecated for like 15 years, which is a bit pointless IMHO. Three years ago there were some clarifications in the spec, see #1409 but it remained deprecated nevertheless, which is even more pointless.
We should probably just face the fact that people use it and keep it there indefinitely. Feel free to open a ticket, if you mention me I can back it up.
@Mathadon any new release to check if the model works ? (1) AHU model and (2) the FMU cant be exported.
@casella @Mathadon the FMU is a larger issue ? I cant export any example model as an FMU. not with any of the existing commands mentioned in the documentation.
As discussed on the issue for Openmodelica with #7705, I am creating an issue here.
I am trying to simulate the AHU example model (Adsolair58) available in IDEAS.AIRFLOW.AHU package of the IDEAS library. When I am trying to simulate the example it is giving the following errors “Illegal access of protected element XiSat.” and “Variable wetBulOut.XiSat not found in scope IndirectEvaporativeHex.”
@Mathadon , kindly look into it and help me resolve the issue.
Thanks