CTS Evpro Live
The CTS software for laptop at download station.
(cts_evpro)
It records downloads and displays results.
Project location:
main_mseal/2019/ipro/
electronics--cts_course_timing_system/0317v17b--cts_software_on_pc_cts_evpro
Currently for version 001h.
Back to main doc.
Versions.
- 001f
-
This was used at the 2019-04-06 event.
This was the first time the cts was ever used.
- 001g
-
Not used.
- 001h
-
The current version as of 2019-04-16.
New in this version compared to 001f:
Major re-write of the code to use python classes.
Shows time splits and time elapsed between controls.
Has control-specific time adjustments for RTC drift.
- xxx
- xxx
- xxx
Time handling.
Variables created from reading the config file:
- timezone int, seconds
- coco_rtc_adj int, seconds
- class rcardrec:
prec[] the punch records, punchrec objects
tzone_dt timedelta object
- class punchrec:
raw_t_s str, seconds, no adjustment
t_dto datetime object, adjusted
t_adj_td timedelta object ***
tzone_dt timedelta object ***
t_dtoloc datetime object, local time
split_td timedelta object, time splits
tbc_td timedelta object, time between controls
*** Note how one has suffix _td while the other has
suffix _dt. This is an naming error to be fixed in
the future.
Sequence of time handling events.
- startup - config file is read.
- The following get set:
- timezone int, seconds
- coco_rtc_adj int, seconds
- startup
- The following get set:
- tdzone timedelta
- set from timezone
- rrec[] array declared
- rrec[] will hold the rcard records.
- Enter the main loop.
- All after this happens in loop.
- All below happens every time reprocess is
set to True by a change in the group list
or the addition of a new rcard record.
- rrec[] is re-initiated with no data.
- Start reading the grouplist file.
- new rrec objects are added with the
following set:
- rrec[i].cc_id = coco_id
- rrec[i].cc_name = coco_name
- rrec[i].uid_s = f1_uid
- rrec[i].grp
- rrec[i].crs
- Note that the timzone is not set yet.
- Start reading the esm_data.
- Each file read will only affect one
rrec[j].
- The data for all the punch records will
be set in rrec[j] with a single call:
rrec[j].reset_rec_lists(esm_data.cc, esm_data.ct)
- First the name of each cc will be searched
and found.
- Then inside the rcardrec object rrec[j], for
each punch record, there will be a call to
self.add_rec(...) with these data:
raw_cc_l[i]
raw_t_l[i]
- That call will set the following in
rrec[j].prec[i]:
- raw_cc_s = raw_cc
- raw_t_s = raw_t a string, seconds
- cc_name = name
- Still no timezone or adjustment data
have been set.
- Then the following are called for every rrec:
- rrec[i].pro_set_j_adj()
- rrec[i].pro()
- rcardrec::pro_set_j_adj()
- Sets the t_adj_dt for every prec.
- rcardrec::pro()
- For each prec:
- prec[i].tzone_dt = tzone_dt
- prec[i].pro() is called
- Sets the following:
- t_dto - Uses raw_t_s + t_adj_dt
- t_dtoloc - Uses t_dto + tzone_dt
- prec[i].pro2(...) is called
- pro2 params are: punfirst punprev
- Sets the following:
- split_td - Uses t_dto - punfirst.t_dto
- tbc_td - Uses t_dto - punprev.t_dto
- td is calculated from two prec[].t_dto data
and that is used to set rcardrec::toc
- Then the data are saved by calling:
- save_data_1() saves the text datum files
- save_data_2() saves the html display file
- To get time data, inside the punchrec class,
calls are made to functions
- gs_t_loc() formats: t_dtoloc
- gs_split() formats: split_td
- gs_tbc() formats: tbc_td
- These "gs_" functions all "get strings".
The 001h README.
********************** even more out of date than before **********************
********************** OUT of DATE **********************
____________________________________________
Procedure for testing wihout esm:
Each of the following commands should be
done in a separate terminal.
- Start g01 master by doing ./aa 1
- Start g10 esm by doing ./aa 10
- If doing a sim, see sim section below.
- Start g20 pro by doing ./aa 20
- Open data00/group.list
- Do alterations and saves while
monitoring the running programs.
- Open z-current_display.txt with gedit.
It's the latest version of
data32_display/h####b
Reload it when needed.
- ...
- When done, close the programs with ctrl-c.
- Doing a sim.
- Instead of doing ./aa 10...
- Open the sim input file.
- After every alteration in the file,
do ./aa 11.
- This will simulate the esm prog reading
new data coming via the serial port.
____________________________________________
data0/group.list
Manually change group.list.
Then, after every change, do
./update
to copy it to a file
data21/f####b
____________________________________________
g10_esm.py
esm: event serial monitor
Takes the serial monitor input from the master control box
and creates a raw data files.
data22/g0000b
data22/g0001b
data22/g0002b
...
Details.
- Every new piece of data coming from the serial
line causes it to write a new file "data22/g####a".
- When it's done writing the file, it closes it
and moves
data22/g0000a -> data22/g####b
This means that the data are not available to the
next program until after the file is completely
written.
____________________________________________
g20_datapro.py
Reads files
data21/f0000b
data21/f0001b
data21/f0002b
...
It reads new files as they appear.
The last of these files contains the latest
UID/group/course info. Only the last file
is important.
Reads files
data22/g0000b
data22/g0001b
data22/g0002b
...
It reads new files as they appear.
Every file is important.
Some later files may supersede info from earlier files.
From the data it read, it creates the following:
data31/
main.data for debugging and post-event use
data32_display/
h0000b
h0001b
h0002b
h0003b
...
____________________________________________
Information flow through scripts.
manual
- fname_fc data0_manual_input/c1.config
- All read this so don't list it in script inputs.
- fname_group_list data0_manual_input/c2_group.list
g01_master
- inputs:
- fname_group_list
- outputs:
- dir_master_work/f<####>b
- This is simply a copy of fname_group_list.
g10_esm.py
- inputs:
- serial data
- outputs:
- dir_esm_work/g<####>b
g20_datapro.py
- inputs:
- dir_master_work/f<####>b
- dir_esm_work/g<####>b
- outputs:
- fname_pro_main
- dir_pro_work/h<####>b
- fname_current_display