7 Sulautettujen järjestelmien suunnittelumallit OhAr 6.10. 2009 Marko Leppänen
Sulautettujen järjestelmien mallikieli Sulake-projekti, 2008-2009 Arkkitehtuurianalyysejä 4 teollisuuskumppanin kanssa Sivutuotteena n. 40 suunnittelumallin kieli
OS Abstraction Heartbeat Watchdog Redundant Functionality Parallel Execution Hardware Abstraction Layer Feature Negotiation Changing OK Distributed Safety Safe State System start-up monitor Locker Key Isolate Functionalities Vector Clock and Events Configuration Abstraction Updating Configuration Parameter Versions Single Point of Updating Control Algorithm Abstraction Protocol Version Handshake Update Transaction Variable Manager Message Queue with Prioritization Message Queue Bus Abstraction Permit Authority Snapshot 1 Message of 1 Type on 1 Bus Routing Service for Message Channels Broadcast Filter Separate Real Time Access Control Dictator Watchdog Early Warning Transaction Operator Profile Fixed Memory Allocation Fixed Process Allocation Point of No Return Sandbox Static Scheduling with External Clock Static Scheduling Next Stable State Limp Home Operation Switcher
Suunnittelumallit Jokainen malli löydetty useampaan otteeseen, vähintään kaksi instanssia Malleja eri tasoilla Suuria suunnitteluratkaisuja koko järjestelmään Yksittäisen ohjaimen toimintaan vaikuttavia Ooh-bivious, itsestään selviä
Esimerkkimalleja Isolate Functionalities Heartbeat Watchdog Message Queue Separate Real Time Permit Authority Variable Manager
Suunnittelumallin kuvaus Coplien Form Konteksti (Context) Pulma (Problem) Voimat (Forces) Laatuattribuutteja (Muokattavuus, tehokkuus, saatavuus) Ratkaisu (Solution) Järkeistys (Rationale) Sukulaismallit (Related patterns) Tuloskonteksti (Resulting context)
Isolate Functionalities How to efficiently control a large machine without extensive wiring and monolithic software? Forces Scalability: The system may incorporate many devices and a lot of communication may emerge between them. Throughput: The system needs to provide reasonable throughput and response time. Modifiability: The system configuration of devices changes, even during the run-time of the system. Portability: During the life cycle of the product, the physical connections may change. Cost efficiency: Wiring is expensive. Fault tolerance: Extensive, thick cabling may break. Understandability: A large and complex entity is hard to understand.
Ratkaisu Node 1 Node 2 Node 3 Node 4 Node 5 Node 6
Perusteluja Helpompi ymmärtää Laajennettavuus lisäämällä uusia yksiköitä Riippuvuus ainoastaan viestien välityksellä Viestien määrä voi olla liikaa väylälle
Heartbeat How to notice that the nodes or the bus will not silently fail? Forces Fault Tolerance: A node may crash and other nodes should notice the situation as fast as possible to prevent the fault propagating. Fault Tolerance: The communication channel may break and the end nodes should notice the situation as fast as possible. Availability: If some node or channel crashes, it should be noticed quickly to minimize downtime.
Ratkaisu Supervisor Node Alive? OK Alive? OK
Perusteluja Nopea kaatumisen havainnointi lisää vikasietoisuutta. Voi olla vaikeaa tietää onko vika yksikössä vai väylässä. Lisää viestiliikennettä.
Watchdog How to make sure that a system crash is noticed and remedying actions are started as soon as possible? Forces Fault Tolerance: A node may crash and it should be restarted as fast as possible. Fault Tolerance: There are some actions which may lead to a deadlock situation. Availability: All remedying actions should done as fast as possible to minimize the downtime.
Ratkaisu Node A Watchdog Node B
Perusteluja Lisää vikasietoisuutta Voi olla vaikeaa säätää odotusaika oikein. Vahtikoiran on oltava muusta järjestelmästä riippumaton.
Message Queue How do you give time to both ends of a message channel to process all messages in an asynchronous messaging scheme? Forces Fault tolerance: All messages should be processed, because important data should not be lost. Predictability: The amount of messages sent or received is not known beforehand. Predictability: The messages should be processed in order they are received. Resource utilization: All messages should be processed as fast as possible.
Ratkaisu Node 1 Node 2 Send queue Receive queue
Perusteluja Molemmilla kanavan päillä on aikaa käsitellä viestit kiireettä. Väylän käyttöastetta voidaan kasvattaa. Viestijärjestys säilyy. Voi lisätä latenssia. Puskurin kokoa voi olla vaikea päättää.
Separate Real Time How to offer high end services without jeopardizing the safety of real time functionality? Forces Safety: Real time functionality must not be interfered by other functionality of the system as it might cause the real time part to function improperly, i.e. deadlines are not met. Testability: It should be possible to test real time and non-real-time parts separately. Understandability: It is easier to develop software when the developer does not need to think about the real time requirements. Response time: Real time part must meet its deadlines as it is used to control the machine.
Ratkaisu
Perusteluja Helpompi hallittavuus. Reaaliaikavaatimusten testaaminen helpottuu. Korkean tason kieliä ja kirjastoja voidaan hyödyntää helpommin.
Permit Authority How to ensure that an independent action of a node does not conflict with the system wide state or cause dangerous situations? Forces Distribution: System is distributed. Throughput: A node may require information from multiple nodes to make a decision. This may cause a lot of bus traffic. Safety: Machine controlling should have short response time to ensure safe usage.
Ratkaisu
Perusteluja On helpompaa säilöä tieto koko järjestelmästä yhdelle yksikölle. Yksittäisten yksiköiden ei tarvitse välittää koko järjestelmän tilasta. Tilatiedoissa voi olla latenssia. Lisää viestien määrää väylällä.
Variable Manager How can you efficiently share system state in the distributed embedded system? Forces Accuracy: Data is volatile. Efficiency: Message traffic should be minimized. Scalability: System must be scalable in terms of its units. Extendability: It should be easy to add new units accessing the state. Adaptability: It should be easy to change the way state is implemented. Adaptability: It should be easy to change the location of origin of the state information. Usability: It should be easy to find the desired state value.
Ratkaisu Node 1 Node 2 Node 3 Variable Manager
Perusteluja Riippuen tilatietojen päivitysnopeudesta, jokaisella yksiköllä on riittävän hyvä kokonaiskuva. Tiedonvälitys on paikkariippumatonta. Tilamuuttujia voi olla niin paljon, että niiden käsittely on hankalaa.
Siinä kaikki Kysymyksiä?