and has the following features.
Channel header | |
4B | Variable length |
Channel block (variable length) |
The size of one channel block can be known by reading channel header. The channel header has the following form:
Channel number | Sample | Sampling |
Size (B) | Rate (Hz) | |
2B | 0.5 B | 1.5 B |
Channel header (4 B) |
The top 2 bytes among 4 bytes channel header is the inherent number of channel. The number is 0000 - FFFF in 4 digits of hexadecimal number. High-order 4 bits of the last 2 bytes shows sample size of subsequent one second data in byte. The available values are 0 - 4. Especially, 0 represents 0.5 byte (4 bits) length. Low-order 12 bits show sampling rate (Hz), and the available values are 1 - 4095. The data block subsequent to this channel header contains data for 1 second of the channel. Among these, the top sample is always 4 bytes long, and the second and subsequent samples contain differential values from the previous sample ("current sample value" - "previous sample value") all in sample size described in channel header. The number of the differential values is (sampling rate - 1).
Starting | First | Last | |
Sample | Differential | ... | Differential |
4 B | (*B) | (*B) | |
Data block (variable length) | |||
(sample size (*B) is specified in channel header) |
When sampling rate is 1 Hz, data block contains only starting 4 bytes sample without differential data. Sample size is 0.5 - 4 bytes, namely 4, 8, 16, 24 or 32 bits long, all of which are shown as complement of 2. When sample size is 0.5 byte and sampling rate is even, unused free space is generated in the low-order 4 bits of the last 1 byte of the data block.
Sample size as small as possible only for expressing differential data for 1 second of this channel is taken. For example, when differential data for 1 second is within the range of -8 - 7, sample size is 0.5 byte. In the similar way, 1 byte for -128 - 127, 2 bytes for -32768 - 32767 and so on. The reason why differential is taken is to avoid sample size being large due to direct current offset. Sample size written in channel header for each second changes dynamically. Thus data will be compressed depending on the content. When gain is appropriately set, it is usual that sample size at normal time is 0.5 - 1 byte. Although it is possible that sampling rate in the same channel fluctuates dynamically, this is not so general. In case of data AD-converted from an analog tape record, fluctuation of sampling rate can be described as it is. However, the program for reading win format may assume that sampling rate of the same channel is constant.
"Second block" of win format is the above-mentioned one or more channel blocks arranged behind second header in which time is described.
Second header | First channel | Last channel | |
year/month/day/hour/minute/second | Block | ... | Block |
BCD 1B | each (for 1 second) | (for 1 second) | |
6 B | Variable length | Variable length | |
Second block (Variable length) |
This second block is a basic format of win format. Win format can be handled on various media for transmission and save. The format slightly varies depending on media. Hereafter win formats (1) on disk/tape, (2) on UDP packet of IP, (3) on shared memory and (4) on dedicated line are described respectively.
Block | Second block | Block | Second block | ||
Size | ... | Size | |||
4B | Variable length | 4B | Variable length | ||
1 file (Variable length) |
Here "block size" represents size of subsequent second block added with 4 (size occupied by "block size") in byte. File size (number of seconds) of win format has no limitation. However, when buffering online continuous data, file is divided in 1 minute increment (wdisk(1W), pmon(1W), events(1W), wtape(1W), etc.).
An example of program for editing a file of win format is:
Files can be catenated with cat(1).
Examples of programs for continuously recording on tape media such as EXABYTE and DAT are wtape(1W) for write and rtape(1W) for read. The format handled by these is basically same as that of disk file. That is to say, one tape mark is inserted for each 10 minutes (between X9 minute 59 second and X0 minute 00 second). By the way, since in case of tape data for variable length 1 second is read and written as one record, it is necessary to use a tape system that can handle "variable record length."
Packet | Packet | Identification | Second | Second | Second | Second | |
Number | Number | Code | Block | Block | ... | Block | Block |
(for resend) | '0xA0' | Size of | Size of | ||||
1B | 1B | 1B | 2B | Variable length | 2B | Variable length | |
1 packet (Variable length) |
"Size of second block" includes 2 bytes of itself. The maximum packet size of 1 packet is 1472 bytes (1500 bytes as IP packet size). In order to increase transmission efficiency, packet size is usually generated in this range by packing data so as to make the size as large as possible. Refer to recvt(1W) for protocol. Other than this, the following old type format that accommodates only data for 1 second in 1 packet is available.
Packet | Packet | Second | |
Number | Number | Block | |
(for resend) | |||
1B | 1B | Variable length | |
1 packet (Variable length) |
This format is for keeping compatibility with old programs, and can be distinguished with the afore-mentioned new format by checking the value of the third byte. Recvt(1W) can accept both formats.
Block | Write | Second |
Size | Time | Block |
4B | 4B | Variable length |
1 block (Variable length) |
and a type not including it:
Block | Second | |
Size | Block | |
4B | Variable length | |
1 block (Variable length) |
"Block size" includes 4 bytes of itself. In shared memory segment, data blocks like these are arranged. Refer to recvt(1W) and order(1W) respectively for details.
FLAG | Observation point | Packet | Packet | Second | Observation point | FCS | FLAG |
ID | Number | Number | Block | Status | |||
(for resend) | |||||||
1B | 1B | 1B | 1B | Variable length | 1B | 2B | 1B |
1 packet (frame) (Variable length) |
Second block contains data of 1 through 3 channels. Size of 1 frame does not usually exceed 1024 bytes.
Medium | Function | Program | |
ADC→IP | Conversion | adt | PC98 |
Telemeter system →IP | Conversion | epo2en etc.* | PC98 |
Dedicated line →IP | Relay | hdlc | PC98 |
Dedicated line → Dedicated line | Relay | hdlc | PC98 |
IP→IP | Relay | relay | WS |
IP→Memory | Receiving | recvt | WS |
Memory → Memory | Time sequence sort | order | WS |
Memory → Memory | Channel selection | raw_raw | WS |
Memory →IP | Transmission | send_raw etc. | WS |
Memory →Disk | Save | wdisk | WS |
Disk →8mm | Save | wtape | WS |
8mm→ Disk | Refresh | rtape | WS |
Disk →Screen | Measurement | win | WS |
Cutting out a single channel with program dewin(1W), and Cutting out portion displayed on screen with program win(1W).
open_win_format(iunit,file) open win format file close_win_format(iunit) close win format file write_win(iunit,idx,idate,nch,nchan_tbl,nsamplea,ibuf,i_end) write win format file (for 1 second) read_win(iunit,idx,idate,nch,nchan_tbl,nsamplea,ibuf,i_end) read win format file (for 1 second) read_win_start_time(iunit,idx,idate,i_end) read time in win format file (for 1 second)Refer to fortran(1W) for these subroutines.