Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulation graph doesn't match simulation time parameter #4

Open
csholmq opened this issue Feb 10, 2018 · 3 comments
Open

Simulation graph doesn't match simulation time parameter #4

csholmq opened this issue Feb 10, 2018 · 3 comments

Comments

@csholmq
Copy link

csholmq commented Feb 10, 2018

I would expect the following JSON

{ "index": 0, "time": 60, "dose": 0.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 100, "length": 10 }] } }
{ "index": 1, "time": 60, "dose": 0.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 0, "length": 0 }] } }
{ "index": 2, "time": 60, "dose": 5.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 0, "length": 0 }] } }
{ "index": 3, "time": 60, "dose": 0.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 0, "length": 0 }] } }
{ "index": 4, "time": 60, "dose": 0.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 0, "length": 0 }] } }
{ "index": 5, "time": 60, "dose": 0.0, "dt": 10, "events": { "carb": [{ "start": 0, "amt": 0, "length": 0 }] } }
{ }

to result in a graph with 60 minutes on the x axis. Have I misunderstood something?

image

@csholmq
Copy link
Author

csholmq commented Feb 10, 2018

I noticed that the default settings didn't get overwritten by the time and dt parameters when posting to /dose (why is that?). So I added an JSON message to post to /update_patient_data:

{
  "sim_p": {
    "Si": [],
    "bw": 89,
    "Ci": 20.1,
    "tau1": 49,
    "tau2": 47,
    "Vg": 253,
    "p2": 0.0106,
    "EGP": 1.33,
    "GEZI": 0.0022,
    "Si_base": 0.00000811,
    "bioavail": 6.0,
    "initialglucose": 100
  },
  "dt": 10,
  "time": 60,
  "sens": [ {
    "per": 100,
    "start": 0
  } ]
}

That changed the results to something more reasonable, but the axis stays the same.

image

@bustavo
Copy link
Member

bustavo commented Jun 24, 2018

Each post you do to GlucoSym equals to an advance in 5 minutes for the simulation. Counting the posts you did, minus the initial one ( 6 - 1 = 5 ), you generated 25 minutes of simulation time as shown on your graph.

The parameter 'time', as described on the repo readme, is:
"time: Total simulation run-time in minutes."

This means that the simulator will only run for 60 minutes from start to end so each post you do to the sim gets you a bit further to that total simulation run-time. After going over those 60 minutes, if you continue to post to the sim, it will stop advancing.

From the graph you show, the sim is running as it should.

You must remember that the simulation running out-of-the-box will not behave as yourself or as any other "real" person with T1D. The simulation is based on pre-generated patients with different body setups as used in some clinical studies simulations.

So in conclusion, you are using the simulator correctly and the graphs seem to represent what you are giving it as an input.

@csholmq
Copy link
Author

csholmq commented Jun 25, 2018

Ok, it seems to make sense now. But I have two questions:

  1. Why do I need to include dtif it isn't taken into account?
  2. Why do I need to specify time? Simply to allocate the array length?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants