% % measure the long-period within the battery reporting % this will be from the last required data 0 bit to the signal-length intro % %%%"87076939911" !Sim.PartImei %%% "AA0110" !Sim.UniqueName [=TrakSess] [Reset] "Con" _Sim.UniqueName 2 right & text_conn "[" """" replall "]" """ [(]" replall execstr "LOD_" &_Sim.PartImei &"_" textwild 0 !counter % % this is the last data report time in msec % 0 !LastComm % % last time a handshake occurred % 0 !ShakeComm 0 !CommC 0 !CommD % % cycle LOD's for this tracker from least recent forward % _Arching.Connector empty { % % stack: path seed % nextfile ? %%%"a1 " count - & &" " log() dup !Sim.File % % next upward in time locater data point file % reading % % stack: path seed seed-content % execstr %%%dup logs % % off time must be greater than 2 minutes % _Sim.Msec _LastComm sub _Sim.Msec !LastComm dup 180000 gt exch 240000 lt and { %%% dup ^"measure " logs % % this is the initial gap for data transmit (conditionally) % read this data point as the 3 minute marker in data transmit % 1-3 Low (engine power out if 1-5 Low) % // 1]L 3]E>> 5]H // 6]8>7]H 9]7>10]H 12]6>13]H 15]5>16]H 18]4>19]H 21]3>22]H 24]2>25]H 27]1>28]H 30]0> // 31]H 33]L 34]H 36]L 37]H60] ... repeats every 60 minutes % % mark the transition point, will return here if experiment fails % dup ^"bat_" ofconn exists { %%% "batexist " log() } { 130000 !Sim.D0 dup "_" 2 1 1 parse !Xper.Minute "min " log() dup !Xper _Sim.Msec !Xper.Msec 0 !Conn.Msec [Any?] { % % there are connections, bring the index to first after time % 1 [@Index] !prior -1 !stkidx [Count] countdown { dup !stkidx [@Index] _Sim.Msec gt ? } for +stkidx positive { _stkidx [@Index] !Conn.Msec % % check for 2 connections between 32 and 38 minutes % "conn1 " count - & &" " _stkidx & logs 2 60 mul 20 sub 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Da %%% 5 5 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Db 8 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Dc 11 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Dd 14 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.De 17 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Df 20 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Dg 23 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Dh 26 60 mul 00 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Di 29 60 mul 30 add 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Dj %%% 32 // 5]H 6]8>7]H 9]7>10]H 12]6>13]H 15]5>16]H 18]4>19]H 21]3>22]H 24]2>25]H 27]1>28]H 30]0> 31]H 29 60 mul 1000 mul _Conn.Msec add _Sim.D0 add !Sim.St 35 60 mul 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Et 45 60 mul 1000 mul _Conn.Msec add _Sim.D0 add !Sim.Ft 0 !evts 0 !evtt 0 !evtu empty !evtv empty !evtw empty !evtx _stkidx - !newidx { _newidx [@Index] _Sim.Da gt _newidx [@Index] _Sim.Dj lt and { _evtu _newidx [@Index] _Sim.Db gt { _newidx [@Index] _Sim.Dc gt { _newidx [@Index] _Sim.Dd gt { _newidx [@Index] _Sim.De gt { _newidx [@Index] _Sim.Df gt { _newidx [@Index] _Sim.Dg gt { _newidx [@Index] _Sim.Dh gt { _newidx [@Index] _Sim.Di gt { 0x01 or } { 0x02 or } ifelse } { 0x04 or } ifelse } { 0x08 or } ifelse } { 0x10 or } ifelse } { 0x20 or } ifelse } { 0x40 or } ifelse } { 0x80 or } ifelse } { 0x100 or } ifelse !evtu } { } ifelse _newidx [@Index] _Sim.St gt dup { _newidx [@Index] _Sim.Et lt { _evtw !evtx _evtv !evtw _newidx [@Index] !evtv +:evts pop false } { _newidx [@Index] _Sim.Ft lt { +:evtt pop false } { } ifelse } ifelse } if ? -newidx negative ? } loop "evts " &_stkidx &" " &_evts &" " &_evtt &" " &_newidx logs } if } if true !Proper % % look for the correct timeout gaps that signal data transmit % _Sim.Msec %%% "Transition " log() !Transition _Sim.Msec 58 60 mul 1000 mul add %%% "Ender " log() !Ender % % set all bits to zero % 0 63 prezero !Bitex 1 128 prezero !Biter { % % stack: path seed % nextfile ? %%% "a1 " count - & &" " log() dup !Sim.File % % next upward in time locater data point file % reading % % stack: path seed seed-content % execstr % % is this record past the end of the hour being sampled % _Sim.Msec _Ender gt ? % % check the time since the experimental transition point % calculate number of 30 second units since starting point % dup "_" 2 1 1 parse _Xper.Minute sub %%%"bx " log() !Bitval % % strike the bit at the minute position % _Bitex _Bitval + + minus left ^"1" _Bitex _Bitval + left ^ !Bitex _Sim.Msec %%% "xper " log() _Transition sub 30000.0 div normint %%% "detect " log() !Bitval % % have the bit position where this data reception time fits % _Bitval 1 gt { % % strike the two bits at the minute position, both are now ones % _Biter _Bitval + minus left ^"11" _Biter _Bitval - left ^ !Biter } if } loop % check for present(1), missing(0) data points at: % 6-7 (!acc) % 9-10 0x80,12-13 0x40,15-16 0x20,18-19 0x10, % 21-22 0x08,24-25 0x04,27-28 0x02 30-31 0x01 % 33-34 Low, 36-37 Low, 38-60 High % %% 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 % 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 % 0001111 % % take off the back-side values, look back in the bit chain to the first zero before all ones field % 0 !Seeker _Bitex "Rawx " log() pop _Biter dup !Bitey "Raw " log() -16 right { dup 1 right "0" eq$ ? +:Seeker -1 right } loop &"1" length !Worklen % % the seeker value has to be xxx ones % %%% _Seeker &" in ones field . . ." logs %% 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 % 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 % 0001111111110001111111111111111111111111111111111001111001101101101101 %%% length logs %%% "signif " log() % % trim away first yyy minutes of intro % dup 6 left !Pretrim -6 left % % sample bit swatches for one or zero content 11 times % 0x0000 exch 11 countup { pop % % shift bit container left one % exch 2 mul exch % % has to be solidly ones for counting as a one % dup 3 left "111" eq$ { exch 0x0001 or exch } if % % go forward in bit times % -6 left } for % % save remaining bits %%% dup logs !Remainder %%% "pre-Final " second 16 base & logs % % the final two least significant bit values are the forced zeros % dup 0x03 and 0 eq { % % this is a properly read value so far % 4 div normint } { % % this is not correct for the transition % false !Proper %%% "Improper " second 16 base & logs } ifelse %%% "Final " second 16 base & logs !Final _Proper %%% _evts 2 eq and %%% _evtt 0 eq and { % % good read % _Seeker 40 gt _Seeker 50 lt and _Worklen 65 gt _Worklen 76 lt and and { dup !Filer _Final 16 base ^"0x" !Sim.Engine dup ofconn empty "Sim.Engine" sval catcr exch append _Xper ofconn empty "Sim.Engine" sval catcr exch append %%% _Seeker &" trimmed and " &_Remainder &" left" logs %%% dup &" --- end of hour with valid read" logs %%% _Xper &" --- begin of hour with valid read" logs _Final 16 base !Xfinal _evtu 0x1FF xor 16 base ^"0x" !Yfinal "bat_" &_Xper ofconn _evtv &" " &_evtw &" " &_evtx !Lock empty !Gap _evtx isnull { pop _evtw isnull { pop } { _evtv from !Gap } ifelse } { _evtw from !Gap } ifelse empty _evtv isnull { pop &" - " } { _Conn.Msec from 1000.0 div 4 left & &" " } ifelse _evtw isnull { pop &" - " } { _Conn.Msec from 1000.0 div 4 left & &" " } ifelse _evtx isnull { pop &" - " } { _Conn.Msec from 1000.0 div 4 left & &" " } ifelse !Lockr empty "Xfinal" sval "Yfinal" sval "Gap" sval "Lock" sval "Lockr" sval "Seeker" sval "Worklen" sval "Pretrim" sval "Xper" sval "Filer" sval "Sim.Msec" sval "Remainder" sval "Trimming" sval "Bitex" sval "Bitey" sval "evts" sval "evtt" sval exch write } if } { } ifelse % % this will put us past the experimental transition % pop _Xper } ifelse } if } loop pop2