Author Topic: Error in tree structure  (Read 1172 times)

cpdmulde

  • Posts: 13
    • View Profile
Error in tree structure
« on: July 26, 2018, 04:21:25 pm »
Hi,

I'm building a new version of the sand filtration model currently present in the default Library. I was able to implement what I wanted, checking along the way for syntax and other errors in the new .msl file and the new CLASS that I created. When I open my WEST project, add the sand filter block and change the properties of the block to use the model I want, I get the following error when trying to run a dynamic simulation:

System error: Error in tree structure

Since I've never encountered this error and since it's also not very instructive in telling me where to look, I was wondering if anyone has some experience with this error message and has possibly found a solution for it.

Thanks in advance,
Chaïm

Enrico Remigi

  • Posts: 320
    • View Profile
Re: Error in tree structure
« Reply #1 on: July 31, 2018, 08:32:10 am »
Hello Chaim,
I must admit: that's a first for me too ...
Never seen this before.

Just to be clear: you are using MSL, the WEST Model Editor and release 2017, correct ?
Are you by any chance implementing a coupled-model? that's where I could imagine a "tree" error may occur, although I would expect such error be caught by the syntax check ...
Enrico U. Remigi
Wastewater Process Modeller
DK Urban
Kortrijk (Belgium)

cpdmulde

  • Posts: 13
    • View Profile
Re: Error in tree structure
« Reply #2 on: July 31, 2018, 09:34:50 am »
Hi Enrico,

I am indeed working in .msl-files and using the 'normal' WEST Model Editor. I'm running the 2018dev version of WEST though.
If with coupled-model you mean that my model would under the hood contain multiple tanks or other submodels, then no, I'm not using a coupled-model (not using coupling <- {}, or connecting variables/parameters in any other way).

One more 'unconventional' thing I do is calculate the interface.Outflow variables explicitly, and not through a FOREACH statement, e.g.:

interface.Outflow[S_I] = -interface.Inflow[S_I]
interface.Outflow[S_O] = -interface.Inflow[S_O]

etc...

instead of

{FOREACH Comp_Index IN {IndexOfSolvent .. IndexOfLastSolubleComponent}:
      interface.Outflow_Unfiltered[Comp_Index] = - interface.Inflow[Comp_Index] * state.f_Out_Unfiltered
                 - interface.Backwash * interface.Inflow_Backwash[Comp_Index];
     };


Could the problem hide somewhere in there? Just trying to narrow down which piece of code I best start checking when looking for the source of the error.

Enrico Remigi

  • Posts: 320
    • View Profile
Re: Error in tree structure
« Reply #3 on: July 31, 2018, 10:55:59 am »
Hello Chaim,
no, I really don't believe it may be due to the replacement of the FOREACH by individual expressions.

However, since you must be restricting your model to one instance only, the 'tree' that the error complains about may refer to resolving the #ifdef statements (only a wild guess ...)
Enrico U. Remigi
Wastewater Process Modeller
DK Urban
Kortrijk (Belgium)

cpdmulde

  • Posts: 13
    • View Profile
Re: Error in tree structure
« Reply #4 on: July 31, 2018, 12:49:15 pm »
Hi Enrico,

Thanks for the answer and the nice tip at the end, I think I found the source of the error (due to technical problems, I cannot check at this time, I will confirm in this thread once I can); I was using an #ifdef StandardCategoryModels at the beginning of my class definition, while I'm only calculating state variables for an own custom version of ASM2d, and not for other models. I've changed this to the relevant #ifdef ASM2dChemTemp. If this wasn't the source of the error, it would have probably popped up sooner or later.

Thanks for the help!

Filip Claeys

  • Global Moderator
  • Posts: 47
    • View Profile
Re: Error in tree structure
« Reply #5 on: July 31, 2018, 05:21:40 pm »
"Error in tree structure" is a very unusual error message that is generated by the TMSL model compiler in case of a malformed equation LHS. As such it has nothing to do with preprocessor defines, at least not directly.
« Last Edit: July 31, 2018, 05:24:30 pm by Filip Claeys »
Filip H.A. Claeys, PhD

cpdmulde

  • Posts: 13
    • View Profile
Re: Error in tree structure
« Reply #6 on: August 01, 2018, 10:09:17 am »
Hi,

Indeed, the changing of the #ifdef statements did not solve the problem. I went through my model .msl file and found the weirdest typo: a '+' sitting in the middle of an otherwise empty line. Removing this also got rid of the problem. Still weird it does not pick this up as a syntax error though.

With regards to other possible causes, would you then suggest to got through the model implementation and double-check every equation left hand side, Filip? Just in case other users ever bump into the same error message.

Best and thanks for your help!

Morata

  • Posts: 2
    • View Profile
Re: Error in tree structure
« Reply #7 on: November 18, 2019, 09:42:33 am »
I have a try to apply.