Главная » Учебные материалы » Искусственный интеллект » Остальные учебные работы » МАИ » 8 семестр » Программное обеспечение к лаб. работе по курсу интелектуальные системы
Для студентов МАИ по предмету Искусственный интеллектПрограммное обеспечение к лаб. работе по курсу интелектуальные системыПрограммное обеспечение к лаб. работе по курсу интелектуальные системы 2017-06-17СтудИзба

Другое: Программное обеспечение к лаб. работе по курсу интелектуальные системы

Описание

Описание файла отсутствует

Характеристики учебной работы

Учебное заведение
Семестр
Просмотров
122
Скачиваний
5
Размер
16,35 Mb

Список файлов

  • Программное обеспечение к лаб. работе по курсу интелектуальные системы
  • CUBICALK
  • CATPOSN.100 2,85 Kb
  • CBCD2.DLL 28,09 Kb
  • CBCTUTOR.HLP 386,46 Kb
  • CIRCLE
  • CIRCLE.CBC 7,09 Kb
  • CIRCLE.C 4,39 Kb
  • CIRCLE.EXE 29,2 Kb
  • CIRCLE.H 996 b
  • CIRCLE.TXT 1,55 Kb
  • CIRCMAIN.C 6,35 Kb
  • CUBICALC.EXE 537,8 Kb
  • CUBICALC.HLP 198,89 Kb
  • CUBICALC.INI 292 b
  • DOGCAT.CBC 6,72 Kb
  • FRUITDAT.TXT 702 b
  • INVENT.CBC 9,95 Kb
  • MAGLEV.CBC 11,23 Kb
  • PICKER.CBC 6,53 Kb
  • PICKER0.CBC 5,11 Kb
  • README.TXT 17,87 Kb
  • TEXTS
  • CIRCLE.TXT 4,39 Kb
  • DOGCAT.TXT 3,25 Kb
  • INVENT.TXT 4,26 Kb
  • MAGLEV.TXT 5,91 Kb
  • PICKER.TXT 2,25 Kb
  • PICKER0.TXT 1,53 Kb
  • TRUCK.TXT 5,45 Kb
  • TRUCKXY.TXT 3,04 Kb
  • TRUCK.CBC 13,62 Kb
  • TRUCKXY.CBC 9,98 Kb
  • lab-track.doc 21 Kb
  • FUZZY
  • ALL.EXE 36,78 Kb
  • ALL.PAS 12,77 Kb
  • EGAVGA.BGI 5,4 Kb
  • README.BAK 4,43 Kb
  • README.TXT 6,13 Kb
  • SVGA256.BGI 5,25 Kb
  • VGA256.BGI 3,21 Kb
  • FUZZYV~1
  • EXE
  • ATT.BGI 6,12 Kb
  • CGA.BGI 6,11 Kb
  • EGAVGA.BGI 5,24 Kb
  • HERC.BGI 5,98 Kb
  • IBM8514.BGI 9,69 Kb
CIRCLE

"Circle" Example Program for CubiCalc RTC

This directory contains C source code and a pre-built executable for

a very simple example program illustrating use of the RTC object code

library functions. It was created with the CIRCLE.CBC project and

uses a "C" simulation similar to that in the project.

Files:

circmain.c - the main program

circle.c - RTC-generated data file

circle.h - RTC-generated data include file

circle.exe - the executable program

circle.txt - this file

The program performs all the basic operations needed to implement a

minimal fuzzy system. It can be compiled for either the 8-bit integer

libraries or the double-precision libraries. The generated files

included in this directory are for the 8-bit integer version.

The inference method options are: Product scaling, Sum combination, Do

not add rules with the same consequent, Centroid defuzzification,

Run-time Integer, Singleton outputs, Point list format for input

adjectives. Other options: Use a prefix of "Circ_" in generated

names, Do not emit rule activations, or Do not emit I/O ranges.

In this example, the generated data structures take less than 100 bytes,

which could reside in ROM. The RAM requirement to operate the fuzzy

engine is 25 bytes; this includes input and output arrays, parameters,

and scratch space. The ROM-able code space requirement for the inference

engine varies widely depending on the compiler used and whether a custom

inference engine is compiled from source code. In this example, the size

ranged from 1K to 1.5K.

FRUITDAT

# Color AR Size Fruit Name (ignored by CBC)

0.1 0.8 0.114 1 Apple

1.9 0.2 0.114 2 Banana

2.8 0.7 0.023 3 Grape

1.5 0.9 0.444 4 Grapefruit

2.2 0.75 0.076 5 Lemon

2.95 0.9 0.045 6 Lime

1.1 0.95 0.114 7 Orange

0.5 0.85 0.090 8 Peach

2.5 0.5 0.128 9 Pear

0.2 0.7 0.012 10 Strawberry

1.1 0.9 0.076 11 Tangarine

README

CubiCalc V2.0 Working Model

Demonstration Diskette

This is a "working model" demonstration of CubiCalc, an interactive

shell for using fuzzy rules. The working model lacks some features

of the full program, most notably the "Save" command. A complete

list of differences between the demo and the commercial version are

listed in a section below.

The demo requires Microsoft Windows 3.1 or a compatible environment,

such as Windows NT, Windows 95, or OS/2. It has minimal memory

requirements; if you can run Windows in any reasonable sense, you

