EXAMINATION Luleå University of Technology Course: Course name: data handling Date: Time: R7018R Spacecraft on board 2022-10-24 9.00-13.00 Aid: Räknedosa (calculator) Appendix A and B (included in exam sheet) Böcker (books): Kelley/Pohl ”A Book on C” Skansholm ”Vägen till C”, H.Schildt ”C- the complete reference” I.Horton ”Beginning C”, Kernighan&Ritchie ” C-programming language” Gratte “Grunderna I C”, Kochan ”Programming in C”, Bjarne Stroustrup “The c++ programming language” , King “C-programming – A modern Approach” Teacher on duty (complete telephone number): Anita Enmark 070-6518365 Grade scale: Students from HT 2022: >41 p pass (including bonus from assignments, max 17p+3p extra bonus) Total number of questions and score: 5 questions/63p on exam Teacher on duty (complete telephone number): Students from 2022 and earlier >32 p for passing (no bonus is included ) General instructions Check that you have received all the tasks/questions. All new answers begin on a separate page. Print, write clearly. After examination The result of your examination will be posted on “My pages” on the Student web. Examination results are posted within 15 workdays after the examination. For the courses with more than 60 students taking the examination the results are posted within 20 workdays after the examination. QUESTION 1 (2x4p=8p) (RTOS and scheduling) Choose no more than 4 of the following concepts and explain what they mean in one or two sentences (if you explain more than 4 concepts, only the first 4 will be marked and the rest ignored) a. b. c. d. e. f. g. h. Blocking time Determinism Hard real time systems Preemtive scheduling Interference time Deadlne monotonic scheduling Priority inversion Sporadic task QUESTION 2 (5p+3p=8p) A task set has computational time and period (C,T): Task I (40,90) Task II (40,160) Task III (90,300) 2a) Is the set scheduable using rate monotonic scheduling? 2b) Check your calculation using a timeline figure QUESTION 3( 8p) (Task model) Below is a simple task model used for scheduling analysis. Discuss the model relevance for use in a safety-critical systems. The application is assumed to consist of a fixed set of tasks All tasks are periodic, with known periods The tasks are completely independent of each other All system's overheads, context-switching times and so on are ignored (i.e, assumed to have zero cost) All tasks have a deadline equal to their period (that is, each task must complete before it is next released) All tasks have a fixed worst-case execution time QUESTION 4( 10p+10p+5p+3p=28p) ( SW requirements, design and implementation) 4a) In assignments you have used protected objects for shared variables. Arduino IDE functions for reading and writing to pins on the same Atmega328p port are not providing mutual exclusion, The complete port is actually accessed by the Arduino functions that look like just accessing one pin. Wrappers, providing mutual exclusion for acessing pins in same port, should therfore be used, when multiple tasks access same HW. Hardware (I/O devices) are usually memory mapped so a similar pattern shall be used as for sharing variables in a safe way, i.e. using protected objects. The difference is that you cannot encapsulate the accsess to hardware by declaring a static variable. Instead you, as a programmer, must strictly follow the design rule that only one object shall have direct access to certain hardware, and that the access shall be encapsulated within a protected object if many task needs the HW, reading and writing, not to a static shared variable, but reading and writing to the hardware. In the Arduino environment this means that the following functions for acessing GPIO ports must be used inside a protected object when ports are shared: pinMode(pin, mode) pin: the Arduino pin number to set the mode of. mode: INPUT, OUTPUT, or INPUT_PULLUP digitalWrite(pin, value) pin: the Arduino pin number. value: HIGH or LOW digitalRead(pin) pin: the Arduino pin number you want to read returns: HIGH or LOW To use these functions <Arduino.h> must be included. You can assume that all types needed are provided by <globals.h> You are going to implement such a <<protected>> object in C, using FreeRTOS calls. The component is shown in Figure 1. You shall write both .h and .cpp file. You do not need to write file header or subroutine headers, just the code. You find prototypes for FreeRTOS services in Appendix (if you do not know exactly how to make the FreeRTOS calls (parameters etc) explain what you want to do. Figure 1. Portb_PO object 4b) Figure 2 is taken from a Software Requirements Document (SRD)and describes the modes and mode transitions of a system (note, not UML state chart). Figure 2. Modes state chart The SRD document has an essential object MODES. Write parts of the document including requirements for the modes READY and HIGH (Note, only for these modes). You may need some parts of the SRD. Among other requirements the SRD includes the following requirements (and many more): _____________________________________________________________________________________________ R-INIT-003/1 The Relay HW shall be OFF at system start as defined in R-INTERFACES-002 R-INIT-004/1 The LED indicator shall be OFF at system start. R-INIT-023/1 At system start system initialization sequence shall be performed as in [A4] R-COMMAND-010/1 When Relay HW is not activated (R-INTERFACES-002) all commands except ActivateRelay command(R-COMMAND-011) shall be ignored R-COMMAND-011/1 ActivateRelay command - 0x00 When Relay HW is not activated (R-INTERFACES-002) the command shall: Activate Relay HW as given in R-INTERFACES-003 (Note: All other commands should not be sent by operator when relay is not activated) R-COMMAND-012/2 SetRelayFrequency HIGH command - 0x02 SetRelayFrequency HIGH command shall: Set Relay frequency to parameter HIGH_FREQ as defined in R-RELAY-003 R-COMMAND-013/2 SetRelayFrequency LOW command - 0x01 SetRelayFrequency LOW command shall: Set Relay frequency to LOW_FREQ as defined in R-RELAY-003 R-RELAY-001/1 When Relay HW is activated ( R-INTERFACES-003) LED indicator shall be ON R-RELAY- 003/1 The ASW shall be able to set the relay frequency to parameter HIGH_FREQ or LOW_FREQ as defined in [A1] 4c) Could you, from the parts of the document given, come to some conclusion regarding some other essential objects than MODES in the logical model? Motivate your answer 4d) What are Non functional, functional and performance requirements respectively. Give examples QUESTION 5 (11-12p) (OBDH) Choose questions giving 11 or 12 points . Note: If you choose questions giving more marks they will be marked in alphabetic order and the last questions will be skipped. Make a note on the chosen question and the number of points and the total sum in your exam solution sheet for this question. a) (4p) Discuss the impact of the mission for the size of the mass memory. Give examples. ( you must explain how the design is related to the mission to get full marks) b) (4p) Discuss the impact of the mission for the choice of redundancy concept. Give examples. (do not only give different redundancy concepts, you must also explain how the choice is related to the mission to get full marks) c) (4p) One of the responibilities of the data handling system is handling time in different aspects. What may this include? d) (3p) How can you find fault intensity levels for space parts? e) (4p) What is the OSI model for communication? f) (4p) You are going to choose a data bus for your satellite, give selection criteria? g) (4p) Compare star (centralized), networked and bussed architechture. Similarities, differences, pros and cons. What systems are they suitable for etc. h) (3p) What are on board control procedures (compare with ordinary flight software)? i) (4p) What is Time and Space Partitioning (as compard to using a classical RTOS) APPENDIX A Utilization-Based Analysis N Ci U N (21/ N 1) i 1 Ti Iteration formula n w win 1 Ci Bi i C j jhp ( i ) T j APPENDIX B Relevant header files and FreeRTOS calls may be: FreeRTOS.h FreeRTOSConfig.h semphr.h: xSemaphoreHandle xSemaphoreCreateBinary( void ) xSemaphoreGive( xSemaphoreHandle xSemaphore ) xSemaphoreTake( xSemaphoreHandle xSemaphore, portTickType xBlockTime ); task.h: portBASE_TYPE xTaskCreate( pdTASK_CODE pvTaskCode, const portCHAR * const pcName, unsigned portSHORT usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pvCreatedTask ) void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ); void vTaskStartScheduler( void )