Solved

A.I. - Fuzzy Clips and VB

Posted on 2003-10-30
8
1,224 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:j4ymz
Comment Utility
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
Comment Utility
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
Comment Utility
How's it going?
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Setup specific permissions in Microsoft Access 9 56
java ^ examples 8 57
haveThree challenge 22 100
data scientists and AI 17 67
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now