Hello, I am new to OMPython, and not sure what I am doing wrong. I am trying to run my .mo using OMPython. I ran the bouncing ball example with no issues, however, when I try to run my .mo code it fails to import. The strange thing is my code works fine in openModelica. Do I need to convert it into an FMU or something? I believe it may be an underlying C error, but I am not sure. Note I do call external data sets and python code within the .mo file.
Thank you for the help
My .mo file https://drive.google.com/file/d/1uBki5YChlz17A6or5taMdJ00q6ky7fU9/view?usp=sharing
Error output:
from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
model_path="filepath"
from OMPython import ModelicaSystem
mod=ModelicaSystem(model_path + "scenario_6_fists_paper_microgrid_bess_l2_l3_peak_shaving_500.mo","conf_paper_microgrid")
[/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter V_nominal has annotation(Evaluate=true) and no binding. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter ev_charger_level_3_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter ev_charger_level_2_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter plug_load_resitive_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/AC/OnePhase/Storage/Battery.mo:15:3-16:39:writable] Warning: Parameter BESS.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter building_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. Error: Error building simulator. Build log: clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid.o conf_paper_microgrid.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_functions.o conf_paper_microgrid_functions.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_records.o conf_paper_microgrid_records.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_01exo.o conf_paper_microgrid_01exo.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_02nls.o conf_paper_microgrid_02nls.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_03lsy.o conf_paper_microgrid_03lsy.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_04set.o conf_paper_microgrid_04set.c In file included from conf_paper_microgrid_functions.c:7: In file included from ./conf_paper_microgrid_includes.h:9: /folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources/pythonWrapper.c:35:3: warning: implicit declaration of function 'pythonExchangeValuesNoModelica' is invalid in C99 [-Wimplicit-function-declaration]
pythonExchangeValuesNoModelica( ^ conf_paper_microgrid_functions.c:87:108: error: assigning to 'modelica_string' (aka 'void ') from incompatible type 'double'
__omcQ_24Buildings_24PUtilities_24PIO_24PPython_5F3_5F8_24PFunctions_24Pexchange_24funDERpytPatBuildings = 0.0; ^ ~~~ conf_paper_microgrid_functions.c:93:102: error: assigning to 'modelica_string' (aka 'void *') from incompatible type 'double'
__omcQ_24Buildings_24PUtilities_24PIO_24PPython_5F3_5F8_24PFunctions_24Pexchange_24funDERpytPatOld = 0.0; ^ ~~~ 1 warning and 2 errors generated. make: [<builtin>: conf_paper_microgrid_functions.o] Error 1 make: * Waiting for unfinished jobs....
mod.buildModel()
[/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter V_nominal has annotation(Evaluate=true) and no binding. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter ev_charger_level_3_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter ev_charger_level_2_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter plug_load_resitive_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/AC/OnePhase/Storage/Battery.mo:15:3-16:39:writable] Warning: Parameter BESS.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. [/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Electrical/Interfaces/Load.mo:19:3-22:28:writable] Warning: Parameter building_load.V_nominal has no value, and is fixed during initialization (fixed=true), using available start value (start=480.0) as default value. Error: Error building simulator. Build log: clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid.o conf_paper_microgrid.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_functions.o conf_paper_microgrid_functions.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_records.o conf_paper_microgrid_records.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_01exo.o conf_paper_microgrid_01exo.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_02nls.o conf_paper_microgrid_02nls.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_03lsy.o conf_paper_microgrid_03lsy.c In file included from conf_paper_microgrid_functions.c:7: In file included from ./conf_paper_microgrid_includes.h:9: /folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources/pythonWrapper.c:35:3: warning: implicit declaration of function 'pythonExchangeValuesNoModelica' is invalid in C99 [-Wimplicit-function-declaration] pythonExchangeValuesNoModelica( ^ conf_paper_microgrid_functions.c:87:108: error: assigning to 'modelica_string' (aka 'void ') from incompatible type 'double' __omcQ_24Buildings_24PUtilities_24PIO_24PPython_5F3_5F8_24PFunctions_24Pexchange_24funDERpytPatBuildings = 0.0; ^ ~~~ conf_paper_microgrid_functions.c:93:102: error: assigning to 'modelica_string' (aka 'void *') from incompatible type 'double' __omcQ_24Buildings_24PUtilities_24PIO_24PPython_5F3_5F8_24PFunctions_24Pexchange_24funDERpytPatOld = 0.0; ^ ~~~ 1 warning and 2 errors generated. clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_04set.o conf_paper_microgrid_04set.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_05evt.o conf_paper_microgrid_05evt.c clang -Os -fPIC -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -Wno-parentheses-equality "-I/folder/subfolder/.openmodelica/libraries/Modelica 4.0.0+maint.om/Resources/C-Sources" "-I/folder/subfolder/.openmodelica/libraries/Buildings 9.1.0/Resources/C-Sources" -I"/usr/bin/../include/omc/c" -I"/usr/bin/../include/omc" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=conf_paper_microgrid -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=3 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o conf_paper_microgrid_06inz.o conf_paper_microgrid_06inz.c make: [<builtin>: conf_paper_microgrid_functions.o] Error 1 make: * Waiting for unfinished jobs....