380 likes | 514 Views
SOIS EDS & Toolchain ESA YGT Study. F. Torelli & P. Skrzypek CCSDS Fall Meeting 2013 28/10/2013. Outline. EDS study overview Interface description Process description Software framework and t oolchain Recap and open points. Credit for the onion diagram: S. Fowell.
E N D
SOIS EDS & ToolchainESA YGT Study F. Torelli & P. SkrzypekCCSDS Fall Meeting 201328/10/2013
Outline • EDS study overview • Interface description • Process description • Software framework and toolchain • Recap and open points Credit for the onion diagram: S. Fowell
EDS study timeline TASTE TRAINING SOIS WG MEETING SOIS WG MEETING MID-TERM PRESENTATION FINAL PRESENTATION Aug Apr Nov Dec Feb Sep Oct Jan Mar May Aug Jul IMPLEMENT EDS TO SDL TRANSLATOR RESEARCHING DRIVER GENERATION IMPLEMENTING DVS SERVICE IN ADA TRYING TO LINK EVERYTHING TOGETHER LEARNING ASN.1 AND SDL EXTENSIVE TESTING OF ASN1SCC TOOL IMPLEMENTING EDS TO ASN.1 TRANSLATOR ANALYSIS OF NPAL ICD UPDATE SCHEMA AND MAPPING MAPPING BETWEEN EDS AND SDL DEFINING EDS REQUIREMENTS SEARCHING FOR SUITABLE CODE GENERATORS IMPLEMENTING NPAL EDS EXTENDING EDS TO ASN.1 TRANSLATOR INTRODUCTION TO ATB FIRST EDS SCHEMA MAPPING BETWEEN EDS AND ASN.1 STUDY VARIOUS DESCRIPTION FORMATS PREPARATION FOR SOIS WG MEETING INTRODUCTION TO SOIS
Overview & key features SOIS EDS SOIS Services EDS • Interface data types based on ASN.1 • Protocol description based on SDL • Transactions connecting service primitives between layers • Different service models Software framework & toolchain • Threads and queues • Code generation based on intermediate formats to leverage existing open source tools DVS Service Interface DVS Interface DACP Description DACP Implementation DAS Service Interface DAS Interface DAP Description DAP Implementation SubNet Service Interface SubNet Interface
Data types Integer number • value constraints • binary encoding rules Enumeration field • value constraints • binary encoding rules Floating point number • value constraints • binary encoding rules Bit string • value constraints • binary encoding rules • dynamic length Array • dynamic length Sequence • up to one component of dynamic length • can put additional constraints on member types • binary encoding rules
Integer Value constraints: • Interval with open or closed boundaries • Constant value • Multiple constraints result in an union Binary encoding rules: • Required if the type is used as a packet or memory field • Supported representations: positive and two’s-complement • Size expressed in bits • Little-endian encoding available only for sizes: 16b, 32b, 64b, etc. <intname="MyInt"> <constraints> <intervallbound="closed"lvalue="-10" rbound="open"rvalue="10"/> <constvalue="15"/> </constraints> <encodingrepresentation="positive" size="16"endianness="big"/> </int>
Enumeration Value constraints: • Finite set of options • It is possible to assign integer number to the option if necessary Binary encoding rules: • Required if the type is used as a packet or memory field • Assumed positive encoding • Size expressed in bits • Little-endian encoding available only for sizes: 16b, 32b, 64b, etc. <enumname="MyEnum"> <constraints> <optionname="run"> <constvalue="0"/> </option> <optionname="stop"> <constvalue="1"/> </option> </constraints> <encodingsize="2"endianness="big"/> </enum>
Floating point number Value constraints: • Interval with open or closed boundaries • Multiple constraints result in an union Binary encoding rules: • Required if the type is used as a packet or memory field • Assumed IEEE754-1985 encoding • Size expressed in bits, but only 32 or 64 bits allowed • Support for endianness <floatname="MyFloat"> <constraints> <intervallbound="closed"lvalue="0" rbound="open"rvalue="3.14"/> </constraints> <encodingsize="32"endianness="big"/> </float>
Bit string Value constraints: • Not required • Useful to describe a constant bit pattern within a packet Binary encoding rules: • Support for endianness • For little-endian encoding, word_size attribute is required Dynamic length: • For variable length, min and max attributes should be provided • For static length, only size attribute is required <bit_stringname="MyBitString"> <constraints> <constbin="1010"/> </constraints> <encodingdynamic="false"size="4" word_size="4"endianness="big"/> </bit_string>
Array Dynamic length: • For variable length, min and max attributes should be provided • For static length, only count attribute is required <arrayname="MyArray"> <elementtype="MyType"/> <lengthdynamic="false"count="28"/> </array>
Sequence Dynamic length: • Sequence may have maximum one member of dynamic size Constraints on member types: • Constraints given here will be intersected with type’s original constraints • Great tool for packet decoding! Binary encoding rules: • Support for endianness • For little-endian, word_size attribute is required <sequencename="MessageComplexMatch"> <members> <membername="header"type="MyHeader"> <sequence_subconstraints> <membername="sync"> <subconstraints> <consthex="BEEF"/> </subconstraints> </member> <membername="id"> <subconstraints> <constvalue="0"/> <intervallbound="closed"lvalue="2" rbound="closed"rvalue="255"/> </subconstraints> </member> <membername="alarm"> <subconstraints> <optionname="red"/> <optionname="yellow"/> </subconstraints> </member> </sequence_subconstraints> </member> <membername="altitude"type="SomeFloat"/> </members> <encodingword_size="16"endianness="big"/> </sequence>
Example of functional interface <functional_interfaceclass="thermistor"> <interface> <acquire> <value_idtype="temperature_reading_t"/> <valuetype="temperature_t"/> <metadatatype="bivalent_t"/> </acquire> <command> <value_idtype="alter_refresh_rate_t"/> <valuetype="interval_t"/> <metadatatype="bivalent_t"/> </command> </interface> <data_types> <sequencename="temperature_reading_t"> <declarename="header"type="value_id_header_t"> <constraintfield="service"> <optionname="read_temperature"/> </constraint> </declare> <declarename="unit"type="thermistor_unit_t"/> </sequence> <!-- temperature_t, bivalent_t, thermistor_unit_t --> <!-- alter_refresh_rate_t, interval_t, ... --> </data_types> </functional_interface> this section lists all possible relations relation which can be aquired relation is identified by value_id type relation which can be commanded structure of exchanged data structure of associated metadata this section defines all data types used value_id may contain many fields
Instructions Data handling • immediate values • aliases • variables: declaring, accessing • moving data • arithmetic operations Calibration • linear calibration Flow control • loops • conditional statements Using SOIS services • Device Access Service • Packet Service • Memory Access Service
Data handling • Immediate values • <constvalue="7"/> • Aliases • <aliasname="reaction_wheel_address"/> • Declaring variables • <declarename="battery_temp"type="temperature_t"/> • Accessing variables • <variablename="battery_temp"/> • Moving data • <copy> • <source> • <!-- constant or variable --> • </source> • <destination> • <!-- variable --> • </destination> • </copy> • Arithmetic operations • <addition> • <result> • <variablename="sum"/> • </result> • <addend> • <variablename="term1"/> • </addend> • <addend> • <constvalue="17"/> • </addend> • </addition>
Calibration • Linear calibration • <linear_calibration> • <slope> • <constvalue="1"/> • </slope> • <bias> • <constvalue="-100"/> • </bias> • <input> • <variablename="temperature_raw"/> • </input> • <output> • <variablename="temperature_kelvin"/> • </output> • </linear_calibration> • More calibrations could be supported
Flow control • Loops • <loop> • <interval> • <leftbound="closed"value="1"/> • <rightbound="closed"value="10"/> • </interval> • <iterator> • <variablename="i"/> • </iterator> • <process> • <!-- process code --> • </process> • </loop> • Conditional statements • <compare> • <subject> • <variablename="result"/> • </subject> • <reference> • <variablename="threshold"/> • </reference> • <lower_than> • <!-- process code A --> • </lower_than> • <greater_than> • <!-- process code B --> • </greater_than> • <equal> • <!-- process code C --> • </equal> • <not_equal> • <!-- process code D --> • </not_equal> • </compare>
Using SOIS Services 1/3 • Device Access Service • <das_acquiretransaction="save"> • <value_id> • <variablename="v_id"/> • </value_id> • <value> • <variablename="temp_data"/> • </value> • <metadata> • <variablename="meta"/> • </metadata> • <time_limit> • <constvalue="3"/> • </time_limit> • <on_success> • <!-- indication arrived beforetimeout --> • </on_success> • <on_timeout> • <!-- executed if timeout occurred --> • </on_timeout> • </das_acquire> • Memory Access Service • <read_memory> • <regionname="uart1"/> • <data> • <variablename="uart_registers"/> • </data> • <metadata> • <variablename="result"/> • </metadata> • <time_limit> • <aliasname="reasonable_time_limit"/> • </time_limit> • <on_success> • <!-- indication intercepted before time out --> • </on_success> • <on_timeout> • <!-- executed if time out occurred --> • </on_timeout> • </read_memory>
Using SOIS Services 2/3 • Packet service - sending • <packet_send> • <destination_address> • <aliasname="reaction_wheel_addr"/> • </destination_address> • <data> • <variablename="tc_set_rotation"/> • </data> • </packet_send> • Packet service - receiving • <packet_receive> • <source_address> • <aliasname="reaction_wheel_addr"/> • </source_address> • <data> • <variablename="tm_ack"/> • </data> • </packet_receive> • Packet service – receiving multiple packets • <wait_for_packets> • <scenario> • <minterm> • <!-- packet A receive --> • <!-- packet B receive --> • </minterm> • <process> • <!-- Executed only if A and B received --> • </process> • </scenario> • <scenario> • <minterm> • <!-- packet A receive --> • <!-- packet C receive --> • </minterm> • <process> • <!-- Executed only if A and C received --> • </process> • </scenario> • <timeout> • <time_limit> • <aliasname="reasonable_time_limit"/> • </time_limit> • <process> • <!-- Executed only if timeout has passed --> • </process> • </timeout> • </wait_for_packets>
Using SOIS Services 3/3 • Transaction model 1:1 • Transaction model Save • Transaction model Passthrough DAS/DVS request load DAS/DVS save save save DAS/DVS
Example of DACP implementation <compare> <subject> <variablename="das_meta"/> </subject> <reference> <constvalue="success"/> </reference> <equal> <linear_calibration> <slope><constvalue="1"/></slope> <bias><constvalue="-100"/></bias> <input><variablename="temperature_raw"/></input> <output><variablename="temperature_kelvin"/></output> </linear_calibration> <copy> <destination> <variablename="dvs_meta"/> </destination> <source> <constvalue="success"/> </source> </copy> </equal> <not_equal> <copy> <destination> <variablename="dvs_meta"/> </destination> <source> <constvalue="failure"/> </source> </copy> </not_equal> </compare>
Example of DACP attachment to service interface <device_abstraction_control_procedure> <request_handler> <variables> <declarename="id"type="temperature_reading_t"/> <declarename="data"type="temperature_t"/> <declarename="meta"type="bivalent_t"/> </variables> <value_id> <variablename="id"/> </value_id> <value> <variablename="data"/> </value> <metadata> <variablename="meta"/> </metadata> <process> <!-- instructions --> </process> </request_handler> </device_abstraction_control_procedure> Declares variables used inside process description connects id variable to value_id contents connects data variable to the value of relation connects meta data variable to meta data information description of the process
Software framework High-level Low-level System Queues for primitives Dispatcher thread THREAD Auto-generated DACP/DAP processes
Translation tools asn1Scc Open source ASN.1 compiler developed by Semantix. The compiler generates C and Ada source code with the proper data type declaration, encoding/decoding functions, initialization procedures and validation of constraints. OpenGeode Open source SDL editor developed by ESA. The program also convertsSDL process description into Ada source code. Custom translator Dedicated application developed within the EDS study to convert XML interface in ASN.1 sources.
Code generation from EDS fi.asn1 ds.asn1 EDS Conv Other devices .asn1 files Documentation ps.asn1 DataView.py EDS Conv mas.asn1 asn1Scc sys.asn1 Ada source code for encoding, decoding, etc. DVS framework DASframework Supporting library Generated code dacp.asn1 device_fi.asn1 dap.asn1 device_dacp_iv.pr device_dacp.pr Man EDS Conv device_ds.asn1 device_dap_iv.pr device_dap.pr Man Ada package with instantiation of all processes according to assembly information device_ps.asn1 EDS device_mas.asn1 OpenGeode Man Man Documentation Ada source code of the processes OpenGeode Other devices .pr files assembly information
Toolchain – step 1 Translate XML file into series of: • ASN.1 files – interface view • PR files –SDL process Translation is performed by a dedicated program developed for this purpose. Translator also performs consistency-checks hard to implement in XSD file (e.g. that maximum one member of a sequence is dynamic). device_fi.asn1 device_dacp_iv.pr device_dacp.pr device_ds.asn1 EDS device_dap_iv.pr device_dap.pr device_ps.asn1 device_mas.asn1
Toolchain – step 2 device_fi.asn1 fi.asn1 device_dacp_iv.pr device_dacp.pr Create ASN.1 files describing complete interfaces: • fi – functional interface • ds – device-specific interface • ps – packet interface • mas – memory interface Create ASN.1 files enumerating processes in the system: • dacp – device abstraction control procedures • dap – device-specific access protocols device_ds.asn1 device_dap_iv.pr device_dap.pr device_ps.asn1 EDS ds.asn1 device_mas.asn1 device_fi.asn1 device_dacp_iv.pr device_dacp.pr ps.asn1 device_ds.asn1 device_dap_iv.pr device_dap.pr EDS device_ps.asn1 device_mas.asn1 mas.asn1 device_fi.asn1 device_dacp_iv.pr device_dacp.pr device_ds.asn1 sys.asn1 device_dap_iv.pr device_dap.pr EDS device_ps.asn1 dacp.asn1 device_mas.asn1 dap.asn1 device_mas.asn1
Toolchain – step 3 Using asn1Scc program, process all ASN.1 files. On output, we get: • Documentation on data types in HTML format • Ada source code for handling those data types • DataView.py – a Python source code with all information on data types. This file is used by OpenGeode to validate the SDL code Documentation device_ds.asn1 ps.asn1 ds.asn1 device_fi.asn1 fi.asn1 device_ps.asn1 DataView.py device_mas.asn1 sys.asn1 dacp.asn1 mas.asn1 dap.asn1 device_mas.asn1 Ada source code for encoding, decoding, etc.
Toolchain – step 4 Using OpenGeode program, process allPR files. On output, we get: • Documentation (SDL code expressed by grahpical blocks according to ITU-T Z.106 standard) • Ada source code Documentation DataView.py device1_dap_iv.pr device1_dap.pr device2_dacp_iv.pr device2_dacp.pr device3_dap_iv.pr device3_dap.pr device3_dacp_iv.pr device3_dacp.pr device1_dacp_iv.pr device1_dacp.pr device2_dap_iv.pr device2_dap.pr Ada source code of a process
Toolchain – step 5 Using assembly information, another package is created. This package instantiates generic Ada processes. Each process is assigned with a process id. Each device is assigned with a value id. At the moment, this is done manually. dacp.ads Ada process code Ada process code dap.ads Ada process code Ada process code Ada package with instantiation of all processes according to assembly information assembly information EDS EDS EDS
Toolchain – step 6 Final step is to link together the generated code with the static source code of the services. DVS and DAS implementation can be considered as a framework, that handles primitive queueing and calls auto-generated processes. Ada package with instantiation of all processes according to assembly information Implementation of DVS service Implementation of DAS service Implementation of supporting procedures (e.g. calibration)
Recap Achieved in the EDS study • Data types and interface definition based on ASN.1 • Process description based on SDL • Transaction-level model for services • “Informal” EDS XMLSchema • Mapping between XML and ASN.1 • Translator from XML to ASN.1 • Mapping between XML and SDL • Code generation using custom and open source tools • DVS service implementation
Future work? Potential future work • To implement the translator from XML to SDL • To convert EDS Schema to XSD file • To implement DAS service • To automation theassembly process • To test generated code in mission context
Open points Open Points • Should EDS interface promote ASN.1? • State machines vs. transactional model • Service models as part of the EDS or of the framework?