Table Of ContentAnaesthetic Record System 5a
revision2014b
www.nickalls.org/dick/papers/xenon/ARS5aDOC2014b.pdf
Richard W. D. Nickalls
March 2014
ii
The single biggest problem we face is that of visualisation
RichardP.Feynman(1918–1988)1
1TheMathematicalGazette(1996);80,267.
iii
Anaesthesia Record System 5a
Richard W. D. Nickalls,
DepartmentofAnaesthesia,
NottinghamUniversityHospitals,
CityHospitalCampus,
Nottingham,UK.
[email protected]
http://www.nickalls.org/
r w d n
March2014
revision2014b
iv
AnaesthesiaRecordSystem5a
Copyright c RWDNickalls 1994—2014
(cid:13)
Preface
Thisdocumentbringstogetherinoneplaceafairlycomprehensivedocumentationof
thedevelopmentwork,files,programsandsomescreenshotsrelatingtomyoriginal
MS-DOS prototype of the Anaesthetic Workstation computer program (written in
PowerBasic)whichwasusedinoneofthethoracicoperatingtheatresduringtheperiod
1994–2001.ThisrevisionincludesanewchapterdescribingtheDatexsimulatorprogram
weusedtosendDatexAS/3datatothemainprogram(chapter4).
After 2001 this computer program was rewritten and developed for the Linux
operatingsystemusingCandPerl(detailedinaseparatedocumentonthiswebsite:
www.nickalls.org/dick/papers/xenon/xenon2009a.pdf).
RWDNickalls
March2014
v
Contents
Preface v
Contents xi
I Screenshots 1
Screenshots 2
II Background 6
1 Arecord-keeping&trendingsystem 7
1.1 Historicalbackground. . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.2 Theanaesthesiarecord . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.1 Automatedanaesthesiarecordkeeping. . . . . . . . . . . . . 8
1.3 Backgroundtothisproject . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 CollaborationwithLeicesterUniversity . . . . . . . . . . . . . . . . 8
2 TEXintheOperatingTheatre 11
3 DatexAS/3anaesthesiamonitor 14
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.1.1 Softwareversion . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.2 Availablesoftware . . . . . . . . . . . . . . . . . . . . . . . 15
3.2 Serialport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.1 Cableconnections . . . . . . . . . . . . . . . . . . . . . . . 16
3.2.2 Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3 Commandformat . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1 Transmissionrequestcommand . . . . . . . . . . . . . . . . 18
3.4 Outputdata-stringformat . . . . . . . . . . . . . . . . . . . . . . . . 20
3.5 Exampleofdataoutput . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.6 CorrespondencewithDatex. . . . . . . . . . . . . . . . . . . . . . . 32
4 DatexAS/3simulator 34
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.2 Configurationfile(as3sim.cfg) . . . . . . . . . . . . . . . . . . . . 36
4.3 Thesimulatorprogram . . . . . . . . . . . . . . . . . . . . . . . . . 36
vi
CONTENTS vii
5 Systemoverview 46
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.2 Front-endmenu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
5.3 Dataprogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
5.4 Printingprogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
III Thefront-end&menus 52
6 Front-endbatch-file(menu-5a.bat) 53
6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
6.2 Start-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
6.3 Quitoption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
6.4 Theprogram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
IV Thedataprogram 72
7 Overview 73
7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.2 PowerBasicprogram . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7.3 Mainmodule(a5-main.pb) . . . . . . . . . . . . . . . . . . . . . . 74
7.4 LoopOne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.5 F-keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
7.6 Classificationofsubroutines . . . . . . . . . . . . . . . . . . . . . . 76
7.6.1 Datastorage . . . . . . . . . . . . . . . . . . . . . . . . . . 76
7.6.2 Screensetup/maintenance . . . . . . . . . . . . . . . . . . . 76
7.6.3 Windowsetup/maintenance . . . . . . . . . . . . . . . . . . 76
7.6.4 Plottingdatainwindows . . . . . . . . . . . . . . . . . . . . 76
7.6.5 Filehandling . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.6.6 Alarmhandling . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.6.7 DatexAS/3monitorI/O . . . . . . . . . . . . . . . . . . . . . 77
7.6.8 F-keyhandling . . . . . . . . . . . . . . . . . . . . . . . . . . 77
7.6.9 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . 78
7.7 Alphabeticallistofsubroutinesandfunctions . . . . . . . . . . . . . 78
7.8 AllocationofSUBstofiles . . . . . . . . . . . . . . . . . . . . . . . 79
8 Mainmodule 82
8.1 Introduction(a5-main.pb) . . . . . . . . . . . . . . . . . . . . . . . 82
8.2 Initialisation(M1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
8.3 Openfiles(M2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
8.4 InitiatedataoutputfromDatexAS/3monitor(M3) . . . . . . . . . . 86
8.5 Settingupthescreen(M4) . . . . . . . . . . . . . . . . . . . . . . . 86
8.6 Printdatatothescreentext-windowarea(M5). . . . . . . . . . . . . 89
8.7 CALL LoopOne(M6) . . . . . . . . . . . . . . . . . . . . . . . . . . 89
CONTENTS viii
9 Theloop 90
9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.2 GetDatexdata(L1) . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
9.3 SavingG-data(L2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
9.4 Determinefreespaceonthehard-drive(L3) . . . . . . . . . . . . . . . 91
9.5 Detectmidnightandadjustelapsedtime(L4) . . . . . . . . . . . . . 93
9.6 Savethelast20minutesofdatatoafile(L5) . . . . . . . . . . . . . 94
9.7 Deleteoldscreenandbuildnewscreen(L6) . . . . . . . . . . . . . . 95
9.8 ProcessoutstandingF-keyinterrupts(L7) . . . . . . . . . . . . . . . 95
10 F-keys 96
10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
10.2 F-keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
11 Mainmodule—a5-main.pb 102
12 Subroutines 112
12.1 Alarms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
12.2 AlarmSound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
12.3 AlarmTester . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
12.4 ClearNIBPnow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
12.5 DiskSpace(bytes#) . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
12.6 DrawBPwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
12.7 DrawBPwindowHlines . . . . . . . . . . . . . . . . . . . . . . . . . 116
12.8 DrawCO2window . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
12.9 DrawHlinesBPnow . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
12.10DrawNowWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
12.11DrawTimeMarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
12.12DrawTVwindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
12.13DrawVapourWindow . . . . . . . . . . . . . . . . . . . . . . . . . . 120
12.14Housekeeping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
12.15KeyHandler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
12.16KeyScreenHandler(k$) . . . . . . . . . . . . . . . . . . . . . . . . . 123
12.17LoopOne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
12.18LoopTwo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
12.19MAC(N2Opercent,vapourname$,etvapour,ageofpatient%,bmac) . . 136
12.20Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
12.21OpenFiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
12.22PlotBP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
12.23PlotBPdataNow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
12.24PlotCO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
12.25PlotFast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
12.26PlotFIO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.27PlotNIBP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
12.28PlotNIBPdataNow . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
12.29PlotOximDataNow . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
12.30PlotRR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.31PlotSAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
12.32PlotTidalVol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
12.33PlotTrendData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
CONTENTS ix
12.34PlotVapour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
12.35PrintDataToScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
12.36PrintLast20minsFast . . . . . . . . . . . . . . . . . . . . . . . . . . 159
12.37PrintNewScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
12.38PrintSubname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12.39SaveDrugData(druginfo$) . . . . . . . . . . . . . . . . . . . . . . . 162
12.40SaveGNUdata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
12.41SaveLastHourData . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.42Screen9Restore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
12.43Screen9Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
12.44ScreenBOFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
12.45ScreenBON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
12.46Screendrug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
12.47ScrollFile(filetoscroll$,r1&,r2&) . . . . . . . . . . . . . . . . . . . 168
12.48SetupScreen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
12.49Terminate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
13 DatexAS/3module 178
13.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
13.2 Listofparameternames. . . . . . . . . . . . . . . . . . . . . . . . . 182
13.3 Datexmainmodule . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
13.4 DatexAS3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
13.5 FixString$(bad$) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
13.6 SaveAS3Data(ddata$) . . . . . . . . . . . . . . . . . . . . . . . . . 188
13.7 Decode(ddata$) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
13.8 RequestString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
13.9 Short%(n1%,n2%) . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
13.10Long&(n1%,n2%,n3%,n4%) . . . . . . . . . . . . . . . . . . . . . . 198
13.11Bytes2?? (n1%,n2%) . . . . . . . . . . . . . . . . . . . . . . . . . . 198
13.12Bytes4??? (n1%,n2%,n3%,n4%) . . . . . . . . . . . . . . . . . . . . 198
13.13Byte1? (n1%) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
13.14Label?? (n1%,n2%) . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
13.15Status??? (n1%,n2%,n3%,n4%) . . . . . . . . . . . . . . . . . . . . 199
V Datastorage 200
14 Datastorage,filesandformats 201
14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.2 Printall.bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.3 Anes-prt.bat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
14.4 Filenames—time/dateencoding . . . . . . . . . . . . . . . . . . . . 203
14.5 D-data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.6 G-data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
14.7 Drug-data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.8 Lasthour-data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
CONTENTS x
VI Theprinterprogram 208
15 Printing—anoverview 209
15.1 Startingtheprintingprocess . . . . . . . . . . . . . . . . . . . . . . 209
15.2 Processingthegraphictrenddata(plotan3a.pb) . . . . . . . . . . . 209
15.3 Processingthedrugsheet(drug-11h.pb) . . . . . . . . . . . . . . . 212
16 Printall.bat 216
17 PlotAn3a.pb 217
17.1 Box1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
17.2 Box2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.3 Box1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.4 MakeNewFiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.5 PlotBP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
17.6 PlotCO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
17.7 PlotFO2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
17.8 PlotSAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
17.9 PlotTV. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227
17.10PlotVapour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
17.11Printerstatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
17.12TimeBase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
18 Datafilesoutputbyplotanes.pb 231
18.1 bps.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
18.2 bpd.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
18.3 co2.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
18.4 cvp.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
18.5 fio2.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
18.6 fin2o.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
18.7 hrecg.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
18.8 hroxim.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
18.9 mac.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
18.10rr.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
18.11sat.dat. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
18.12tv.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
18.13vapin.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
18.14vapout.dat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237
19 GNUplotfiles 238
19.1 Plot-BP.gnu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
19.2 Plot-CO2.gnu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
19.3 Plot-fo2.gnu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
19.4 Plot-sat.gnu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
19.5 Plot-tv.gnu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
19.6 Plot-vap.gnu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
19.7 GNUplotandLATEXpictureformat . . . . . . . . . . . . . . . . . . . 242
20 Typesettingthegraphs 244
20.1 LATEX2ε . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
20.2 LATEX2.09 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
Description:1994–2001. This revision includes a new chapter describing the Datex simulator
program 1.2.1 Automated anaesthesia record keeping . 3.2.2
Protocol . communications interface known as the RS-232 serial port. The
Datex-Ohmeda1AS/3 and CS/3 monitors are versatile modular anaesthesia moni
-