help-mcsim
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with iSpikes


From: Bill Harris
Subject: Re: Help with iSpikes
Date: Sun, 5 Jul 2020 09:16:55 -0700

(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 <wsharris13@gmail.com> 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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]