Commit e4f4ecae authored by Peter Waher's avatar Peter Waher

Adding clock synchronization

parent d5ce7d50
Clock Synchronization
========================
This document outlines the XML representation of clock synchronization, as defined by the IEEE XMPP IoT Working Group. The XML representation is modelled using
an annotated XML Schema:
| Sensor Data ||
| ------------|----------------------------------------------------|
| Namespace: | urn:ieee:iot:synchronization:1.0 |
| Schema: | [Synchronization.xsd](Schemas/Synchronization.xsd) |
Motivation and design goal
----------------------------
The method of clock synchronization described hee, is designed with the following goals in mind:
* Entities are connected *ad hoc* in a global federated network.
* It should be possible for each entity in the network to estimate the difference of its internal clock with respect to the internal clock of any other entity
to a relative high degree of accuracy.
* The method should allow for varying latency in the network.
* The method should allow for varying latency between different nodes in the network.
Process
------------------------
The Synchronization namespace only defines one simple element: `clock`, which is an element of the simple type `xs:dateTime`. The client sends its time
(in UTC) to the clock source, who immediately responds with a `clock` element of its own, with its time (in UTC). When the client receives the response,
it notes its own time again (in UTC).
![Clock Synchronization](Diagrams/Synchronization.png)
This source diff could not be displayed because it is too large. You can view the blob instead.
@startuml
Activate Client
group Average results using time window
Client -> Client : <math>ct_1=ClientTime_{UTC}</math>
Client -> Source : clock(ct1)
Activate Source
Source -> Source : <math>st=SourceTime_{UTC}</math>
Client <-- Source : clock(st)
Deactivate Source
Client -> Client : <math>ct_2=ClientTime_{UTC}</math>
note right
<math>Δt_1=st-ct_1≈l+Δt</math>
<math>Δt_2=ct_2-st≈l-Δt</math>
<math>Δt_1+Δt_2=2*l</math>
<math>Δt_1-Δt_2=2*Δt</math>
end note
end
Deactivate Client
@enduml
\ No newline at end of file
......@@ -23,6 +23,7 @@ Communication Patterns
* [Sensor Data Event Subscription communication pattern](SensorDataEventSubscription.md)
* [Simple Control Actions](ControlSimpleActions.md)
* [Data Form Control Actions](ControlDataForm.md)
* [Clock Synchronization](ClockSynchronization.md)
Schemas
-------------
......@@ -33,6 +34,7 @@ Schemas
* [ProvisioningTokens.xsd](Schemas/ProvisioningTokens.xsd)
* [ProvisioningDevice.xsd](Schemas/ProvisioningDevice.xsd)
* [ProvisioningOwner.xsd](Schemas/ProvisioningOwner.xsd)
* [Syncrhonization.xsd](Schemas/Syncrhonization.xsd)
Implementations
......
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:ieee:iot:synchronization:1.0'
xmlns='urn:ieee:iot:synchronization:1.0'
elementFormDefault='qualified'>
<!--
Copyright 2017-2018 The Institute of Electrical and Electronics Engineers,
Incorporated (IEEE).
This work is licensed to The Institute of Electrical and Electronics
Engineers, Incorporated (IEEE) under one or more contributor license
agreements.
See the LICENSE.md file distributed with this work for additional
information regarding copyright ownership. Use of this file is
governed by a BSD-style license, the terms of which are as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright
notice, this list of conditions, the following disclaimer, and the
NOTICE file.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, the following disclaimer in the
documentation and/or other materials provided with the
distribution, and the NOTICE file.
Neither the name of The Institute of Electrical and Electronics
Engineers, Incorporated (IEEE) nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SPDX-License-Identifier: BSD-3-Clause
Disclaimer: This open source repository contains material that may be
included-in or referenced by an unapproved draft of a proposed IEEE
Standard. All material in this repository is subject to change. The
material in this repository is presented "as is" and with all faults.
Use of the material is at the sole risk of the user. IEEE specifically
disclaims all warranties and representations with respect to all
material contained in this repository and shall not be liable, under
any theory, for any use of the material. Unapproved drafts of proposed
IEEE standards must not be utilized for any conformance/compliance
purposes.
-->
<xs:import namespace='urn:ieee:iot:synchronization:1.0'/>
<xs:element name='clock' type='xs:dateTime'>
<xs:annotation>
<xs:documentation>Element used to synchronize clocks.</xs:documentation>
<xs:documentation>Used in both iq get and result stanzas.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment