Skip to content

Commit

Permalink
add time-event case
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Apr 20, 2021
1 parent af1dd47 commit fe62949
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/draft
/.vscode

# temporal files
/*/_julia
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Storing different cases for simulation using HetaSimulator (Simulatrix?)

Update heta compiler before run

```julia
heta_update_dev()
```

## List of cases

- **/biochem** : reproduced model from "Biochem J Proteome Res 2014", in LP article.
Expand Down
43 changes: 43 additions & 0 deletions time-events/index.heta
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// === multiple doses ===

comp1 @Compartment .= 1.2;
s1 @Species {compartment: comp1, isAmount: true} .= 0;
r1_elim @Reaction {actors: s1=>} := kel1 * s1;
kel1 @Const = 1e-3;
dose1 @Const = 100;

dose_sw1 @TimeSwitcher {
start: 100,
period: 10
};
s1 [dose_sw1]= s1 + dose1;

block {output: true} begin
comp1; s1;
end

// === multiple injection ===

comp2 @Compartment .= 1.5;
s2 @Species {compartment: comp2, isAmount: true} .= 0;
r2_elim @Reaction {actors: s2=>} := kel2 * s2;
r3_injection @Reaction {actors: =>s2} := infusion_flag * dose2 / 1; // umole/hour
kel2 @Const = 1e-4;
dose2 @Const = 80; // umole

// duration 1 hour
infusion_on2 @TimeSwitcher {
start: 48000,
period: 504
};
infusion_off2 @TimeSwitcher {
start: 48001,
period: 504
};
infusion_flag @Record .= 0;
infusion_flag [infusion_on]= 1;
infusion_flag [infusion_off]= 0;

block {output: true} begin
comp2; s2;
end
32 changes: 32 additions & 0 deletions time-events/run.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using HetaSimulator, Plots

p = load_platform("./time-events"; rm_out = false);
model = models(p)[:nameless]

# for s1 : dose

sim(model;
tspan = (0, 1200),
observables = [:s1]
) |> plot

sim(model;
tspan = (0,1200),
observables = [:comp1, :s1],
events_on = [:dose_sw1=>false]
) |> plot

# for s2 : injection

sim(model;
tspan = (0, 69_600),
#saveat = collect(48000.:720.:69600.),
observables = [:comp2, :s2]
) |> plot

sim(model;
span = (0, 69_600),
#saveat = collect(48000.:720.:69600.),
observables = [:comp2, :s2],
events_on = [:infusion_on2=>false, :infusion_off2=>false]
) |> plot

0 comments on commit fe62949

Please sign in to comment.