-
<p>Hi Enrico,</p>
<p>I work with 3 SST models. Takacs, BurgerDiehl and Plosz.</p>
-
Hello Enrico,<br>
yes I tested change in simulation results (both steady-state and dynamic) after this "swap".<br>
Results are more then sensible. To my surprise they were not so different from the original run. It seems as though this model is not so sensitive to 'min' and 'max' condition.<br>
<br>
Regarding second issue - there's no implementation of Plosz model in Modelica library. Generally Modelica library, in terms of available SST models, is very limited (when compared to MSL library).That's why, since using this exact SST model is part of my research, I have to either create this model in Modelica by myself (which is not so straight forward since, as we can see, the same piece of code can be interpreted differently) or go back to MSL. Are there plans to complete Modelica library with models available in MSL?
-
<p>Hi Enrico,</p>
<p>indeed after this modification error disappeared but this new, proposed loop does not reflect original structure - it refers only to J_G[i-1] and therefore when conditions in the second part of the loop are met J_G[i-1] = J_G[i+1] and and not J_G[i] = J_G[i+1].</p>
<p>Furthermore, after checking the exact form of Godunov scheme in Plosz paper (2007)</p>
<p><img></p>
<p>I believe in original MSL code there's an error in condition for finding maximum (second loop). Now, it states:</p>
<pre class="linenums prettyprint"><span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"><span style="color:red;">{</span> <span style="color:blue;">FOREACH</span> Layer_Index <span style="color:blue;">IN</span> <span style="color:red;">{</span><span style="color:black;">1</span> <span style="color:red;">..</span> <span style="color:black;">59</span><span style="color:red;">}</span>: <i><span style="color:black;">state.</span></i>J_G<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">=</span></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">IF</span> <span style="color:red;">(</span>Layer_Index <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>DynamicIndexOfFeedLayer<span style="color:red;">)</span> <span style="color:blue;">THEN</span> </span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">IF</span> <span style="color:red;">(</span><i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+</span><span style="color:black;">1</span><span style="color:red;">])</span> <span style="color:blue;">THEN</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+</span><span style="color:black;">1</span><span style="color:red;">]</span></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> ; <span style="color:red;">}</span>;</span></span></span></span></pre>
<p>and it looks as though this loop actually finds minimum. Shouldn't it be:</p>
<pre class="linenums prettyprint"><span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"><span style="color:red;">{</span> <span style="color:blue;">FOREACH</span> Layer_Index <span style="color:blue;">IN</span> <span style="color:red;">{</span><span style="color:black;">1</span> <span style="color:red;">..</span> <span style="color:black;">59</span><span style="color:red;">}</span>: <i><span style="color:black;">state.</span></i>J_G<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">=</span></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">IF</span> <span style="color:red;">(</span>Layer_Index <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>DynamicIndexOfFeedLayer<span style="color:red;">)</span> <span style="color:blue;">THEN</span> </span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">IF</span> <span style="color:red;">(</span><i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+</span><span style="color:black;">1</span><span style="color:red;">])</span> <span style="color:blue;">THEN</span> <strong><i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span></strong></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <strong> <span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+1]</span></strong></span></span></span></span>
<span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;"> <span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> ; <span style="color:red;">}</span>;</span></span></span></span></pre>
<p><span style="font-size:11pt;"><span style="line-height:normal;"><span style=""><span style="font-family:"Calibri",sans-serif;">And the last question relates to state variables. When I tried to convert MSL code to Modelica I found two state variables in Plosz MSL model that are declared and neither defined nor used in the model. From their description it looks like they were supposed to be used exactly in the Godunov condition: </span></span></span></span></p>
<pre class="linenums prettyprint"><span style="font-size:11pt;"><span style="line-height:107%;"><span style="font-family:"Calibri",sans-serif;"><span style="color:blue;">OBJ</span></span></span></span><span style="font-size:11pt;"><span style="line-height:107%;"><span style="font-family:"Calibri",sans-serif;"> J_GUp_Help <span style="color:red;">(*</span> <span style="color:gray;">hidden</span> <span style="color:red;">=</span> <i><span style="color:purple;">"1"</span></i> <span style="color:red;">*)</span> <i><span style="color:purple;">"Treatment of the minimum settling flux conditions by Godunov - gravity and upwards convective help fluxes"</span></i>: PloszArealFluxVector;
<span style="color:blue;">OBJ</span> J_GUp <span style="color:red;">(*</span> <span style="color:gray;">hidden</span> <span style="color:red;">=</span> <i><span style="color:purple;">"1"</span></i> <span style="color:red;">*)</span> <i><span style="color:purple;">" Treatment of the minimum settling flux conditions by Godunov - gravity and upwards convective fluxes"</span></i>: PloszArealFluxVector; </span></span></span></pre>
<p><span style="font-size:11pt;"><span style="line-height:107%;"><span style="font-family:"Calibri",sans-serif;">So now I'm wondering if someone changed original concept for describing this condition and forgot to remove this variable or if there's someting missing in the code?</span></span></span></p>
-
Helo Enrico,<br>
thanks for the tip. It definitely helped - eror message in logging pane indicated what the issue was.<br>
Minimal settling flux condition in MSL Plosz model is defined as follows:
<pre class="linenums prettyprint"><span style="font-size:11.0pt;"><span style="line-height:107%;"><span style="font-family:"Calibri",sans-serif;"><span style="color:green;">//BPlosz - mathematical treatment of the minimum settling flux condition using the Godunov-approach</span></span></span></span>
<span style="font-size:11.0pt;"><span style="line-height:107%;"><span style="font-family:"Calibri",sans-serif;"> <span style="color:red;">{</span> <span style="color:blue;">FOREACH</span> Layer_Index <span style="color:blue;">IN</span> <span style="color:red;">{</span><span style="color:black;">2</span> <span style="color:red;">..</span> <span style="color:black;">59</span><span style="color:red;">}</span>: <i><span style="color:black;">state.</span></i>J_G<span style="color:red;">[</span>Layer_Index<span style="color:red;">-</span><span style="color:black;">1</span><span style="color:red;">]</span> <span style="color:red;">=</span>
<span style="color:blue;">IF</span> <span style="color:red;">(</span>Layer_Index <span style="color:red;"><=</span> <i><span style="color:black;">state.</span></i>DynamicIndexOfFeedLayer<span style="color:red;">)</span> <span style="color:blue;">THEN</span>
<span style="color:blue;">IF</span> <span style="color:red;">(</span><i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">-</span><span style="color:black;">1</span><span style="color:red;">]</span> <span style="color:red;"><=</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">])</span> <span style="color:blue;">THEN</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">-</span><span style="color:black;">1</span><span style="color:red;">]</span>
<span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span>
<span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">-</span><span style="color:black;">1</span><span style="color:red;">]</span> ; <span style="color:red;">}</span>;
<span style="color:red;">{</span> <span style="color:blue;">FOREACH</span> Layer_Index <span style="color:blue;">IN</span> <span style="color:red;">{</span><span style="color:black;">1</span> <span style="color:red;">..</span> <span style="color:black;">59</span><span style="color:red;">}</span>: <i><span style="color:black;">state.</span></i>J_G<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">=</span>
<span style="color:blue;">IF</span> <span style="color:red;">(</span>Layer_Index <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>DynamicIndexOfFeedLayer<span style="color:red;">)</span> <span style="color:blue;">THEN</span>
<span style="color:blue;">IF</span> <span style="color:red;">(</span><i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> <span style="color:red;">></span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+</span><span style="color:black;">1</span><span style="color:red;">])</span> <span style="color:blue;">THEN</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">+</span><span style="color:black;">1</span><span style="color:red;">]</span>
<span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span>
<span style="color:blue;">ELSE</span> <i><span style="color:black;">state.</span></i>J_G_Help<span style="color:red;">[</span>Layer_Index<span style="color:red;">]</span> ; <span style="color:red;">}</span>;
<span style="color:green;">// end</span></span></span></span></pre>
When the above code is straightfowardly converted to Modelica it should look like this:
<pre class="linenums prettyprint"><span style="color:#0000ff;font-weight:normal;font-style:normal;">for</span> i <span style="color:#0000ff;font-weight:normal;font-style:normal;">in</span> <span style="color:#000000;font-weight:normal;font-style:normal;">2</span>:<span style="color:#000000;font-weight:normal;font-style:normal;">59</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">loop</span>
J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">-</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;">=</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">if</span> i <span style="color:#ff0000;font-weight:normal;font-style:normal;"><=</span>DynamicIndexOfFeedLayer <span style="color:#0000ff;font-weight:normal;font-style:normal;">then</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">if</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;">(</span>Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">-</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;"><=</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">])</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">then</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">-</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">else</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">else</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">-</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>;
<span style="color:#0000ff;font-weight:normal;font-style:normal;">end</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">for</span>;
<span style="color:#0000ff;font-weight:normal;font-style:normal;">for</span> i <span style="color:#0000ff;font-weight:normal;font-style:normal;">in</span> <span style="color:#000000;font-weight:normal;font-style:normal;">1</span>:<span style="color:#000000;font-weight:normal;font-style:normal;">59</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">loop</span>
J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;">=</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">if</span> i <span style="color:#ff0000;font-weight:normal;font-style:normal;">></span> DynamicIndexOfFeedLayer <span style="color:#0000ff;font-weight:normal;font-style:normal;">then</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">if</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;">(</span>Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span> <span style="color:#ff0000;font-weight:normal;font-style:normal;">></span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">+</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">])</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">then</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">+</span><span style="color:#000000;font-weight:normal;font-style:normal;">1</span><span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">else</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>
<span style="color:#0000ff;font-weight:normal;font-style:normal;">else</span> Help_J_G<span style="color:#ff0000;font-weight:normal;font-style:normal;">[</span>i<span style="color:#ff0000;font-weight:normal;font-style:normal;">]</span>;
<span style="color:#0000ff;font-weight:normal;font-style:normal;">end</span> <span style="color:#0000ff;font-weight:normal;font-style:normal;">for</span>; </pre>
<div class="linenums prettyprint">But then for all layers J_G is defined twice, startng with J_G[1] and model build error occurs. How to modify minimal settling flux condition in Modelica? Why, when using MSL model library, the same error doesn't occur? State variable J_G for all layers is also defined twice.</div>
-
Hello everyone,
I created new SST model in Modelica that is based on the Plosz SST model in MSL library.
Now I identify all the typos and wrong variable declatations by trying to run a simple simualtion with this new model and analyzing error message that popped up.
It went pretty smooth until an error message had actually no defined error in it. Instead there's a long list of all functions and variables in this particular project (in attatchment).
Does anybody had similar experience and know where might be the problem?
-
Hello,
I have a similar issue and didn't find a solution yet. I want [u]steady-state [b]u[/b][/u] value to be the [u]initial [b]u[/b] for dynamic simulation[/u].
I had a look at PI controller MSL file I couldn't find a line where initial conditions are defined - but what was obvious from my simulations is that initial [b]u[/b] was [b]u[sub]max[/sub][/b]. Why is that? And how I could copy steady-state [b]u[/b] to dynamic simulation?
My dynaminc simulation period is quite short so when [b]initial u[/b] is [b]u[sub]max[/sub][/b] it introduces quite a big interferences.
Natalia
-
Hi Enrico,
model modifications I was mentioning in the first post were put on hold. I was working with MLS library but then at the end of a year decided to upgrade to WEST+ and work on Modelica from now on. Since there are some issues with SST model I want to work with in Modelica library, I decided to go back to MSL.
As I changed a bit research plans and I don't plan to perform long term simulations my first question is not valid anymore.
Coming back to the second question: I assume I have to declare a new class which would be a TSS concentration in all leyers at time O? Is that correct? If so, is this procedure similar in both MSL and Modelica (like placement of new parameter definition etc.). Anyhow, I would definitely need help in creating those new models.
Additinally another question came along (similar in topic) - I have dynamic data for SST model validation (inflow and underflow - Q and TSS- and SBH). So I wanted to modify SST model so as an input I can have direct TSS values and not ASM fractions. I assume follwing code lines in SST models have to be changed:
in Modelica
[i]Help_X_In = [new defined input vector] [s]sum(Inflow[i] for i in zModWWTP.TComponentsTSS) * (if size(zModWWTP.TComponentsTSS,1) > 1 then F_TSS_COD else 1)[/s];
X_In = if (Q_In <= 0.0) then 0.0 else Help_X_In / [s]Q_In ;[/s][/i]
in MSL (base.clarifier file)
[i]state.Help_X_In = [new defined input vector][s](SUMOVER Comp_Index IN {IndexOfFirstTSSComponent .. IndexOfLastTSSComponent}:
(interface.Inflow[Comp_Index]))[/s];
{state.X_In = IF (state.Q_In == 0)
THEN 0
ELSE state.Help_X_In [s]/ state.Q_In * parameters.F_TSS_COD;[/s][/i]
And of course similarly for X_Out.
Am I even close to the right solution?
Regards,
Natalia
-
Hello everyone,
I have a few issues revolving conducting simulations of SST and would appretiate any input from other users who maybe were confronted with similar problems.
I. Is there a way to conduct a long-term dynamic simualtion with alternating settling parameters of activated sludge - to mimic filamentous growth during winter months? Other then conducting a series of dynamic simulations and manually adjusting r_H, r_P or v0?
II. To simulate batch settling tests I wanted to declare a uniform initial concentration across all leyers of SST and then start dynamic simulation with no feed and no under- and overflow. And I failed in finding a way to impose a user-declared values for state variables. Is there a way to do that other then creating a new model?
With regards,
Natalia