A11102 MfiSblS

NATL INST OF STANDARDS & TECH Ft. .C.

All 10248561

2

Smith, Richard L/ASKBUDJR : a primitive QC100 .U56 NO. 86-3319 V1986 C.2 NBS-PUB- ASKBUDJR: A Primitive Expert

System for the Evaluation of the

Hazard of A Room

NBS

PUBLICATIONS

Richard L. Smith

U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

National Engineering Laboratory

Center for Fire Research

Gaithersburg, MD 20899

March 1986

U.S. DEPARTMENT OF COMMERCE

- QC

100

• U56

86-3319

1986

C. 2

REAU OF STANDARDS

NBS

K2SEASC:I INFORMATION CENTER Qc*

NBSIR 86-3319

f //

ft

ASKBUDJR: A PRIMITIVE EXPERT

SYSTEM FOR THE EVALUATION OF THE

FIRE HAZARD OF A ROOM

Richard L. Smith

U.S. DEPARTMENT OF COMMERCE

National Bureau of Standards

National Engineering Laboratory

Center for Fire Research

Gaithersburg, MD 20899

March 1986

U.S. DEPARTMENT OF COMMERCE, Malcolm Baldrige, Secretary

NATIONAL BUREAU OF STANDARDS. Ernest Ambler, Director

TABLE OF CONTENTS

Page

List of Tables iv

List of Figures v

Abstract 1

1. INTRODUCTION 1

2. ASKBUDJR 4

3. SUMMARY AND THE NEXT STEP 15

4. REFERENCES 17

APPENDIX A. Operating Instructions 23

APPENDIX B. LIST CODE FOR ASKBUDJR 24

-iii-
LIST OF TABLES

Page

Table 1. Programming Modules of ASKBUDJr 18

Table 2. Rules Used in ASKBUDJr 19

-iv-
LIST OF FIGURES

Page

Figure 1. Introductory Message 20

Figure 2. Request for User Input 21

Figure 3. ASKBUDJr Output 22

-v-

ASKBUDJR: A PRIMITIVE EXPERT SYSTEM FOR THE EVALUATION OF THE

FIRE HAZARD OF A ROOM

Richard L. Smith

Abstract

The Center for Fire Research (CFR) has a long-term project to develop

expert systems as a technology transfer mechanism. CFR has as the long-term

goal of this project: to develop a computer program which will make an expert

estimate of the fire safety of a building based on CFR's deterministic

physical models, technical data, and the expert judgment of its staff. The

first major program to be developed by this project is based on the expertise

of Harold E. (Bud) Nelson. Thus, this program will be called ASKBUD. In this

report, the first exploratory steps taken to develop an expert system for fire

hazard evaluation are described. Also, the progress made to date, as well as

some of the major problems that must be solved, will be discussed. Since the

ASKBUD expert system discussed in this report is in its infancy, we call it

ASKBUDJr.

1 . INTRODUCTION

The Center for Fire Research (CFR) has a long-term project to develop

expert systems as a technology transfer mechanism. CFR has as the long-term

goal of this project: to develop a computer program which will make an expert

estimate of the fire safety of a building based on CFR's deterministic

physical models, technical data, and the expert judgment of its staff. The

program will have the capability to explain its conclusions it makes. It is

important that this program, or one based on it, should be readily usable by

CFR's clients. This is a progress report on this project.

- 1 -
An expert system is a computer program that solves real-world problems

whose solution would normally require a human expert [1,2]. A number of such

computer programs have been built. It is recommended that an expert system

first be developed using the expertise of only one expert. This facilitates

the evaluation of the computer program and the collection of knowledge.

Later, the expertise of other experts can be added to the program. One major

benefit of developing an expert system is that one is forced to record the

human expert reasoning process explicitly. This facilitates the improvement

of the human expert's decision making process. Another major advantage of an

expert system is it effectiveness as a tool for the transfer of technology.

Using expert systems to transfer technology will greatly improve the

speed, efficiency, and accuracy of transferring the valuable technology

developed by CFR to its clients. It could lead to a revolution in fire safety

engineering. It is envisioned that eventually every fire safety engineer in

this country will have at his disposal an expert consultant in fire safety;

one that is always state-of-the-art, always working at top quality, and recognized worldwide as an expert in its field. This consultant will be a computer

program that will run on a modestly priced computer, currently comparable to

1 an IBM AT . Its performance will equal or surpass the performance of most

human experts. It will tirelessly explain its results to the user so it will

also act as a teacher. It will not become tired or bored. It will always

operate at its best, never having an off day.

Certain commercial equipment, instruments, or materials are identified in

this report in order to describe adequately the program. Such identification

does not imply recommendation or endorsement by the National Bureau of

Standards, nor does it imply that the materials or equipment Identified ire

necessarily the best available for the purpose.

-2 -
This will not come about easily or cheaply. But, we do not need to wait

for the completion of the final expert system before we have useful programs.

Like a person entering a new field or discipline, a program on its way to

becoming an expert program will start as a novice. Thus it becomes competent

in its craft and, if it continues its development, it becomes an expert. Just

as an apprentice can help the journeyman, programs developed by this project

will be of significant use to the fire safety engineer before we have reached

our final goal of having an expert system comparable to the best human

experts

.

Thus we see a series of programs growing out of this project that will be

of value to fire safety engineers. Each of these programs should improve the

decision-making quality of the human expert that it aids.

The first major program to be developed by this project is based on the

fire safety expertise of Harold E. (Bud) Nelson. Thus, this program will be

called ASKBUD. In this report, the first exploratory steps taken to develop

an expert system for fire hazard evaluation are described. Also, the progress

made to date, as well as some of the major problems that must be solved, will

be discussed. Since the ASKBUD expert system discussed in this report is in

its infancy, we call it ASKBUDJr. It was written in Golden Common Lisp

(version 1.0) on a Heath personal computer (model 161) with two floppy disks

and 640 K RAM. This hardware and software restricted the size and complexity

of ASKBUDJr.

- 3 -
2 . ASKBUDJR

No attempt will be make to defend the technical approach that the expert

(H. Nelson) used because by definition the expert is correct for purposes of

evaluating an expert system based on one expert. Furthermore, the underlying

fire technology of ASKBUDJr is not the subject of this report. The organization, control, and structure of the computer program ASKBUDJr are the main

subjects

.

Furthermore, we were severely limited in the techniques that ASKBUDJr

could use because of the limitations imposed by the software and hardware.

Thus, our human expert had to choose or invent techniques that were consistent

with these limitations. It should not be inferred that the techniques used in

ASKBUDJr are recommended or that the human expert would use them if he was not

constrained as he was by the limitation of the hardware and software.

Therefore, the technical approach will be described but not defended or recommended. However, we are willing to explain and defend the transformation of

this approach into a computer program.

The problem that ASKBUDJr will address involves a single room, e.g., a

bedroom, a motel room, or a hospital room. It is assumed that a fire starts

in the room and that we have only one occupant. The structure of the building

does not become involved in the fire. The room has one window and one door.

Also, the room will have the following furnishings: a bed, a chest, a chair,

a table, a wastebasket, and a set of curtains or drapes.

-4 -
The degree of hazard the occupant is exposed to depends upon how fast the

hazard from the fire builds up versus how fast he can evacuate the room. Of

all the many things that could influence these times, we are limiting ourself

to the considerations of only a few. However, there will be enough meat on

these bare bones to identify some interesting problems.

The user of ASKBUDJr will be asked to enter the following for each item

of the room's furnishings:

• the peak burning rate in kW

• the effective heat of combustion, DHc, in kJ/g

• LC50, the amount of burned material per unit volume that will kill 50%

of a sample of rats in 30 minutes using a standard test procedure in

mg/L or g/m .

• the growth rate of the burning rate as one of four t-squared curves,

i.e., slow, moderate, fast, or very fast (or zero if it doesn't burn)

• what other items will be ignited if the one in question burns

For our t-squared burning curves:

a slow growing curve leads to 1 MW in 600 sec

a moderate growing curve leads to 1 MW in 300 sec

a fast growing curve leads to 1 MW in 150 sec

a very fast growing curve leads to 1 MW in 75 sec.

- 5-
The user will also enter the sizes of the room (length, width, and height),

the size of the door and window openings, and whether there is a fire

detector/alarm or not.

Finally the user inputs whether the occupant is: awake, asleep, drunk,

mobile, or nonmobile; the time, in seconds, the occupant would take to move

out of the room after becoming aware of the fire; and whether the occupant has

a heart or lung condition. Also the user will input whether there is a person

outside the room who can aid the occupant and how long, in seconds, it would

take this person to come in and remove the occupant after becoming aware of

the fire.

The principal output of ASKBUDJr is a statement of the level of risk the

occupant is exposed to and the margin-of-safety-time, the length of time from

the start of the fire until hazardous conditions exist less the length of time

for the occupant to get out of the room. The time interval to hazardous

conditions is either the length of time to flashover or the length of time to

reach a dangerous level of toxicity, both measured from the time of ignition.

To the user, ASKBUDJr consists of the introductory message (Figure 1) and

a request for user input (Figure 2) and the program's final output (Figure

3). However, there is more to ASKBUDJr. It consists of the programming

modules and their principal procedures as shown in Table 1.

We will now discuss each of these modules in turn. The module "askbudjr''

contains the introductory message, the procedure that loads all the required

files, and the procedure that runs all the procedures in the right order.

-6 -
The "toolkit" contains needed procedures that are not provided in Golden

Common Lisp, e.g., a procedure that computes the square root of a number.

To first order, the match procedure [3] can be said to compare two

symbolic expressions to see if they are identical. However, "match” is more

general than this simple statement would indicate. For example, "match” would

say for the following two expressions that the first matches the second.

1. The ? is greater than the ? +.

2. The time-to-f lashover is greater than the time-to-toxicity except when

the door is closed.

The match procedure is used in the forward-chain procedure [3] as is the

expression "rules". The rulejr module contains all the rules for the system

2 (see Table 2 and appendix A3) . The rules have the general form:

2 Instead of the approach we chose, we could, in principle, have used the

following approach. For each possible combination of the parameters for the

room and occupant we could have a rule that states whether the associated

level of risk is acceptable or not. For this case, let us estimate the

number of rules we would have to write.

Number of Cummulative

Possible Values Number of Rules

awake or asleep 2 2

drunk or sober 2 4

mobile or nonmobile 2 8

heart or lung condition 2 16

initial slope of burning 5 80

detector in room 2 160

availability of external aid 2 320

door open or closed 2 1280

other parameters > 2 39

> 10

Thus one sees why we don't build a huge truth table one square at a time.

