A.I. - Fuzzy Clips and VB

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.

j4ymzAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jmvoodooCommented:
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
cookreCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
diarmaidCommented:
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
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

j4ymzAuthor Commented:
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
jmvoodooCommented:
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
cookreCommented:
How's it going?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.