CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Desperate Help with Fuzzy C in CCS

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
solidust



Joined: 08 Mar 2010
Posts: 13

View user's profile Send private message

Desperate Help with Fuzzy C in CCS
PostPosted: Sat Mar 27, 2010 5:40 pm     Reply with quote

Ok hope that somebody could help. I tried a simple program on Fuzzytech Pro edition, basically one input and one output and two rules, 1. If input low output off, 2. If input high output on.

I compiled to C in fuuzytech and this is the code obtained. What the???
Code:

#define PRECOMPILER
#define FTLIBC16
#include "ftlibc.h"
#define FUZZYDEFINED
#define FLAGSDEFINED
#include "FUZZYPIC.h"

static FUZZY crispio[1+1];

static FUZZY fuzvals[2+2+0];

static double dcvs[1+1];
double * const pcvfuzzypic = dcvs;


static const FUZZY tpts[8] = {
  0x0000, 0x0000, 0x4000, 0xDFFF,
  0x2000, 0xBFFF, 0xFFFF, 0xFFFF};

static const FUZZY xcom[2] = {
  0x0000, 0xFFFF};

static const BYTE rt0[6] = {
  0x00, 0x01, 0x02,
  0x00, 0x01, 0x03};

static const FRAT frat0[4] = {
  0x0003, 0x0000, 0x0003, 0x0001};

static const FUZZY BVRCode[4] = {
  0x0000, 0xFFFF,
  0x0000, 0xFFFF};

static const double BVRShell[6] = {
  0, 1, 2e-005,
  0, 1, 2e-005};


FLAGS fuzzypic(void) {
  crispio[0] = BVScaleShell2Code(&BVRCode[0*2], &BVRShell[0*3], dcvs[0], BVRCode[0*2+1]<MAXBVRANGE, MAXBVRANGE);
 
  fuzptr = (PFUZZY) fuzvals;
  tpptr  = (PFUZZY) tpts;

  crisp = crispio[0];
  bTNum = 2;
  flms();

  fuzptr = (PFUZZY) fuzvals;

  bTNum   = 2;
  fratptr = (PFRAT)  frat0;
  rtptr   = (PFTBYTE) rt0;
  iMMin(); /* Max-Min */

  invalidflags = 0;
  fuzptr       = &fuzvals[2];
  xcomptr      = (PFUZZY) xcom;

  crispio[1] = 0x8000;
  bTNum  = 2;
  defuzz = &crispio[1];
  þ·—<mI q();

  dcvs[1] = BVScaleCode2Shell(&BVRCode[1*2], &BVRShell[1*3], crispio[1]);
  return invalidflags;
}

void initfuzzypic(void) {
  for (fuzptr = &fuzvals[2];
       fuzptr <= &fuzvals[3];
       *fuzptr++ = 0);
}

This is crazy. Anybody can make sense?
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sat Mar 27, 2010 5:55 pm     Reply with quote

Nobody ever said Fuzzy logic was small or fast....

I prefer a Fuzzy Navel.
_________________
The search for better is endless. Instead simply find very good and get the job done.
jbmiller



Joined: 07 Oct 2006
Posts: 73
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Mar 27, 2010 6:23 pm     Reply with quote

I thought it had 'fuzzyed out' a long time ago....

Never understood the acceptance of fuzzy logic...yeesh, computers like on,off, yes,no, ones, zeros...well if a is somewhere between x and y....do this, maybe ??!!!

I do know that even a good PID algorithm will run faster and better than any fuzzy logic. Been there proved that, like 10-12 years ago....

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 27, 2010 6:46 pm     Reply with quote

Someone in this thread was using it. Send him an email or a PM:
http://www.ccsinfo.com/forum/viewtopic.php?p=54720
solidust



Joined: 08 Mar 2010
Posts: 13

View user's profile Send private message

PostPosted: Sun Apr 04, 2010 5:53 pm     Reply with quote

no headway yet. anyone?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group