Organizing the knowledge so we avoid a combinatorial explosion and have a system that works is a significant portion of the knowledge representation

problem.

- 7 -
If the sky is blue, then the sun is shining,

or, in general,

If A, B, and C, then D.

The forward-chain procedure takes the initial assertions (statements of

facts that define the problem) and uses "match" to see if any of the rules

apply. If they do, it adds the rule's conclusion, the "then” part of the

expression, to the list of assertions. "Forward-chain" continues until there

are no more new conclusions to be made. It then quits.

Knowledge in this system is contained in assertions, rules, frames, and

the methods of calculating various parameters such as time to hazard. A frame

is a data structure which allows values to be assigned to properties of the

room, occupant, or furnishings. It allows various types of values such as

explicit values, default values, if-needed values, and inheritances. The

frame module contains the procedures for the creation and manipulation of

frames. If one requests a value from a frame, first the procedure in the

frame's module looks to see if there is an explicit value for the parameter of

interest. If none, it looks to see if there is a default value. If none, it

looks to see if there is an if-needed or demon procedure that will compute the

needed value. There is also the option that a value can be inherited from a

parent frame. However, this feature is not used in ASKBUDJr.

The inputjrl module contains the default and if-needed values for all th*>

parameters used in ASKBUDJr.

-8 -
In the frame for each item of furnishings, there is a will-ignite

property. This is a list of all furnishings that a given item will ignite.

From this will-ignite information, the fuel-packages procedure will compute

all the fuel packages in the room. For example, if the wastebasket will

ignite the bed and table and the table will ignite the curtains-drapes and we

assume the other items will not ignite anything, then the fuel packages are:

(1) chair, (2) chest, (3) curtains-drapes, (4) bed, (5) table, curtainsdrapes, (6) wastebasket, bed, table, curtains-drapes.

The time-to-flashover procedure takes the list of fuel packages and sees

which one will lead to f las hover in the shortest time. The peak burning rate

of a fuel package is taken to be the sum of its members' peak-burning-rates.

ASKBUDJr uses the Thomas equation to predict the power level required for

flashover. The Thomas equation estimates the minimum power in kilowatts that

will flashover a room. It is written as

1/2 (dQ/dt)fo = 278 Av (hv) + 7.8 Aw

(dQ/dt)fo is the estimated minimum flashover power in kW,

Av is the vent area in square meters (e.g., area of open windows and doors),

hv is the vent height in meters (the actual vertical length of the vent), and

Aw is the total surface area of the room in square meters.

If the sum of the peak burning rate of the items in any fuel package

exceeds the minimum flashover power, we assume flashover occurs.

-9 -
The time-to-f lashover procedure determines the shortest time to flashover

due to any fuel package. To do this, we assume that an entire fuel package

burns as a single unit with its growth rate determined by the fastest burning

member of the package that has an individual peak burning rate greater than

200 kW. Thus the equation for the energy emitted by the burning of a fuel

package, q, is

dq/dt = Kt^

for 0 < t < [(sum of (dq/dt)max of items in fuel package) /(growth rate of

fastest growing element with (dq/dt)max > 200 kW)]^^

where K is the growth rate of the fastest growing element which has a peak

burning rate greater than 200 kW.

Besides the hazard due to flashover, we also consider toxic gases hazard.

To compute the time to a hazardous condition due to toxic gases we proceed as

follows in the "toxic" module.

For a one item fuel package for which m is the weight loss of the burning

object and q is the energy released, we have

dq/dt = (dm/dt) DHc

where DHc is the effective heat of combustion. Thus it follows that

dm/dt = (dq/dt)/DHc.

- 10-
A hazardous condition is reached whenever

m/Vc = r LC50

where Vc = one half the volume of the room; r is a constant that is taken to

be 3, except for an occupant who is drunk or has a heart or lung condition,

then "r" is taken to be 1; LC50 is the value for the material burning in units

of mg/1 or g/m^. The selection of the value for Vc is consistent with the

worst case approach. It is assumed that the toxic gases are all in the upper

half of the room.

We wish to determine when we will reach this toxic condition. This will

happen when

m(t) = r LC50 Vc.

Since dq/dt = Kt^, we have

dm/dt = Kt

2 /DHc

or

3

m(t) = (Kt )/3 DHc.

Assuming we do not run out of material, we get for the time to toxic hazard,

tx.

1/3 tx = (3 DHc r LC50 Vc/K)
For two or more items in a fuel package we compute a weighted average of

the LC50 and DHc for all the items in the package. The relative weight, ri,

assigned to each item is:

Item

bed

chest

table

chair

wastebasket

curtains-drapes

Relative Weight

1.0

1.0

0.5

0.3

0.05

0.05

The average of DHc, (DHc)a, is computed using the following expression

( DHc ) a = (rl (DHc)l + r2 (DHc)2 + ...)/(rl + r2 + ...)

where ri is the relative weight of the item with heat of combustion (DHc)i.

The average of the effective LC50, (LC50)a, is computed using the

following expression

( 1 / (LC50)a) = (rl/ (rl + r2 + ...))/(LC50)l + (r2/(rl + r2 + . . . ) )/(LC50)2 + ...

where (LC50)i is the LC50 of the i-th item.

To take into account the impact on the time to toxic hazard due to having

the window or door open, we make the following six approximations:

- 12 -
1. If the area of the window opening is larger than 16 sq. ft., then the

time to toxic hazard is infinite (10^ seconds), i.e., a toxic hazard

is never reached.

2. If the room is not in a building or is in a big building and the total

open area of the door and window is larger than 16 sq. ft., then the

time to toxic hazard is infinite.

3. If the door is closed and the area of the window opening is less than

16 sq. ft., then the time to toxic hazard, th, is

th = tx/ (1 - Wa/16)

where Wa = the area of the window in square feet.

4. If the room is in a large building or no building and the open area of

the door and the window is less than 16 sq. ft., then the time to

toxicity is

th = tx/(l - (Wa + Da)/16)

where Da = the area of the door opening in square feet.

5. If the room is in a small building, the open area of the door is

greater than 16 sq. ft., and the open area of the window is less than

16 sq. ft., then the time to toxicity is

- 13 -
th = 1.44225 tx/(l - Wa/16)

6. If the room is in a small building, the open area of the door is less

than 16 sq. ft., and the open area of the window is less than 16 sq.

ft., then the time to toxicity is

th = tx (1 + (Da/16) ( .44225) )/( 1 - Wa/16).

If the occupant is capable of escape, the time for the occupant to escape

the burning room is the time it takes him to become aware of the fire plus the

time it takes for him to move out of the room. We assume the awake, sober

occupant becomes aware of the fire when it reaches a power level of 25 kW.

The sober, asleep occupant becomes aware of the fire when and if the detector

sets off an alarm. In all other cases the occupant will have to rely on

external aid to escape. It there is no person to aid the escape, then the

rescue time is infinite (10-* s). With no detector and the occupant asleep, we

assume the rescuer takes 5 minutes to become aware of the fire and to get the

occupant out. In all other cases, the rescuer learns of the fire when the

occupant does or when the alarm goes off. In this case, the rescue time is

the time to awareness plus the time to come in and take the occupant out,

which we assume to be 30 seconds unless the user enters a different duration.

The key parameter, margin-of-safety-time , is defined as the difference

between the time to hazard and the lesser of the escape or rescue time.

The "inputjr2" module contains the procedure that clears out all the old

explicit values in the frames (reset-all) so that the procedure request-values

- 14 -
can ask the program user for new values. The framass procedure takes the

information in the frames as explicit, default, or if—needed values and makes

assertions out of them.

The status procedure reports the values that will be used by the program

for all the variables of the problem, such as room length, occupant awake,

etc. A status report is given in Figure 2.

Finally, the whyjr procedure gives the "if" part of any rule that was

used. An example of its use is shown in Figure 3.

3. SUMMARY AND THE NEXT STEP

In developing ASKBUDJr we had to take into account software and hardware

limitations. For example, the version of Golden Common Lisp we used lacked

most numerical functions such as square roots, exponents, transcendental

functions, etc. The generic software tools were limited to procedures in the

modules match, forchain, frames, and whyjr. These factors had a strong influence on the problem ASKBUDJr could consider and the approaches that could be

followed to a solution. However, ASKBUDJr gave reasonable answers,

considering its constraints, for a number of situations.

The knowledge of the expert is spread rather widely throughout ASKBUDJr.

It is in the frames in the default values and if-needed values. It is in the

rules. It is also in the procedures used to calculate the various quantities

of interest. From the point of view of getting the conclusion only, it

doesn’t matter where the knowledge resides. However, the problem of providing

- 15-
an explanation for the conclusion that traces back to the problem’s initial

point needs further investigation if we use a similar structure for the

knowledge in future programs.

In the next step, we move to a more powerful computer, to more powerful

software tools, and to a more demanding problem. With this enhanced capability and challenge, we must resolve the general structure of how to represent

the expert's knowledge in ASKBUD and what type of explanation facility will be

required.

At one extreme we could try to put all the knowledge into rules. Since

there is some transformation from frames and procedures to rules [4], we could

convert ASKBUDJr to a pure rule system. However, speed or economy of size may

argue against this.

On the other hand, we can put our expert's knowledge into rules and

procedures (or models) with the rules selecting which procedure to use and

analyze the procedures output. Only future investigation will resolve this

question.

Another question that ASKBUDJr brings up is that of logical consistency.

It is possible to enter logically inconsistent information into ASKBUDJr and

it will accept them. The question arises whether in future programs there

should be a logical consistency check built into the program so the user

cannot enter logically inconsistent data.

- 16 -
Finally, we need to resolve the question of the form for our output. Is

a statement saying the risk is low, moderate, etc. , of use to potential uses

of such an expert system? If it is, do these terms need to be more clearly

defined? These and other questions may be resolved as we develop future

programs.

4. REFERENCES

[1] Weiss, S. and Kulikowski, C., A practical guide to designing expert

systems, Rowman & Allanheld Publishers, New Jersey, 1984, 174 p.

[2] Goodall, A., The guide to expert systems, Learned Information, New

Jersey, 1985, 220 p.

[3] Winston, H. and Horn, B. , LISP second edition, Addison-Wesley Publishing

Co., Massachusetts, 1984, 434 p.

[4] Rich, E. , Artificial Intelligence, McGraw-Hill Book Co., New York, 1983,

436 p.

- 17 -
Table 1. Programming Modules of ASKBUDJr

Modules Procedures

askbudjr intro-message

superload

runprograms

toolkit cube-root

square-root

match match

(chapter 17, ref. 3)

rulesj r rules

f orchain forward-chain

(chapter 18, ref. 3)

frames fget-v-d-p

f put

