Re: Help with iSpikes
Bill Harris <[email protected]> Sun, 5 Jul 2020 09:16:55 -0700
| Newsgroups | gmane.comp.gnu.mcsim |
|---|---|
| Message-ID | <CAOBquGo1Nq5HX7kbbcQESmM5c1tabCyk+cBBHZbuav6=eZd6DA@mail.gmail.com> |
--000000000000e76a3105a9b4160e Content-Type: text/plain; charset="UTF-8" (Try 2: Now I should be subscribed.) Frederic, Thanks! I must have fallen off--or never really joined--this list. I think I fixed that. Okay, so here's my real question. I'd like to take an SIR model such as the one shown on the quick reference card and challenge it by having infectious people flow into the I stock periodically; I think that's a way to explore herd immunity, right? I thought I might do that by using Spikes() much as I showed in my first email yesterday and have that add to the RHS of the dt(I) statement, but that would require the magnitude argument of Spikes() to be the AUC, not the peak value. Since that doesn' t work, what would be an idiomatic way to accomplish that in MCSim? I can think of other places that problem would arise. For example, one might want to count through the months of a year and then reset the month count to 1 upon leaving month 12. I guess you could use a C mod function for that From the PBPK domain, how do you model taking a pill once a day (or hour or ...)? I had imagined that Spikes() might be one way, putting x mg of medication in the stomach each day and letting the model take care of its disposition via ADME , but I'm certainly open to learning the way it's really done. Bill On Sat, Jul 4, 2020 at 7:53 PM Bill Harris <[email protected]> wrote: > Mode File: > > States = { > State > }; > Inputs = { > inflow > }; > Initial_State = 0.0; > Initialize{ > State = Initial_State; > }; > Dynamics{ > dt(State) = inflow; > }; > End. > > $ makemcsim spikestest.model > Creating model.c file from spikestest.model ... > > ________________________________________ > > Mod v6.1.0 - Model Generator for MCSim > > MCSim and associated software comes with ABSOLUTELY NO WARRANTY; > This is free software, and you are welcome to redistribute it > under certain conditions; see the GNU General Public License. > > No CalcOutputs{} equations. Null function defined. > > > * Created model file 'model.c'. > > > Compiling and linking model ... > Cleaning up ... > Created executable mcsim.spikestest > > Input File: > > Integrate(Lsodes,1.0e-6,1.0e-6,0); > OutputFile("spikes.test01.out"); > StartTime(0.0); > Initial_State = 0.0; > > Simulation { # Base > inflow = 1.0; > PrintStep(State,0.0,200.0,1.0); > PrintStep(inflow,0.0,200.0,1.0); > } > > Simulation { # Base w/ Spikes > inflow = Spikes( > 5, > 10.0, 10.0, 10.0, 10.0, 10.0, > 0.0, 50.0, 100.0, 150.0, 200.0); > PrintStep(State,0.0,200.0,1.0); > PrintStep(inflow,0.0,200.0,1.0); > } > > End. > > OUtput File: > > Results of Simulation 1 > > Time State inflow > 0 0 1 > 1 1 1 > 2 2 1 > 3 3 1 > 4 4 1 > 5 5 1 > 6 6 1 > . > . > . > > Results of Simulation 2 > > Time State inflow > 0 0 10 > 1 0 0 > 2 0 0 > 3 0 0 > 4 0 0 > 5 0 0 > 6 0 0 > . > . > . > > Question: Why doesn 't State jump by 10 every 50 time units? What is > Spikes doing? > > Thanks, > > Bill > -- > Bill Harris > -- Bill Harris http://makingsense.facilitatedsystems.com/ --000000000000e76a3105a9b4160e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">(Try 2: Now I should be subscribed.)<div><br></div><div>Fr= ederic,<div><br></div><div>Thanks!</div><div><br></div><div>I must have fal= len off--or never really joined--this list.=C2=A0 I think I fixed that.</di= v><div><br></div><div>Okay, so here's my real question.=C2=A0 I'd l= ike to take an SIR model such as the one shown on the quick reference card = and challenge it by having infectious people flow into the I stock periodic= ally; I think that's a way to explore herd immunity,=C2=A0right?=C2=A0 = I thought I might do that by using Spikes() much as I showed in my first em= ail yesterday and have that add to the RHS of the dt(I) statement, but that= would require the magnitude argument of Spikes() to be the AUC, not the pe= ak value.</div><div><br></div><div>Since that doesn' t work, what would= be an idiomatic way to accomplish that in MCSim?</div><div><br></div><div>= I can think of other places that problem would arise. For example, one migh= t want to count through the months of a year and then reset the month count= to 1 upon leaving month 12.=C2=A0 I guess you could use a C mod function f= or that</div><div><br></div><div>From the PBPK domain, how do you model tak= ing a pill once a day (or hour or ...)?=C2=A0 I had imagined that Spikes() = might be one way, putting x mg of medication in the stomach each day and le= tting the=C2=A0model take care of its disposition via ADME , but I'm ce= rtainly open to learning the way it's really done.</div><div><br></div>= <div>Bill<br></div></div></div><br><div class=3D"gmail_quote"><div dir=3D"l= tr" class=3D"gmail_attr">On Sat, Jul 4, 2020 at 7:53 PM Bill Harris <<a = href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br= ></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;= border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">M= ode File:<div><br></div>States =3D {<br>=C2=A0 State<br>=C2=A0 };<br>Inputs= =3D {<br>=C2=A0 inflow<br>=C2=A0 };<br>Initial_State =3D 0.0;<br>Initializ= e{<br>=C2=A0 State =3D Initial_State;<br>=C2=A0 };<br>Dynamics{<br>=C2=A0dt= (State) =3D inflow;<br>=C2=A0};<br><div>End.</div><div>=C2=A0=C2=A0</div><d= iv>$ makemcsim spikestest.model <br>Creating model.c file from spikestest.m= odel ...<br><br>________________________________________<br><br>Mod v6.1.0 = - Model Generator for MCSim<br><br>MCSim and associated software comes with= ABSOLUTELY NO WARRANTY;<br>This is free software, and you are welcome to r= edistribute it<br>under certain conditions; see the GNU General Public Lice= nse.<br><br>No CalcOutputs{} equations. Null function defined.<br><br><br>*= Created model file 'model.c'.<br><br><br>Compiling and linking mod= el ...<br>Cleaning up ...<br>Created executable mcsim.spikestest<br><div><b= r></div><div>Input File:</div><div><br></div><div>Integrate(Lsodes,1.0e-6,1= .0e-6,0);<br>OutputFile("spikes.test01.out");<br>StartTime(0.0);<= br>Initial_State =3D 0.0;<br><br>Simulation { # Base<br>inflow =3D 1.0;<br>= PrintStep(State,0.0,200.0,1.0);<br>PrintStep(inflow,0.0,200.0,1.0);<br>}<br= ><br>Simulation { # Base w/ Spikes<br>inflow =3D Spikes(<br>=C2=A0 5,<br>= =C2=A0 10.0, 10.0, =C2=A010.0, =C2=A010.0, =C2=A010.0,<br>=C2=A0 =C2=A00.0,= 50.0, 100.0, 150.0, 200.0); =C2=A0 =C2=A0 <br>PrintStep(State,0.0,200.0,1.= 0);<br>PrintStep(inflow,0.0,200.0,1.0);<br>}<br><br>End.<br></div><div><br>= </div><div>OUtput File:<br><br></div><div>Results of Simulation 1<br><br>Ti= me State inflow<br>0 0 1<br>1 1 1<br>2 2 1<br>3 3 1<br>4 4 1<br>5 5 1<br>6 = 6 1<br></div><div>.</div><div>.</div><div>.</div><div><br></div><div>Result= s of Simulation 2<br><br>Time State inflow<br>0 0 10<br>1 0 0<br>2 0 0<br>3= 0 0<br>4 0 0<br>5 0 0<br>6 0 0<br></div><div>.</div><div>.</div><div>.</di= v><div><br></div><div>Question: Why doesn 't State jump by 10 every 50 = time units?=C2=A0 What is Spikes doing?</div><div><br></div><div>Thanks,</d= iv><div><br></div><div>Bill</div><div>-- <br><div dir=3D"ltr"><div dir=3D"l= tr"><div><div dir=3D"ltr"><div>Bill Harris=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0</div></div></div></div></div></div></div></div> </blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"= class=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Bill= Harris=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0<br><a href=3D"http://makingsense.facilitatedsystems.com/" target=3D"_bl= ank">http://makingsense.facilitatedsystems.com/</a></div></div></div></div>= </div> --000000000000e76a3105a9b4160e--