Posted Wed, 28 Feb 2018 20:39:47 GMT by Julia Ledergerber PhD Student
Dear forum users

I am working on a coupled model. Currently I am trying to add a parameter to the coupled model, that already exist as a vector in one of the sub-models. So far, I have only been coupling parameters of the "real" or "integer" and I am wondering, whether it is also possible to couple vectors (e.g. Kosim1ConcentrationVector).

I added the following part:

OBJ Mean_S (* hidden = "0" *) "Vector containing the mean concentration in (mg/l=g/m3) for DWF by PE only" : Kosim1ConcentrationVector := [{:value <-1000000 :}, {:value <- 30 :}, {:value <- 10 :}, {:value <- 100 :}, {:value <- 200 :}, {:value <-150 :};];

sub_models.DWF.parameters.Mean_S.value := parameters.Mean_S.value,

But the model won't run. I get the following error:
Error E2451 _v170807_bordquant_sample_.c 55985: Undefined symbol 'AB1_parameters_DWF_parameters_Mean_S' in function ComputeInitial

Does anyone have an idea what could be the problem?

Thank you very much,
Posted Thu, 01 Mar 2018 09:24:55 GMT by Enrico Remigi WEST Product Owner
Hi Julia,
I have never done this myself, so I cannot be sure.
My guess is that indeed that type of equivalence is not working in MSL - and not just in the scope of a coupled model.
In other words: you cannot just write vectorA = vectorB (assuming of course A and B have the same cardinality). You need to write:
vectorA[elem1] = vectorB[elem1]
vectorA[elem2] = vectorB[elem2]

In the scope of a simple model, you can certainly use a FOREACH statement, but I am not sure this is going to be the case for a coupled model.
You may have to write out element by element.
Posted Thu, 01 Mar 2018 19:42:22 GMT by Julia Ledergerber PhD Student
Hi Enrico,

Thank you very much for this idea - I will certainly try it and keep you up to date!


Posted Fri, 02 Mar 2018 19:35:18 GMT by Julia Ledergerber PhD Student
Hi Enrico

Thanks for the idea of coupling elements of a vector. Unfortunately it seems that it does not work. The following two tests resulted in a parse error at the specific line:

Try 1:
sub_models.DWF.parameters.Mean_S[1].value := parameters.Mean_S[1].value
sub_models.DWF.parameters.Mean_S[XTSS].value := parameters.Mean_S[XTSS].value

But there is a solution to it, that seems to work, even tough it is not a "nice" one. You create an additional parameter (here: Conc_TSS) in the sub-model and use it to feed the one vector element that you want to change in the initial condition of that sub-model. The new simple parameter can then be coupled with your main model.

  parameters <-
    OBJ Mean_S "Vector containing the mean concentration in (mg/l=g/m3) for DWF" : Kosim1ConcentrationVector :=
    [{:value <-1000000 :}, {:value <- 30 :}, {:value <- 10 :}, {:value <- 100 :}, {:value <- 200 :}, {:value <-150 :};];
    OBJ Conc_TSS (* hidden = "0" *) "TSS concentrations of DWF" : Concentration  := {: group <- "General" :};

  initial <-
    parameters.Mean_S[XTSS] = parameters.Conc_TSS;

This seems to be a work-around solution. If you figure out a more elegant way to do it - let me know, I'd certainly be interested.

Thanks again,

You must be signed in to post in this forum.