(chapter 22, ref. 3)

inputjrl (default and if-needed

values for frames)

fuelpack fuel-packages

f lashovr time-to-f lashover

toxic time-to-toxic

time-to-hazard

margin-of-safe ty

inputj r2 framass

reset-all

request-values

status status

whyjr whyjr

- 18 -
Table 2. Rules Used in ASKBUDJr

Rule

Number

1 .

2 .

3.

4.

5.

6 .

7.

8 .

9.

10 .

11 .

12 .

13.

14.

Statement of Rules

If the occupant is drunk, then the occupant is nonmobile.

If the occupant is drunk, then the occupant reacts to smoke as if

he had a heart or lung condition.

If the time to toxic hazard is greater than the time to flashover,

then the time to hazard is equal to the time to flashover, o$o

seconds (o$o is the number of seconds to flashover).

If the time to flashover is greater than the time to toxic hazard,

then the time to hazard is equal to the time to toxic hazard, t$t

seconds (t$t is the number of seconds to toxic hazard).

If the ratio of the margin-of-safety-time to the escape-time is

greater than one, then the occupant will have a safety margin of

m$m seconds which is (m$m/e$e) times his physical escape time. He

must recognize the need to evacuate and start his escape within m$m

seconds from his moment of awareness to avoid eliminating his

margin of safety (m$m is the margin of safety time in seconds and

e$e is the escape time).

If the margin of safety is negative, then in case of fire the risk

to the person is very high.

If the margin of safety is less than one minute and the ratio of

the margin-of-safety-time to the escape-time is less than one, then

the risk is high.

If the margin of safety is less than one minute and the ratio of

the margin-of-safety-time to the escape-time is greater than one and less than two, then the safety is marginal.

If the margin of safety is less than one minute and the ratio of

the margin-of-safety-time to the escape-time is greater than two,

then the safety is moderate.

If the margin of safety is greater than one minute and less than

five minutes and the ratio of the margin-of-safety-time to the

escape-time is greater than two, then the risk is low.

If the margin of safety is greater than five minutes, then the risk

is low.

If the ratio of the margin-of-safety-time to the escape-time is

less than one and the margin of safety is greater than one minute

and less than five minutes, then the risk is marginal.

If the ratio of the margin-of-safety-time to the escape-time is

greater than one and less than two and the margin of safety is

greater than one minute and less than five minutes, then the risk

is moderate.

If the room never becomes hazardous, then the risk Is low.

- 19 -
Figure 1. Introductory Message

ASKBUDJr - version 1.1 - is a demonstration of a simple expert system for the

evaluation of the fire hazard of a room. It was written by Richard L. Smith

in Golden Common Lisp. It is based on the expertise of Harold E. Nelson.

CENTER FOR FIRE RESEARCH

National Bureau of Standards

September 24, 1985

ASKBUDJr deals with a fire in one room with one occupant. In the room is a bed, chest, table, chair, wastebasket, and curtains-drapes . You will be asked

to supply information about the room furnishings, and occupant. If you don't

have the information, or don't want to enter it, type "p" for pass.

Type any letter and "return" to continue.

-20-
Figure 2. Request for User Input

The present status of the room is:

A B

V C D E

furnishing peak h .-of-combi. LC50 growth-rate will-ignite

1 . Bed 1000 35 20 FAST NIL

2. Chair 500 20 20 MODERATE (TABLE CURTAINSDRAPES)

3. Table 500 18 60 SLOW (CHAIR)

4. Chest 1000 25 40 SLOW NIL

5c Wastebasket 50 20 60 VERY-FAST (BED)

6. Curtains 100 25 15 VERY-FAST (CHAIR)

8. ROOM - dimensions in feet

A B C D E F G

detector length wid th height door-height door-width fraction-open

N 15.0 12.0013 7.99869 7.00131 2.5 1

H I J K

window-width window-height in-big-bldg dim-m-f

2.5 2.00131 Y F

7. Occupant

A B C D E F G

awake mobile drunk heart-lung external-air time-to-es rescue-time

N Y N N N 8.23 1.0F+05

(DO YOU WANT TO INPUT DATA INSTEAD OF USING DEFAULT DATA? Y OR N)

-21 -
Figure 3. ASKBUDJr Program's Output

((THE ROOM WILL FLASHOVER WITH THE FUEL PACKAGE (WASTEBASKET BED) BURNING IN 120.319

SECONDS)) (THE ROOM WILL BE TOXIC WITH THE FUEL PACKAGE (CHAIR TABLE CURTAIN

S-DRAPES) BURNING IN 99.9019 SECONDS)

; Reading file B :/RULESJR.LSP

(RULE IDENTIFY4 SAYS THE TIME TO HAZARD IS EQUAL TO THE TIME TO TOXIC HAZARD 99.9019

SECONDS)

(RULE IDENTIFY7 SAYS THE RISK IS HIGH)

T

* (whyjr ’identify7)

((THE MARGIN OF SAFETY IS LESS THAN ONE MINUTE) (THE RATIO OF THE MARGIN-OF-S AFETY

TIME TO THE ESCAPE-TIME IS LESS THAN ONE))

*

-22 -
APPENDIX A. OPERATING INSTRUCTIONS

To run ASKBUDJr, one must first load Golden Common Lisp. Then, with the

ASKBUDJr disk in drive B, type

(load "askbudjr . lsp")

•

Then one types

(askbudj r)

and follow the instructions. If after a run, you would like to run the program

again with some changes, type

(do-again)

and follow instructions.

- 23 -
APPENDIX B. LISP CODE FOR ASKB UDJR

Page

Askbudjr 25

Toolkit 27

Rulesjr 29

Inputjrl 31

Fuelpack 36

Flashovr 38

Toxic 41

Inputj r2 45

Status 55

Whyjr 58

-24 -
file : askbudj r 1.1

<defun askbudjr ()

< super 1 oad)

( run programs)

)

(defun superload <) ;

9 (setq *pr i n t-1 e ve 1 * nil) ;

» (setq *pr i n t-1 ength* nil) ; (setq f$f ''(bed chair chest

( 1 oad " tool k i t . 1 sp

u

) (load "match . 1 sp "

)

(load " f or cha i n . 1 sp "

)

(load " frames . 1 sp “

)

(load " i npu t j r 1 . 1 sp "

)

(load " f ue 1 pack . 1 sp "

)

(load " f 1 ashovr . 1 sp "

)

( 1 oad " tox i c . 1 sp "

)

(load " i npu tj r-2 . 1 sp " )

( 1 oad " whyj r . 1 sp "

)

(load " status . 1 sp ")

)

must load file with f$f before calls

to are made

this & nexts line are needed so long

list are

printed without abbreviations

table wastebasket cur ta i ns-drapes)

)

(defun runprograms ()

( rese t —a 11) ; ( intro-message)

(input) ;

( do-aga ini))

(defun do-again ()

( request -value s2)

( do-aga ini))

(defun do-againl ()

(setq assertions nil)

sets all the "values" in the frames to nil

input the values for the parameters that

describes the room and occupant

resets the gobal variable that contains

the assertions that charac ter i z i es the

room and occupant

( thomas-f 1 ashover-package f$f) ; add an assertion about

; f 1 ashover

( t i me-to-tox i c-asser t i on f$f) ; add an assertion about toxicity

(framass) ; converts info in frames to assertions

(marg i n-of -saf e ty-ass f$f) ; add an assertion about margin of

; safety

(marg in-saf-evacuate-ratio-ass f$f)

( f 1 ash-or- tox i c-ass f$f)

(load " r u 1 esj r . 1 sp " ) ; we moved this from super load because it

; would calculate expression before the

; assertions had been made

( f orwar d-cha i n ) ) ; with rules & assertion we reason

(defun intro-message ()

25
( terpr i )

( terpr i )

< terpr i ) (Princ ' expert!)

< terpr i ) (princ

I t was !

)

( terpr i ) (princ '[written by Richard L. Smith in Golden Common Lisp. It

i s based ! )

IASKBUDJR -version 1.1 -is a demonstration of a simple

' Isystem -tor the evaluation o-f the -fire hazard o-f a room.

