• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1295
  • Last Modified:

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.

0
j4ymz
Asked:
j4ymz
3 Solutions
 
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
 
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now