Opened 4 years ago
Last modified 3 years ago
#6416 assigned task
Error in Implementation of the delay function
Reported by: | Owned by: | Andreas Heuermann | |
---|---|---|---|
Priority: | blocker | Milestone: | 1.19.0 |
Component: | Code Generation | Version: | 1.16.5 |
Keywords: | DIVISION_SIM, macro, 'equationIndexes' undeclared, Compilation process failed, Code 2 | Cc: | Adrian Pop, arunkumar palanisamy |
Description
Greetings!
I hope you're having a nice day! So please hear me out. I am relatively an advanced beginner in OpenModelica and I am currently working on a project for my thesis. I need to use the delay function in my code for a Real variable. However, while the function works perfectly on one of the variables I need delayed, there are multiple variables that I need delayed. When I implement this for multiple variables with the same time delay constant, I get an error. If you could help me interpret and resolve this error, it would be greatly helpful.
error: 'equationIndexes' undeclared (first use in this function) #define DIVISION_SIM(a,b,msg,equation) (__OMC_DIV_SIM(threadData, a, b, msg, equationIndexes, data->simulationInfo->noThrowDivZero, data->localData[0]->timeValue, initial())) note: in expansion of macro 'DIVISION_SIM' storeDelayedExpression(data, threadData, 1, DIVISION_SIM(data->simulationInfo->realParameter[42] /* k4 PARAM */,data->localData[0]->realVars[67] /* v variable */,"v",equationIndexes), data->localData[0]->timeValue, data->simulationInfo->realParameter[78] /* tDelay PARAM */, data->simulationInfo->realParameter[78] /* tDelay PARAM */); note: each undeclared identifier is reported only once for each function it appears in #define DIVISION_SIM(a,b,msg,equation) (__OMC_DIV_SIM(threadData, a, b, msg, equationIndexes, data->simulationInfo->noThrowDivZero, data->localData[0]->timeValue, initial())) note: in expansion of macro 'DIVISION_SIM' storeDelayedExpression(data, threadData, 1, DIVISION_SIM(data->simulationInfo->realParameter[42] /* k4 PARAM */,data->localData[0]->realVars[67] /* v variable */,"v",equationIndexes), data->localData[0]->timeValue, data->simulationInfo->realParameter[78] /* tDelay PARAM */, data->simulationInfo->realParameter[78] /* tDelay PARAM */); Compilation process failed. Exited with code 2.
I'd be thankful for any help! Thanks in advance!
Change History (12)
comment:1 by , 4 years ago
Cc: | added |
---|---|
Priority: | high → blocker |
comment:2 by , 4 years ago
Cc: | removed |
---|
comment:3 by , 4 years ago
Component: | OMEdit → Code Generation |
---|---|
Owner: | changed from | to
comment:4 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|---|
Owner: | changed from | to
Status: | new → assigned |
follow-up: 6 comment:5 by , 4 years ago
See https://github.com/OpenModelica/OpenModelica/pull/7287.
5 Minutes making tea, 5 minutes to fix the bug.
I think this is the fastes I'll ever be...
follow-up: 7 comment:6 by , 4 years ago
Replying to AnHeuermann:
See https://github.com/OpenModelica/OpenModelica/pull/7287.
5 Minutes making tea, 5 minutes to fix the bug.
I think this is the fastes I'll ever be...
Hello,
Thank you for your immediate response. I have seen that you have also merged the PR in the repo. I have cloned the repo locally and I am trying to use it. Since I am still a beginner as previously mentioned, could you guide me on how to link this repo to my current OpenModelica so that this error is fixed? I have simply performed all the steps mentioned in GitHub to build the compiler and clone the repository. But however, I already have OpenModelica installed on my system. Would this have anything to do with the cloned repo? If yes, how do I link them both to reflect the updated source code changes in my current OMEdit Model?
Thank you very much!
comment:7 by , 4 years ago
Replying to Guru Charan Das M <gcharandas2@…>:
Hello,
Thank you for your immediate response. I have seen that you have also merged the PR in the repo. I have cloned the repo locally and I am trying to use it. Since I am still a beginner as previously mentioned, could you guide me on how to link this repo to my current OpenModelica so that this error is fixed? I have simply performed all the steps mentioned in GitHub to build the compiler and clone the repository. But however, I already have OpenModelica installed on my system. Would this have anything to do with the cloned repo? If yes, how do I link them both to reflect the updated source code changes in my current OMEdit Model?
Thank you very much!
The easiest solution is probably to just wait a bit and use the next nightly build, then you get a proper installer.
But if you want to use your own compiled version of OM you'll need to run OMEdit from the build directory of your cloned repo, and maybe also change some system paths to point to it depending on what OS you're using.
follow-up: 9 comment:8 by , 4 years ago
@Guru Charan Das M <gcharandas2@…>
Can you try with the nightly build and see if your problem is solved?
If not I would need a minimal working example to continue with the ticket.
comment:9 by , 4 years ago
Replying to AnHeuermann:
@Guru Charan Das M <gcharandas2@…>
Can you try with the nightly build and see if your problem is solved?
If not I would need a minimal working example to continue with the ticket.
Hey, sorry for the delayed response. I am currently not working with the delay function as such but I will definitely try it out and let you know. Is the newly released recent official version 1.17.0 containing the changes?
I fixed something like that for spatialDistribution last week.
The solution was to give each spatial distribution an index and use that one instead of the equationIndex. It most likely doesn't refer to the same equation index in which the delay operator is used, but the compilation should work.
I'll create a PR for it.
@gcharandas2 Can you add a minimal working example that displays this error so I can validate if my solution works for you?