can run CubiCalc. (Available memory determines the size of the system

you can create and run.) You can use the program without a mouse or

hardware floating point, but both are recommended.

You can run the demo directly from the floppy or you can copy all the

files to your hard drive. (The performance will be much better from

the hard drive.) If you do copy it, you can put it on any drive and

in any directory. To do this, create a directory and copy all the files

to it. If you are interested in using CubiCalc RTC for C programming,

copy the CIRCLE subdirectory on the disk too.

If you downloaded an archive from an on-line service, when you unpack

it into a directory, it will be as if you had copied it. The CIRCLE

subdirectory containing the programming example could be in a

separate subdirectory or not, depending on the archive format and

how you unpacked it.

To start the program, use the Windows "Run" command and choose the

file CUBICALC.EXE on the floppy or in the directory you made.

Begin your work with CubiCalc by choosing the "Help/Tutorial" menu

command. The on-line tutorial gives an overview of the program and

detailed walk-through descriptions of two example projects.

---------------------------------------- ------------------------------

NOTE

---------------------------------------- ------------------------------

If you copy the demo onto your hard drive or if your 3.5" floppy drive

is not "A:"

When you run the PICKER project, it will try to read its data file from

A:\FRUITDAT.TXT. You must use the "File/Input File" menu command to

change the location of the data file to the correct directory. This is

the only project in which a full file name is saved with directory

information.

If you run the demo from a write protected floppy:

CubiCalc uses a preferences file called "CUBICALC.INI" to save changes

you make using the Options/Settings... command. If it is on a write-

protected floppy disk, when you change preferences with the Settings

command, you will get an error message. The settings changes will

still be in effect, but they will not be saved in the INI file.

---------------------------------------- ------------------------------

Differences

---------------------------------------- ------------------------------

These are the differences between this demo and CubiCalc V2.0:

The demo version is a closed system in that you can't get anything

out of it other than to view what is on the screen. You can create

and run a system of your own design, but you can't save it. Also,

the working model refuses to load projects other than the specific

ones provided with the demo.

The following commands are disabled in the demo version:

File/Save - save the current project

File/Save As - save the project to a file you name

File/Print - print project definitions (including graphical

displays of adjectives), print plots, print

variable current values (including arrays),

File/Log File - set the name and directory for an output log

Edit/Copy - place selected text in the Windows clipboard, put

a copy of a plot, log, or adjective editor window

in the Windows clipboard

Edit/Cut - delete selection and place it in the Windows clipboard

Edit/Paste - insert Windows clipboard text

Options/Log To File - write log data to a disk file

Also, because the demo version does not allow saves, its behavior is different

if you exit or use the New or Open commands when the current project has been

changed. Instead of offering you a chance to save, it just warns that your

changes will be lost and gives you a chance to Cancel the command.

The following commands are present in other HyperLogic fuzzy products

above the CubiCalc level. None of these commands appears in the demo:

- CubiCalc RTC, an enhanced version for programmers with a run-time generator

Execute/Compile - for converting the project definitions into C

or creating a definition file for the run-time DLL

Options/Rule Evaluation - this dialog does not include the options

related to run-time generation, such as use of

singletons, integer vs. floating point, etc.

- CubiCard, an enhanced version with hardware support for data acquisition

Project/Hardware - for defining associations between hardware

I/O channels and CubiCalc variables

Options/Run Timing - for defining timing-related behavior as the

fuzzy controller runs

- Rule Maker, an add-on for automatically generating rules from data

Project/Rule Maker - starts the Rule Maker

If there is a particular feature you are looking for, please contact us

to find out if a more recent version of the program has it.

---------------------------------------- ------------------------------

Example Projects

---------------------------------------- ------------------------------

Dog vs. Cat (DOGCAT.CBC)

This scenario is discussed in detail in the online tutorial. The basic

idea is target tracking, described as a dog chasing a cat. It applies

equally well to all sorts of tracking problems.

If you just load and run the project, the "cat" runs across the top of a

plot field with the dog chasing. The project terminates when the cat

reaches the right hand edge.

The file CATPOSN.100 provides a source of positional data for the

cat and can be used in lieu of the simulation instructions

in the project file. To use it, do the following:

Load the project file DOGCAT.CBC.

To set up the file as an input source:

Select the File/Input File menu command.

Set the file name to "CATPOSN.100".

Set the file type to "Text".

Set the field count per record to "2". (Don't enter the quote marks.)

Set the lines per record count to "1".

Click OK.

Select Project/Preprocessing and type the following lines:

Cat_x = field(1);

Cat_y = field(2);

So that the project will keep running instead of stopping when

the end of the input file is reached, select Project/Postprocessing

and type the following line:

CIRCLE

file: CIRCLE.TXT

Rules for "Circle"

RATIONALE:

The problem is to drive a car in a circle.

Abstracted, the problem becomes a one-dimensional

tracking problem in the plane. Compare this example

with the "Dog vs. Cat" scenario, which is a variation

on the same theme.

The car will simply steer to the left if it is outside

the circle, and steer to the right if it is inside.

The car will circle in a counterclockwise direction.

The actual rule base is simple: Generate corrections

in direct proportion to the error. No allowance is made

for large positive errors; the car will probably spin

aimlessly in that case.

SYSTEM VARIABLES:

This one-dimensional problem has a single input

(RangeError), and a single output (SteeringAngle).

RangeError ranges from -70 to 70 (linear units).

SteeringAngle ranges from -60 to 60 (degrees).

Adjectives for the two variables have identical

characteristics except for scale.

ASSUMPTIONS:

1. The plane has a rectangular coordinate system.

2. The location of the origin is immaterial.

3. Positive angles are measured in the clockwise direction.

4. RangeError is defined as "actual radius" - "desired radius".

5. The simulator will produce a positive error signal to induce

a leftward correction, negative for a rightward correction.

6. The simulator will ADD the output signal to the

car's current azimuth to get the new azimuth.

The assumptions matter since they define the basis

for interaction with the simulator. In view

assumption 5, both simulator and fuzzy engine must

agree on the angle convention.

RULES:

Rules use three fuzzy sets. Beyond that, they simply

track the input data. The names of the fuzzy sets

are the same for both variables, but their meanings

depend on which one they are used with. Activations

are available through the activation variables.

#}

(Weights[0]) If RangeError is Positive then

make SteeringAngle Negative @ Activations[0];

(Weights[1]) If RangeError is NearZero then

make SteeringAngle NearZero @ Activations[1];

(Weights[2]) If RangeError is Negative then

make SteeringAngle Positive @ Activations[2];

# End of rules for Circle tracking problem

Simulation instructions for "Circle"

Update car's current radius and azimuth. Since the display is

assumed to be a polar plot, no X-Y position is needed.

VARIABLES

V:the speed of the car

CarRad:distance from the center of the circle to the car

CarAz:the current azimuth of the car

SteeringAngle:the steering wheel orientation

New Current Radius

Calculate car's new current radius using Law of Cosines. Assume

a step of size v in the direction car_az. Computations are based

on (SteeringAngle + 90) since the car must drive tangent to the

circle (at right angles to the error input vector). Note that

cos(angle + 90) = - sin(angle).

CarRad=sqrt(CarRad*CarRad+v*v+2*CarRad*v *sind(SteeringAngle));

New Current Azimuth

Calculate car's new current azimuth using Law of Sines,

correcting for angle modularity.

CarAz = angle360(CarAz + IIF (CarRad = 0, 0,

asind((v * cosd(SteeringAngle)) / CarRad)));

# done

Preprocessing rules for "Circle"

Calculate Range Error for use by fuzzy engine.

VARIABLES

Radius:the desired distance from the center

CarRad:distance from the car to the center of the circle

RangeError:the error input to the fuzzy engine

# calculate current range error.

RangeError = CarRad - Radius;

# done

Postprocessing instructions for CIRCLE

Here we use the Activations array to locate

the most active rule. If there are more than

one, we'll just record the first one.

idx = 0; Highval = 0; BestRule = 0; While (idx < 3)

If (Activations[idx] > Highval)

Highval = Activations[idx];

BestRule = idx + 1;

End

idx += 1;

End?

Initialization instructions for CIRCLE

All that is necessary is to set initial values

for the Weights array.

idx = 0;While (idx < 3)

Weights[idx] = 1.0;

idx += 1;

End

DOGCAT

file: DOGCAT.TXT

Rules for "Dog vs Cat"

RATIONALE:

The problem is chasing a cat (if you are a dog).

Abstracted, the problem becomes a one-dimensional

tracking problem in the plane.

The dog will follow the classical pursuit path by

adjusting its azimuth in accordance with the relative

direction of the cat.

The actual rule base is simple: Generate corrections

in direct proportion to the error.

SYSTEM VARIABLES:

This one-dimensional problem has a single input

(TrackingError), and a single output (AzimuthAdjust).

TrackingError ranges from -180 to 180 (degrees).

AzimuthAdjust ranges from -45 to 45 (degrees).

Adjectives for the two variables have identical

characteristics except for scale.

ASSUMPTIONS:

1. The plane has a rectangular coordinate system.

2. The location of the origin is immaterial.

3. Positive angles are measured in the clockwise direction.

4. The preprocessor will produce a positive error signal

to induce a leftward correction, negative for a

rightward correction.

5. The simulator will ADD the output signal to the

dog's current azimuth to get the new azimuth.

The assumptions matter since they define the basis for

interaction with other elements. In view of assumption 4,

all participants must agree on the angle convention.

RULES:

Rules use five fuzzy sets. Beyond that, they simply

track the input data. The names of the fuzzy sets

are the same for both variables, but their meanings

depend on which one they are used with. All are equally

important, so each has weight 1.0.

(1.0) If TrackingError is LargePositive

then make AzimuthAdjust LargePositive;

(1.0) If TrackingError is SmallPositive

then make AzimuthAdjust SmallPositive;

(1.0) If TrackingError is NearZero

then make AzimuthAdjust NearZero @ ZeroAct;

(1.0) If TrackingError is SmallNegative

then make AzimuthAdjust SmallNegative @ SNAct;

(1.0) If TrackingError is LargeNegative

then make AzimuthAdjust LargeNegative @ LNAct;

# End of rules for Dog vs Cat tracking problem

# Simulation rules for "Dog vs Cat"

# Calculate dog's new azimuth.

# Use angle180 since trig functions expect angles

# in the range [-180, 180).

DogAzimuth = DogAzimuth + AzimuthAdjust;

DogAzimuth = angle180(DogAzimuth);

# Update cat and dog positions.

# Cat moves horizontally (no change in Cat_y).

# Dog chases cat.

Cat_x = Cat_x + CatSpeed; Cat_y = Cat_y;

Dog_x = Dog_x + DogSpeed * cosd(DogAzimuth);

Dog_y = Dog_y + DogSpeed * sind(DogAzimuth);

# done

# Preprocessing rules for "Dog vs Cat"

# Calculate current tracking error.

If (Cat_x = Dog_x)

If (Cat_y > Dog_y) TrackingError = 90;

Elseif (Cat_y < Dog_y) TrackingError = -90;

Else TrackingError = 0;

End

Else

TrackingError=atand((Cat_y-Dog_y)/(Cat_x -Dog_x))+iif(Cat_x<Dog_x,180,0);

End

TrackingError = angle180(TrackingError - DogAzimuth);

# done

INVENT

file:INVENT.TXT

Rules for controlling inventory level

As the scenario executes, note the following:

When sales are rising, the order level is

above the current sales level. When the

sales are falling, the order level is

below the current sales level. The net

effect is that the stock level remains about

even with the sales.

The backlog is typically above the sales

level. When sales suddenly drop, the backlog

shrinks, giving some cushion so that the stock

level doesn't shoot up.

When the sales rate changes suddenly (from rising

to falling or falling to rising), the stock level

continues moving in the same direction for a while

before it can reverse. This is because of the

lead time simulated with the "OnOrder" queue.

# All other things being equal, just track the sales rate

(RateWt) If SalesRate is Falling then FuzzyOrder should be small;

(RateWt) If SalesRate is Rising then FuzzyOrder should be large;

(RateWt) If SalesRate is Steady then FuzzyOrder should be normal;

# A high backlog is not a problem unless it gets so high that

# we start to lose orders. A low backlog is not a problem, but

# if we don't have a backlog and the amount on order is high, it

# indicates that some other area hasn't exerted enough control.

(BackLogWt) If BackLog is high and OnOrder is not high

then FuzzyOrder should be large;

(BackLogWt) If BackLog is very low and OnOrder is high

then FuzzyOrder should be near_zero;

# The amount on order is also a factor.

(OnOrderWt) If OnOrder is high then FuzzyOrder should be small;

(OnOrderWt) If (OnOrder is medium or BackLog is normal)

and SalesRate is not Falling then FuzzyOrder should be normal;

(OnOrderWt) If OnOrder is low and SalesRate is not Falling

then FuzzyOrder should be large;

# Low stock is not really a problem, in fact, it's desirable.

# If it's higher than we need when sales are falling, we should

# try to push it down.

(StockWt) If (StockInHouse is high or StockInHouse is medium)

and SalesRate is Falling then FuzzyOrder should be near_zero;Z#

# Preprocessing instructions for 'Invent'

# Generate new sales as a triangle function so we

# can see how it behaves with sales rising and falling.

NewSales = floor(.5 + salesmin + triangle(Iterations/90) * salesmax);

# Follow trends in the sales by averaging the magnitude

# and the direction of changes over the last 5 iterations.

If (NewSales <> PrevSales)

call enter(ChangeMagList, CMLs, CMLe, abs(NewSales - PrevSales));

call enter(ChangeDirList, CDLs, CDLe, iif (NewSales > PrevSales, 1, -1));

PrevSales = NewSales;

else

call enter(ChangeMagList, CMLs, CMLe, 0.0);

call enter(ChangeDirList, CDLs, CDLe, 0.0);

end

SalesRate=average(ChangeMagList,CMLs,CML e)*average(ChangeDirList,CDLs,CDLe);

# The fuzzy input variables are actually relative to the current

# level of sales for flexibility. But we use the absolute levels

# of the Backlog and Stock for plotting.

# Add the new sales to the backlog.

AbsBacklog = AbsBacklog + NewSales;

# Decide how many units to ship (as much as we can).

# Adjust the stock and backlog accordingly.

Shipped = min(AbsStock, AbsBacklog); AbsStock = AbsStock - Shipped;

AbsBacklog = AbsBacklog - Shipped;

# Receive the deliveries. The "OnOrder" list allows

# for lead time.

Delivered = oldest(OnOrderList, OOLs, OOLe);

AbsStock = AbsStock + Delivered;

# Compute the relative fuzzy variable values

TotalOnOrder = sum(OnOrderList, OOLs, OOLe);

Backlog = AbsBackLog - NewSales;

OnOrder = (TotalOnOrder - 4 * NewSales);

StockInHouse = AbsStock - NewSales;ä#

# Postprocessing instructions for 'Invent'

# Orders are in discrete amounts, so integerize the

# output from the fuzzy engine. Then keep a history

# of what's on order to simulate lead time.

Order = max(floor(FuzzyOrder + NewSales + .5), 0.);

call enter(OnOrderList, OOLs, OOLe, Order);

# Force plot variables to stay in range to make it

# easier to experiment.

AbsBackLog = bound(AbsBackLog, 0.0, 500.0);

AbsStock = bound(AbsStock, 0.0, 500.0);-2#

# Initialization instructions for 'Invent'

# Initialize random number generator

call srand(37);

# Enter a value so that we can check the total

# at any time. We must enter something before we

# can sum() the amount on order.

call enter(OnOrderList, OOLs, OOLe, 0.0);

MAGLEV

file: MAGLEV.TXT

Rules for "Maglev"

RATIONALE:

The problem is to stably suspend a metal object in air

midway between a magnet and the ground. This problem is

simple in principle but difficult to solve since the system

dynamics are highly nonlinear.

The rule base is involved but straightforward: Generate

collections casewise depending on the current location and

rate of change in location. No allowance is made in these

rules for starting the object too close to the ground or magnet.

SYSTEM VARIABLES:

This problem has two inputs: Err, the current difference between

the object's position (vertical height) and the desired midpoint,

and ErrDot, the current rate of change in Err. The output, Current,

is the current level that should be delivered to the magnet.

Err lies in the range -5.0 to 5.0 ("units").

ErrDot ranges from -15 to 15 ("units/sec").

Current ranges from 0 to 85 (amperes).

The rulebase does not employ weight or activation variables.

RULES:

The rules are a case-by-case map of what to do for

each possible value of Err and ErrDot. The adjectives for

Err and ErrDot bear typical names that describe their relative

size: "NL" for "Negative Large" and so on. Those describing

Current are chosen to reflect the intended action on the

object's acceleration. Note that the magnet does not pull

downward -- that is accomplished by gravity.

Refer to the Simulation editor text for information about the

simulation of the object under the influence of the magnetic

field.

Proper choice of rule syntax is selected by the

NORMAL_SYNTAX keyword at the start of the rule text.

NORMAL_SYNTAX

If Err is NL and Errdot is PL then Current is DownFast;

If Err is NL and Errdot is PM then Current is DownFast;

If Err is NL and Errdot is PS then Current is DownFast;

If Err is NL and Errdot is ZE then Current is DownFast;

If Err is NL and Errdot is NS then Current is DownFast;

If Err is NL and Errdot is NM then Current is DownMedium;

If Err is NL and Errdot is NL then Current is DownMedium;

If Err is NM and Errdot is PL then Current is DownFast;

If Err is NM and Errdot is PM then Current is DownFast;

If Err is NM and Errdot is PS then Current is DownFast;

If Err is NM and Errdot is ZE then Current is DownFast;

If Err is NM and Errdot is NS then Current is DownMedium;

If Err is NM and Errdot is NM then Current is DownMedium;

If Err is NM and Errdot is NL then Current is DownSmall;

If Err is NS and Errdot is PL then Current is DownFast;

If Err is NS and Errdot is PM then Current is DownMedium;

If Err is NS and Errdot is PS then Current is DownSmall;

If Err is NS and Errdot is ZE then Current is DownSmall;

If Err is NS and Errdot is NS then Current is Hold;

If Err is NS and Errdot is NM then Current is UpSmall;

If Err is NS and Errdot is NL then Current is UpSmall;

If Err is ZE and Errdot is PL then Current is DownFast;

If Err is ZE and Errdot is PM then Current is DownMedium;

If Err is ZE and Errdot is PS then Current is DownSmall;

If Err is ZE and Errdot is ZE then Current is Hold;

If Err is ZE and Errdot is NS then Current is UpSmall;

If Err is ZE and Errdot is NM then Current is UpMedium;

If Err is ZE and Errdot is NL then Current is UpMedium;

If Err is PS and Errdot is PL then Current is DownSmall;

If Err is PS and Errdot is PM then Current is DownSmall;

If Err is PS and Errdot is PS then Current is Hold;

If Err is PS and Errdot is ZE then Current is UpSmall;

If Err is PS and Errdot is NS then Current is UpSmall;

If Err is PS and Errdot is NM then Current is UpMedium;

If Err is PS and Errdot is NL then Current is UpMedium;

If Err is PM and Errdot is PL then Current is UpSmall;

If Err is PM and Errdot is PM then Current is UpMedium;

If Err is PM and Errdot is PS then Current is UpMedium;

If Err is PM and Errdot is ZE then Current is UpFast;

If Err is PM and Errdot is NS then Current is UpFast;

If Err is PM and Errdot is NM then Current is UpFast;

If Err is PM and Errdot is NL then Current is UpFast;

If Err is PL and Errdot is NL then Current is UpSmall;

If Err is PL and Errdot is NM then Current is UpMedium;

If Err is PL and Errdot is NS then Current is UpFast;

If Err is PL and Errdot is ZE then Current is UpFast;

If Err is PL and Errdot is PS then Current is UpFast;

If Err is PL and Errdot is PM then Current is UpFast;

If Err is PL and Errdot is PL then Current is UpFast;,D

Simulation instructions for MAGLEV

Simulation comprises two steps:

First, calculate the force on the ball as a function

of the distance between the ball and the magnet face

and the force of gravity.

Second, update the position and velocity of the ball as

a function of the total force and its current position

and velocity.

Magnet equations are taken from "Design of Feedback Control

Systems" (2nd Edition), by Hostetter, Savant, and Stefani,

published by Saunders College Publishing (New York), 1989.

# Calculate the current total force on the ball.

Force = -H * Current + G * (10.0 - z) + Gravity;

# Calculate the current bearing height and velocity

z = z - zdot * DeltaT;

zdot = zdot + (Force / Mass) * DeltaT;

# done

# Preprocessing instructions for MAGLEV

# All we need are the current values

# of Err and ErrDot.

err = 5.0 - z;

errdot = -zdot;

# done

# Postprocessing instructions for MAGLEV

# We detect equilibrium condition here so it will cause

# a restart next cycle if warranted.

IF (Abs(Err) < 0.01) Restart = TRUE; End

# done

Initialization instructions for MAGLEV

Set the initial height of the ball bearing to a

random uniform displacement from the center of its

travel (at 5). The maximum displacement is 3.

Z = 5 + 3 * (2 * uniform() - 1);

# done

PICKER

file: PICKER.TXT

Rules for the PICKER project

# The problem is to choose which type of fruit is the best match.

# The input variables used are:

# AR - the "aspect ratio," used to approximate the shape

# Color - Red, Orange, Yellow, Green or something in between

# Size - the weight in kilograms

# These rules are designed to be used with the "best rule" inference

# method. The rule with the highest activation wins, and the "answer"

# is the consequent of that rule.

# The data file for use with this project is FRUITDAT.TXT.

IF Color is RED and AR is Round and Size is Medium

THEN Fruit is Apple;

If Color is YELLOW and AR is Thin and Size is Medium

THEN Fruit is Banana;

If Color is GREEN and (AR is Round OR AR is Oval) and Size is Tiny

THEN Fruit is Grape;

If (Color is YELLOW OR Color is ORANGE) and AR is Round and Size is Large

THEN Fruit is Grapefruit;

If Color is YELLOW and AR is Oval and Size is Small

THEN Fruit is Lemon;

If Color is GREEN and AR is Round and Size is Small

THEN Fruit is Lime;

If Color is ORANGE and AR is Round and Size is Medium

THEN Fruit is Orange;

If (Color is RED OR Color is ORANGE) and AR is Round and Size is Medium

THEN Fruit is Peach;

If (Color is YELLOW AND Color is GREEN)

and (AR is Oval) and (Size is Medium OR Size is Large)

THEN Fruit is Pear;

If Color is RED and (AR is Oval OR AR is Thin) and Size is Tiny

THEN Fruit is Strawberry;

If Color is ORANGE and AR is Round and Size is Small

THEN Fruit is Tangerine;

# Preprocessing for the PICKER project

# Copy input file data fields to CubiCalc variables.

# The Check field has the correct "answer".

Color = field(1);

AR = field(2);

Size = field(3);

Check = field(4);

# Postprocessing for the PICKER project

# Use the Check field from the input file to

# verify results from the fuzzy engine.

# If the output is wrong, increment the error count.

# Using "floor(Fruit + 0.1)" makes sure we compare an

# integer value to the Check variable. Otherwise, we

# could get an error by a tiny shift of one of the

# output adjectives.

If (floor(Fruit + 0.1) <> Check) Errors += 1; End

# On the last iteration, put up a message box

# about the number of errors.

If (EndOfFile=TRUE) Call message(Errors); End

PICKER0

file: PICKER0.TXT

# Rules for the PICKER project

# The problem is to choose which type of fruit is the best match.

#

# The input variables used are:

#

# AR - the "aspect ratio," used to approximate the shape

# Color - Red, Orange, Yellow, Green or something in between

# Size - the weight in kilograms

#

# These rules are designed to be used with the "best rule" inference

# method. The rule with the highest activation wins, and the "answer"

# is the consequent of that rule.

#

# The data file for use with this project is FRUITDAT.TXT.

IF Color is RED and AR is Round and Size is Medium

THEN Fruit is Apple;

If Color is YELLOW and AR is Thin and Size is Medium

THEN Fruit is Banana;

If Color is GREEN and (AR is Round OR AR is Oval) and Size is Tiny

THEN Fruit is Grape;

If (Color is YELLOW OR Color is ORANGE) and AR is Round and Size is Large

THEN Fruit is Grapefruit;

If Color is YELLOW and AR is Oval and Size is Small

THEN Fruit is Lemon;

If Color is GREEN and AR is Round and Size is Small

THEN Fruit is Lime;

If Color is ORANGE and AR is Round and Size is Medium

THEN Fruit is Orange;

If (Color is RED OR Color is ORANGE) and AR is Round and Size is Medium

THEN Fruit is Peach;

If (Color is YELLOW AND Color is GREEN)

and (AR is Oval) and (Size is Medium OR Size is Large)

THEN Fruit is Pear;

If Color is RED and (AR is Oval OR AR is Thin) and Size is Tiny

THEN Fruit is Strawberry;

If Color is ORANGE and AR is Round and Size is Small

THEN Fruit is Tangerine;

TRUCK

file: TRUCK.TXT

Rules for "Truck"

RATIONALE:

The problem is to back a truck up to a loading dock.

Abstracted, the problem becomes a two-dimensional

control problem (X and Phi; the Y-coordinate is ignored).

The rule base is involved but straightforward: Generate

corrections casewise depending on the current location.

No allowance is made in these rules for starting the truck

too close to the boundary.

SYSTEM VARIABLES:

This problem has two inputs: X the current truck position,

and Phi, the current azimuth of the truck (as seen from the rear).

The output, Theta, is the steering correction angle.

X (and Y) lie in the range 0 to 100 ("yards").

Phi ranges from -180 to 180 (degrees).

Theta ranges from -30 to 30 (degrees).

ASSUMPTIONS:

1. The truck yard has a rectangular coordinate system

ranging from 0 to 100 in both directions.

2. The location of the loading dock is at (50, 0).

3. Positive angles are measured in the counterclockwise

direction.

4. Angles are negative for clockwise rotations.

5 The simulator will produce a positive error signal

to induce a left turn, negative for a right turn.

6. The simulator will add the output signal to the

truck's current azimuth to get the new azimuth.

The assumptions matter since they define the basis

for interaction with the simulator. In view of

assumption 5, all both simulator and fuzzy engine

must agree on the angle convention.

RULES:

The rules are a case-by-case map of what to do for

each possible X-coordinate and azimuth range. The

adjectives that describe X and Phi are named consistently

with those in the paper "Comparison of Fuzzy and Neural Truck

Backer-Upper Control Systems" (Kong and Kosko) appearing

in the Proceedings of the IJCNN, June 1990.

(wt_le_rb) If X is LE and Phi is RB then Theta is PS @act_le_rb;

(wt_le_ru) If X is LE and Phi is RU then Theta is NS @act_le_ru;

(wt_le_rv) If X is LE and Phi is RV then Theta is NM @act_le_rv;

(wt_le_ve) If X is LE and Phi is VE then Theta is NM @act_le_ve;

(wt_le_lv) If X is LE and Phi is LV then Theta is NB @act_le_lv;

(wt_le_lu) If X is LE and Phi is LU then Theta is NB @act_le_lu;

(wt_le_lb) If X is LE and Phi is LB then Theta is NB @act_le_lb;

(wt_lc_rb) If X is LC and Phi is RB then Theta is PM @act_lc_rb;

(wt_lc_ru) If X is LC and Phi is RU then Theta is PS @act_lc_ru;

(wt_lc_rv) If X is LC and Phi is RV then Theta is NS @act_lc_rv;

(wt_lc_ve) If X is LC and Phi is VE then Theta is NM @act_lc_ve;

(wt_lc_lv) If X is LC and Phi is LV then Theta is NM @act_lc_lv;

(wt_lc_lu) If X is LC and Phi is LU then Theta is NB @act_lc_lu;

(wt_lc_lb) If X is LC and Phi is LB then Theta is NB @act_lc_lb;

(wt_ce_rb) If X is CE and Phi is RB then Theta is PM @act_ce_rb;

(wt_ce_ru) If X is CE and Phi is RU then Theta is PM @act_ce_ru;

(wt_ce_rv) If X is CE and Phi is RV then Theta is PS @act_ce_rv;

(wt_ce_ve) If X is CE and Phi is VE then Theta is ZE @act_ce_ve;

(wt_ce_lv) If X is CE and Phi is LV then Theta is NS @act_ce_lv;

(wt_ce_lu) If X is CE and Phi is LU then Theta is NM @act_ce_lu;

(wt_ce_lb) If X is CE and Phi is LB then Theta is NM @act_ce_lb;

(wt_rc_rb) If X is RC and Phi is RB then Theta is PB @act_rc_rb;

(wt_rc_ru) If X is RC and Phi is RU then Theta is PB @act_rc_ru;

(wt_rc_rv) If X is RC and Phi is RV then Theta is PM @act_rc_rv;

(wt_rc_ve) If X is RC and Phi is VE then Theta is PM @act_rc_ve;

(wt_rc_lv) If X is RC and Phi is LV then Theta is PS @act_rc_lv;

(wt_rc_lu) If X is RC and Phi is LU then Theta is NS @act_rc_lu;

(wt_rc_lb) If X is RC and Phi is LB then Theta is NM @act_rc_lb;

(wt_ri_rb) If X is RI and Phi is RB then Theta is PB @act_ri_rb;

(wt_ri_ru) If X is RI and Phi is RU then Theta is PB @act_ri_ru;

(wt_ri_rv) If X is RI and Phi is RV then Theta is PB @act_ri_rv;

(wt_ri_ve) If X is RI and Phi is VE then Theta is PM @act_ri_ve;

(wt_ri_lv) If X is RI and Phi is LV then Theta is PM @act_ri_lv;

(wt_ri_lu) If X is RI and Phi is LU then Theta is PS @act_ri_lu;

(wt_ri_lb) If X is RI and Phi is LB then Theta is NS @act_ri_lb;

End of rules for Truck Backing problem

# Simulation instructions for "Truck"

Updates Phi, then computes truck's new X-Y position coordinates.

VARIABLES

Phi: the current azimuth of the truck, measured from the REAR.

X: the truck's current X coordinate

Y: the truck's current Y coordinate

Speed: the speed of the truck (i.e., distance it

travels in a single iteration)

Theta: the output signal from the fuzzy engine

# Calculate trucks's new current azimuth.

Phi = angle360(Phi + Theta);

# Calculate truck's new coordinates.

# Assume a step of size Speed in the direction Phi.

# Subtract Y increment since the positive correction is downward

# and since Phi is measured with respect to the rear.

X = X + (Speed * cosd(Phi));

Y = Y - (Speed * sind(Phi));

#We don't check for end conditions: The Restart Options

#are set up so that when data goes off plot, a new initial

#position is generated randomly.

# done

# Inputs can be randomized automatically, but temporary

# variables must be randomized by explicit initialization.

y = 40.0 + 50.0 * uniform();

TRUCKXY

file: TRUCKXY.TXT

Rules for TRUCKXY

The rulebase is expands on that of the TRUCK example

to account for the Y variable. Two cases are of

importance: when the truck is distant from the

bottom boundary, and when it is near it. In the former

case the rules match the TRUCK example; in the latter,

the rules steer the truck away from the wall while at

the same time approaching the center.

This rulebase does not use OR, so we opt for the terse

"Alternate Rule Syntax".

ALTERNATE_SYNTAX

Y LARGE, X LG_LEFT, Phi45 VL45 : Theta PB;

Y LARGE, X LG_LEFT, Phi45 L45 : Theta PS;

Y LARGE, X LG_LEFT, Phi45 M45 : Theta ZE;

Y LARGE, X LG_LEFT, Phi45 R45 : Theta NS;

Y LARGE, X LG_LEFT, Phi45 VR45 : Theta NB;

Y LARGE, X LG_LCTR, Phi45 VL45 : Theta PB;

Y LARGE, X LG_LCTR, Phi45 L45 : Theta PS;

Y LARGE, X LG_LCTR, Phi45 M45 : Theta ZE;

Y LARGE, X LG_LCTR, Phi45 R45 : Theta NS;

Y LARGE, X LG_LCTR, Phi45 VR45 : Theta NB;

Y LARGE, X CENTER, Phi VL90 : Theta PM;

Y LARGE, X CENTER, Phi L90 : Theta PS;

Y LARGE, X CENTER, Phi M90 : Theta ZE;

Y LARGE, X CENTER, Phi R90 : Theta NS;

Y LARGE, X CENTER, Phi VR90 : Theta NM;

Y LARGE, X LG_RCTR, Phi135 VL135 : Theta PM;

Y LARGE, X LG_RCTR, Phi135 L135 : Theta PS;

Y LARGE, X LG_RCTR, Phi135 M135 : Theta ZE;

Y LARGE, X LG_RCTR, Phi135 R135 : Theta NS;

Y LARGE, X LG_RCTR, Phi135 VR135 : Theta NM;

Y LARGE, X LG_RIGHT, Phi135 VL135 : Theta PB;

Y LARGE, X LG_RIGHT, Phi135 L135 : Theta PS;

Y LARGE, X LG_RIGHT, Phi135 M135 : Theta ZE;

Y LARGE, X LG_RIGHT, Phi135 R135 : Theta NS;

Y LARGE, X LG_RIGHT, Phi135 VR135 : Theta NB;

Y SMALL, X LEFT, Phi VL0 : Theta PB;

Y SMALL, X LEFT, Phi L0 : Theta PS;

Y SMALL, X LEFT, Phi M0 : Theta ZE;

Y SMALL, X LEFT, Phi R0 : Theta NS;

Y SMALL, X LEFT, Phi VR0 : Theta NB;

Y SMALL, X LCTR, Phi VL0 : Theta PM;

Y SMALL, X LCTR, Phi L0 : Theta PS;

Y SMALL, X LCTR, Phi M0 : Theta ZE;

Y SMALL, X LCTR, Phi R0 : Theta NS;

Y SMALL, X LCTR, Phi VR0 : Theta NM;

Y SMALL, X CENTER, Phi VL90 : Theta PB;

Y SMALL, X CENTER, Phi L90 : Theta PS;

Y SMALL, X CENTER, Phi M90 : Theta ZE;

Y SMALL, X CENTER, Phi R90 : Theta NS;

Y SMALL, X CENTER, Phi VR90 : Theta NB;

Y SMALL, X RCTR, Phi VL180 : Theta PM;

Y SMALL, X RCTR, Phi L180 : Theta PS;

Y SMALL, X RCTR, Phi M180 : Theta ZE;

Y SMALL, X RCTR, Phi R180 : Theta NS;

Y SMALL, X RCTR, Phi VR180 : Theta NM;

Y SMALL, X RIGHT, Phi VL180 : Theta PB;

Y SMALL, X RIGHT, Phi L180 : Theta PS;

Y SMALL, X RIGHT, Phi M180 : Theta ZE;

Y SMALL, X RIGHT, Phi R180 : Theta NS;

Y SMALL, X RIGHT, Phi VR180 : Theta NB;

Simulation instructions for TRUCKXY

Update the values of all the input variables.

Phi = angle360(Phi + Theta);

Phi45 = Phi; Phi135 = Phi;

X = X + (Speed * cosd(Phi));

Y = Y - (Speed * sind(Phi));-

Initialization instructions for TRUCKXY

Simply randomize the inputs. This happens each time

the system does an auto-restart.

X = 80 * uniform() + 10;

Y = 80 * uniform() + 10;

Phi = 360 * uniform(); Phi45 = Phi; Phi135 = Phi;

README

Возможно не удалось распознать кодировку файла

Картинка-подпись
Хочешь зарабатывать на СтудИзбе больше 10к рублей в месяц? Научу бесплатно!
Начать зарабатывать

Комментарии

Поделитесь ссылкой:
Рейтинг-
0
0
0
0
0
Поделитесь ссылкой:
Сопутствующие материалы
Свежие статьи
Популярно сейчас
А знаете ли Вы, что из года в год задания практически не меняются? Математика, преподаваемая в учебных заведениях, никак не менялась минимум 30 лет. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5173
Авторов
на СтудИзбе
436
Средний доход
с одного платного файла
Обучение Подробнее