GlucoSym
                                
                                 GlucoSym copied to clipboard
                                
                                    GlucoSym copied to clipboard
                            
                            
                            
                        Simulation graph doesn't match simulation time parameter
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?

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.

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.
Ok, it seems to make sense now. But I have two questions:
- Why do I need to include dtif it isn't taken into account?
- Why do I need to specify time? Simply to allocate the array length?