Solved

A.I. - Fuzzy Clips and VB

Posted on 2003-10-30
8
1,241 Views
Last Modified: 2010-07-27
Hi, i am simulating an ABS (anti-locking) system.
i am using fuzzy clips to run the fuzzy logic rules.
I would like to design a Visual Basic frontend, where the user can enter inputs (eg. speed of car, terrain) into the VB GUI,
and then send those values to fuzzy clips for processing.
After defuzzification, the values will be sent back to VB,
VB will then populate an excel file with those values,
and then plot a graph
I know it sounds a little much, however, i only need to know how to link the 2 programs first.
If anyone knows anything about linking the 2 programs or any other alternative ways to go about this please help. Thanks.

0
Comment
Question by:j4ymz
8 Comments
 
LVL 1

Expert Comment

by:jmvoodoo
ID: 9654888
Hi,

Unfortunately I don't know much about fuzzy clips, however it sounds like what you need is a COM object to handle communication between fuzzyclips (a C program) and VB.   Creating a COM object is more involved than I can get in this message, but there are many books on the subject.  Other than that, if you have fuzzyclips running as a command-line tool you can use Shell() to call fuzzyclips within your VB app.

Your question is pretty large in scope and requires some fairly in-depth knowledge of a very obscure tool, so I'm not sure if I can help you much more than by giving rough suggestions on how an integration could be achieved.

Are there any other interfaces that the fuzzyclips program/lib has that might help?  I'm fairly well versed in VB.NET especially when it comes to interop with other technologies (mostly PHP, but also COM/MFC), but I have no experience or knowledge of fuzzyclips at all.

-Javier
0
 
LVL 22

Accepted Solution

by:
cookre earned 68 total points
ID: 9655827
Since you won't be continuously talking back and forth between the programs, the simplest thing to do is to pass the data in files.

Program 1 collects the data, plops it into a file, calls program 2 which reads said file, does its thing, and creates a second file for program 1 to read and process.

The simplest way to call another program from VB is with Shell().  Unfortunately, Shell() is asynchronous, i.e., Shell() just starts the program - it doesn't wait for it to complete.

The following code from:
http://www.vb-helper.com/howto_shell_wait.html

provides a subroutine that acts like a Shell() with a wait:


' Start the indicated program and wait for it
' to finish, hiding while we wait.
Private Sub ShellAndWait(ByVal program_name As String, _
    ByVal window_style As VbAppWinStyle)
Dim process_id As Long
Dim process_handle As Long

    ' Start the program.
    On Error GoTo ShellError
    process_id = Shell(program_name, window_style)
    On Error GoTo 0

    ' Hide.
    Me.Visible = False
    DoEvents

    ' Wait for the program to finish.
    ' Get the process handle.
    process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
    If process_handle <> 0 Then
        WaitForSingleObject process_handle, INFINITE
        CloseHandle process_handle
    End If

    ' Reappear.
    Me.Visible = True
    Exit Sub

ShellError:
    MsgBox "Error starting task " & _
        txtProgram.Text & vbCrLf & _
        Err.Description, vbOKOnly Or vbExclamation, _
        "Error"
End Sub
0
 
LVL 2

Assisted Solution

by:diarmaid
diarmaid earned 66 total points
ID: 9657037
Is fuzzy clips a third party program or library?
Presumably there are APIs provided with fuzzy clips that you can declare and call from VB or that there is an object library that you can refenence and use directly from VB.

To output to Excel you reference the excel object library, create an excel object and do your work.

The other way is you can run the fuzzy clips program using windows APIs and using the API Window handles etc. directly interface with the fuzzy clips program from your VB app. This is a little more complicated though.

Can you provide some more info on fuzzy clips?
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:j4ymz
ID: 9658250
hi guys,
thanks for the feedback.
its still relatively early in my project, so it might be awhile.
fuzzy clips, basically is a C program, designed to handle Fuzzy Logic (ie. NOT crisp, all values between 0 and 1)
The FuzzyCLips program accepts inputs and runs them past a rule based which is Fuzzy.
FuzzyCLips is downloadable as shareware.
I think the Shell() method from cookre would be a good bet, I shall give it a go and post back my results, and my grading.
thnks alot !
0
 
LVL 1

Assisted Solution

by:jmvoodoo
jmvoodoo earned 66 total points
ID: 9660997
FYI, in VB.NET Shell() supports an optional 3rd argument that tells it whether or not to wait, so Shell(cmd, AppWinStyle.Hide, True)  will call VB to execute cmd with a hidden interface, and to wait for cmd to finish before executing more code.  Not sure if VB6 supports this, but given above comments I think it's new for .NET.

-Javier
0
 
LVL 22

Expert Comment

by:cookre
ID: 9889073
How's it going?
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
countXY challenge 28 153
debug as  junit test 4 82
Need To Find FireFox Binary Path For Python Selenium On Windows 7 15 605
Re-position sub-options beneath the TAB 7 92
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question