( terpr i ) (princ '

( t e r p r i >

( t e r p r i ) (princ '

( terpr i

)

(princ '

( ter pr i

)

(princ '

( terpr i

)

( ter pr i

( ter pr i ) (princ '

on the expertise o-f Harold E. Nelson. !)

CENTER FOR FIRE RESEARCH!)

National Bureau o-f Standards!)

September 24, 1935!)

ASKBUDJR deals with a -fire in one room with one

occupan t . In the ! )

( terpr i ) (princ '

( terpr i

)

(princ '

room is a bed, chest, table, chair, wastebasket, and!)

information about!)

( terpr i ) (princ ' ! the ! )

( ter pr i ) (princ ' ! pass

.

! )

( ter pr i )

( ter pr i )

( terpr i )

)

curtai ns-drapes. You will be asked to supply

abou t !

)

the room, furnishings, and occupant. If you don't have

information, or don't want to enter it, type "p" for

26
; -file: toolkit

(de-fun our-cube-root (y)

(cond (<< y 0) "negative-number) ; we don't need the cube root

; of negative numbers

<t (do ((x 1>)

((or (< (abs (- y (* x x x))>

(cond ((> y 10000) (/ y 1000000.0)

(t .001)))

(= ( - y (*x x x))

(cond ((> y 10000) (/ y 1000000.0))

( t .001 ) ) ) ) x)

(setf x (* .5 (+ x (/ y (* x x)))))))))

(de-fun our-sqrt (y) ; works -for large numbers

(cond ((< y 0) "negative-number)

(t (do ((x 1))

((or (< (abs (- y (* x x)))

(cond ((> y 8000) (/ y 1000000.0)); -for large no.

(t .001)))

(= (- y (* x x)

)

(cond ((> y 8000) (/ y 1000000.0))

( t .001 ) ) ) ) x)

(setf x (* .5 (+ x (/ y x))))))))

(de-fun our-union (X Y)

( cond ((null x) y

)

((member (car x) y) (our-union (cdr x) y))

(t (our-union (cdr x) (cons (car x) y)))))

(de-fun our-i ntersect i on (X Y)

(cond ((null x) nil)

((member (car x) y) (cons (car x) (our-i ntersect i on (cdr x)

y) ) ) (t ( our- i n tersec t i on (cdr x) y))))

(de-fun make-a-set (Y)

( cond ( ( nu 1 1 y) n i 1

)

((member (car y) (cdr y))

(make-a-set (cdr y)))

(t (cons (car y) (make-a-set (cdr y) ) ) ) )

)

(de-fun squash (x) ; problem 4-9

(cond ((null x) nil)

((atom x) (list x))

(t (append (squash (car x)) (squash (cdr x))))))

(de-fun our-se t-d i f -f er ence (in out) ; problem 4-13

(cond ((null in) nil)

((member (car in) out) ( our-se t-d i fference (cdr in) out))

(t (cons (car in) ( our-se t-d i fference (cdr in) out)))))

(defun samesetp (X Y) ; problem 4-15

(cond ((and (null ( our-se t-d i fference x y)

)

27
<null ( our-se t-d i f f erence y x)))

t) ) ) ****** "make-a-1 i st-super " takes a list of sets and remove any

; dup 1 i cat i ons

(defun make-a-1 i st-super 1 (Y 1 ) ; if 1 =n i 1 , removes dulication of

; first el emen t (cond ((null y) y)

((equal (length y) 1) (append y 1)> ; if there is only one

; element, return it.

((samesetp (car y) (cadr y)); 1st & 2nd elements =, drop 1st

; e 1 emen t (make-a-1 i st-super 1 (cdr y) 1)); and repeat

(t (setq 1 (cons (cadr y) 1)) ; if not = , save the second

(setq y (cons (car y) (cddr y) ) ) ; and look at 3th

(make-a-1 i st-super 1 y 1))))

(defun make-a-1 i st-super2 (Y) ; have one agrument instead of 2

(make-a-1 i st-super 1 Y nil))

(defun make-a-1 i st-super 3 (Y r) ; this is our non-dup 1 i c a t i ve list

(cond ((null y) y)

((equal (length (make-a-1 i st-super2 Y)) 1); if list is 1 long

; or 2 long but same sets, return

(append (make-a-1 i st-super2 Y) r)); this shorten list with r (t (setq r (cons (car (make-a-1 i st-super2 Y)) r)); operate on

; 1st and save it i n r (setq y (cdr (make-a-1 i st-super2 Y))); set y = to the cdr

(make-a-1 i st-super3 y r)))); repeat

(defun make-a-1 i st-super (Y)

;

one input variable

(make-a-1 i st-super 3 Y nil))

28
file : ru 1 esj

r

(setq rules '((rule identifyl

(If (The occupant is drunk))

(then (The occupant is nonmob i 1 e ) )

)

(rule i den t i f y2

(If (The occupant is drunk))

(then (The occupant reacts to smoke as if he had a heart or lung condition)))

(rule i den t i f y3

(If (The time to toxic hazard is greater than the

time to flashover))

(then (The time to hazard is equal to the time to

flashover ,o$o seconds)))

(rule i den t i f y4

(If (The time to flashover is greater than the time

to toxic hazard)

)

(then (The time to hazard is equal to the time to

toxic hazard ,t$t seconds)))

(rule identifyS

(If (The ratio of the mar g i n-of -safe ty time to the

escape-time is greater than one))

(Then (The occupant will have a safety margin of

,m$m

seconds which is

, (/ m$m

e$e

)

times his physical escape time. He must

recognize the need to evacuate and start his

escape within

,m$m

seconds from his moment of awareness to avoid

eliminating his margin of safety.)))

(rule identif y6

(If (The margin of safety is negative))

(then (In case of fire the risk to the person is

very high)))

(rule identify?

(If (The margin of safety is less than one minute)

(The ratio of the mar g i n-of -safe ty time to the

escape-time is less than one))

(Then (The risk is high)))

(rule i den t i f y8

(If (The margin of safety is less than one minute)

(The ratio of the mar g i n-of -safe ty time to the

escape-time is greater than one and less than

two) ) (then (The safety is marginal)))

(rule identif y9

(If (The margin of safety is less than one minute)

(The ratio of the mar g i n-of -safe ty time to the

escape-time is greater than two))

(then (The safety is moderate)))

(rule identifylO

29
(If (The margin of safety is greater than one minute

and less than five minutes)

(The ratio of the marg i n-of -saf e ty time to the

escape-time is greater than two))

(then (the risk is low)))

(rule identifyll

(If (The margin of safety is greater than five

minutes))

(then (the risk is low)))

(rule identifyl2

(if (The ratio of the mar g i n-of -saf e ty time to the

escape-time is less than one)

(The margin of safety is greater than one minute

and less than five minutes))

(then (The risk is marginal)))

(rule identifyl3

(if (The ratio of the mar g i n-of -saf e ty time to the

escape-time is greater than one and less than

two)

(The margin of safety is greater than one minute

and less than five minutes))

(then (The risk is moderate)))

(rule i den t i f y 1

4

(if (The room never becomes hazardous))

(then (The risk is low)))))

0
; i npu t j r

1

(setf (get 'bed '-frame)

'(bed ( i n i t i al -si ope-of-burn

(value)

(de-fault -f ast

)

( i -f-needed)

)

( peak-rate-of-bur

n

(value)

(de-fault 1000)

( i-f-needed))

(w i 1 1 - i gn i te

(value)

(de-fault )

( if -needed))

( he a t-of -combust i on

(value)

(default 35)

( i f-needed )

)

( re 1 at i ve-we i gh t (value)

(default 1

)

( if -needed))

( LC50

( val ue

)

(def aul t 20)

( i f-needed) ))

)

(setf (get 'chair 'frame)

'(chair ( i n i t i al -si ope-of-burn

(val ue

)

(default moderate)

( if-needed))

( peak-r ate-of -burn

(val ue

)

(def aul t 500)

( if-needed))

(wi 1 1— igni te

(val ue

)

(default table cur ta i ns-dr apes)

( if-needed))

( he a t-of -combust i on

(value)

(def aul t 20)

( i f-needed)

)

( re 1 at i ve-we i gh t (val ue

)

(default .3)

( i f-needed)

)

( LC50

(value)

(defaul t 20)

( if-needed))))

31
(setf (get "table "frame)

" < tabl e (initial -si ope-of-burn

(val ue)

(default si ow)

( i f -needed)

)

( peak-rate-of-burn

(val ue

)

(default 500

)

( if -needed))

(w i 1 1 - i gn i te

( v a 1 u e

)

(default chair)

( i f -needed)

)

( heat-of-combust i on

(value)

(default 13)

( if -needed))

( r e 1 at i ve-we i gh t (val u e

)

(default .5)

( if -needed))

( LC50

(value)

(def aul t 60)

( if-needed))))

(setf (get "chest "frame)

"(chest ( i n i t i al -si ope-of-burn

(value ) (default si ow)

( if-needed))

(peak-rate-of-burn

(val ue

)

(default 1000)

( i f -needed)

)

(w i 1 1 - i gn i te

(value)

( def au 1 t

)

( i f -needed)

)

(heat-of-combust i on

(val ue

)

( def au 1 t 25)

( i f -needed)

)

( r e 1 at i ve-we i gh t (value)

(default 1

)

( i f -needed)

)

( LC50

(value)

(default 40

)

( if-needed))))

(setf (get "wastebasket "frame)

' (wastebasket (initial -si ope-of-burn

32
(value ) (de-fault very-fast)

( if-needed))

( peak-rate-of -burn

(value)

( def au It 50

)

(if -needed))

( w i 1 1 — i gn i te

(value)

( def au 1 t bed)

( if-needed))

( heat-of -combust i on

(value)

(default 20

)

( if-needed))

( re 1 at i ve-we i gh t (value)

(default .05)

( i f-needed)

)

( LC50

(value)

(default 60

)

( i f-needed) ) )

)

(setf (get " cur ta i ns-drapes "frame)

" ( cur ta i ns-drapes ( i n i t i al -si ope -of -burn

(value ) (default very-fast)

( if-needed))

( peak-r ate-of -burn

(value)

(default 100)

( if-needed))

( w i 1 1 - i gn i te

(value)

(default chair)

( if-needed))

( heat-of -combust i on

(value)

(def aul t 25)

( i f-needed)

)

( r e 1 at i ve-we i gh t

( val ue

)

(default .05)

( if-needed))

( LC50

(val ue

)

(default 15)

( if-needed))))

(setf (get "occupant "frame)

"(occupant (awake

(value ) (default n

)

33
( if-needed))

(mob i 1

e

< val ue)

(default y ) (if -needed))

(drunk

(value ) (default n

)

( if -needed))

(heart-1 ung-cond i t i on

(value ) (default n

)

( i f-needed)

)

( t i me- to-escape

(value )

( def au 1 t

)

(if-needed t i me-to-escape-d) ) (external -ai

d

(value ) (default n

)

( if-needed))

(rescue-time

(value ) (default ) (if-needed ex t-rescue- t i me-d) ) )

)

(setf (get "room "frame)

"(room (detector

(value ) (default n

)

( if-needed))

(length

( val ue

)

( def au 1 t 4.572)

( if-needed))

(w i dth

(value)

( def au 1 t 3.658)

( if-needed))

(height

(val ue

)

( def au 1 t 2.438)

( i f-needed)

)

( door-he i gh t (val ue

)

( def au 1 t 2.134)

( i f-needed)

)

( door-w i dth

(val ue

)

(default .762)

( if-needed))

( f r ac t i on -door -open

(val ue

)

(default 1)

34
(

i -f-needed)

)

(wi ndow-wi dth-open i ng

( v a 1 ue)

(de-fault . 762)

( i f-needed)

)

(w i ndow-he i gh t-open i ng

(value)

(de-fault .61)

< i f-needed)

)

( i n-b i g-bu i 1 d i ng

(value)

(de-fault y )

( i -f-needed)

)

( d i m-me ter--f ee t (value)

(de-faul t -f

)

( i-f-needed))))

35
; files fuel pack

(defun f ue 1 -packagesS <x 2);list of all element in 2 whose 1st

; e 1 emen t i s x (cond ((null x) z) ; should have only one for fuel

; packages

<<null z > z)

(( equal x (caar z )

)

(cons (car z ) ( f ue 1 -packages5 x (cdr z)>))

(t ( f ue 1 -packages5 x (cdr z)>)))

