Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions score/time_daemon/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
.. _time_daemon:

Time Daemon
#####################

.. note:: Document header
###########

.. document:: Time Daemon
:id: doc__time_daemon
Expand All @@ -28,52 +26,54 @@ Time Daemon
:realizes: wp__cmpt_request
:tags: time_daemon

.. note::
Work in progress: structure, titles, and needs IDs only. Content and req/comp/feat traceability links to follow in later PRs.
.. comp:: Time Daemon
:id: comp__time_daemon
:security: NO
:safety: ASIL_B
:status: valid
:version: 1
:belongs_to: feat__time[version==1]

Abstract
========

This component implements a time synchronization daemon that receives time data from time_slave via IPC, performs verification and qualification, and provides validated time information to applications.

.. code-block:: rst
Specification
=============

.. comp:: Time Daemon
:id: comp__time_daemon_template
:security: YES
:safety: ASIL_B
:status: invalid
:implements: logic_arc_int__feature_name__interface_name1
:consists_of: comp__component_name_internal_1, comp__component_name_internal_2, comp__component_name_internal_3
:belongs_to: feat__feature_name
The time_daemon component acts as a verification and publishing layer between the time_slave component and client applications. It receives gPTP time synchronization data from shared memory, validates it through multiple verification stages, and publishes qualified time data via IPC.

.. attention::
The above directives must be updated according to your Component.
The component operates as a continuous loop with the following stages:

- Adjust ``status`` to be ``valid``
- Adjust ``safety`` and ``tags`` according to your needs
1. **Data Reception**: Reads gPTP time synchronization data from shared memory written by time_slave
2. **Verification Pipeline**: Validates data through three checks:

Abstract
========
* Synchronization status validation
* Timeout detection (no new time sync data within configured span of time)
* Time jump detection (received master timestamp deviates from its expected value by more than the configured threshold)

[A short (~200 word) description of the component.]
3. **Publishing**: Publishes verified time data with quality indicators to clients via VehicleTime IPC interface at a fixed interval

Key Behaviors
-------------

Specification
=============
**Startup Stabilization**: Synchronization state changes are not reported during a configurable span of time after initial synchronization to avoid spurious time jump detection.

Comment thread
ryan-steel marked this conversation as resolved.
[Describe the requirements, architecture of any component.] or
**Error Recovery**: Time jump and timeout conditions are non-fatal. The component continues publishing with appropriate status flags set. Time jump condition clears after configurable number of consecutive valid frames.

**Multi-Client Support**: Multiple client applications can concurrently read published time data.

How to Teach This
=================
**Platform Support**: Linux and QNX 8.0 SDP platforms supported for shared memory and IPC operations.

[How to teach users, new and experienced, how to apply the CR to their work.]
Assumptions of Use
------------------

.. note::
For a CR that adds new functionality or changes behaviour, it is helpful to include a section on how to teach users, new and experienced, how to apply the CR to their work.
The gPTP shared memory must be available and initialized before synchronized time data published by time_daemon is relied upon. Otherwise shared memory access failures or stale data may occur.

Footnotes
=========

[A collection of footnotes cited in the CR, and a place to list non-inline hyperlink targets.]


Further Documentation of the component can be found in the following sections:

Component Detail Information
Expand Down
7 changes: 2 additions & 5 deletions score/time_daemon/docs/requirements/chklst_req_inspection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
.. document:: Time Daemon Requirements Inspection Checklist
:id: doc__time_daemon_req_inspection
:status: draft
:version: 2
:version: 1
:safety: ASIL_B
:security: YES
:security: NO
:realizes: wp__requirements_inspect
:tags: time_daemon

