diff --git a/.gitignore b/.gitignore index c1c92ed..94671ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ /draft /.vscode + +# temporal files +/*/_julia diff --git a/README.md b/README.md index bb9ccf6..fe02aa6 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/time-events/index.heta b/time-events/index.heta new file mode 100644 index 0000000..e979d0e --- /dev/null +++ b/time-events/index.heta @@ -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 diff --git a/time-events/run.jl b/time-events/run.jl new file mode 100644 index 0000000..a093657 --- /dev/null +++ b/time-events/run.jl @@ -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