(defun f ue 1 -packages4 (z) ; fuel package due to 1st element- only

; 1st pass

(make-a-se t (squash (cons (car z)

(apply 'append (mapcar #' ( 1 ambda (w)

( f ue 1 -packages5 w (cdr z))>

( cdar z> ) ) > > > > (defun f ue 1 -packagesS (z) ; fuel package from 1 pass and unused

; e 1 emen ts

(cons ( f ue 1 -packages4 z) ; cons the results of the 1st pass to

; the cdr of the 1 i st

(remove (car ( f ue 1 -packages5 (cadar z) z)> ;with the used

; part removed

(cdr z))>)

(defun f ue 1 -packages2 (z) ; complete fuel package for 1st element

(cond ( (samesetp (car z) ( f ue 1 -packages4 z)> (car z))

(t (setq z ( f ue 1 -packages3 z)>

( f ue 1 -packages2 z))))

(defun f ue 1 -packagesl (x z); x is an element of z. This determine

; the fuel package due to this element

( f ue 1 -packages2 (cons x (remove x z))))

(defun fue 1 -packages (z) ; all the fuel packages

(make-a-1 i st-super (apply 'list (mapcar #'(lambda (w)

( fue 1 -packagesl w z))

z) ) )

)

J We need the various items of furnishings that wi 1 1 be i gn i ted by

5 an i tern

(defun 1 i st-w i 1 1 - i gn i te- i tern (w) ; causal vector for w . Reports (

w

X e e y>

; where x . . y are caused by w . I n this case

; x . . y are i terns that w w i

1

1 -ii gn ii t e . (remove nil (append (list w) ( f ge t-v-d-p w '

w

i 1 1 - i gn

i

t

e

) ) ) )

5 need to remove nil because it ignites everything 1

(defun 1 i st-w i 1 1 - i gn i te- i terns (y) ; Makes a list of will-ignite

; causal vectors for list of furnishing y. It is a

; input for the procedure "fuel -packages" .
(apply "list (map car

y ) )

)

( 1 ambda (x) ( 1 i st-w i 1 1 - i gn i te-i tem x))

''

...
; ; -f 1 ashovr

; Thomas Flashover Equation

(defun aw

( + (* 2

(car

(* 2

(car

(* 2

(car

() ; computes the area of the surfaces of the room

(car (fget-v-d-p ‘'room "length))

(fget-v-d-p "room "width)))

(car (fget-v-d-p "room "length))

(fget-v-d-p "room "height)))

(car (fget-v-d-p "room "height))

(fget-v-d-p "room "width)))))

(defun vent-eff () ; computes the vent term in the Thomas equation

; for f 1 ashover

(+ (* (car (fget-v-d-p "room "window-height-opening))

(car (fget-v-d-p "room "window-width-opening))

(our-sqrt (car (fget-v-d-p "room "window-height-opening))))

(* (car (fget-v-d-p "room "door-height))

(car (fget-v-d-p "room "door-width))

(car (fget-v-d-p "room 'fraction-door-open))

(our-sqrt (car (fget-v-d-p 'room "door-height))))))

(defun thomas-f 1 ashover-power () ; Thomas equation for the power

needed for

; f 1 ashover

(+ (* 278.0 (vent-eff)) (* 7.8 (aw))))

l Logically we now would go to the fuelpack file to get the

procedure " fue 1 -packages" . We assume we have done that so we

; now have all the fuel packages. We will now determine if

; burning any of the fuel packages will lead to flashover. We

; assune all the maximum burning rates will occur at the same

f time so that they add. This is a conservative estimation.

(defun total -peak-of-1 i st (y) ; the sum of all the peak burning

; rates for all items in list y

(apply "+ (mapcar #" (lambda (w) (car (fget-v-d-p w "peak-rateof -burn ) )

)

y) ) ) (defun sum-packages (y) ; the sum of the peak burning rate for

; all fuel packages, (sum package) in list y

(mapcar #" ( lambda (w)

(append (list ( total -peak-of-1 i st w)

)

w)

)

( fue 1 -packages ( 1 i st-w i 1 1 - i gn i te- i terns y) ) )

)

(defun max-pack (y) ; the max fuel package (power package)

( assoc

(apply "max ; max power

(mapcar #"car (sum-packages y))) ; a list of all powers

(sum-packages y)))

;; What we want is all the packages that could cause flashover and

38
;; then select a package that would cause flashover in the

; ; shortest time.

(defun -flash-packs (y) ; a list of all fuel packages that could

cause

; flashover (sum package)

(remove nil (mapcar #" ( lambda (w)

( cond < ( > (car w)

( thomas-f 1 ashover-power )

)

w)

( t nil)))

(sum-packages y))))

(defun name-pack-flash (y) ; name of the flashover fuel package

(cddr (fastest-flash-pack ( f 1 ash-packs-sl ope y) ) )

)

; If the room will flashover, we need to determine how long it

; will take to flashover.

; For this version we proceed as follows:

; a. pick the item with DQmax > 200KUI & with the fastest slope.

; b. add all the peak burning rates in the fuel package,

; DQpack

.

; c. use the slope of item found in step a, Kf . So we have

; DQpack = Kf t A 2

; d. if DQfo < DQpack, combute time to flashover.

___ __ _ __ mm __ __ _

j

; Slope for items with DQmax >200kw

(defun list-slope (y); list of (item slope) if DQmax >200

(remove nil (mapcar #' ( 1 ambda (w)

(cond ((> (car (fget-v-d-p w

' peak-r ate-of

bur n )

)

200 ) (cons w

(fget-v-d-p w

'

i n i t i al -si ope-of -burn ) )

)

( t nil)))

y) ) )

5;Now we want the fastest slope of any item in a list

(defun 1 i st-f astest-sl ope (y) ; fastest slope of a list

( or

( 1 i st-sl ope 1

( 1 i st-sl ope 1

( 1 i st-sl ope 1

( 1 i st-sl ope 1

"very-fast y)

"fast y)

"moderate y)

" s 1 ow y ) ) ) (defun list-slopel (s y)

(cond ((null y) nil)

((equal s (cadar (list-slope y) )

)

s)

3 ?
(t (list-slopel s (cdr y)))))

(de-fun f 1 ash-packs-sl ope (y) ; < -f astest-sl ope sum-DQmax -fuel-pack)

(mapcar #"( lambda (w) ; for flashover packages

(cons ( 1 i st-f astest-sl ope (cdr w)

)

w)

)

(flash-packs y)))

(defun fastest-flash-pack (y) ; ( f astest-sl ope sum-DQ package)

(cond ((slope-pack "very-fast y))

((slope-pack "fast y)

)

((slope-pack "moderate y))

((slope-pack "slow y))))

(defun slope-pack (s y)

(cond ((null y) nil)

((equal s (caar y) ) (car y)

)

(t (slope-pack s (cdr y)))))

(defun slope (y) ; converts a verbal slope into a numerical one

KUI/s A 2

(cond ((equal "slow y) (/ 1000 (* 600.0 600)))

((equal "moderate y) (/ 1000 (* 300 300.0)))

((equal "fast y) (/ 1000 (* 150 150.0)))

((equal "very-fast y) (/ 1000 (* 75 75.0)))

( t 0) ) ) (defun t i me- to-f 1 ashover (y) ; time to flashover

(let ((x (fastest-flash-pack ( f 1 ash-packs-sl ope y) ) )

)

(cond (x

(our-sqrt (/ ( thomas-f 1 ashover-power

)

(si ope (car x)))))

(t 100000.0))))

40
; toxic

(defun time-to-max (y) ; the time it takes an item to reach its

max i mum

; burning rate.

<our-sqrt (/ (car (fget-v-d-p y " peak-rate-of -burn ) ) (slope (car (fget-v-d-p y " i n i t i al —si ope—of —bur n ) ) ) ) )

)

(de-fun volume-m () ; volume o-f room in cubic meters

(* (car (fget-v-d-p "room 'width))

(car (fget-v-d-p "room "height))

(car (fget-v-d-p "room "length))))

(de-fun mass-burned (y t) ; mass o-f item,y, burned in t seconds

(* 1000 (/ (* (slope (car (fget-v-d-p y

" i n i t i al -si ope-o-fburn ) ) ) t t t

)

(* 3 (car (fget-v-d-p y

" heat-o-f-combust i on ) ) ) ) ) )

(de-fun we i gh t-average-LC50 (y) ; weighted average o-f LC50 -for list

o-f i terns

(/ (apply "+ (mapcar #"(lambda (w)

(* (car (-fget-v-d-p w "relative-weight))

(car (fget-v-d-p w "LC50))))

y)

)

(apply "+ (mapcar #"(lambda (w)

(car (fget-v-d-p w "relative-weight)))

y))))

(defun we i gh t-average-heat-of-combust i on (y) ; weighted average of

; heat-of-combust i on for list of items

(/ (apply "+ (mapcar #" ( 1 ambda (w)

(* (car (fget-v-d-p w "relative-weight))

(car (fget-v-d-p w " heat-of-combust i on )))

)

y) ) (apply "+ (mapcar #" ( 1 ambda (w)

(car (fget-v-d-p w "relative-weight)))

y) ) ) )

; We need a list of all packages and their slopes. We can use

; "fastest-flash-pack y" to add the slope to "sum-packages y"

(defun packs-slope (y) ; ( f astest-sl ope sum-DQmax fuel-pack)

(mapcar #" ( 1 ambda (w) ; for flashover packages

(cons ( 1 i st-f astest-sl ope (cdr w)

)

w) ) (sum-packages y) )

)

(defun t i me- to-tox i c4 (y) ; time to toxic for each package

(mapcar #" ( 1 ambda (w)

(cons ; cons the time to toxic hazard with package

( our-cube-r oot (/ (* 3

(weigh t-average-heat-of-combust i on

( cddr w)

)

41
3 ; this is the "r" -factor in our eq . (we i gh t-average-LC50 <cddr w) ) .5 ; the volume o-f interest is

(vol ume-m) ) ; half the total

(si ope (car w) ) )

)

(cddr w))) ; the package

(packs-slope y)))

51 The room and occupant's conditions may change the time to toxic

;; condition but will not change the relative sizes for each fuel

; ; package

.

(defun t i me- to- tox i c3 (y) ; minimum time to toxic conditions for

normal person

(apply 'min (mapcar tt'car ( t i me- to- tox i c4 y) ) ) ) (defun toxic-pack (y) ; list the package that gets to toxic hazard

first

(cdr (assoc ( t i me- to- tox i c3 y) ( t i me- to-tox

i

c4 y) ) )

)

(defun window-area (y)

(* (car (fget-v-d-p 'room

(car (fget-v-d-p 'room

(defun door-area (y)

(* (car (fget-v-d-p 'room

(car ( f ge t-v-d-p 'room

(car ( f ge t-v-d-p 'room

'w i ndow-he i gh t-open i ng) ) ' w i ndow-w i dth-open i ng) ) )

)

' door-he i gh t )

)

' door-w i dth )

)

' f r ac t i on -door -open ) ) )

)

(defun t i me- to- tox i c 1 (y) ; adjustments due to venting and

; en v i r onmen

t

(cond ((> (window-area y)

(* 16 .3048 .3048)) ; converting 16 sq ft into m

A 2

100000.0) ; window area > 16 sq ft, never become toxic

((and (> (+ (window-area y) (door-area y))

(* 16 .3048 .3048))

(equal 'y (car (fget-v-d-p 'room '

i n-b

i

g-bu i 1 d i ng) ) )

)

100000.0) ; in big building & venting > 16 sq ft

((< (door-area y) .0001) ; door is closed if opening < 1 cm~2

(/ ( t i me- to-tox i c3 y)

(- 1 (/ (window-area y)(* 16 .3048 .3048)))))

((equal 'y (car (fget-v-d-p 'room 'in-big-building))) ; large

(/ ( t i me- to-tox i c3 y)

(- 1 (/ (+ (window-area y) (door-area y))

(* 16 .3048 .3048)))))

(( > (door-area y) (* 16 .3048 .3048))

(/ (* 1.44225 ( t ime-to-tox i c3 y) ) ; 3^1/3

(- 1 (/ (window-area y)(* 16 .3048 .3048)))))

(t (/ (* (+ 1 (* (/ (door-area y)(* 16 .3048 .3043))

(- 1 .44225 1 ) ) ) ; 3^ 1/3 - 1

( t i me- to- tox i c3 y))

(- 1 (/ (window-area y)(* 16 .3048 .3048)))))))

(defun t i me- to- tox i c (y) ; takes into account lung-heart condition

42
; & drunkness

(cond ((or (equal 'y (car (fget-v-d-p 'occupant 'heart-lungcon d i t i on ) )

)

(equal 'y (car (fget-v-d-p 'occupant 'drunk))))

(/ ( t i me-to-tox i c 1 y) (our-cube-root 3)))

(t ( t i me- to-tox i c 1 y))))

(defun driver (y) ; returns the fuel package that leads to the 1st

; hazard

(let ((w ( t i me-to-f 1 ashover y))

(v ( t i me-to-tox i c y)))

(cond ((> w v

)

(toxic-pack y )

)

( ( < w v

)

(name-pack-flash y)

)

( t nil))))

;; problem must use slope of package that will lead to hazardous

; ; conditions first

(defun t i me- to-de tec t i on (y power) ; time for an awake occupant to

; detect a fire without a detector

(cond ((> power 9000.0) 100000.0) ; default power to give

; default time

(t (our-sqrt (/ power (slope ( 1 i st-f astest-sl ope (driver

y) )))))))

(defun t i me-to-awar eness-de tec tor (y)

(let ((k ( 1 i st-f astest-sl ope (driver y))))

(cond ((equal 'very-fast k) 15)

((equal 'fast k) 30)

((equal 'moderate k) 50)

((equal 'slow k) 100)

(t 100000.0))))

(defun t i me-to-hazard (Y)

(let ((w ( t i me- to-f 1 ashover y))

(v ( t i me- to-tox i c y)))

(cond ((> w v) v)

( t w) ) )

)

(defun cal - 1 i me-to-escape (y)

(cond

((and (equal 'y (car (fget-v-d-p 'occupant 'awake)))

(equal 'n (car (fget-v-d-p 'occupant 'drunk)))

(equal 'y (car (fget-v-d-p 'occupant 'mobile))))

(+ ( t i me- to-de tec t i on y 25) ; time to detect fire

(car (fget-v-d-p 'occupant ' t i me-to-escape ))) ) ; travel

; time

((and (equal 'n (car (fget-v-d-p 'occupant 'drunk)))

(equal 'y (car (fget-v-d-p 'room 'detector)))

(equal 'y (car (fget-v-d-p 'occupant 'mobile))))

(+ ( t i me- to-awareness-de tec tor y)

(car (fget-v-d-p 'occupant ' t i me-to-escape )))

)

43
<t ( +

can't get

( t i me- to-awar eness-de tec tor y)

(car (fget-v-d-p 'occupant 'rescue-time))))))

; out, use rescue time +

i f he

(defun t i me-to-escape-d (frame slot)

(fput frame slot 'value

( cal -t i me- to-escape f $f )

)

(fget-v-d-p frame slot))

(defun t i me- to-escape-d (frame slot) ; travel time to escape

(fput frame slot 'value

(+ (car (fget-v-d-p 'room 'length))

(car (fget-v-d-p 'room 'width))))

(fget-v-d-p frame slot)) ; we had to add this or the 1st time we

cal led

; this

(defun marg i n-of-saf e ty (Y)

(- ( t i me-to-hazar d y) ( cal -t i me-to-escape y)))

(defun ex t-r escue- t i me (y)

(cond ((equal 'y (car (fget-v-d-p 'occupant 'external -aid)))

(cond ((equal 'y (car (fget-v-d-p 'room 'detector)))

(+ ( t i me-to-awareness-de tec tor y) 30))

(t 300)))

(t 100000.0)))

(defun ex t-r escue-t i me-d (frame slot)

(fput frame slot 'value

( ex t-rescue- t i me f$f))

(fget-v-d-p frame slot))

44
;

i npu t j r2

(de-fun framass <) ; produces assertions from all our frames

(framasso 'occupant)

(framassr 'room))

(defun framasso (frame) ; produces assertions from a occupant

; frame

(setq assertions (append assertions

'((It will take ,(car (fget-v-d-p frame ' t i me- to-escape )

)

seconds for the

, frame to escape the room)

(The , frame i

s

, (cond ((equal (car (fget-v-d-p frame 'awake)) 'y) 'awake)

(t 'asleep)))

(The , frame i

s

, (cond ((equal (car (fget-u-d-p frame 'mobile)) 'y) 'mobile)

( t ' nonmob i 1 e ) )

)

(The , frame i

s

, (cond ((equal (car (fget-v-d-p frame 'drunk)) 'y) 'drunk)

( t ' sober ) )

)

(The , frame has

,(cond ((equal (car (fget-u-d-p frame 'heart-lungcondition)) 'n)

'n)

(t 'a))

heart-lung condition)

(There is

,(cond ((equal (car (fget-v-d-p frame ' ex ter nal -a i d) ) 'y)

' someone

)

( t ' no-one )

)

to hel p) ) ) )

)

(defun framassr (frame) ; produces assertions from a room

; frame

(setq assertions (append assertions

' ( (The room

,(cond ((equal (car (fget-v-d-p frame 'detector)) 'y)

' has-a-de tec tor

)

(t ' does-not-have-a-de tec tor ) )

)

(The length of the , frame is ,(car (fget-v-d-p frame 'length))

meters)

(The width of the , frame is ,(car (fget-v-d-p frame 'width))

meters)

(The height of the , frame is ,(car (fget-v-d-p frame 'height))

meters)

(The door -width of the , frame is

,(car (fget-v-d-p frame 'door-width)) meters)

(The door-height of the , frame is meters

,(car (fget-u-d-p frame ' door -h e i gh t ) ) meters)

(The fraction the door is openned

,(car (fget-u-d-p frame ' f r ac t i on-door-open ) )

)

(The width of the window opening of the , frame is

,(car (fget-v-d-p frame 'window-width-opening)) meters)

45
(The height of the window opening of the , frame is

,(car (fget-v-d-p frame ‘'window-height-opening)) meters)))))

(defun reset-values (frame slot) ; removes the value of the

"value" facet

(fremove frame slot 'value (car (fget frame slot 'value))))

(defun rese t-val ues-al 1 (frame)

(mapcar #'(lambda (y) (reset-values frame y))

(list-slots frame)))

(defun list-slots (frame) ; produces a list of all the slots of

this frame

(mapcar 'car (cdr (get frame 'frame))))

(defun re set -a 11 () ; f removes all values

(mapcar #' ( 1 ambda (w) (mapcar #' ( 1 ambda (y) (reset-values w y))

(1 ist-slots w)))

'(bed chest chair table wastebasket cur ta i ns-dr apes

occupant room)))

(defun request-values ()

( r equest-val uesf 'bed)

( request-val uesf 'chair)

( request-val uesf 'chest)

( request-val uesf 'table)

( request-val uesf 'wastebasket)

(request -value sf 'curtai ns-dr apes)

(request -value so 'occupant)

(request -valuesr 'room))

request values for all our frames

(defun messagel ()

( ter pr i )

( terpr i ) (princ '(It will take a few minutes to compute the

r esu 1 ts)

)

( ter pr i )

( ter pr i ) (princ N

! Wh i 1 e you are waiting, let me explain very

br i ef 1 y what !

)

( terpr i

)

(princ >!I am doing. I first use the "will-ignite"

i nf ormat ion to !

)

( ter pr i ) (princ s

! compute all the fuel packages in the room and

their peak!)

( terpr i ) (princ '[burning rates and initial slopes. I then

de term i ne if!)

( terpr i ) (princ ' ! the room will flashover. If it will, the time

to ! )

( t e r p r i )

46
(princ '[flashover is computed. For a normal person, I assume a 1

)

< terpr i ) <princ '[toxic condition exists whenever the average

concentration of ! )

< ter pr i ) <princ '[burned material produces a concentration in all

the 1 )

< terpr i ) (princ '[space accessible to the smoke of 1.5 times the

! )

( terpr i ) (princ '[average LC50 of the burning materials. The time

to a ! )

< terpr i ) (princ ' ! hazardous condition is the smaller of the time to

! )

( terpr i ) (princ ' ! f 1 ashover or the time to a toxic hazard. You

e i ther ! >

( ter pr i ) (princ '

1 prov i de me with the time of escape or rescue, or

I ! )

( terpr i ) (princ 'Swill compute them. Finally, the margin of safety

is!)

( terpr i ) (princ 'Scomputed. It is the difference between the time

to ! )

( terpr i ) (princ 'Shazard and the escape or rescue time. Then, based

on ! )

( ter pr i ) (princ '[rules provided by H. Nelson, I will draw a conclusion!

)

( terpr i ) (princ '[about the risk level to which the occupant is

exposed . !

)

( ter pr i )

( terpr i ) (princ '[After I wan t !

)

( ter pr i ) (princ '!to know

( terpr i ) (princ '

!

( terpr i ) (princ '[where N

( terpr i )

)

(defun message2 ()

(princ '!Do you want to change any of the parameters in the

status report? If you do,!)

( terpr i )

have finished, I will print a"T" . If you

why I drew any conclusion I did, type !)

(whyjr "identifyN) !)

is the number given.!)

47
<princ s [enter the item number and then either the associated

letter or X <ret> fori)

< terpr i ) (princ s !all the par ame ters . I f you enter X <ret> and p for any

value, you will get the!)

< terpr i ) (princ '! default value for that parameter.To pass the rest, type

"p" <ret> "p" <r e t > . !

)

( terpr i )

)

(defun request-val ues2-al 1 <n) ; used to change all values for a frame n (cond ((equal n 1) (reset-val ues-al 1 'bed)

(request-val uesf ' be d)( request -value s2))

((equal n 2) ( rese t-val ues-al 1 'chair)

(request-val uesf ' cha i r) (request-val ues2)

)

((equal n 3) ( rese t-val ues-al 1 'chest)

(request-val uesf 'chest) (request-val ues2)

)

((equal n 4) ( rese t-val ues-al 1 'table)

(request -value sf 'table)(request-values2))

((equal n 5) ( rese t-val ues-al 1 'wastebasket)

(request-val uesf ' was te bask e t) (request-val ues2) ) ((equal n 6) ( rese t-val ues-al 1 'curtai ns-drapes)

(request -value sf 'curtai ns-drapes) (request-val ues2)

)

((equal n 7) ( rese t-val ues-al 1 'occupant)

(request -value so 'occupant) (request-val ues2) ) ((equal n 8) ( rese t-val ues-al 1 'room)

(request-val uesr ' room) (request-val ues2) ) )

)

(defun request-val ues2 () ; request values for all our frames

( status)

(message2)

(let ((n (read))

(m (read)))

(cond ((equal n ' p ) (message 1 )

)

((equal m 'x) ( request-val ues2-al 1 n))

(t (change n m) ( request-val ues2) )))

)

(defun add-value (frame slot)

(let ((y (read)))

(cond ((equal 'p y) 'pass)

((equal slot 'w i 1 1 - i gn i te

)

(cond ((or (equal y 'bed)(equal y

s cha i r )( equal y

'chest

)

(equal y ' tabl e )( equal y 'wastebasket)

(equal y ' cur ta i ns-drapes) ) (fput frame slot 'value y))

(t (reset-values frame slot)))

( ter pr i ) (princ ' I I f you do not want to add anymore items to the

will-ignite list type pi)

( ter pr i ) (add-value frame slot))

((not (equal frame 'room)) (fput frame slot 'value y ) )

48
((or (equal slot ' frac t i on-door-open

)

(equal slot 'detector-)

(equal slot 'in-big-building)

(equal slot ' d i m-me ter-f ee t ) ) ( f pu t frame slot 'value

y))

(t (fput frame slot 'value (/ y (metric)))))))

(defun request -valuesf (frame) ; request values for a furnishing

frame

(print s (The initial slope of burning of the , frame is - zero

si ow moderate

fast or very-fast))

(add-value frame ' i n i t i al -si ope-of -burn

)

(print '(The peak rate of burning of the , frame is -in kW))

(add-value frame ' peak-r ate-of -burn

)

(print '(List the items the , frame will ignite))

(add-value frame ' w i 1 1 - i gn i te

)

(print '(The heat of combustion of the , frame in KJ/g is?))

(add-value frame ' heat-of -combust i on

)

(print '(The , frame LC50 value is in mg/1 or g/rr/3?)

)

(add-value frame 'LC50))

(defun request-val ueso (frame) ; request values for a occupant

frame

(print '(The , frame is awake- y or n?))

(add-value frame 'awake)

(print '(The , frame is mobile- y or n))

(add-value frame 'mobile)

(print '(Is the , frame drunk?))

(add-value frame 'drunk)

(print '(Does the , frame have a heart or lung condition?))

(add-value frame 'heart-lung-condition)

(print '(Is there someone outside the room that can come to the

aid of

the , frame - y or n))

(add-value frame ' ex ternal -a i d)

(print '(How many seconds will it take for the , frame to travel

ou t of

the room?)

)

(add-value frame ' t i me- to-escape

)

(print '(How many seconds will it take for the person outside

the room

to travel into the room and take the occupant out?))

(add-value frame 'rescue-time))

(defun m-or-f (

)

(cond ((equal 'm (car (fget-v-d-p 'room 'dim-meter-feet)))

'meter)

(t 'feet)))

(defun request-val uesr (frame) ; request values for a room frame

4?
(print "(The dimensions are in feet (f) or meters (m)? - f or

m?)

)

(add-value frame ' d i m-me ter-f ee t

)

(print '(The length of the , frame is ? ,(m-or-f)?))

(add-value frame 'length)

(print '(The width of the , frame is ? ,(m-or-f>?))

(add-value frame 'width)

(print '(The height of the , frame is ? ,(m-or-f)?))

(add-value frame 'height)

(print '(The width of the door of the , frame is ? ,(m-or-f)?))

(add-value frame 'door-width)

(print '(The height of the door of the , frame is ? ,(m-or-f)?))

(add-value frame 'door-height)

(print '(The fraction the door of the , frame is openned?) ) (add-value frame 'fraction-door-open)

(print '(The width of the window opening of the , frame is ? , (mor-f )?)

)

(add-value frame 'window-width-opening)

(print '(The height of the window opening of the , frame is ?

, (m-or-f ) ?)

)

(add-value frame 'window-height-opening)

(print '(The , frame has a fire detector - y or n))

(add-value frame 'detector)

(print '(The , frame is in a large building or no building - y or

n ) )(add-value frame 'in-big-building))

(defun input ()

(princ 'IType any letter and "return" to continue, i)

(read)

( ter pr i )

( terpr i ) (status)

(print '(Do you want to input data instead of using default

data? Y or N)

)

(cond ((equal 'y (read)) ( request-val ues2)

)

( t (message 1 ) ) )

)

(defun t i me-to- tox i c-asser t i on (y)

(setq t$t ( t i me- to- tox i c y)

)

(setq tp$tp (toxic-pack y)

)

(princ '(The room will be toxic with the fuel package

, tp*tp

burn i ng in

, t$t seconds)

)

( terpr i ) (setq assertions (append assertions

'((The room will be toxic with the fuel package

, tp*tp

burning in

, t$t seconds) )))

)

(dtfun thomas-f 1 ashover-package (y) ; produces assertion about the

; room flashing over

50
(setq o$o < t i me-to-f 1 ashoyer y))

(cond (( f 1 ash-packs y)

<princ '((The room will flashover with the fuel package

, ( name-pack—f 1 ash y)

burning in

, o$o seconds) )

)

(setq assertions (append assertions

'((The room will flashover with the fuel package

, ( name-pack-f 1 ash y)

burning in

,o$o seconds)))))

(t (setq assertions (append assertions

'((The room will not flashover with the biggest fuel

package

( pr i nc

fuel package

burning))))

'((The room will not flashover with the biggest

burning ,(cdr (max-pack y)) at a maximum power of

, (car (max-pack y) ) KW)

(The power needed for flashover is

, ( thomas-f 1 ashover-power ) KW) ) ) ) )

)

(defun f 1 ash-or- tox i c (y)

(princ '(The time to a hazardous condition is

,(cond ((> o$o t$t)

t*t)

(t o$o)) seconds))

( terpr i

)

( ter pr i ) (princ '(The hazardous conditions are due to

, (cond ((> o$o t$t)

' due- to- tox i c -gases)

(t ' due- to-f 1 ashover ) ) )

)

( terpr i

)

( ter pr i ) (princ '(The occupant will need , ( cal -t i me- to-escape y) seconds

to escape from the room))

( terpr i

)

( terpr i ) (princ '(Therefore the margin of safety for the occupant to

escape harm i s , (marg i n-of-saf e ty y) seconds))

( ter pr i )

( terpr i ) ) (defun f 1 ash-or-tox i c-ass (y)

( cond ( ( > o$o t$t

)

(setq assertions (append assertions

'((The time to flashover is greater than the time to

toxic hazard)))))

(t (setq assertions (append assertions

'((The time to toxic hazard is greater than the time to

f 1 ashover )))))))

(defun marg i n-of-saf e ty-ass (y) ; fast version

51
<setq m$m (marg i n-of-saf e ty f$f))

(cond ((> ( t i me-to-hazard y) 99000.0)

(setq assertions (append assertions

'((The room never becomes hazardous)))))

( ( < m$m 0

)

(setq assertions (append assertions

'((The margin of safety is negative)))))

((> m*m 300)

(setq assertions (append assertions

'((The margin of safety is greater than five

minutes)))))

( ( < m$m 60

)

(setq assertions (append assertions

'((The margin of safety is less than one minute)))))

((> m*m 60)

(setq assertions (append assertions

'((The margin of safety is greater than one minute

and less than five minutes)))))

( t nil)))

(defun mar g i n-saf -evacuate-r at i o-assx (y) ;sl ow version

(cond ((> (/ (mar g i n-of -safe ty y) ( cal -t i me-to-escape y)) 2)

(setq assertions (append assertions

'((The ratio of the mar g i n-of -safe ty time to the

escape-time is greater than two)))))

((> (/ (marg i n-of -safe ty y) ( cal -t i me-to-escape y)) 1)

(setq assertions (append assertions

'((The ratio of the mar g i n-of-saf

e

ty time to the

escape-time is greater than one and less than

two) ) ) )

)

((> (/ (mar g i n-of -safe ty y) ( cal -t i me-to-escape y) ) 0)

(setq assertions (append assertions

'((The ratio of the marg i n-of -safe ty time to the

escape-time is less than one)))))

(t '((The ratio of the marg i n-of-saf

e

ty time to the escapetime is

negative)) nil)))

(defun marg i n-saf -evacuate-r at i o-ass (y) ; fast version

(setq e$e ( cal -t i me-to-escape f$f))

(cond ((> (/ m$m e$e) 2)

(setq assertions (append assertions

'((The ratio of the marg i n-of -safe ty time to the

escape-time is greater than two)))))

( ( > (/ m$m e$e ) 1

)

(setq assertions (append assertions

'((The ratio of the marg i n-of -safe ty time to the

escape-time is greater than one and less than

two) ) ) )

)

( ( > (/ m*m e*e) 0)

(setq assertions (append assertions

'((The ratio of the mar g i n-of -safe ty time to the

escape-time is less than one)))))
(t M(The ratio o-f the marg i n-o-f-sa-f e ty time to the escapetime is

negative)) nil)))

(de-fun change (x y)

(cond ((equal x 1) (change2 'bed y)

)

((equal x 2) (change 2 'chair y))

((equal x 3) (change2 'table y)

)

((equal x 4) (change2 'chest y)

)

((equal x 5) (change2 'wastebasket y)

)

((equal x 6) (change2 ' cur ta i ns-dr apes y)

)

((equal x 7) (change2 'occupant y))

((equal x 3) (change2 'room y) ) )

)

(de-fun change2 (z y)

(cond ((or (equal z 'bed)(equal z ' cha i r )( equal z ' tabl e )( equal

z 'chest)

(equal z 'wastebaske t )( equal z 'curtai ns-drapes)

)

(cond ((equal y 'AMchangel

((equal y 'BMchangel

((equal y 'CMchangel

((equal y 'DMchangel

((equal y 'EMchangel

((equal z 'occupant)

(cond ((equal y 'AMchangel

((equal y 'BMchangel

((equal y 'CMchangel

((equal y 'DMchangel

((equal y 'EMchangel

((equal y 'FMchangel

((equal y 'GMchangel

(( equal z 'room)

(cond ((equal y 'AMchangel

((equal y 'BMchangel

((equal y 'CMchangel

((equal y 'DMchangel

((equal y 'EMchangel

((equal y 'FMchangel

((equal y 'GMchangel

((equal y 'HMchangel

((equal y 'IMchangel

((equal y 'JMchangel

((equal y 'KMchangel

z ' peak-rate-o-f-burn ) ) z ' heat-o-f-combust i on )

)

z ' LC50 )

)

z ' i n i t i al -si ope-o-f-burn )

)

z 'will-ignite))))

z 'awake))

z 'mob i 1 e )

)

z 'drunk )

)

z 'heart-lung-condition))

z 'external -a id))

z ' t i me- to-escape )

)

z ' rescue- t i me )))

)

z 'detector))

z 'length))

z 'width))

z 'height))

z ' door-he i gh t )

)

z ' door-w i dth )

)

z

'

-f rac t i on-door-open ) ) z 'window-width-opening))

z 'window-height-opening))

z 'in-big-building))

z ' d i m-me ter-f ee t ) ) ) ) )

)

(de-fun changel (x y)

( terpr i ) (cond ((not (equal x 'room))

(princ MOld value was ,(car (-fget-v-d-p x y ))))

( terpr i ) (fremove x y 'value (car (-fget x y 'value)))

(princ 'IWhat is new value?!)

( ter pr i ) (fput x y 'value (read)))

((or (equal y 'detector)
(equal y ' frac t i on -door-op en ) (equal y ' i n-b i g-bu i 1 d i ng)

(equal y ' d i m-me ter-f ee t )

)

(princ s (01d value was ,(car (-fget-v-d-p x y ))))

( terpr i

)

(fremove x y 'value (car (fget x y 'value)))

(princ N !What is new value?!)

( ter pr i

)

(fput x y 'value (read)))

(t (cond ((equal 'm (car (fget-v-d-p x 'dim-meter-feet)))

(princ s (01d value was ,(car (fget-v-d-p x y ))))

( terpr i

)

(fremove x y 'value (car (fget x y 'value)))

(princ s !What is new value?!)

( terpr i

)

(fput x y 'value (read)))

(t (princ s (01d value was ,(* (metric)

(car (fget-v-d-p x y )))))

( terpr i ) (fremove x y 'value (car (fget x y 'value)))

(princ s !U)hat is new value?!)

( terpr i

)

(fput x y 'value (/ (read) (metric))))))))

54
; -f i 1 e status

(defun header ( >

< pr i nc " 1 E! )

( t e r p r i )

< pr i nc " ! f urn i sh i ng

will-ignitei))

(defun statusfl (y)

B

peak h.-of-comb. LC50 i n i t i al -si ope

( terpr i ) (cond ((equal

( ( equal y

(( equal y

(( equal y

((equal y

( ( equal y

y ' bed) ( pr i nc

'chair) ( pr i nc

'table) (princ

'chest) (princ

'wastebasket ) ( pr i nc

' cur ta i ns-dr apes) (princ

" ! 1 s 12

" 13

" 1 4

Bed

Chair

Tabl e Chest

' 15 .

1 ) )

1 )

)

1 )

)

1 ) Wastebaske t '16. Cur ta i n-

)

)

) ) )

)

(de-fun status-f (y)

(status-fl y)

(princ (car (fget-v-d-p y ' peak-rate-o-f-burn ) )

)

(cond ((or (equal y 'bed)(equal y 'wastebaske t )( equal y 'chest))

(princ " 1 !))

( t ( pr i nc " 1 !)))

(princ (car (fget-v-d-p y

' heat-o-f-combust i on ) )

)

( pr i nc " 1 1 ) (princ (car (-fget-u-d-p y 'LC50)))

( pr i nc x

1 1 ) (princ (car (fget-v-d-p y ' i n i t i al -si ope-of-burn ) )

)

(cond ((or (equal (car (fget-v-d-p y ' i n i t i al -si ope-of-bur n )

)

' s 1 ow

)

(equal (car (fget-v-d-p y

' i n i t i al -si ope-o-f-bur n )

)

'fast) )(princ"! 1 ) ) (t (princ s

! !)))

(princ (-fget-v-d-p y

' w i 1 1 - i gn i te ) ) )

(de-fun status-f-al 1 (header

)

( status-f

(status-f

( status-f

( statusf

(status-f

(statusf

( terpr i )

( terpr i )

)

( )

'bed)

'chair)

' table)

'chest

)

'wastebasket

)

' cur ta i ns-dr apes)

( defun headero (

)

(princ "17. Occupant!)

( ter pr i ) (princ"!A B C D E F

G! )

( terpr i ) 55
(princ '

! awake mobile drunk heart-lung external-aid timeto-es r escue- t i me !

)

(terpri))

( defun statuso (

)

( headero)

(princ \ 11 ! ) (princ (car ( f ge t-u-d-p 'occupant ' awake ) )

)

(princ \ l

l ! ) (princ (car ( f ge t-v-d-p 'occupant 'mob i 1 e ) )

)

(princ \ 11 ! ) (princ (car ( f ge t-v-d-p 'occupant 'drunk)))

(princ \ 1

1 ! ) (princ (car ( f ge t-v-d-p ' occupan t ' hear t-1 ung-cond i t i on ) )

)

(princ \ 1l ! ) (princ (car ( f ge t-v-d-p 'occupant 'external -ai d) )

)

( pr i inc ' ! ! ) (princ (car ( f ge t-u-d-p 'occupant ' t ime-to-escape) )

)

(princ ' ! ! ) (princ (car ( f ge t-v-d-p 'occupant 'rescue-t ime) )

)

(terpri))

(defun headerrl ()

(cond ((equal 'm (car (fget-v-d-p 'room ' d i m-me ter-f ee

t

) ) ) (princ '!3. ROOM - dimensions in meters!))

(t (princ "18. ROOM - dimensions in feet!)))

( terpr i ) (princ '! A B

G! )(terpri)

(princ 'idetector length

width fraction-open!)

(terpri))

(defun headerr2 ()

(princ'! H

( terpr i ) (princ ' ! w i ndow-w i dth window-height in-big-bldg dim-m-f!)

(terpri))

( defun metric ( ) (cond ((equal 'm (car (fget-u-d-p 'room 'dim-meter-feet) ) ) 1.0)

(t (/ 100 (* 2.54 12)))))

(defun statusr ()

( headerr 1

)

(princ ' ! ! ) (princ (car (fget-u-d-p 'room 'detector)))

(princ

(princ

\ l

( (*

! ) (metr i c) (car ( f ge t-v-d-p ' room '

1 ength) ) )

)

(princ

(princ

\ 1

1 (*

! ) (metr i c) (car ( f ge t-v-d-p ' room 'width)) )

)

(princ

(princ

\ 1

1

< *

! ) (me tr i c ) ( car ( f ge t -v — d—

p

' room 'height))))

C D E F

width height door-height doorI J K! )
(pr i nc '

! !

)

(princ (* (metr i c) (car

(princ'! ! ) (princ (* (metr i c) (car

(princ'! ! ) (princ (car (fget-u-d-p

( terpr i

)

( headerr2)

(princ s! ! ) (princ (* (metr i c) (car

opening))))

(princ'! ! ) (princ (* (metr i c) (car

open i ng) ) )

)

(princ ' i (princ (car (fget-v-d-p

(princ'! ! (princ (car (fget-v-d-p

(terpri))

(fget-v-d-p "room "door-height))))

(fget-v-d-p "room "door-width))))

"room " frac t i on-door-open ))

)

(fget-u-d-p "room "window-width-

(fget-u-d-p "room "window-height-

! )"room "in-big-building)))

) "room " d i m-me ter-f ee t ) )

)

(defun status ()

(princ '!The present status of the room is:!)

(terpri)

( terpr i ) (statusf-al 1

)

( statusr

)

( statuso)

)

57
; whyjr

(de-fun whyjr (rule)

(car (remove nil (mapcar #" ( 1 ambda (w)

(cond ((equal rule (cadr w)

)

(cdr (caddr w)))

( t nil)))

rules))))

58
|i»C.I1iA (REV- 2*6C1_

.S. OEPT. OF COMM.

bibliographic data

SHEET (See in structions)

1. PUBLICATION OR

REPORT NO.

NBSIR-86/3319

2. Performing Organ. Report No. 3. Publication Date March 1986

4. TITLE AND SU BTITLE

ASKBUDJr : A Primitive Expert System for the Evaluation of the Fire

Hazard of a Room

5 . AUTHOR(S) . Richard L. Smith

S. PERFORMING ORGANIZATION (If joint or other than NBS, see instructions)

NATIONAL BUREAU OF STANDARDS

DEPARTMENT OF COMMERCE

Gaithersburg, MD 20 899

7. Contract/Grant No.

S. Type of Report & Period Covered

!. SPONSORING ORGANIZATION NAME AND COMPLETE ADDRESS (Street, City, State, ZIP)

SUPPLEMENTARY NOTES

| | Document describes a computer program; SF-185, FIPS Software Summary, is attached. .ABSTRACT (A 200-word or less factual summary of most significant information. If document includes a significant

bibliography or literature survey, mention it here)

The Center for Fire Research (CFR) has a long term project to develop expert systems

as a technology transfer mechanism. CFR has as the long term goal of this project:

to develop a computer program which will make an expert estimate of the fire safety

of a building based on CFR' s deterministic physical models, technical data, and

the expert judgment of its staff. The first major program to be developed by this

project is based on the expertise of Harold E. (Bud) Nelson. Thus, this program

will be called ASKBUD. In this report, the first exploratory steps taken to develop

an expert system for fire hazard evaluation are described. Also, the progress made

to date, as well as some of the major problems that must be solved, will be discussed

Since the ASKBUD expert system discussed in this report is in its infancy, we

call it ASKBUDJr.

12. KEY WORDS (Six to twelve entries; alphabetical order; capital'/ ze only proper names; and separate key words by semicolon s)

Artificial intelligence; computer programs; expert systems; fire safety;

fire hazards

(a^•availability

H Unlimited Q For Official Distribution. Do Not Release to NTIS

Order From Superintendent of Documents, U.S. Government Printing Office, Washington, D.C.

20402. 0 O f der From National Technical Information Service (NTIS), Springfield, VA. 22161

14. NO. OF

PRINTED PAGES

64

15. Price

$ 11.95

U SC OMM- DC 8043-PS0
.

.