Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Modelling physical and biological systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mipi
Lectures
Modelling physical and biological systems
Commits
6b88e04c
Commit
6b88e04c
authored
1 year ago
by
Delvigne Frank
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
182f1374
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Additional_exercice_3.py
+65
-0
65 additions, 0 deletions
Additional_exercice_3.py
with
65 additions
and
0 deletions
Additional_exercice_3.py
0 → 100644
+
65
−
0
View file @
6b88e04c
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 29 10:38:19 2024
@author: delvigne
"""
'''
Additional exercice 3
'''
import
numpy
as
np
from
scipy.integrate
import
solve_ivp
from
matplotlib.pyplot
import
figure
from
matplotlib.pyplot
import
plot
from
matplotlib.pyplot
import
xlabel
from
matplotlib.pyplot
import
ylabel
def
Fedbatch
(
t
,
state
):
X
=
state
[
0
]
S
=
state
[
1
]
V
=
state
[
2
]
mumax
=
0.7
#in h-1
Ks
=
0.01
#in g/L
Yxs
=
0.46
#in g per g
D
=
0.1
/
10
#Dilution rate in h-1 (D = Q/V)
Sin
=
200
rx
=
mumax
*
(
S
/
(
Ks
+
S
))
*
X
if
t
<
5
:
D
=
0
dXdt
=
rx
-
D
*
X
dSdt
=
-
rx
/
Yxs
-
D
*
S
+
D
*
Sin
dVdt
=
D
*
V
state
=
[
dXdt
,
dSdt
,
dVdt
]
return
state
'''
Specify the time range for running the simulation
'''
t
=
np
.
linspace
(
0
,
30
)
'''
Specify the initial conditions
'''
state0
=
[
0.2
,
10
,
10
]
#We have 0.2 g/L of biomass, 10 g/L of substrate
#and a volume of 10L at the beginning of the simulation
'''
Solve the ODEs
'''
r
=
solve_ivp
(
fun
=
Fedbatch
,
t_span
=
[
t
[
0
],
max
(
t
)],
y0
=
state0
,
t_eval
=
t
,
method
=
'
LSODA
'
)
a
=
r
.
y
.
T
figure
(
1
)
plot
(
r
.
t
,
a
[:,
0
],
r
.
t
,
a
[:,
1
])
xlabel
(
'
Time (h)
'
)
ylabel
(
'
X, S (g/L)
'
)
figure
(
2
)
plot
(
r
.
t
,
a
[:,
2
])
xlabel
(
'
Time (h)
'
)
ylabel
(
'
V (L)
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment