# Non linear kinetics flow dependant

**URL:** <https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327>\
**Category:** Concepts\
**Created:** [April 19, 2020, 12:19pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327 "2020-04-19T12:19:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 19, 2020, 12:19pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/1 "2020-04-19T12:19:43Z")

</div>

Hello, can anyone help me with code this is a multi compartment model and the clearance is concentration dependant and also they have given a proportionality constant (a) for the changes in plasma concentration, which i have given in dynamics but still not getting the results.

```auto
PK24= @model begin
  @param begin
    tvvc ∈ RealDomain(lower=0)
    tvclo ∈ RealDomain(lower=0)
    tvcl ∈ RealDomain(lower=0)
    tvq1 ∈ RealDomain(lower=0)
    tvq2 ∈ RealDomain(lower=0)
    tvvp1 ∈ RealDomain(lower=0)
    tvvp2 ∈ RealDomain(lower=0)
    tva ∈ RealDomain(lower=0)
    Ω ∈ PDiagDomain(8)
    σ_prop ∈ RealDomain(lower=0)
  end
  @random begin
    η ~ MvNormal(Ω)
  end
  @pre begin
    Vc = tvvc*exp(η[1])
    CL = tvcl*exp(η[2])
    CLo = tvclo*exp(η[3])
    Q1 = tvq1*exp(η[4])
    Q2 = tvq2*exp(η[5])
    Vp1 = tvvp1*exp(η[6])
    Vp2 = tvvp2*exp(η[7])
    A = tva*exp(η[8])

  end

  @dynamics begin
    Central' = - (CLo -(A*(Central/Vc))) * (Central/Vc) - Q1*(Central/Vc) + Q1*(Shallow/Vp1) - Q2*(Central/Vc) + Q2*(Deep/Vp2)
    Shallow' = Q1*(Central/Vc) - Q1*(Shallow/Vp1)
    Deep' = Q2*(Central/Vc) - Q2*(Deep/Vp2)
  end
  
  @derived begin
    cp = @. 1000*Central/Vc
    dv ~ @. Normal(cp, sqrt(cp^2*σ_prop))
  end
end

```

---

<div class="post-metadata">

**Author:** ![jogagobburu](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jogagobburu](https://discourse.pumas.ai/u/jogagobburu)\
**Post date:** [April 19, 2020, 4:49pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/2 "2020-04-19T16:49:33Z")

</div>

What are the initial conditions? I dont see them…J

---

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 19, 2020, 5:49pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/3 "2020-04-19T17:49:15Z")

</div>

Actually sir, I tried adding the initial conditions but might be i was doing wrong it was giving the concentration in negative.

---

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 19, 2020, 5:59pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/4 "2020-04-19T17:59:12Z")

</div>

Cl = Cl0 - a\* plasma concentration  
this was the equation which was given in the book.

---

<div class="post-metadata">

**Author:** ![ramya](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/ramya/32/379_2.png) [@ramya](https://discourse.pumas.ai/u/ramya)\
**Post date:** [April 19, 2020, 5:59pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/5 "2020-04-19T17:59:51Z")

</div>

Dear Monika,  
Your dynamics is balanced using Proportionality constant for Clearance in central compartment. Im able to produce results using same model. Kindly check the other areas of simulation.

PK24= @model begin  
@param begin  
tvvc ∈ RealDomain(lower=0)  
tvclo ∈ RealDomain(lower=0)  
tvq1 ∈ RealDomain(lower=0)  
tvq2 ∈ RealDomain(lower=0)  
tvvp1 ∈ RealDomain(lower=0)  
tvvp2 ∈ RealDomain(lower=0)  
tva ∈ RealDomain(lower=0)  
Ω ∈ PDiagDomain(7)  
σ\_prop ∈ RealDomain(lower=0)  
end  
@random begin  
η ~ MvNormal(Ω)  
end  
@pre begin  
Vc = tvvc_exp(η[1])  
CLo = tvclo_exp(η[2])  
Q1 = tvq1_exp(η[3])  
Q2 = tvq2_exp(η[4])  
Vp1 = tvvp1_exp(η[5])  
Vp2 = tvvp2_exp(η[6])  
A = tva\*exp(η[7])

end

@dynamics begin  
Central’ = - (CLo -(A\*(Central/Vc))) \* (Central/Vc) - Q1\*(Central/Vc) + Q1\*(Shallow/Vp1) - Q2\*(Central/Vc) + Q2\*(Deep/Vp2)  
Shallow’ = Q1\*(Central/Vc) - Q1\*(Shallow/Vp1)  
Deep’ = Q2\*(Central/Vc) - Q2\*(Deep/Vp2)  
end

@derived begin  
cp = @. (Central/Vc)  
dv ~ @. Normal(cp, sqrt(cp^2\*σ\_prop))  
end  
end  
param= (tvvc=0.68,  
tvclo=6.61,  
tvq1=5.94,  
tvq2=0.93,  
tvvp1=1.77,  
tvvp2=3.18,  
tva=0.0025,  
Ω= Diagonal([0.001,0.001,0.001,0.001,0.001,0.001,0.001]),  
σ\_prop=0.01)

ev1=DosageRegimen(10000,time=0,cmt=1,duration=2)  
s1=Subject(id=1,evs=ev1)  
obs=simobs(PK24, s1, param, obstimes=[0.25, 0.5, 0.75, 1.05, 1.25, 1.49, 1.75, 1.99, 2.16, 2.35, 2.4, 2.65, 2.81, 2.95, 3.11, 3.56, 4.15, 6, 7])  
plot(obs)

```auto
![pk24|576x384](upload://pzb2weYXesfCEoEZQRlDo4R8qsH.png)
```

---

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 19, 2020, 6:01pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/6 "2020-04-19T18:01:26Z")

</div>

Yes Ramya, the plot is coming but the Cmax if you see can you tell me at which concentration your Cmax is coming?

---

<div class="post-metadata">

**Author:** ![ramya](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/ramya/32/379_2.png) [@ramya](https://discourse.pumas.ai/u/ramya)\
**Post date:** [April 19, 2020, 6:03pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/7 "2020-04-19T18:03:54Z")

</div>

Cmax is 1000ug.

![pk24](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/b33057b1578961074492ed65252d47763f60a56b.png)

---

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 19, 2020, 6:20pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/8 "2020-04-19T18:20:52Z")

</div>

I am not getting plot and also in the diagonal you have used 0.001 which is not as mentioned in book and in sigma also

---

<div class="post-metadata">

**Author:** ![ramya](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/ramya/32/379_2.png) [@ramya](https://discourse.pumas.ai/u/ramya)\
**Post date:** [April 19, 2020, 6:23pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/9 "2020-04-19T18:23:49Z")

</div>

Hello all,  
In the above model 10mg of dose is given. If I scale it in derived block my cmax is approx. 600ug. And if I did not scale it in derived and give it as 10000ug in dosage regimen then cmax is 1000. what may be the reason?. Can anyone help me with this?

> @derived begin  
> cp=@. 1000\* (Central/Vc)  
> end  
> ![pk24_1](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/925fda4d34a637e260e55a9838bb372afc682714.png)

> ev1=DosageRegimen(10000,time=0,cmt=1,duration=2)  
> s1=Subject(id=1,evs=ev1)  
> ![pk24](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/b33057b1578961074492ed65252d47763f60a56b.png)

---

<div class="post-metadata">

**Author:** ![jogagobburu](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@jogagobburu](https://discourse.pumas.ai/u/jogagobburu)\
**Post date:** [April 19, 2020, 8:41pm UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/10 "2020-04-19T20:41:34Z")

</div>

Dear Monica - the following modified code seems to produce some results, not sure if that is what you were looking for. My plots are similar to those shown above. Few pointers for consideration:

1. I think there was an issue with the character you used to denote derivative. When I copied & pasted your code, I had to change the `'`. You may want to check if its the right character.
2. Please include notes block upfront, provide details about what the model is supposed to do, definition of the parameters, units etc. This is very important for documentation, and future reference.
3. Technically, it is not clear to me what you were trying to achieve with `- (CLo -(A*(Central/Vc)))`. CLo seems to be a zero-order elimination; A seems to be first-order. If that is the case, then what the is the rationale to call the first-order clearance `A`? I suggest you use mechanistically identifiable nomenclature. Scientifically, what is not clear is if the zero-order and first-order processes are separate physiologic processes or not? Typically concentration-dependent clearance (this is a better term than ‘nonlinear’ kinetics), is well dependent on the concentration range. Lower conc - first order, higher conc - zero-order. Not sure how both processes are at play simultaneously. Again, notes block upfront will be helpful esp for readers like me.

```auto
using Pumas
using Plots
######################################
##### Definitions and Units ###############
#####
######################################
PK24= @model begin
    @param begin
        tvvc ∈ RealDomain(lower=0)
        tvclo ∈ RealDomain(lower=0)
        tvq1 ∈ RealDomain(lower=0)
        tvq2 ∈ RealDomain(lower=0)
        tvvp1 ∈ RealDomain(lower=0)
        tvvp2 ∈ RealDomain(lower=0)
        tva ∈ RealDomain(lower=0)
        Ω ∈ PDiagDomain(7)
        σ_prop ∈ RealDomain(lower=0)
    end
    @random begin
        η ~ MvNormal(Ω)
    end

    @pre begin
        Vc = tvvc*exp(η[1])
        CLo = tvclo*exp(η[2])
        Q1 = tvq1*exp(η[3])
        Q2 = tvq2*exp(η[4])
        Vp1 = tvvp1*exp(η[5])
        Vp2 = tvvp2*exp(η[6])
        A = tva*exp(η[7])
    end

# @init begin
# Central = 0
# Shallow = 0
# Peripheral = 0
# end

    @dynamics begin
        Central' = - (CLo -(A*(Central/Vc))) * (Central/Vc) - Q1*(Central/Vc) +
                        Q1*(Shallow/Vp1) - Q2*(Central/Vc) + Q2*(Deep/Vp2)
        Shallow' = Q1*(Central/Vc) - Q1*(Shallow/Vp1)
        Deep' = Q2*(Central/Vc) - Q2*(Deep/Vp2)
    end

    @derived begin
        cp = @. (Central/Vc)
        dv ~ @. Normal(cp, sqrt(cp^2*σ_prop))
    end
end

param= (tvvc=0.68,
        tvclo=6.61,
        tvq1=5.94,
        tvq2=0.93,
        tvvp1=1.77,
        tvvp2=3.18,
        tva=0.0025,
        Ω= Diagonal([0.001,0.001,0.001,0.001,0.001,0.001,0.001]),
        σ_prop=0.01)

ev1=DosageRegimen(10000,time=0,cmt=1,duration=2)
s1=Subject(id=1,evs=ev1)
obs=simobs(PK24, s1, param, obstimes=[0.25, 0.5, 0.75, 1.05, 1.25, 1.49, 1.75,
                            1.99, 2.16, 2.35, 2.4, 2.65, 2.81, 2.95, 3.11, 3.56, 4.15, 6, 7])
plot(obs)

```

---

<div class="post-metadata">

**Author:** ![monika](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@monika](https://discourse.pumas.ai/u/monika)\
**Post date:** [April 20, 2020, 5:25am UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/11 "2020-04-20T05:25:23Z")

</div>

Okay sir, I will remember this for future to make note.  
So, I will try to explain what the model is all about, the aim is to model non linear kinetics with respect to flow. An IV infusion dose of 10mg/kg is given to a subject. The drug is displaying muti-compartment disposition showing perfusion limited behaviour and also known to reduce cardiac output and hepatic blood flow when plasma concentration increases.  
In the exercise they have not included any parameter related to blood flow but instead they have given the above equation i.e. CL = CL0 -A \* Cp, where A is proportionality constant between CL and Cp and it accounts for the change in the plasma concentration.  
I have included this equation in the dynamics to correlate the change is plasma concentration.  
When I tried to run the model the plot was coming but the Cmax was not reaching to 1000 and I was looking for this only that where I am doing wrong or am I missing something.

---

<div class="post-metadata">

**Author:** ![parssh.mehta](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@parssh.mehta](https://discourse.pumas.ai/u/parssh.mehta)\
**Post date:** [April 20, 2020, 7:20am UTC](https://discourse.pumas.ai/t/non-linear-kinetics-flow-dependant/327/12 "2020-04-20T07:20:06Z")

</div>

Dear Ramya,

In this example you are using A as a proportionality constant between `Cl` and `cp`. The dose that you are giving is in mg and after all the necessary derivations are done you are scaling it by factor of 1000. So only your final output of cp is scaled by the necessary factor.

If you want the similar output you will need to scale you proportional constant (A) accordingly in the `parameters` to account for the necessary concentration. Hope this helps.