Expand Down Expand Up @@ -189,6 +189,3 @@ And also the following AoUs in "valid" state and with "inspected" tag set (for t
:columns: id;status;tags
:colwidths: 25,25,25
:sort: title

.. attention::
The above tables filtering must be updated according to your Component.
272 changes: 267 additions & 5 deletions score/time_daemon/docs/requirements/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,275 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

Requirements
############
Time Daemon Component Requirements
##################################

.. note::
Work in progress: page structure only, content to follow in later PRs.
.. document:: Time Daemon Requirements
:id: doc__time_daemon_requirements
:status: valid
:version: 1
:safety: ASIL_B
:security: NO
:realizes: wp__requirements_comp[version==1]
:tags: requirements, time_daemon

Functional Requirements
-----------------------

Initialization and Lifecycle
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. comp_req:: Component Initialization
:id: comp_req__time_daemon__startup
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

On startup the time_daemon component shall determine its configuration, initialize the configured time synchronization data receiver, time data verification pipeline (synchronization validation, timeout detection, time jump detection), and IPC publisher. If initialization of any of those units fails, the time_daemon shall retry to initialize the respective unit. Overall initialization shall fail if not completed within 20 seconds and shall end the time_slave process.

.. comp_req:: Component Shutdown
:id: comp_req__time_daemon__shutdown
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_ctrl_flow[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall stop the publishing loop and close plus release any IPC resources (e.g. shared memory mappings) when a stop signal is received.

Data Reception and Validation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. comp_req:: Time Synchronization Data Reception
:id: comp_req__time_daemon__gptp_shm_reception
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall receive time synchronization data from time_slave component using the ts_client component for IPC abstraction.

Verification Pipeline
^^^^^^^^^^^^^^^^^^^^^

.. comp_req:: Synchronization Status Validation
:id: comp_req__time_daemon__sync_validation
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall validate synchronization status based on received time synchronization data.

.. comp_req:: Synchronization State Stabilization
:id: comp_req__time_daemon__sync_debounce
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall not report time jumps during the configured time span (default: 5 seconds) after initial synchronization to avoid spuriously detected time jumps during startup.

.. comp_req:: Time Jump Detection
:id: comp_req__time_daemon__time_jump_detection
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall detect time jumps when the master clock timestamp of a gPTP time sync data update differs from the expected value by more than the configured time span (default: 500 microseconds). Both forward and backward time jumps shall be detected.

.. comp_req:: Timeout Detection
:id: comp_req__time_daemon__timeout_detection
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall detect timeout condition when no new time synchronization data is received within the configured time span (default: 3.3 seconds).

Data Publishing
^^^^^^^^^^^^^^^

.. comp_req:: Time Data Publishing
:id: comp_req__time_daemon__time_data_publishing
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_time_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall publish the verified time synchronization data to the time component linked as a library into client applications.

.. comp_req:: Published Time Data Content
:id: comp_req__time_daemon__published_data_content
:reqtype: Interface
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1],
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall include in published time data: the timestamp of the master clock, the corresponding timestamp of the local reference clock, the rate deviation between those two clocks, synchronization status, time jump status, and timeout status.

Also it shall include condensed raw data of the last received Sync/FollowUp pair and the last finished Pdelay measurement.

.. comp_req:: Time Point Qualifier Production
:id: comp_req__time_daemon__time_point_qualifier
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_time_pt_qual[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall determine the time point qualifier (quality indicator) of the published time data from the outcome of the synchronization, time jump and timeout verification checks.

.. comp_req:: Publish Interval
:id: comp_req__time_daemon__publish_interval
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_ctrl_flow[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall publish time data to client applications at a fixed configurable interval (default: 250 milliseconds).

.. comp_req:: Non-Blocking Access Path
:id: comp_req__time_daemon__non_blocking
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_ctrl_flow[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall use a non-blocking, lock-free shared memory access path for receiving time synchronization data and providing published time data to client applications.

.. comp_req:: Multi-Client Support
:id: comp_req__time_daemon__multi_client
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_ctrl_flow[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall support concurrent non-blocking read access from multiple client applications to the published time data.

Error Handling and Recovery
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. comp_req:: Error Reporting
:id: comp_req__time_daemon__error_reporting
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync_log[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall log messages via the score::mw::log interface when initialization fails (error level), shared memory access fails (error level), verification stage failures occur (warning level), or time synchronization data reception fails (error level).

.. comp_req:: Time Jump Error Reaction
:id: comp_req__time_daemon__time_jump_reaction
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall continue publishing time data with time jump status set when time jump is detected.

.. comp_req:: Time Jump Recovery
:id: comp_req__time_daemon__time_jump_recovery
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_acc_qual_api[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall clear time jump condition after receiving 2 consecutive valid gPTP frames without time jump.

.. comp_req:: Timeout Error Reaction
:id: comp_req__time_daemon__timeout_reaction
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall continue publishing time data with timeout status set when the timeout detection period elapses without receiving new gPTP data.

Platform Abstraction
^^^^^^^^^^^^^^^^^^^^

.. comp_req:: Platform Support
:id: comp_req__time_daemon__platform_support
:reqtype: Functional
:security: NO
:safety: ASIL_B
:derived_from: feat_req__time__vehicle_time_sync[version==1]
:status: valid
:version: 1
:satisfied_by: comp__time_daemon

The time_daemon component shall support POSIX and QNX 8.0 SDPplatforms for shared memory access and IPC communication.

Assumption of Use Requirements
-------------------------------

.. aou_req:: gPTP Shared Memory Availability
:id: aou_req__time_daemon__gptp_shm_available
:reqtype: Process
:security: NO
:safety: ASIL_B
:status: valid
:version: 1

The user shall ensure gPTP shared memory is initialized and the time_slave component is running before starting time_daemon. Starting time_daemon without an initialized shared memory region will cause shared memory access failures or reading of stale/uninitialized time data during startup.
Comment thread
ryan-steel marked this conversation as resolved.


.. needextend:: "c.this_doc()"
:+tags: time_daemon

.. toctree::
:maxdepth: 1

requirements
chklst_req_inspection
Loading
Loading