Insulin diseaseand the number is growing tremendously. The main

Insulin Glucagon Pump SimulatorSai Krishna Kaushik Karanam – 1232194, Vinay Gopalakrishna Rao 1235269, Poonam Shipure – 1230882,Vadlamani Raghuram -1230934 , Varun Srinivasan – 1230280 ,High Integrity Systems WS 17/18University of Applied SciencesNibelungenplatz 160318 Frankfurt am MainTABLE IDISTRIBUTION OF TASKMember Name Topics writtenSai Krishna Kaushik KaranamAbstractIntroductionRPCVinay Gopalakrishna RaoRPCPoonam ShipureRPCVadlamani RaghuramRPCnVarun SrinivasanRPCAbstractThe most common disease the world is facing todayis diabetes. Millions of people suffer from this diseaseand the number is growing tremendously. The main reasonbehind the growth of this disease is the western lifestyle,with lots of unhealthy food habits. Diabetes is basicallycaused by two main factors, the pancreas not being ableto produce the desired amount of insulin or the cellsnot responding to the insulin produced by the pancreas.Since this is a large problem many researchers try to findmethods for detecting and curing the disease. One of theapproaches to diagnosis and treating is the glucose-insulinpump system. This document illustrates the important designapproach, mathematical model and design decisionsthat were taken during the design of the insulin pumpsimulator.Index Terms—component, formatting, style, styling, insertI. INTRODUCTIONInsulin glucagon pump is a software controlled safety criticalsystem which aims to provide highly reliable and safesystem which regulate glucose level in the human body. Thisdevice helps diabetic patients to monitor and take action onglucose level of their body in real time. The device is equippedwith insulin and glucagon injection mechanism which workboth in manual and autonomous mode. The blood glucose ismonitored continuously using sensor system and the patient isnotified of developments in real time through the interactiveuser interface. The patient is warned in the case of emergency.The main purpose of this attempt is to design a system whichwill keep the glucose level at a safe range and avoid diabetesrelatedcomplications.III. REQUIREMENT ANALYSISMost of the failures are not due to coding errors but itis because of the lack of requirement acknowledgement andappropriate constraints.The following are the list of conditions on which the projectmust run:A. Functional Requirements• The amount of insulin or glucagon injected is computedby considering the current BGL and the previousBGL which is calculated using the derived mathematicalmodel.• The variation of BGL is represented by the graph.• The maximum and minimum allowable dosage are notallowed to exceed.• The system works in both automatic and manual mode.The mode has to be selected by the physician dependingon patient ‘s history.• In manual mode: Maximum allowed quantity of insulinconsumption by the patient per day should be displayedin manual mode.• Insulin Reservoir: Patient should be able to view theamount of Insulin remained in the reservoir after everyinjection.• Glucagon Reservoir: Patient should be able to view theamount of Glucagon remained in the reservoir after everyinjection• Before every injection of insulin or glucagon respectivereservoir should be checked whether they contain therequired amount of insulin/glucagon. If not, the reservoirmust be filled.• Battery level should be continuously displayed to the user.B. Safety RequirementsAs this system is directly related to patient’s body, safetyhas always been an important issue. Every medical systemfalls under the safety-critical system. We have taken manysafety plans into consideration while designing of insulinpump simulator. The main role of the safety designer is toidentify design constraints to maintain safety.• Maximum daily Insulin Dosage number should not beexceeded.• The quantity of single dosage will depend on the patient’shistory.• System Mode needs to be set by the physician.• Set Mode: If the patient is suffering from dementia thenhe/she is not allowed to use manual mode. It must beonly in the automatic mode in this case.• If the system detects High blood glucose level, thennotification should be displayed.• Warnings and Alerts should be notified repeatedly if theuser does not acknowledge them.C. Software Requirements• Platform: Windows7,10,Vista, MacOS, Linux• Programming Language: Java• Tools: Eclipse Neon, JavaFX• Repository: GitLab• Documentation: Microsoft WordD. Graphical User Interface Requirements• Depending on Patient’s or Doctor’s screen selection respectivescreen will open.• The battery level is continuously displayed.• The clock is displayed at the bottom.• The amount of Insulin or Glucagon that is currentlyinjected into the patient’s body has been displayed.• The amount of Insulin or Glucagon currently available inthe reservoir is also displayed.Fig. 1. V model XT.• The current BGL and the previous BGL is displayed.• A notification for error messages and warning massagesis displayed.• Whenever new patient comes the doctor has to insert newpatient’s information into database.• In case of emergency helper can come and check thehelper screen and can take needed action.IV. PROCESS MANAGEMENTProcess of the project has been framed considering theSWEBOOK standards.A. Project ScopeThe aim of this project is to simulate the behavior ofthe Insulin Pump. That can be used to implement insulinand glucagon pump that can work in real time to preventeffects of diabetes on body. This is achieved by observing theblood sugar level under certain effects like food and increasedphysical work and according to this reading, insulin will beinjected to keep the blood sugar level in the safe range level.We tried to design system which also covers maximum safetycritical system aspect required to build a safe system. we haveimplemented a control algorithm for the insulin and glucagonpump to automate the delivery process. The algorithm worksaccording to the glucose metabolic rate and determine theappropriate amount of insulin or glucagon to be inject intothe body.B. Process ModelV model XT is used as process model for this project. Thisproject requirements are changed dynamically, and additionalfeatures are being added periodically. V model XT providemore flexibility towards requirement changes and potentialenhancement.fig1C. Project EstimationAn efforts estimation is the approximation of the Requirementgathering efforts,coding efforts, Documentation effortsand testing efforts of a project. Cocomo models gives estimationof coding efforts.Fig. 2. Cocomo model.Fig. 3. Cocomo model.D. Deliverables ManagementThe deliverables will be delivered every sprint. Each sprintwill have duration of 2 weeks. Before each sprint, all the teammembers will meet to put a plan for what is going to be donefor the next sprint. Everyone will be committed to a certaintask that should be finished by the end of the sprint.E. Software Configuration ManagementTools and TechnologiesFramework: JAVALanguage: JavaGUI:CSS, JavaFXDatabase: SQLiteV. DESIGNUMl Diagram helps developer to design model with bettersystem understanding.A. BehavioralUML behavioral diagrams helps to visualize and documentthe dynamic aspects of a system.fig4,5,6Fig. 4. flowchart.Fig. 5. State machine.Fig. 6. Sequence diagram.Fig. 7. Class diagram.Fig. 8. Class diagram.B. StructuralStructural diagram shows the different components of thesystem and shows how they connect and interact with eachother.Fig.4,7,9,8C. ArchitectureArchitecture:The architecture of this project consists of multiple provendesign patterns which will make the system more reliable androbust.The UI and Business logic interaction use the Model viewcontroller patterns, In theory, model-view-controller mainlyconsists of three components.1. Model, which represents the underlying, logical structureof data in a software application and the high-level classassociated with it.2. View, which is a collection of classes representing theelements in the user interface.Fig. 9. Class diagram.Fig. 10. System Architecture.3.Controller, is the brain of the design which connects themodel and the view, it is used to communicate between classesin the model and view.MVC provides a robust framework for development and enhancementespecially when the team is big and work needs tocollaborate. for the database interaction, the Object-relationalmodel is being used, object-relational mapping (ORM) isa mechanism that makes it viable to address, access andmanipulate objects while not having to recollect how the one’sobjects relate to their data assets. ORM lets programmers holda regular view of items over time, whilst the resources thatdeliver them, the sinks that acquire them and the packagesthat access them change.Addition to the above, a utility framework is created for easyand efficient access to common and essential functionality.Architectural diagrams helps application developers to describethe basic software structure by separating functionalareas into various layers. fig10VI. SIMULATIONFor a diabetes patient it is highly recommended to followregular diet advised by doctor. Doctor specify how muchcarbohydrate.For a diabetes patient it is always highly and strictly advisedby the doctors to follow a regular diet routine. Doctor setsdosage according to patient’s history how much carbohydratesto consume per day, at what time, when to take insulin withevery minute detail. As a basic requirement patient shouldhave enough knowledge on how to calculate CHO level in thefood and understand how that food will going to balance withthe insulin dose over time.The insulin does not start working instantaneously, so thedecision of injecting glucagon or insulin to compensate bloodglucose level is not entirely depend on current blood sugarlevel. But it is also dependent on previous level and rate ofchange of sugar level used.A person has diabetes test is done by checking fasting bloodglucose. In this test patient is not allowed to eat or drink for8-10 hours, then blood glucose level is checked.TABLE IIABBREVIATIONParameter DescriptionG(t) Blood Glucose ConcentrationG0 Initial GlucoseGb Base Line GlucoseP Basal Insulin of minimum load, that reduces glucose constantlyXt Active Blood GlucoseIt Active Insulin ConcentrationIR Insulin to be disolved in the bloodGg t Active Glucagon ConcentrationGg r IGlucagon to be disolved in the bloodYt Effect of physical Activities on the Metabolism of the Human bodyTotal Insulin Dosage per Day = (Weight of Patient in Kg * 0.55) Units(1)Example : Carbohydrates in a Meal = 60 (2)1mg of Insulin disposes 10 grams of Carbohydrates (3)1mg of Insulin disposes 50mg/dl of Blood glucose (4)CHO Insulin Dose =Meal in gramsInsulin Disposition (5)i.e,6010= 6Units(6)i.e,200 ? 11050= 1.8UnitsT otal Meal T ime Dosage = CHO Insulin Dose + HBS Correction Dose(7)i.e, 6 + 1.8 = 7.8UnitsdG(t)dt= (G(t) ? P) + Xt) ? It G(0) = G0 (8)dIrdt= (Ir ? It) (9)dItdt= (Ir ? K1) (10)dG(t)dt= (G(t) ? P) + Ggt ? Yt G(0) = G0 (11)dGg rdt= Gg r ? Ggt (12)dGgtdt= Gg r ? K2 (13)dItdt= Ir ? K1 (14)Fig. 11. Risk analysisVII. RISK ANALYSISA. RISKS OF INSULIN PUMP• An overdose of insulin due to service failure.• Under dose of insulin due to service failure.• Failure in power system (Battery).• Failure of the interface between medical equipment andelectric equipment.• Poor connection between sensors and actuators.• Physical damage to sensors and actuators.• Damage to organs in the human body because of hardwareequipment introduced into the body.• Biological reactions between hardware equipment andacids produced by the body.B. RISKS OF SOFTWAREAlgorithm Error:Abnormal behavior of the algorithm is undetectable whenit goes to infinite loop.Calculation or Arithmetic Error:Due to the overflow and underflow flags, there may be anerror while calculating the dosage, it may cause overdose orunder dose.C. CLASSIFICATION OF RISKThe risk is classified by the measuring consequences of thedamage happened.Critical: Risk which leads to the heavy damage like thedeath of human being is considered as Critical. The consequencesof the risk are very high, which is not acceptable. Thered coloured region in the figure is a critical region, which isnot acceptable.Medium: Risk which leads to the damage, but whichhave beneficial advantages, these come under the category ofMedium. The consequences of the risk are high, but these canbe considered because of its advantages. The yellow colouredregion in the figure is medium region. We should always tryto reduce the risk by keeping its advantages remaining same.Low: Risk which is acceptable, because the consequencesof the risk are very small.D. RISKS OF INSULIN PUMP• The tolerance level of critical risk is very low.• The tolerance level of medium risk is medium.• The tolerance level of low risk is very high.E. Technological risk• Many hazards are due to complexity of the system.• Automation and manual mode both have their own advantagesand disadvantage.• Increasing automation can cause software failure.• The main job of safety designer is to identify designconstraints to maintain safety.• Most failures are not due to coding errors, but it isbecause of lack of requirement acknowledgment andappropriate constraints.• Pre-release software reliability which is an assessment ofdesign integrity. Post release software analysis launcheserror like multi-thread concurrency exception.• Insulin Glucagon pump simulator is critical systems asa patient’s life may depend on the correct and timelyfunctioning of this systems.VIII. RISK MITIGATION1. N version Programming N version programming techniquesis a great method to fight the software faults. Nversion programming is a method to generate an independentprogram from the same specification and run parallel andoutputs of all the version of the programs are comparedusing a voting algorithm which will improve the reliabilityof software system. Interestingly, in this project, the secondlevel of N- version programming has been proposed in whichseparation of the program is at the hardware level instead ofthe software level. we are using the implementation of thecore logic of the insulin-glucagon pump Java which will runin the main processor and in embedded c which will runin the microcontroller, both the results are compared in themain processor using the voting algorithm. The additionallevel of isolation of the software in terms of hardware and theprogramming language provides the reliability and high levelof control against fault detection which is a major concern inany safety critical system.2. Fail-Safe Implementation The manual mode of thepatient screen has been modelled in a way it also acts as afail-safe state. Even after the extensive measures in design andimplementation of software, errors are inevitable, the systemhas to be prepared in such scenario. If the automatic mode failsto perform, the user is given a chance to change the mode ofoperation to the manual which provides more control in thehands of the user.3. System alert implementation The system is alsoequipped with the multiple system alert implementation towarn the patient in case of emergency or if there is anyimmediate action required.a. Visual alert: When the patient’s glucose level crossesthe high and low threshold, the visual warning appears on thenotification panel of the user interface with intuitive colourand animation.b. Sound alert: In the same way, an emergency alarm startbeeping when the glucose level is out of bound System isusing multiple levels of alert mechanism to considering largeraudience and their physical conditions4. Sofware design measures. As released from the accidentin the past in various field, minor mistakes paid a lot of pricein sense of money, design and resources and since insulinglucagon pump is a safety critical system, the system isdesigned in such a way that, prevention of common mistakeis taken care of.a. Null and Casting checks: Before any data manipulationas part of coding is undergoes a null check to prevent datamanipulation exceptions. A great time is invested in reviewingall the casting in the project.b. Encryption framework: All login details are encryptedand Blowfish, a symmetric-key block cypher to prevent thesystem from hacking and data misuse.c. Code reviews: Every programmer’s work is reviewed bythe other programmer before it is approved and integrated intothe project.Build Rollback and Iterator model: Project is built is iterations,in case of configuration and installation failure theprevious stable build will kick in which provide the systemavailability and to prevent the damage.5.Crash report and error logs: As part of capturingreal-time error and software crash. An error log frameworkhas been designed, so the system is monitored and rectifiedperiodically.IX. IMPLEMENTATIONThe plan of implementing a software that automatizes theprocess of injecting either Insulin or Glucagon began withthe millions of cases being struck with the diabetic deaths orblindness on the daily basis.We made a user-friendly software to make both the doctorand patient easily understand in the state of panic. Thepatient screen is again divided into two different screens i.e.Automatic and Manual.A. Screen 1 (Home Screen):This screen is the gateway for the patient, doctor and theHelper(nurse) as well. With the click of the button the userwill be directed to the respective Login page.B. Screen 2(Login):With this page user can enters the respective Doctor or theHelper or the Patient Screen.C. Patient Automatic Screen:In Automatic mode, three different input options are providedfor the user i.e. Breakfast, Lunch, Dinner. If the userselects Breakfast-60/ Lunch-45/ Dinner-50 carbohydrates willScreen.pdf Screen.png Screen.jpg Screen.mps Screen.jpegScreen.jbig2 Screen.jb2 Screen.PDF Screen.PNG Screen.JPGScreen.JPEG Screen.JBIG2 Screen.JB2 Screen.epsFig. 12. Patient automatic screenFig. 13. Patient manual screenbe given. With the single click of the button itself, it startsinjecting required Insulin, to neutralize the blood glucose level.Mathematical simulations are shown below.fig12D. Patient Manual Screen:In Manual Mode, user will have option to consume differentamount of carbohydrates than what doctor has prescribed likein the Automatic mode, for breakfast/ Lunch/ Dinner.In addition to the regular meal, patient can take extracarbohydrates and then inject the required insulin when everthe current blood glucose level raises more than 180 mg/DL.When ever the glucose level crosses the normally safe limiti.e. 180 mg/dL, the alarm starts ringing to warn the patientand the surrounding people around him to take care of thesituation.Patient might experience reduction in his blood glucosewhenever he does excessive exercises. When the blood glucosefalls-down below 60 mg/dL for a patient who suffers withLow BP, the alarm functions in the similar way. In both thecases, the patient will have an option to calculate and injectthe insulin/ glucagon.In Manual mode, another feature is, the patient mighteven choose to inject the insulin based on the number ofcarbohydrates he is going to take in for his immediate nextmeal. This is because, a diabetic patient can either choose tohave insulin before or after 15 minutes his meal. In this mode,the patient will be able to view the projected time to get hisbody to the normal state from the time of injection of insulin.Patient will also be able to see every different value of thecurrent blood glucose level changing rapidly every momentin his body. The main feature which is common to bothAutomatic and the Manual mode is the dynamic graph throughwhich a patient can get a clear picture of his body state.fig13Fig. 14. Helper screenE. Helper Screen:In the Helper Screen, the Nurse will be able to help thepatient with two things. One, he can change the mode of thepatient. Two, he can book new appointments for the patientswhen required urgently. Nurse will help the patients when thedoctor is not readily available.fig14F. Doctor Screen:Doctor Screen will have all the options as the Helper has.In addition, the doctor can add new patients. He will be ableto check the status of the patient. On selection of the patient’sID and a date, he will be able to fetch the history data ofthe patient and make a graph of the obtained data. Based onthe results he can assess how the patient’s body is reacting toinsulin given/ amount of dosage given.X. QUALITY ASSURANCE AND TESTINGQuality assurance is as important as the development of thesoftware itself. Quality assurance and testing in safety-criticalsystems are even more important than regular system due tothe fact that error is not tolerated and it leads a catastropheconsequences.As part of V-model XT which emphasise a lot of qualityassurance and testing, in this project, quality is monitored atevery stage of the project. Manual testing is considered asa primary testing method. later in the project, more testingmethodology will in incorporated.Testing is considering at every level and maturity of theproject such as Unit Testing, Component Testing, integrationtesting and User Acceptance testingXI. FUTURE SCOPEREFERENCESPlease number citations consecutively within brackets 1.The sentence punctuation follows the bracket 2. Refer simplyto the reference number, as in 3—do not use “Ref. 3″or “reference 3” except at the beginning of a sentence:”Reference 3 was the first . . .”Number footnotes separately in superscripts. Place the actualfootnote at the bottom of the column in which it wasFig. 15. Test cases.Fig. 16. Test cases.cited. Do not put footnotes in the abstract or reference list.Use letters for table footnotes.Unless there are six authors or more give all authors’ names;do not use “et al.”. Papers that have not been published,even if they have been submitted for publication, should becited as “unpublished” 4. Papers that have been accepted forpublication should be cited as “in press” ?. Capitalize onlythe first word in a paper title, except for proper nouns andelement symbols.For papers published in translation journals, please give theEnglish citation first, followed by the original foreign-languagecitation ?.REFERENCES1 Georgios D. Mitsis*, Mihalis G. Markakis, Vasilis Z. Marmarelis,”Nonlinear Modeling of the Dynamic Effects of Infused Insulin on Glucose:Comparison of Compartmental With Volterra Models”, BiomedicalEngineering IEEE Transactions on, vol. 56, pp. 2347-2358, 2009, ISSN0018-9294.2 Mihalis G. Markakis, Georgios D. Mitsis, Vasilis Z. Marmarelis, “Computationalstudy of an augmented minimal model for glycaemia control”,Engineering in Medicine and Biology Society 2008. EMBS 2008. 30thAnnual International Conference of the IEEE, pp. 5445-5448, 2008,ISSN 1557-170X.3 IT. Van Herpe, B. Pluymers, M. Espinoza, G. Van den Berghe andB. De Moor, “A minimal model for glycemia control in critically illpatients,” 2006 International Conference of the IEEE Engineering inMedicine and Biology Society, New York, NY, 2006, pp. 5432-5435.doi: 10.1109/IEMBS.2006.2606134 F. Islam, A. H. A. Khan, N. Singh and A. A. Ali, “Advanced simulationof an insulin glucagon pump,” 2016 International Conference onInformation Technology (InCITe) – The Next Generation IT Summiton the Theme – Internet of Things: Connect your Worlds, Noida, 2016,pp. 197-202. doi: 10.1109/INCITE.2016.7857616