Home
W&WW Blog Case Histories Books Shop Amazon Member Survey Advertise ?
Buyer's Guide News Help Forum Ask Tom! Jobs Videos Online Training

Water and Wastewater.com Help Forums

Click here now

Search

Welcome, Guest. Please Login or Register
May 25th, 2013, 12:45am
Top 10 Members
Runyan Sobisch Keenan Seghers Santa Cruz Gillen Kendall Orlebeke Ayrus Kersey
  HomeHelpSearchLoginRegister  
Poll Poll
Question: Unable to run ADM1

ADM1  
  1 (100%)
anaerobic digestion  
  0 (0%)




Total votes: 1
« Created by: juventus30 on: Apr 10th, 2013, 9:01am »

Pages: 1 2 3 4 
ADM1 (Read 8462 times)
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #30 - May 17th, 2012, 4:14am
 
Changing adm1init_ADMtest changes the initial values. This change will not affect the ultimate outcome of your simulation - it might, if the ADM1 is a 'chaotic' system, but I haven't seen anything to this effect.

Changing the initial values can have two useful effects: it can speed up getting to the dynamic euilibrium; and it can improve the ease with which the integration algorithm can start the simulation. But usually you leave the initial conditions alone.

What you normally want to change are:

PHysical parameters - also held in the init file;
Calibration parameters - ditto

and

the sludge flow & concentration, held in the MAT file.

In my MAT file ALL values are constant with time. The only value that changes is the 1st variable, which is TIME, not S_Su. The value of S_su is the second variable, and has the value in the file of 0.01.

In other words, the MAT file has a CONSTANT set of conditions, defined at time 0 and time 10,000. I have not looked at how the model implements influent handling - does it linear interplation or does it hold the values constant until the next time change. Either way, with the defualt MAT file, the result will be the same. I think that it holds the value constant until the next time change, but, as I wrote, I have not looked at this.
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #31 - May 17th, 2012, 6:40am
 
Thanks for the tip about 1st variable, which is TIME, not S_Su .
Dont get me wrong but I still wont get why variable values presented in both files adm1init_ADMtest.m and  input_ADMtest.mat are not identical, since both files refers to initial conditions for any of the three model implementations.

For example, Q_D = 170; T_D = 35; are the same in both files, but all other variables are different.

adm1init_ADMtest.m   input_ADMtest.mat
S_su =  0.012;          1.0000000e-02
S_aa =  0.0053;        1.0000000e-03
S_fa =  0.099;           1.0000000e-03
S_va =  0.012;         1.0000000e-03  
S_bu = 0.013;          1.0000000e-03

Also you say that you normally want to change are:
PHysical parameters - also held in the init file;
Calibration parameters - ditto ?
and
the sludge flow & concentration, held in the MAT file.

Do I need to change those parameteres in adm1init_ADMtest.m also, meaning that if I have different e.g. Q_D = 170  --> 2000; T_D = 35 ---->45; should I change in both files?
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #32 - May 17th, 2012, 7:04am
 
Initial values are in the adm1init_ADMtest.m file.

Input (i.e. sludge feed, not initial values) are in input_ADMtest.mat

To change the digester temperature you want to change the value for T_op, not T_D.

The value for Q_D will set the flow for the period just before the start of the simulation; mathematically, at t = 0-. As soon as the simulation begins, Q_D is dropped for the Q value read from the input data file, and appllies for t = 0+ and beyond.

When a heat balance is added to the ADM1 model then T_D will be of use, and will set the initial temperature; at the moment it is ignored completely. The temperature specified in the influent file is currently ignored.

If you are operating at a temperature other than 35C you need to adjust the model parameters to compensate for the temperature.

If you wish to have temperature vary then you need, as a minimum, a temperature-varying function for kinetic and solubility parameters. At present this appears to be the 'state of the art'.
A functional form for growth parameters of mu(T) = a exp(-b T) - c exp(-d T) is common; and for death, kd(T) = f exp(-g T) should be acceptable. But this would mean writing your own version, or, at least, modifying and recompiling the C code that you get from Ulf.

If you do make such changes Ulf would appreciate being sent them.
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #33 - May 17th, 2012, 7:38am
 
Ok, I think I get it now, your example about start of the simulation; mathematically, at t = 0- and as soon as the simulation begins, Q_D is dropped for the Q value read from the input data file, and appllies for t = 0+, is perfect.
Not sure about why on earth do we need this, since inital conditions won't affect the results?

Also, it explains why should we change values in  input_ADMtest.mat
rather than adm1init_ADMtest.m .

My next step would be implementing the model against case studies which are presented in Ulf Jeppson papers and perhaps then modify it.
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #34 - May 17th, 2012, 7:56am
 
Initial conditions don't affect the final result.

But they do affect how quickly you stabilise; they do affect the speed of the simulation at the start; they can affect being able to start in the first place.

