📄 wxsys-25.txt
字号:
(steady (pi 0.5 0)) (falling (z -3.5 0)) (rising (s 0 3.5)) (falling-slowly (pi 1.0 -1.0)) (rising-slowly (pi 1.0 1.0)) )) ;**********;Rule to determine the (fuzzy) trend in barometric pressure.;**********(defrule determine-barometric-pressure-trend (current-barometric-pressure ?current) (earlier-barometric-pressure ?earlier) => (bind ?difference (- ?current ?earlier)) (fuzzify-trend ff-barometric-pressure-trend ?difference 0.02));**********;Template to hold the (fuzzy) trend in cloud cover.;**********(deftemplate ff-cloud-cover-trend -100 100 percent ;range of possible change in cloud cover ( (decreasing (z -10 -5)) (increasing (s 5 10)) (steady (pi 6 0)) ));**********;Rule to determine the (fuzzy) trend in cloud cover. Note that;we "defuzzify" the two cloud-cover trend facts to get a crisp;value, then use that crisp value with fuzzify-trend to generate;a fuzzy value describing the trend (e.g. "cloud-cover decreasing").;**********(defrule determine-cloud-cover-trend ?f1 <- (ff-current-cloud-cover ?) ?f2 <- (ff-earlier-cloud-cover ?) => (bind ?current (moment-defuzzify ?f1)) (bind ?earlier (moment-defuzzify ?f2)) (bind ?difference (- ?current ?earlier)) (fuzzify-trend ff-cloud-cover-trend ?difference 5.0));**********;Template to hold the (fuzzy) trend in primary cloud base level.;**********(deftemplate ff-primary-cloud-base-trend -70 70 Kfeet ;range of possible change in cloud base height ( (decreasing (z -7 0)) (increasing (s 0 7)) (steady (pi 8 0)) ));**********;Rule to determine the (fuzzy) trend in primary cloud base height.;**********(defrule determine-primary-cloud-base-trend ?f1 <- (ff-current-primary-cloud-base ?) ?f2 <- (ff-earlier-primary-cloud-base ?) => (bind ?current (moment-defuzzify ?f1)) (bind ?earlier (moment-defuzzify ?f2)) (bind ?difference (- ?current ?earlier)) (fuzzify-trend ff-primary-cloud-base-trend ?difference 3.0));**********;Template to hold the (fuzzy) trend in wind speed.;**********(deftemplate ff-wind-speed-trend -150 150 mph ;range of possible change in wind speed ( (decreasing (z -15 0)) (increasing (s 0 15)) (steady (pi 8 0)) ));**********;Rule to determine the (fuzzy) trend in wind speed.;**********(defrule determine-wind-speed-trend ?f1 <- (ff-current-wind-speed ?) ?f2 <- (ff-earlier-wind-speed ?) => (bind ?current (moment-defuzzify ?f1)) (bind ?earlier (moment-defuzzify ?f2)) (bind ?difference (- ?current ?earlier)) (fuzzify-trend ff-wind-speed-trend ?difference 5));**********;Template to hold the (fuzzy) trend in wind direction.;**********(deftemplate ff-wind-direction-trend -259 259 degrees ;range of possible change in wind direction ( (backing (z -55 0)) (veering (s 0 55)) (steady (pi 45 0)) ));**********;Rule to determine the (fuzzy) trend in wind direction.;**********(defrule determine-wind-direction-trend ?f1 <- (ff-current-wind-direction ?) ?f2 <- (ff-earlier-wind-direction ?) => (bind ?current (moment-defuzzify ?f1)) (bind ?earlier (moment-defuzzify ?f2)) (bind ?difference (- ?current ?earlier)) (fuzzify-trend ff-wind-direction-trend ?difference 5.0));************************************************************; MODULE: FORECAST *;************************************************************;**********;Templates to hold the forecasts.;**********(defmodule FORECAST (import MAIN ?ALL) (import FUZZIFY ?ALL) (import DETERMINE-CHANGES ?ALL) (export ?ALL));**********;Template to hold the general trend forecast for the next 12 hours.;**********(deftemplate immediate-general-trend (slot forecast (allowed-values no-change-in-weather change-in-weather)));**********;Template to hold the detailed forecast for the next 12 hours.;**********(deftemplate immediate-detailed (slot forecast (allowed-values dry-period dry-period-ending wet wet-period-ending stormy-period stormy-period-ending)));**********;Template to hold the general trend forecast for the next 12-24 hours.;**********(deftemplate future-general-trend (slot forecast (allowed-values no-change-in-weather change-in-weather)));**********;Template to hold the detailed forecast for the next 12-24 hours.;**********(deftemplate future-detailed (slot forecast (allowed-values dry-period dry-period-ending wet wet-period-ending stormy-period stormy-period-ending)));**********;Forecasting rules.;**********(defrule forecast1"From [USA96]."; If the current wind is blowing from...; SW to NW; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; steady; then the weather will be.....; fair with little temperature change for 1 to 2 days. (or (ff-current-wind-direction southwest) (ff-current-wind-direction west) (ff-current-wind-direction northwest)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend steady) => (assert (immediate-detailed (forecast dry-period)) (future-detailed (forecast dry-period))))(defrule forecast2"From [USA96]."; If the current wind is blowing from...; SW to NW; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; rising rapidly; then the weather will be.....; fair followed within 2 days by rain.; Note that here we make use of the "rapidly" fuzzy modifier; (hedge) that we defined in "HEDGES.BAT." (or (ff-current-wind-direction southwest) (ff-current-wind-direction west) (ff-current-wind-direction northwest)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend rapidly rising) => (assert (immediate-detailed (forecast dry-period)) (future-general-trend (forecast change-in-weather)) (future-detailed (forecast dry-period-ending))))(defrule forecast3"From [USA96]."; If the current wind is blowing from...; SW to NW; and the current barometric pressure has the range...; 30.20 and above; and the current barometric pressure is...; steady; then the weather will be.....; continued fair, no marked temperature change. (or (ff-current-wind-direction southwest) (ff-current-wind-direction west) (ff-current-wind-direction northwest)) (current-barometric-pressure ?press) (test (>= 30.20 ?press)) (ff-barometric-pressure-trend steady) => (assert (immediate-general-trend (forecast no-change-in-weather)) (immediate-detailed (forecast dry-period)) (future-general-trend (forecast no-change-in-weather)) (future-detailed (forecast dry-period))))(defrule forecast4"From [USA96]."; If the current wind is blowing from...; SW to NW; and the current barometric pressure has the range...; 30.20 and above; and the current barometric pressure is...; falling slowly; then the weather will be.....; fair with slightly rising temperature for 2 days. (or (ff-current-wind-direction southwest) (ff-current-wind-direction west) (ff-current-wind-direction northwest)) (current-barometric-pressure ?press) (test (>= 30.20 ?press)) (ff-barometric-pressure-trend falling-slowly) => (assert (immediate-detailed (forecast dry-period)) (future-detailed (forecast dry-period))))(defrule forecast5"From [USA96]."; If the current wind is blowing from...; S to SE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling slowly; then the weather will be.....; rain within 24 hours. (or (ff-current-wind-direction south) (ff-current-wind-direction southeast)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend falling-slowly) => (assert (immediate-detailed (forecast wet)) (future-detailed (forecast wet))))(defrule forecast6"From [USA96]."; If the current wind is blowing from...; S to SE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling rapidly; then the weather will be.....; wind increasing, rain within 12 to 24 hours. (or (ff-current-wind-direction south) (ff-current-wind-direction southeast)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend rapidly falling) => (assert (future-general-trend (forecast change-in-weather)) (future-detailed (forecast wet))))(defrule forecast7"From [USA96]."; If the current wind is blowing from...; SE to NE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling slowly; then the weather will be.....; rain in 12 to 18 hours. (or (ff-current-wind-direction southeast) (ff-current-wind-direction east) (ff-current-wind-direction northeast)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend falling-slowly) => (assert (future-detailed (forecast wet))))(defrule forecast8"From [USA96]."; If the current wind is blowing from...; SE to NE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling rapidly; then the weather will be.....; increasing wind, rain within 12 hours. (or (ff-current-wind-direction southeast) (ff-current-wind-direction east) (ff-current-wind-direction northeast)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend rapidly falling) => (assert (immediate-detailed (forecast wet)) (future-detailed (forecast wet))))(defrule forecast9"From [USA96]."; If the current wind is blowing from...; E to NE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling slowly; then the weather will be.....; (winter) rain within 24 hours,; (summer) with light winds, rain may not occur for several days. (or (ff-current-wind-direction east) (ff-current-wind-direction northeast)) (current-barometric-pressure ?press) (test (>= 30.10 ?press)) (test (<= 30.20 ?press)) (ff-barometric-pressure-trend falling-slowly) (ff-season winter) => (assert (immediate-detailed (forecast wet)) (future-detailed (forecast wet))))(defrule forecast10"From [USA96]."; If the current wind is blowing from...; E to NE; and the current barometric pressure has the range...; 30.10 to 30.20; and the current barometric pressure is...; falling slowly; then the weather will be.....; (winter) rain within 24 hours,; (summer) with light winds, rain may not occur for several days. (or (ff-current-wind-direction east) (ff-current-wind-direction northeast))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -