-
Notifications
You must be signed in to change notification settings - Fork 46
Command 1A Insulin Schedule
Several important messages include the $1A
command,
which gives an insulin schedule based on the number of 0.05U pulses
over 30 minute periods for all the various insulin delivery related commands:
basal patterns, temp basals and boluses.
This particular page describes the generic information
for how these various commands are constructed.
There are subsequent pages to describe the details for the
three different types of insulin delivery scheduling:
- Command 1A Table 0 for basal schedule
- Command 1A Table 1 for temp basal
- Command 1A Table 2 for bolus
The generic 1A insulin schedule command format is:
00 01 02030405 06 0708 09 0A0B 0C0D 0E0F
1a LL NNNNNNNN TT CCCC HH SSSS PPPP napp [napp]... NC...
-
1a
(1 byte): Mtype value of$1a
specifies a generic insulin schedule command -
LL
(1 byte): Length of the command (i.e. # of bytes followingLL
, >=$0e
) -
NNNNNNNN
(4 bytes): Nonce, the 32-bit validator (random looking numbers) -
TT
(1 byte): TableNum, 0 = Basal, 1 = Temp Basal, 2 = Bolus -
CCCC
(2 bytes): CheckSum, byte sum of the following 3 fields and the bytes in the generated insulin schedule table -
HH
(1 byte): Field9 (was Duration), TableNum specific data, # of Half Hours -
SSSS
(2 bytes): FieldA, TableNum specific data, max $3840 (=14,400 decimal = 30 * 60 * 8) -
PPPP
(2 bytes): FieldC (Pulses, was UnitRate), initial # pulses to deliver, max $384 (=900 decimal) -
napp [napp...]
(2 bytes per element): InsulinScheduleElement, one of more elements as described below (was UnitRateSchedule) -
NC
(1 byte): Next Command (either $13, $16 or $17) followed by length and data
Command $1A is always followed in the same message by the following Next Commands:
- $13 Basal Schedule for basal schedule (TableNum = 0)
- $16 Temp Basal for temp basal (TableNum = 1)
- $17 Bolus Extra for bolus (TableNum = 2)
The number of elements for any $1A command is the (length - 0xC) / 2. 0xC is the fixed overhead of the fields before the first InsulinScheduleElement. Since the each $1A command consists of one or more InsulinScheduleElements, the minimum $1A command length value is $0e, a $1A command length value of $12 has ($12-$C)/2 = 3 elements (the minimum value for a 24-hour basal pattern), a $1A command length value of $16 has ($16-$C)/2 = 5 elements, etc.
The TableNum
field can have the value 0, 1 or 2 and
specifies which internal table holds the schedule.
Details for each of the table specific interpretation
of the other various fields can be found here:
- Command 1A Table 0 for basal schedule
- Command 1A Table 1 for temp basal
- Command 1A Table 2 for bolus
The CheckSum
is always the sum of the bytes in the case specific
HH, AAAA, PPPP fields
and the bytes of the generated insulin schedule table.
However for some cases,
CheckSum can also be a simple sum of the remaining bytes in the command.
Various examples of the Checksum calculation
are shown within the TableNum specific case pages.
All of the various $1A commands use one or more InsulinScheduleElements
to describe an insulin delivery over an interval based
on the number of 0.05U pulses delivered every half hour.
These elements are used to generate an internal
insulin schedule table that is then used to drive the Omnipod's pump
and is also used for the $1A command CheckSum calculation.
The basic format for each of these elements is napp
:
-
n
: there aren
+1 half hour entries described by this element -
a
: the top bit is set to add an extra pulse each alternate half hour and the bottom 2 bits being the upper 2 bits of the 10-bit pulse value -
pp
: lower 8 bits of the 10-bit number of 0.05U pulses per each half hour table entry
Since n
is a 4-bit nibble,
each element can describe a time interval of between
30 minutes (n
=0) to 8 hours (n
=f) maximum.
A
is typically either 0 or 8 and
effectively acts as a boolean to indicate if an
extra 0.05U pulse is added to alternate half hours to
give an hourly basal rate resolution of up to an additional 0.05 U/h
(depending on the length of the interval as seen in examples below).
For larger amounts that require more than 255 pulses to describe
(255 * 0.05U = 12.75U),
the 'a' nibble will get the top 2 bits of the 10-bit pulse value.
pp
is the lower 8 bits of the 10-bit base number of
0.05U pulses for each of the N
+1 entries
in the specified insulin schedule table.
The documented maximum bolus amount is 30U
which indicates that the maximum supported value for this 10-bit
value is a 30U / 0.05 = 600 decimal ($258).
The pod's firmware actually supports values of up to $384 (=900 decimal).
The example InsulinScheduleElement value of $3005 has
n
=3 (the number of additional 1/2 hour entries),
a
=0 (no alternating extra pulses or high order pulse bits), and
pp
=05 (the base number of pulses for each half hour entry).
Thus the generated insulin schedule table for a
$3005 element creates the following
n
+1 = 4 entry (2 hour) insulin schedule table:
1: 5 x 0.05U = 0.25U
2: 5 x 0.05U = 0.25U
3: 5 x 0.05U = 0.25U
4: 5 x 0.05U = 0.25U
1.00U total
This insulin schedule table of [5 5 5 5] delivers a total of 1.0U over 2 hours or 0.50 U/h for the 2 hour interval.
The example InsulinScheduleElement value of $0258 has
n
=0 additional 1/2 hour entries,
a
=2 which is binary 0010 indicating no alternating extra pulse (a
=0)
and a top nibble of the pulse value of 2, and
pp
=$58 for the lower 8 bits for the number of pulses
for each half hour entry.
Thus the full 10-bit pulse value is $258 (=600 decimal) and the generated insulin schedule table for a $0258 InsulinScheduleElement creates a single entry insulin schedule table of [600] that can be used to deliver the documented maximum bolus of 30U.
The Omnipod documentation also states that the maximum basal rate is 30 U/h(!) which 15U or 300 0.05U pulses per half hour. The InsulinScheduleElement to describe this maximum 30 U/h basal rate for 1 hour would be $112C which would create a two entry insulin schedule table of [300 300].
The example InsulinScheduleElement value of $000a has
n
of 0 for a one 1/2 0.5h entry and pp
of $0a.
Thus the generated insulin schedule table for the
$000a element creates the following
single entry (half hour) insulin schedule table:
1: 10 x 0.05U = 0.50U total
This single entry insulin schedule table of [10] delivers 0.5 U over 0.5h which is a rate of 1.0 U/h for a half hour interval for a basal rate or can be used to deliver a 0.5 unit bolus.
n
=7 is the number of additional half hour entries,
a
=8 indicates adding an extra pulse for alternate half hours, and
pp
=01 is the base number of pulses for each half hour segment.
Thus the generated insulin schedule table for a
$7801 element creates the following 8 entry (4 hour) insulin schedule table:
1: 1 x 0.05U = 0.05U
2: 2 x 0.05U = 0.10U
3: 1 x 0.05U = 0.05U
4: 2 x 0.05U = 0.10U
5: 1 x 0.05U = 0.05U
6: 2 x 0.05U = 0.10U
7: 1 x 0.05U = 0.05U
8: 2 x 0.05U = 0.10U
0.60U total
This insulin schedule table of [1 2 1 2 1 2 1 2] delivers a total of 0.60U over 4 hours or 0.15 U/h for the 4 hour interval.
n
=4 (+1 for a 5 entry table), a
=8
(add an additional pulse for alternate entries),
pp
=00 (the base number of pulses is zero)
will create the following 5 entry (2.5 hour) insulin schedule table:
1: 0 x 0.05U = 0.00U
2: 1 x 0.05U = 0.05U
3: 0 x 0.05U = 0.00U
4: 1 x 0.05U = 0.05U
5: 0 x 0.05U = 0.00U
0.10U total
This insulin schedule table of [0 1 0 1 0] delivers a total of 0.10U over 2.5 hours. This works out to be an average of 0.04 U/h for 2.5 hours. Note that because of the Omnipod can only deliver an integral number of 0.05U pulses each half hour, certain basal rates over various time intervals can only be approximated. Some more examples of what element values are generated for various bolus rates and times will help illustrate some of these boundary conditions.
The element value of $0000 (zero 0.05U pulses over one half hour) gives the requested 0 U/h for 0.5h and generates a single entry insulin schedule table of [0].
The element value of $1800 will generate a two entry insulin schedule table of [0 1] which will deliver a total of 0.05U over 1 hour which is the requested 0.05 U/h for this 1 hour interval.
Since only an integral number of 0.05U pulses can be delivered for each half hour interval, there can only be either 0 pulses (0.0 U/h) or 1 pulse (0.05U total over 0.5h or 0.10 U/h) delivered in a half hour interval, the Omnipod will round down (for safety reasons) and generate 0.0 U/h using the element value of $0000. This is the exact same element value created for 0 U/h for 0.5h which generates the single entry insulin schedule table of [0].
The element value of $1802 will generate a two entry insulin schedule table of [2 3] which will deliver 5 * 0.05U = 0.25U total over one hour which is the requested 0.25 U/h for this 1 hour interval.
Since only an integral number of 0.05U pulses can be delivered for each half hour interval, there can either be 2 pulses (0.10 total over 0.5h or 0.20 U/h) or 3 pulses (0.15U total over 0.5h or 0.30 U/h) delivered in a half hour interval, the Omnipod will round down and generate an element value of $0002 to generate a single entry insulin schedule of [2] which will deliver 2 * 0.05U = 0.10U total over 0.5h or 0.20 U/h for 1/2 hour.
In this example, the larger time interval is specified which will allow for the Omnipod to more closely approximate the requested basal rate. An element value of $6802 generates a 7 entry insulin schedule table of [2 3 2 3 2 3 2] which will deliver a total of (7*2 + 1+1+1) pulses or 17 * 0.05U = 0.85U total over 3.5h which is 0.243 U/h for 3.5 hour.
The conditions for when use of a $1A Insulin Schedule Command is restricted are those of the accompanying $13 Basal Schedule for basal schedule (TableNum = 0), $16 Temp Basal for temp basal (TableNum = 1), or $17 Bolus Extra for bolus (TableNum = 2) subcommand restrictions. The $1A Insulin Schedule Command and its subsequent subcommand must always occur together and cannot be combined with any other commands in the same message.