Title: Real Time ? ?????? CRW-DAQ
1Real Time? ?????? CRW-DAQ
2? ??? ??? ???????????
- ????? CRW-DAQ ??????? ???????????? ???
????????????? ????????????????? ??????????
????????? ? - ????? (???? 19 ???. 33 ??? ?????)
- ????? (???,????,ACCULINA ???,????,??????)
- ??.?????????(???????????, ???????? ????-????????)
- Geneve, Switzerland (CERN,ALICE,PHOS)
- ??????(???????????)
- ????????????
- ?????????
- ???? ???????????? ? ???????? ???? ????????????
?????????? ????????????? ?????? - ?????? ???? ??????? ?????????? ???????????? ??
?????????? ? CRW-DAQ ??????? ????? ? ?????????
?????? - ?????? ??????????? ??????? ???????? ??????????
???? ??????
3?????????? ?????? CRW-DAQ
- ???? ?????? ? ?????????? ? ???????? ???????
- ???? ????????????????? ?????? ? ???????? ???????
- ?????????? ??????????? ??????????? ? ????????
??????? - ???????????? - ??????????? ?????????? ?????? ?
?????? online - ????????? - ?????????? ?????????? ?????? ???
???????????? ??????? - ??????????????? ?????? ????????????????? ??????
- ?????????? \ ???????? ???????????
????????????????? ?????? - ???????????? ??????????? ?????????? ?????? ?
?????? offline - ??????????? ? ??????? ???????? ??????????, ????,
?????????????? ???????? ??? ???????, ???????????,
??????????, ???????????? ? ?.?. - ???????? ?????? ? ?????????????????? ??????
????????? ?????? - CRW-DAQ ???????? ??????????? ???????? ??? ???????
Real Time ????? - ????????? ????????????? ?????????????? ??????
?????? - ????????? ???????? ?????? ??????? (?? 1000 Hz)
- ???????? ???????? ? ??????? ????????? ???????
- ??????????? ???????? ???????? ?????-??????
- ?????? ??????????? ??????? ?????? ???????
- ?????????? ?????? ??????? - Watchdog
- ?????? ?????????? ???????
- ????? ? ????????? ?????? ???????????.
4????????? Real Time
- ??? ????? ????? ????????? ???????? ??????, ??
????? ? ????? ?????? ?????????? ??????. - ?????????? ????? ?????????? ??????? ? ??????
???????, ???????? ???????? - ??????????? ??????
(?????????????) ??????? ??????. - ????????????? ??????? - ????? ??????????
??????????? ???????????? ????? ??????, ?? ?????
??????? ?? ???????? ???????????? ?????? ????
??????????, lt 100 ??. - ???????? ????? ???????????? ????? ?????? ??
?????? ??????? ????. ??? ????? ?????????? ???? ?
???????????? ??????? ???????? (???. ??????????).
???????? ???????? ??????????????? ?????? ?
??????????????? ????? ???????. ???????? ????????
??????????? ????????? ??????? ??????? ? ??????
??????. - ?.?. ??????????????? ????? ??????? ???????????
??????????? Real Time ??????. ?????????? ???????
?????????? ?? ????, ?????? ??? ???????????????
????? - lt 10µs ?????? Hardware (FPGA, Signal
Processors ? ?.?.) - 10µs10ms Real Time OS (QNX, OS9000, Solaris,
eCos, DOS etc) - gt 10ms - Windows, Unix, Linux ?????????
???????????? - ??????? ???????? ????? ?????? ?? ??????????
??????????? ?????????, ??????????? ????? ???????
10 ???????????. - ?????? ???????? ????? ?????? ? ??????
???????????? ?????? (?????????? ???????),
??????????? ????? ??????? 10 ???????????. - Crw32 (?????? CRW-DAQ ??? Windows) ???????
??????? ????????? ??????? ? ???????? ???????
??????? 10 ms. - Crw16 (?????? CRW-DAQ ??? DOS DPMI) ?????????
??????? ??????? ???????? ????????? ??????? ?
???????? ??????? 10 µs.
5??????? ????????? ???????
- ??????, ??? ??????? Real Time ?????????
???????? ?????. ?????????????? ??????? ?????????
??????? ??? Real Time ?????? ?????? - ????? ???????
- ????????? ??????
- ???????? ????????????
- ???????? ?????????????
- ??????? ????????? ? ?????? ??????? ???????
- ??????????????? (???????????) \ ????????? (??
?????? ???????) ????? - GMT (Greenwich Mean Time) \ LMT (Local Mean Time)
- Thread safe ????????? ????????????
- Win32
- 1)GetSystemTimeAsFileTime()-?????
???????????????, GMT, ????? 40 ns, ????? 10 ms,
???????????? ? ????????????? ?? ?????????????
(????? ?????????? ???????, ??????? ????,
??????/?????? ?????). ? ?????? ???? ??? Real Time
?? ????????. - 2)GetTickCount ????? ?????????, ????? 20 ns,
????? 10 ms, ???????????? ? ?????????????
????????????? (??????? ?????????? ???????), ??
?????? ? ?????? overflow ????? 49.71 ?????. ?
?????? ???? ??? Real Time ?? ????????. - 3)QueryPerformanceCounter ????? ?????????,
????? 1 µs, ????? 1 µs, ???????????? ?
????????????? ?????????????. ? ?????? ???? ???
Real Time ?? ???????? (??????? ?????????????
?????? QueryPerformanceFrequency). - CRW-DAQ ?????????? ?????? ??????? Win32,
???????? ?? ?????????? (_rtc.pas) - 1)msecnow - ????? ???????????????, LMT,
????????? ?????? 90 ns, ????? 10 ms, ????????????
? ????????????? ?????????????, thread safe. - 2)mksecnow ????? ?????????, ????????? ?????? 1
µs, ????? 1 µs, ???????????? ? ?????????????
?????????????, thread safe.
6???????? ????????? Real Time (?????? ???????
CRW-DAQ)
- ???? CRW-DAQ ????????? ? ??????????, ?????
?????????? ?????????? ?????? ?????? Real Time
??????? (?.?. ?????????? ????????, ?????????
????????? ? ?.?.). - ????????? ????????? ????? Windows ?? ?????????, ?
????????? ????? CRW-DAQ ?????????????? ?????????,
???????? ??????? ? ?????????? ????? Windows ?
CRW-DAQ (???????????????? ?????). ?????? ???????
??????????? ??????? ???????????????? ? ??????
??????????????. - ?????? ??? ??????? ????????????? ????? ??
??????? net time ??????????? ????????????????
?????.
7??????? ??????????? Windows
- Windows ????? ??????????? (Round Robin)
?????????? ??????????????? ??????? ? ??????
?????????? ? ?????? ??????? (10 ms ??? single, 15
ms ??? multi processor). ????? ??????? ????????
????? ? ????????? ??????????? (???????????
???????????? ???????????????). ???????????????
???????? ?????? ??????, ? ?? ????????, ?.?.
??????? ??? ?????? ????????? ??? ???????. - ????? ?????????? ???????? ?????????? ????????
??????????? ???????. - Windows ????? 32 ?????? ?????????? 0..15 -
??????? ??????????, 16..31-?????????? ?????????
????????? ???????. ??? ??????, ????? ?????
RealTime ???????? ????????? ????? ????? ?????????
Idle,Lower,Normal,Higher,High.
????????????? ????????? RelPriority ?????? -8
tpIdle - ??? ??????? ???????. -6 tpLowest
-4 tpLow -2 tpLower 0 tpNormal -
???????, ?? ?????????. 2 tpHigher 4
tpHigh 6 tpHighest 8 tpTimeCritical -
??? Real Time ???????.
- ????? ?????????? ???????? PriorityClass
- 4 Idle - ??? ??????? ?????.
- 6 Lower
- 8 Normal - ???????, ?? ?????????.
- 10 Higher
- 13 High
- 24 RealTime - ??? Real Time ?????.
???????? ? ???????? ?????????? Idle..High ?????
????? ?????? ?????? ? ????????? ???????
??????????? 0..15. ???????? ??????? ????
AbsPriorityMax(1,Min(15,PriorityClassRelPriorit
y))
???????? ? ??????? ?????????? RealTime ?????
????? ?????? ?????? ? ????????? ???????????
????????? ??????? 16..31. ???????? ???????
AbsPriorityMax(16,Min(31,PriorityClassRelPriori
ty))
8???????? ???????? ???????????
- ??????? ????? ? ??????????? tpTimeCritical(15).
??????????? ???????? TThread.Synchronize.
Synchronize ???????? SendMessage, ????????? ?????
? ???????? ?????????? ?????? VCL ? ???????????
tpNormal(8). ? ??? ????? ?????????????? ??????
????? ? ??????????? tpHigher(10), ???????
???????? 100 CPU. ????? ?????????????????? ?????
(15) ??????? (!) ?? ?????? ???????? ??????????
??-?? ?????????? ????? ?????????????????? ??????
(10). ??? ???????? ??????????. - ??????
- ?? ??????????? Synchronize
- ????????????? ????? ?????????? ????? ????????
- ? ?????????, ? ?????? Windows ???????????
???????? ??????????? ????????????? ????????
??????. ??? ??????? ???????? ???? ??? ?????
?????? Real Time OS.
9????????? ?????? CRW-DAQ
- ??? CRW-DAQ ?????????? ????? ??????? ???????
????????????. ? ???????? DAQ ??????? ????????
30-50 ??????? ? ?????. ?????? ??????????
????????? Daq Pascal ??????????? ? ????? ??????.
?? ???? ???????????? ????? ????????????????
??????????? ??????? ???????????? (???????????
?????????????) ??? ????. - ????? ?????????? ?????????? ???????? ?
???????????????? ?????. - ?????? ????? ????????????? ?????????? ? ???????
??????, ?????????? ? ???????????????? ?????.
?????? ????? ???????? ??? ??????? ???????. ???
???????????? ?????? ???????????? ????????????????
????????? (???????????? ????? ???
UserPollingCallback). ????????, ??? ?????????
program ??? ????? ????????? ???????????? ?? ?????
Daq Pascal. - ?????????? ??????? Watchdog ?????? ?? ???????
???????. ???? ????? ?? ??????? Watchdog ??
???????? ?????, ??????? ????????? ????
?????????? ??????. - ????? ????? ???? ???????? ???????? ???????
???????? - ?????????? ?? ?????? ????????? (devsend,devmsg)
- ?? ???????????? ?????????? ????????????
- Daq
- ProcessPriorityClass RealTime
-
- DeviceList
- Demo device software program
- Demo
- InquiryPeriod 10
- DevicePolling 10, tpTimeCritical
// ????????? ?????? ??????? Procedure
Thread.Execute Var t,p,qDouble
eventBoolean begin While not Terminated do
begin tmsecnow ResetWatchDog(t)
eventWaitForSingleObject(hEvent,DevicePolling)W
AIT_OBJECT0 if (t-qgtInquiryPeriod) or event
then begin UserPollingCallback
FillHistogramm(t-p) qt end pt
End End
10??????????? ????? ????????????????
- ??? CRW-DAQ ?????????? ??????????? ?????
???????????????? ??? ????? ?? ?????? ?????????
? ?? ????? ??? ??????.
Program AsynchronousStyle Var stateinteger
t0Double Begin case state of 0 begin
SendRequest t0msecnow State1
end 1 begin if WaitForAnswer(0) then
begin HandleAnswer State0
end else if msecnow-t0gtTimeOut then begin
TimeOutDetected State0
end end end DoSomethingMore End
Program SynchronousStyle Begin SendRequest if
WaitForAnswer(TimeOut) then HandleAnswer else
TimeOutDetected End
?????????? ????????? ???????? ??????, ?? ????????
?? ?????????. ????? ?????????? ??????? ?????????
????? ?? ????? TimeOut ? ????? ?????? ?????? ??
????? ??????, ???? ????? ??? ?????????
??????. ???? ? ??????????? ?????? ?????
DoSomethingMore ? ???????? 100 Hz. ? ?????
??????? ?? ????????, ???? ???? ?????? ??
?????????? ??? ? ?? ?????. ????????? CRW-DAQ
?????? ???-?? ??????-?????? ?????? ?? ?????? ?
????? ?????? ?????????? ???????, ????? ??
?????????????? ?????????? ?????? ???????. ?? ????
???????????? ????? ??????????? (???????????
?????????????) ?????????? ??? ???? (????? ?
??????).
11???????? ????????? Real Time(?????????? ?
???????????)
- ??????? ????????? ??????????? ?????? (???????)
?????? ???????, ?????? ??????????? - 1)?????????? ??????? ?????? ???????
- 2)?????????? ?????? WatchDog ??? ??????????????
???????? ??????? - 3)??????????? ??????? ?????? ???????
- ?????????? ??????? (???? ??????? ???????)
- _at_polling list - ?????? ???????
- _at_polling plot logy - ?????? ??????????
- _at_polling PriorityClass RealTime - ?????????
??????????
12?????-?????????? ?????????? ??????????? CRW-DAQ
- ?????????? ???? Daq Pascal ???????? ??????????
??? ??????????? ?????-?????????? ??????, ??? ????
???????????? (???????????? ?????????) ?????????
CRW-DAQ. ? ?????? CRW-DAQ ???????? ?????????
(?????) ?? ?????????? ????? Daq Pascal,
??????????? (master) ???????? ?????????. ????????
?????? ????????? ???????? (?????? ????????
??????????? ??????????) ? ??????? ?? ??????
(stdin, stdout ??????????????? ? ?????????
?????). - ?????-?????????? ??????? ????????? ????????
?????????? ??????? - ???????? (slave) ???????? ????? ?????? ???
????? ??? ???????????, ??????? ???????? ???????
???????????????, ???? ????. - ???????? ???????? ??????? ? ???????? ??????????
??????, ????????????? ?????? ? ????? CRW-DAQ, ??
?????????? ??????????? Delphi. - ???????????? ?? ?????????? ? ?????????????
(?????????? COM, ActiveX, OPC) ??????????
?????????? ? ???????? ????????. ???? CRW-DAQ
???????? ?????? ? ????????. - ????? ????, ???????? ???????? ????? ????? ?????
??????????, ???????? ?? ?????? ??????????
CRW-DAQ, ??? ?????? ?????? ?????????? (??. ?????
?????????????).
CRW-DAQ kernel
pipe
User Process slave
Daq Pascal master thread
13??????? ?????? ???????(??????????? ??????)
- ??????????? ????????? ?????? ??? ??????????
?????? ??????????? ??????? ????????? ??????????
?????? ?? ??????? ???????? 10ms (15ms ???
?????????????????? ??????), ?????? ??? ????
????????????? ????? ??????? 20 ms.
14??????? ?????? ???????(mmtimer)
- ????????? mmtimer, ??? ?????????? ??????
??????????? ???????, ????? ?????????? ?????? ?
??????? ???????? 1 ms, ?????? ??? ????
????????????? ????? ????? ??????? 5 ms. - mmtimer ??????????????
- ?????????? ????????
- _at_mmtimer 1
15?????????????(??????? ???? ??????)
- ? ???? ??????? (??????? ??????????? ??????,
????????? ?????? (?????????????)) ?????????
??????? ??????? ?????? ? ???????, ? ??
??????????????? ????? ???????. - ? ???? ?????? ??????????? ????? ?????? CRW-DAQ
???????? ? ??????? ?????????? RealTime, ?????? ??
Daq Pascal ? ?????? tpTimeCritical, Windows
Shell ? ??????????? Normal. ?????????????
?????? ??????????? ??? ????????? ??????? ?
??????? ?????????? Idle, ? ?????? ????????????
??????, ??? ???????? 99 CPU, ?? ????? ??? ????
???? ?????????. ??????? ????? ??????????
??????????? ?????????? (??????? ? ????????).
CRW-DAQ RealTime
pipe
in/out PKK4 ISA
DAQ client tpTimeCritical
Readout server Idle
Hardware device
16??????? ???????? ?????-??????
- ?????? ????-????? ????? ????? ?????????? (IN,OUT)
??????????? ??? ???????????????? ISA, PCI
?????????, ???? ??? ????????? ????????? ??? ???
?? ?????????? ?? ????? ???????????????? ???
????????. - ??????? IN,OUT ? CPU x86 ?????????????????. ??
?????? ????????????? ?? User Mode ??? Windows NT
?????????. - ?????? ??????? ????? IOPM (I/O permission map).
- User Mode ? IOPM ? Kernel Mode ? Port
- IOPM ??????? ????? 8 kB, ???????
?????????/????????? 64 kB ?????? ?????-?????? ???
User Mode. ? ?????? ???? ???? ?????? ????????. - ? ?????/?????? ?? User Mode 2 ???????
- 1)???????????? ??????? ?????? ????, ????? IO gt
30µs - User Mode ???????? ?????????, ??????? ?????????
??????? ?????? ????, ?????????? ???????? ?????
?? ???????????? User?Kernel?User. - 2)??????????? IOPM, ?.?. ?????? ??????? I/O,
????? I/O 1µs - ??????? ?????? ???? ???????????? IOPM (???????
?????? ?? I/O ?? User Mode), ????? User ??????
I/O ???????????????. - CRW-DAQ ????????? ?????? ??????, ?????????
???????? ?????????????? ??????? GiveIO.Sys, ??.
???? _pio.pas ? ???????????? CRW-DAQ. - ? CRW-DAQ ??????? ???????? PKK3, PKK4,
LA-1.5-ISA, LA-1.5-PCI, LA-2-USB, DIO-144,
PCL-812PG, PCL-818L ? ?.?.
17???????????? ??? Real Time ?????? ??? Win32
- Real Time ??? ? ?????? ??????? ????????, ??????
? ??????????. - ?? ??????? ?????????????????, 50 ??????? ???
?????????, ???????? ??????. - ?? ??????????? ??????????? ?????? PostMessage
????? SendMessage ????????????? ????????
WaitForSingleObject(h,0) ?????, ???
WaitForSingleObject(h,INFINITE). ????????? ????
?????????????? ???????????? ????? CPU ????? ?????
?? ?????. ?????????? ? ??????? ??????. - ?? ??????????? VCL. ??? ?? ????????????
????????????? ????? ??????. - ?? ??????????? TThread.Sinchronize. ?? ??????? ??
??????????? SendMessage ? ???????? ???????
?????????? ??????????? (?????????
?????????????????? ????? ? ?????? ??????????
?????????????????? ???????? ???????????). - ??????????? ?????????? ???????, ??? ?????? ??????
????? ?????? ??????. ????????? ? ????????? ??????
???????. - ????????????? ????? ?????????? (Lock/Unlock)
????? ????????. ?????? ??????? ????????? ?????
?????? ? ????????? ? ???? ????? ?????????????. - ??????????? ReadFile, WriteFile ?????? ? ??????
Overlapped I/O. - ??????????? ??????????? ????? ????????????????
?? ??????, ? ?? ??? ??????. - ?? ??????????? ????????? ????????????? COM,
ActiveX. ??? ?????????? ?)?????? ????????? ?
??????????? ?? ?????????, b)???????? ?????????
????????? (???????????? ??????????), ?)??????
??????? ????? ????????????? d)?????????
?????????? ????? ???? ?????????? ????????????
???????? ? ?????? ?????? ?????????????? (????????
???????? ?????), ? ?? ?????????????. - ??????????? ?? ??????????? ?????? Open Source
??????????. ??????????????? ?? ??????
??????????? ???? ? ?????????????? ??????? ?????
(Microsoft etc). ??? ?????????? ??????? ?????,
???? ?????????? ???? ? ?????. CRW-DAQ
??????????? ?????????? ?????? Open Source
?????????? ???, ??? ??? ????????.
18? ??? ??, DAQ ??????
?.?.????????? ???.,???????? ?????????? ?? 31959
?.?.?????? ???.,???????? ?????????? ?? 31959
?.?.?????????? ?.?.?.?.,???.???. ???????
???????? 45877
?.?.????????? ?.?.,???????? ?????????? ?? 31959
?.?.??????? ?.?.?.,????? CRW-DAQ ???????
??????????? 31959
?? ???????? ??? ??? ????????? ????????????