challenges of implementing timed models on timed platforms...reference clock integrated through the...
TRANSCRIPT
Challenges of Implementing Timed Models on Timed
PlatformsPatricia Derler, Hugo Andrade, Arkadeb Ghosal,
Rhishikesh Limaye, Jacob Kornerup, Ankita Prasad, Trung Tran, Kaushik Ravindran
Ptolemy Miniconference Oct 16, 2015
What we do
• Graphical software • Heterogeneous hardware • To build measurement and control systems
Measurementand Control Hardware
Development Tools System Platforms
Application AreasHistorically focus on Test and Measurement
• Acquiring data, instrument control
New Application areas
• Embedded Systems, Cyber-Physical Systems, Internet of Things, …
Commercial Technology
Models of Computation, User Interface
Math and Analysis
Measurement and Control I/O
Timing
Applications
Deployable Targets
With new application areas come new requirements.
ftp://ftp.ni.com/pub/branches/asean/140331_lv_brochure_2013.pdf
ApplicationsReal-time optical coherent tomography (OCT) imaging system to enable early cancer detection
• combines 320 simultaneous channels at 10 MS/s, LabVIEW performs >700,000 FFT/sec.
European Extremely large telescope (E-ELT)
• 1.87 teraflops of data, 64 compute notes at 512 cores, and 14,000 samples every 2 ms
The Large Hadron Collider (LHC) at CERN • requires precise synchronization
• LabVIEW FPGA serves as the timekeeper for more than 100 collimators, control for approximately 600 stepper motors with millisecond synchronization over the 27 km of the LHC.
https://decibel.ni.com/content/blogs/labview-news-english/2015/04/07/point-of-view-why-you-just-need-time
Challenges
• Time representation • Precision
• Coercion, rounding
• Phase alignment • Jitter • Hardware clock
• Clock edge, clock domain, clock rate
• Multiple timescales, relation to global/TAI time • Clock synchronization • Programming with time
LabVIEW timestamp: 128-bit data type that represents absolute time
The most significant 64 bits should be interpreted as a 64-bit signed two's complement integer. (number of whole seconds after Epoch 01/01/1904 00:00:00.00 UTC). The least significant 64 bits should be interpreted as a 64-bit unsigned integer. (number of 2-64 seconds after the whole seconds specified in the most significant 64-bits)
Time in LabVIEW• Timing Source
• 1kHz, 1MHz, software triggered, … • Create/Clear/Instantiate timing
source • Create timing source hierarchies
• Timing Structure • Timed Loop • Timed
Sequence • Single Cycle
Time Loop (SCTL)
• Precise timing, execution feedback, timing characteristics that
• Programming with Time • Wait until time or tick • Measure elapsed time • Get current time • Create timestamp • Get time difference • Convert time to value/string and the
reverse • Format timestamp
Programming with TimeConfiguration: • Period • Offset • Priority • Processor • Timing Source • What to do if timing
is not met
Runtime status • When did the execution
actually start • How long did the
execution actually take
Configuration for next iteration
executes all functions inside within one tick of the FPGA clock
LabVIEW Timing Engine• Nanosecond engine to keep track of time within a program
• Interfaces to the OS to manage time
• Can use a local real-time clock (RTC) or can be driven by an external reference clock integrated through the NI Time Sync Framework (NI-TimeSync)
• Functions and structures (Wait, Timed Loop) in LabVIEW use the nanosecond engine for time keeping
An example: PWM Generation and Current Sampling for Brushless Motor Control
PID PID PID PID
CurrentLoopPeriod(50us)
time
Complex, brittle code
SCTL for PWM, requires precise timing
While Loop for PID which is difficult to write in SCTL
Shared Variable for communication
LabVIEW Communications
Time in NI Hardware
• FPGA vs RT Processor
• Synchronization supported for various platforms • GPS,
• IEEE 1588-2008 (IEC 61588:2009),
• PPS or
• IRIG-B
• NI EtherCAT RIO • deterministic Ethernet-based communication protocol
Real-time OS
LV Execution System
Timing of a Virtual Instrument (VI)
Compilation, Clumping
Clumps: Nodes that
can be executed together
LabVIEW VI• LabVIEW Execution Systems
• preemptive, cooperative multithreading
• schedule execution of clumps in threads nondeterministically
• Special case: Timed Loop. All code enclosed in a timed loop is executed in a single thread
• Operating system • schedule threads on cores
• #Threads = #Cores * 4 Priority Levels * 5 Non-UI Execution Systems + 1 UI Execution System
Timing of a VI
• Timing statistics: Number of runs, average, shortest, longest time spent for diagram, display, draw, tracking, r/w local variables
• Profile memory usage—number of bytes and independent memory blocks used by a VI. However, memory profiling substantially slows down the execution speed.
• Measured execution time contains VI execution as well as runtime system overhead
Achieving precise timing behavior with LabVIEW and NI hardware is possible …
… but it is not easy to get it right
Now: Future:
Research Challenges• Time Representation
• Logical vs. Real time
• Timing Analysis
• WCET
• Mapping functionality onto distributed, heterogeneous hardware
• Design-space exploration
• PRET Machines
• NIST Cyber-Physical Systems Public Working Group, Timing and Synchronization Subgroup http://www.nist.gov/cps/cpspwg_timing.cfm
• Time-Aware Applications, Computers, and Communication Systems (TAACCS)http://www.taaccs.org/
• IEEE 802 standards group and the AVnu Alliance
• Industrial Internet Consortiumhttp://www.industrialinternetconsortium.org/
Date and Time Extensions to Ptolemy II
Patricia Derler
How does Ptolemy model time?
• Every director has a local clock that keeps track of model time/simulated time
How does Ptolemy model real time?
• Some directors have a synchronizeToRealTime property, others can use the SynchronizeToRealTime attribute
• 1 time unit corresponds to 1 second
• The system time at simulation start time is recorded
ptolemy.data.type.BaseType.DateType
Actors to create and handle DateTokens
• Create DateTokens
• Modify DateTokens
• Convert DateTokens
• Relate model time to real time
Relate model time to real time
model time0 1 2 4 5
Relate model time to real time
model time0 1 2 4 5
10/16/2015 4:00pm 10/16/2015 4:05pmreal time
Relate model time to real time
model time0 1 2 4 5synchronizeToRealTime = true
output the model time value that
corresponds to the date
10/16/2015 4:00pm 10/16/2015 4:05pm
Relate model time to real time
model time0 1 2 4 5synchronizeToRealTime = true
output the model time value that
corresponds to the date output the
date token at the
specified date
10/16/2015 4:00pm 10/16/2015 4:05pm
Relate model time to real time
model time0 1 2 4 5synchronizeToRealTime = true
output the model time value that
corresponds to the date output the
date token at the
specified date
output the date at real time
corresponding to the model time of the
input event
10/16/2015 4:00pm 10/16/2015 4:05pm
Thanks