Many simulations assume a sterile feed - not knowing what bioamss is present in the sludge/wastewater, set it to zero, and rely entriely upon the performance of the tank to maintain a healthy biomass concentration. But then the initial conditions for the biomass must ensure that you have enough to grow, and to avoid loss while stabilising.
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #35 - May 17th, 2012, 8:13am
 
So, in another words if my tank is empty and I introduce for a first time wastewater it will take some time, if ever, to grow biomass a.k.a initial conditions (adm1init_ADMtest.m   concentration etc  = 0 ).
While, in another situation a reactor is already running and I just alterate the wastewater quality (when I have initial conditions of the reactor adm1init_ADMtest.m   and new wastewater input_ADMtest.mat

May I assume then :
adm1init_ADMtest.m   ---> refers to initial reactor environment and
input_ADMtest.mat    ----> refers to wastewater which is newly introduced to reactor


Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #36 - May 17th, 2012, 8:18am
 
adm1init_ADMtest.m   ---> refers to initial reactor environment and
input_ADMtest.mat    ----> refers to wastewater which is newly introduced to reactor

Yes.

So, in other words if my tank is empty and I introduce for a first time wastewater it will take some time, if ever, to grow biomass a.k.a initial conditions (adm1init_ADMtest.m   concentration etc  = 0 ).

While, in another situation a reactor is already running and I just alter the wastewater quality (when I have initial conditions of the reactor adm1init_ADMtest.m   and new wastewater input_ADMtest.mat)

Yes.
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #37 - May 17th, 2012, 8:26am
 
Thanks your help and patience which are invaluable....  Smiley
I will try to run few simulations today to see how its going
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #38 - May 24th, 2012, 8:35pm
 
Hi all,
I have some problems with the implementation of ADM1 and I found your forum very very useful so I registered. Thank you for all the posts in the first place, they have helped me to understand Ulf's implementation better. I have a question: I am trying to use ADM1 for another size of digester and feed rate so I have changes Vliquid, Vgas and Q_D in "adm1init_ADMtest" and column 28 in the vector "input" that is created in the variable list in Matlab when you load "input_ADMtest.mat". What I wanted to see is what would happen if I treat a sludge with the same characteristics of Ulf's but with another size of digester and feed rate.

The steady state value seems similar to that found in the literature but the model is producing an enormous peak in the response at the beginning of the simulation (near time 0, approx at 5e-3)which seems to have a numerical origin because it is not the typical biogas peak from quick hydrolysis and I don't know why. As I told you, I've only modified flow rate and volume of liquid and gas and left the rest of Ulf's parameters. Do you know the reason for this?

Also I would like to simulate the reponse of the digester for a year but I have read in Matlab help that the simulation time is in seconds so if instead of 1000 seconds as it is by default in Ulf's file I put 31536000 which are the seconds in a year, I overload the system, as it's logical (or is the simulation time in days and would it be enough to type 365 instead of 1000?) However, I have seen that many other authors (Bajzelj, 2009 "A comparative energy balance model of the anaerobic digestion of domestic food waste both with and without domestic sewage sludge" for example) have simulated the digester response for a whole year and I wonder how...
I've attached images of the two graphs that I obtain.

Thank you very much for your help.

Best regards,

Alba
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #39 - May 25th, 2012, 9:16am
 
While th Matlab/Simulink documentation may state that the timestep is in seconds, this is irelevant. The ODE solver uses a numerical timestep, where the dimensions are given by the time constants as used in the differential equations. The ADM1 parameters are set up with days as the unit of time - so the 1,000 is days, not seconds.

What change did you make to the digester? My guess would be that you reduced the digester volume, especially the gas head space. The initial conditions for the gas headspace are unfortuanetly kept not as mole fraction but mole; so a smaller gas head space emans that there is excess gas in the headspace, which wil be reapidly discharged. conversely, a larger headspace means that there will no gas flow until the molar quantity permits the gas pressure to exceed the discharge pressure - default is 1 atmosphere.

So, my guess is that you need to adjust the initial gas space molarq quantities to match with the volume.
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #40 - May 27th, 2012, 2:36am
 
Yes, in effect I have reduced the working volume, head space and flow rate. I hadn't realized that the initial concentrations were in moles. I'll change that and see what happens, thank you very much for that advice!!

While trying to understand what was wrong, I developed some files to run Ulf's much quicker. They just need to be copied to the same folder as Ulf's files and only by running the "setup" one the rest of the steps are done (load the initial state vector, the influent vector, the simulink program...) so I tried to attach them here with a readme file in case someone finds them useful, but the file is too big and it doesn't let me..if anyone wants them, just let me know. I think it's easier to work with ADM1 with these since all the parameters of the model can be changed in an Excel file I've created, following the format of Zaher et al in their paper about the transformer to ADM1 "GISCOD". Cheers!
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #41 - May 28th, 2012, 7:13am
 
Hi
It would be nice if you send me your file for a review.
thanks.
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #42 - May 28th, 2012, 6:52pm
 
Done! I wanted to ask again however, about the issue I had in the simulation. I still get a peak in the response after having set the methane, hydrogen and carbon dioxides in the gas phase to zero. I even set to zero the dissolved methane and hydrogen concentrations. The peak reduces its value (now at around 60 m3/day with a steady state value of 1,6 m3/day more or less) but still appears. I am trying to simulate co-digestion of sludge and food waste and I used Zaher's GISCOD interface and a mass balance to find out the inputs for ADM1. My mass balance is quite simple: I just multiply each one of the parameters given by the transformer to the fraction of the flow. For example, if I have 1 m3 food waste and 2 m3 sludge then I multiply the carbohydrate fraction of food waste by 1/3 and add it to the carbohydrate fraction of sludge times 2/3. I'm telling you this because I'm thinking if it could be an issue of wrong values taken for the influent...Any other ideas?thank you very much!
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #43 - May 29th, 2012, 4:48am
 
Would it be OK to accept the peak, and reset the initial conditions on your next simulation to the end-point values from your first?

The peak you see may be caused by the digester adjusting from the conditions of the default initial conditions to the new steady-satte with your inputs. My experience is that the model is sensitive to the ionic balance, which influences the pH. The values for the cations/anions made the difference between getting zero gas (using the defaults with the ASM1 -  ADM1 converter) and around four times more gas than was measured (setting amonia to 4 x the measured value). (The data was routine sewage works measurements for a newly-installed UASB, so no cation/anion measurements, just the usual parameters used for the current activated sludge system).

Your approach for creating your composite waste seems reasonable.

Have you looked at these?

http://warrr.org/799/ The anaerobic digestion of food waste with and without sewage sludge: Achievements and the potential of the ADM1

http://warrr.org/776/ A comparative energy balance model of the anaerobic digestion of domestic food waste both with and without domestic sewage sludge
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #44 - May 29th, 2012, 6:17am
 
oh, ok I hadn't thought about using the obtained values as initial conditions, yes, that is what I get too, a peak on biogas production like 4 times higher than the steady state value...I'll definitely try that. And thank you for the two documents, I had already seen them but I will revise them again...I even tried reproducing the graphs on the second one (Bajzelj, 2009) but I didn't get the same form of the curves, that is why I think something is wrong with my simulations...however, when I run it with a sludge with the same characteristics as Rosen and Jeppsson (2006) I don't get that peak, even reducing the digester volume so it must be the initial conditions, as you say. I'll try your suggestion, thanks again for the help!
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #45 - May 31st, 2012, 4:20am
 
Alba wrote on May 28th, 2012, 6:52pm:
Done!

Hi,
I think that there are some errors in ploting functions (plot_VFA.m. plot_biogas_prod).
I am getting
Error using plot_VFA (line 2)
Not enough input arguments.


in line
function []=plot_VFA(tout,matrix)
[r,c]=size(matrix);   <----------

what is "matrix" variable?
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #46 - May 31st, 2012, 4:43am
 
Oh, no, I wrote an example on how to use the functions in the readme file. You have to pass as an argument the name of the matrix you want to plot, so, for example
>>plot_VFA(tout,DAE2out)
where tout is the vector that saves the time and DAE2out is the matrix that stores the solutions of the system of equations (those two variables are created by Jeppsson's files). In the same way, if you want to use another matrix, like to see what the ODE or the DAE1 system are giving then you just type:
>>plot_VFA(tout,ODEout)
In the case of the biogas production you have to type it like this:
>>plot_biogas_prod(tout,adm_in,DAE2out) because it also calls Jeppsson's function to print the results.
Hope this helps, cheers!
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #47 - May 31st, 2012, 4:48am
 
BendelBoy wrote on May 29th, 2012, 4:48am:
Would it be OK to accept the peak, and reset the initial conditions on your next simulation to the end-point values from your first?


I tried it and I get a curious result: my system becomes substrate limited, the peak doesn't disappear (it reduces though) and the biogas production (steady state) is reduced...the rest of the parameters however, seem reasonable, except from a 70% methane content which seems a bit high...I also pass from an accumulation of VFA to almost a complete consumption of them by the bacteria...
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #48 - May 31st, 2012, 5:14am
 
Ok, I think I know why my simulations were so weird.. I thought the mat file was for the initial conditions, I was reading the posts now and realized this. I have corrected the files in case someone is interested. (If you have the old ones, where it says inoculum you should type the characteristics of the influent so you can correct the excel spreadsheet your selfs really). Sorry for that!
Cheers.
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #49 - May 31st, 2012, 5:15am
 
Thanks for the post. I'll look at updating the file when I get the chance.
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #50 - May 31st, 2012, 5:33am
 
Alba wrote on May 31st, 2012, 4:43am:
Oh, no, I wrote an example on how to use the functions in the readme file. You have to pass as an argument the name of the matrix you want to plot, so, for example
>>plot_VFA(tout,DAE2out)
where tout is the vector that saves the time and DAE2out is the matrix that stores the solutions of the system of equations (those two variables are created by Jeppsson's files). In the same way, if you want to use another matrix, like to see what the ODE or the DAE1 system are giving then you just type:
>>plot_VFA(tout,ODEout)
In the case of the biogas production you have to type it like this:
>>plot_biogas_prod(tout,adm_in,DAE2out) because it also calls Jeppsson's function to print the results.
Hope this helps, cheers!


Unfortunately were wasnt any readme file in zip, but I got it working as per your suggestion.
Also few remarks, as per matlab syntax, function name should be the same as file names, and in 1st line you dont need semicolon at the end.
function []=plot_VFA(tout,matrix)
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #51 - May 31st, 2012, 5:53am
 
Oh ok, thanks for that! I thought I had named all of my functions as the file name though...and sorry I thought I had included that readme file...as I modified it then I must had forgotten sorry! does it work properly?for my simulations is doing quite well..except from this thing on the inoculum and the influent that where swapped..
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #52 - May 31st, 2012, 6:14am
 
I've managed to run simulation without any problem.
Also, since I am running simulation with your input data I cant be sure that the calculated output is correct.
Back to top
 
 
  IP Logged
Alba
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 9


Company or Organization: Uni
Re: ADM1
Reply #53 - May 31st, 2012, 6:17am
 
My input data is taken from Jeppsson's code. The paper Rosen and Jeppsson(2006) "Aspects on ADM1 implementation" has a list of the inputs to the model and the outputs obtained if you want to take a look at it.
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #54 - May 31st, 2012, 6:25am
 
I have benchmark results from Ulf, where a steady input and the expected output, is given. I can provide by e-mail if you ask - I won't be in a position to send until the middle of the next week.
Back to top
 
 
  IP Logged
cjbl
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 2


Company or Organization: Civil Engineering & Environmen
Re: ADM1
Reply #55 - May 31st, 2012, 9:25am
 
Hi all,

I am also working with ADM1 at present - very nice to find this group recently. Working on an extension of the ADM1 myself and my main substrate of interest is food waste. I wrote my own version of the ADM1 in Matlab but having difficulty getting it to take discreet inputs (i.e. semi-continuous feeding) so I am using Ulf's version at the moment in Matlab/Simulink, which seems to have a nice way of defining influent (in the 'input' file).

Best wishes,

Charles
Back to top
 
 
  IP Logged
Dmitri
YaBB Newbies
*
Offline

WaterandWastewa
ter.Com is the best!

Posts: 22

Re: ADM1
Reply #56 - Jun 1st, 2012, 8:25am
 
Hi,
Thanks to Alba I have really nice input excel file, which make the whole experience more pleasurable.
My next question would be : How do you fraction and characterize the influent to match model input variables. I am in particular interest of slaughterhouse wastes, but it seems that it will be similar to any kind of waste (food, municipal etc)
Back to top
 
 
  IP Logged
cjbl
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 2


Company or Organization: Civil Engineering & Environmen
Re: ADM1
Reply #57 - Jun 1st, 2012, 11:19am
 
That depends on the iformation that you have available about your feedstock - lots of good papers on this out there. Particularly by Zaher, Koch, kleerebezem.... etc.

Sorry in a rush at the moment but I will get back to you after the weekend with a better response!

cjbl
Back to top
 
 
  IP Logged
andre2503
YaBB Newbies
*
Offline

I love Water and
Wastewater.com

Posts: 10


Company or Organization: UFSM
Re: ADM1
Reply #58 - Jun 4th, 2012, 2:13pm
 
Hello

I'm starting to work with the ADM1 model, I've read several articles but have not got the model in Matlab.

I saw the posts that you work with the model provided by Ulf, I was wondering if I could have these files in matlab.

My goal is to do a job optimization and simulations comparing with another model developed here for the treatment of stillage from the alcohol distillation.
Back to top
 
 
  IP Logged
BendelBoy
Senior Member
****
Offline

Free the STOAT

Posts: 317

Gender: male

Company or Organization: wrc plc
Re: ADM1
Reply #59 - Jun 4th, 2012, 6:25pm
 
Start by e-mailing Ulf for his files. He will provide them, and that way he knows that you have them and can contact you again if there are any changes.

After that you can request the improvements that others have made & described here.

His contact details are at

http://www.iea.lth.se/ielulf/

Back to top
 
 
  IP Logged
Pages: 1 2 3 4