Presentation is loading. Please wait.

Presentation is loading. Please wait.

Frame-Based System Design. Fames vs. Rules General design methodology Define the problem Analyze the domain Define the classes Define the instances Define.

Similar presentations


Presentation on theme: "Frame-Based System Design. Fames vs. Rules General design methodology Define the problem Analyze the domain Define the classes Define the instances Define."— Presentation transcript:

1 Frame-Based System Design

2 Fames vs. Rules General design methodology Define the problem Analyze the domain Define the classes Define the instances Define the rules Object communications Interface Evaluate and expand the system

3 Rule 1 IF Boiler temprature>300 AND Boiler water level>5 THEN Boiler condition normal Rule 2 IF Boiler pressure<50 AND Boiler water level>3 THEN add water to boiler Rule-based system: Unrelated facts scattered throughout the knowledge base

4 Frame – Boiler Temprature Pressure Water level Condition Frame-based system: Collects the related facts Represents them as slots within a single frame structure

5 Better way to manage the knowledge base Eases system coding and maintenance when working with similar types of objects (through inheritance) Pattern matching  include rules : IF.Temprature > 300 AND.Water_level > 5 THEN.Condition = normal Another benefit: object communications through message-passing

6 General Design Methodology Define the problem Analyze the domain Define the classes Define the instances Define the rules Define object communications Design the interface Evaluate the system Expand the system

7 Task 1 :Define the problem A system for controling the house temperature Usually one thermostat - inefficient - large temperature variations between rooms Solution: - We have 3 rooms: living room, kitchen, bedroom - It can be extended - Each room has a cooling and heating unit, and a thermostat - Rooms can be occupied or unoccupied

8 Infrared Senor Mode Heat Air FurnaceAir conditioner Setting Temperature

9 Task 2 : Analyze the domain define objects, Features,Events,Architecture Room, Furnace, Air conditioner, Thermostat, Room temperature, Sensor Objects

10 Object features ROOM Features Thermostat Furnace AC Sensor occupancy THERMOSTAT Room Furnace AC Sensor Mode Setting temperature FURNACE Room State Thermostat Sensor Occupancy Room Thermostat

11 Events Thermostat mode of operation for each room is either heat or cool When a given room is occupied, temperature should be adjusted toward the thermostat setting When a given room is unoccupied, and operation mode is heat, then room temperature should be adjusted toward the thermostat setting minus 5 degree When a given room is unoccupied, and operation mode is cool, then room temperature should be adjusted toward the thermostat setting plus 5 degree

12 Generalization : “Kind of” relationship Aggregation : “Part of” relationship Association : “Semantic” relationship Architecture

13 Thermostat Thermostat 1Thermostat 2Thermostat 3 Room LivingroomKitchenBedroom

14 Task3 : Define the classes Define the problem Analyze the domain Define the classes Define the instances Define the rules Define object communications Design the interface Evaluate the system Expand the system MakeClass(THERMOSTAT,Root) Also possible via graphical menu Kappa: Kappa’s advantage: window-based development feature, includes message passing

15 Room Furnace UnoccupiedOccupancy Thermostat AC Class name: Properties: Methods:

16 Thermostat Furnace HeatMode Setting68 65Temperature Class name: Properties: Methods: AC Room

17 AC Room Stateoff Class name: Properties: Methods: Thermostat

18 Task4 : Define the Instances MakeInstance(THERMOSTAT1,THERMOSTAT) Room instances: we have 3 rooms and we need to create instances. Then we assign the appropriate values in each instance (Furnace name, etc)

19 Room LivingroomKitchenBedroom FurnaceFurnace1 occupancyunoccupied thermostatthermostat1 ACAC1 FurnaceFurnace2 occupancyunoccupied thermostatthermostat2 ACAC2 FurnaceFurnace3 occupancyunoccupied thermostatthermostat3 ACAC3

20 Example: When a room is unoccupied,the mode of operation is heat, and the thermostat setting is 5 degree greater than the room temperature,then turn on the room furnace. Task5 : Define the Rules ForAll x|THERMOSTAT IF x:Room:Occupancy #= Unoccupied AND x:Mode #= Heat AND x:Setting – x:Temperature >5 THEN x:furnace:State = ON

21 Object communications vs. Rules We should decide when to use rules and when to use interobject communication techniques Usually it is personal preference of the designer

22 Advantages of rules - takes a set of evidence and inferes new informaion - deep inferencing: general information - using variables, all instances are scanned Disadvantages of rules - an inefficient means for capturing knowledge that is largely procedural - limited in the type of functions they can perform - quickly become unreadable and difficult to maintain - difficult to write a set of rules that account for the propagation of changes in information

23 Advantages of object communications - it is natural to define interactions and behaviour of an object in addition to its properties - Encapsulation of methods within a frame instead of being spread around the rules - easy to maintain and debug - applications such as simulation or control rely on objects interactions Disadvantages of object communications - might be difficult to debug when actions ripple through a large number of objects! - overuse of methods - methods are not appropriate for representing heuristics

24 Demons:  IF-NEEDED  IF-CHANGED Task6 : Define object communcations We want to write a method that enables the frame THERMOSTAT1 to respond to a question about its location we can write this method and attach it to the IF-NEEDED facet of the property “Room” of the frame: THERMOSTAT1:Room

25 This method is simple but not efficient because it can be used only by THERMOSTAT1 We need a variable that can be bound to each thermostat: Self:Room

26 An IF-CHANGED facet method is executed whenever some property value is changed While ((Self:State #=ON)) Self:Thermostat:Temperature= Self:Thermostat:Temperature +1

27 IF-NEEDED and IF-CHANGED provide means for objects to exchange and change information Some shells like Kappa also provide message passing SendMessage(objName,methodName, ) SendMessage(Self:Fornace,On) SetValue(Self:State,On)

28 Thermostat Modeheat Air Class name: Properties: Methods: Setting68 Unit-Control IF-CHANGED Temperature65 Unit-Control Self:Mode=Air; HeatSelf:Mode=Heat; Init forAll (x|Thermostat) |ResetValue(x:setting); RestValue(x:mode); ResetValue(x:Temperature);

29 Thermostat Class name: Methods: Unit-Control { If ((Self:Temprature

30 Furnace Class name: Methods: Room OFF ON Init Heat State Thermostat OFFHeat IF-CHANGED NameBody SetValue (Self:State,OFF) SetValue (Self:State,ON) resetvalue… While((Self:State #=ON)) Self:Thermostat:Temperature == … +1

31 Most shells offer a toolkit of graphical objects - Observable displays - Control displays Task7 : Design the interface

32 Test case: 1. Increase living room Thermostat setting in 1 degree increments 2. Continue this process until setting is at 75 degrees Room temperature = 65 Furnace and AC are off Mode is heat Thermo setting = 68 Room is Unoccupied Task8 : Evaluate the system

33 Trace of operation 1.User increases thermostat handler in interface 2.With each increment, “setting” slot of thermostat1 increments. Each increment causes the IF-CHANGED method “unit control” to fire. 3.When setting reaches temperature + 5, “unit control” sends an On msg to Furnace1 4.Change of furnace state, causes “Heat” to fire 5.…

34 Task9 : Expand the system Deepening knowledge By adding new objects related to existed ones use of generalization and part of and…. Broadening knowledge Addition of new events or objects

35


Download ppt "Frame-Based System Design. Fames vs. Rules General design methodology Define the problem Analyze the domain Define the classes Define the instances Define."

Similar presentations


Ads by Google