?
Solved

A.I. - Fuzzy Clips and VB

Posted on 2003-10-30
8
Medium Priority
?
1,265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 272 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 264 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 264 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

762 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