Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

Findroute (SwitchExecutive 3.00)

Solved!
Go to solution

Hi,

 

I updated SwitchExecutive v2.1 to v3.00.

 

I'm using Findroute() to get the path between 2 endpoints.

 

I don't want to use the multiconnect mode but if the user connects 2 times the same points I don't want to return an error :

Connect Point1 to Point 2

Connect Point1 to Point 2 (same connection, no error, no reference incremented)

Disconnect Point 1 and Point 2 (the 2 points are really disconnected)

 

I'm using Findroute() to know if the path already exists.

If the path already exists, then only return a warning, else connect the 2 points.

 

 

This was working with SE 2.1 but it is not working with SE 3.0 :

 

If I want to connect 2 points via a bus using the autocomplete capability, Findroute returns that the path already exists when I connect the points 2 times.

Route : [MATRIX_1/x213->MATRIX_1/y1->MATRIX_1/x180]

 

If I want to connect 2 points manually (and one point is connected directly to the bus), Findroute returns that the path is available when I connect the points 2 times (It should return that the path already exists).

Route : [MATRIX_1/x213->MATRIX_1/y1]

 

 

Why is there a different behaviour between the 2 cases with SE 3.0 ? (It was working with SE 2.1).

 

Bruno

 

 

 

0 Kudos
Message 1 of 9
(8,405 Views)

Hey Bruno,


This is a known issue with Switch Executive 3.0.  It has been documented in CAR#: 122555; and will be fixed in a future release of Switch Executive.  If you connect A to B, and then check to see the availability from A to B, the correct information is returned.  If you check to see the availability from B to A, findroute will return that the path is available (no connection is made), which is incorrect.  This behavior only exists in NISE 3.0.

For NISE 3.0, use the attached VI in place of the normal NISE FindRoute VI.

Message Edited by Knights Who Say NI on 03-05-2010 10:59 AM
-John Sullivan
Problem Solver
0 Kudos
Message 2 of 9
(8,400 Views)

Hi,

 

Thanks for your reply, and for the information.

 

But I think my problem is not exactly the same as you described :

 

If I connect A to B via Y (the route is A->Y->B) and then check to see the availability from A to B, the correct information is returned.

 

But if I connect directly A to B (the route is A->B), and then check to see the availability from A to B, findroute will return that the path is available.

 

Note : I'm using LabWindows/CVI and not LabView.

 

Bruno

0 Kudos
Message 3 of 9
(8,385 Views)

Sorry,

I read my post and I think I badly choose the second case : I would like to connect directly (manually) A to the bus Y. The direct connection means that there is no intermediate point between A and Y.

 

 

If I connect A to B via Y (the route is A->Y->B) and then check to see the availability from A to B, the correct information is returned.

 

But if I connect directly A to Y (the route is A->Y), and then check to see the availability from A to Y, findroute will return that the path is available.

0 Kudos
Message 4 of 9
(8,367 Views)

Hi Bruno,

 

I believe the error you're seeing is related to the error I described above.  I'd recommend using the VI attached to this KnowledgeBase article in place on the FindRoute VI.

 

 

-John Sullivan
Problem Solver
0 Kudos
Message 5 of 9
(8,294 Views)

Hi john,

 

Maybe you are right but I can't test your solution : I am not using LabView but LabWindows/CVI.

 

Could you give me a patch that I can use in LabWindows/CVI ?

 

Bruno

0 Kudos
Message 6 of 9
(8,289 Views)

Hey Bruno,

 

Here's a description of the code:

 

 2010-03-25_090718.png

 

The fixed findroute function calls findroute twice sequentially.  The second time, we alternate the 'channel 1' and 'channel 2' inputs.  From there, we check to see if the two 'Path Capability' outputs are the same.  If they are, we simply output the path capability.  If they aren't, we look at the first 'Path Capability' output and see if it's a 1 (indicates the path is available).  If it's a one and the second path says it exists (2), then we pick that the path exists.  We also have a case to do the same test if the outputs aren't the same and the first output is a 2, and then check for 1.  

 

Essentially, we're running the findroute twice and then comparing the outputs; if the outputs are different, and any output is 'path exists' we go with the 'path exists' route.

 

FYI: I experimented with your routing examples and observed the same errors you did. 

Message Edited by Knights Who Say NI on 03-25-2010 09:15 AM
-John Sullivan
Problem Solver
Message 7 of 9
(8,284 Views)

Bruno -

 

I've put together what I believe to be the C code equivalent to the VI Workaround that John S. provided. I have not tested this yet, so please try it out and see if it behaves as expected.

 

 

int FindRouteWorkaround (NISESession niSEHandle, NISEConstString chan1, NISEConstString chan2, NISEBuffer *routeSpec, NISEInt32 *routeSpecSize, NISEInt32 *routeCapability)
{
NISEStatus errorStatus;
NISEBuffer routeSpec1, routeSpec2;
NISEInt32 routeSpecSize1, routeSpecSize2;
NISEInt32 routeCapability1, routeCapability2;

errorStatus = niSE_FindRoute (niSEHandle, chan1, chan2, &routeSpec1, &routeSpecSize1, &routeCapability1);
if (errorStatus != 0)
{
return errorStatus;
}

errorStatus = niSE_FindRoute (niSEHandle, chan2, chan1, &routeSpec2, &routeSpecSize2, &routeCapability2);
if (errorStatus != 0)
{
return errorStatus;
}

if (routeCapability1 == routeCapability2)
{
*routeSpec = routeSpec1;
*routeSpecSize = routeSpecSize1;
*routeCapability = routeCapability1;
} else if (routeCapability1 == 2)
{
*routeSpec = routeSpec1;
*routeSpecSize = routeSpecSize1;
*routeCapability = routeCapability1;
} else if (routeCapability2 == 2)
{
*routeSpec = routeSpec2;
*routeSpecSize = routeSpecSize2;
*routeCapability = routeCapability2;
}

return 0;
}

 

 

 

 

Hope this helps.

Message Edited by Manooch_H on 03-26-2010 11:54 AM
Manooch H.
National Instruments
Message 8 of 9
(8,272 Views)
Solution
Accepted by topic author bruno_p

Thank you John and Manooch.

 

I tested your patch and it works (sorry for the delay).

 

Just a precision :

The routeSpec buffers are dynamically allocated buffers (NISEBuffer *). The function FindRoute() must be called twice.

The first function call returns the routeSpecSize value and the routeSpec is NULL.

Then allocate dynamically the routeSpec using routeSpecSize.

The second function call returns the routeSpec.

 

The FindRouteWorkaround should be called twice too.

I modified your function to allocate the buffers dynamically.

 

int FindRouteWorkaround (
NISESession niSEHandle,
NISEConstString chan1,
NISEConstString chan2,
NISEBuffer * routeSpec,
NISEInt32 * routeSpecSize,
NISEInt32 * routeCapability)
{
NISEStatus errorStatus = 0;
NISEInt32 routeSpecSize1 = 0;
NISEInt32 routeSpecSize2 = 0;
NISEInt32 routeCapability1 = 0;
NISEInt32 routeCapability2 = 0;
NISEBuffer* routeSpec1 = NULL;
NISEBuffer* routeSpec2 = NULL;

if (routeSpec != NULL)
{
routeSpec1 = calloc (*routeSpecSize, sizeof (NISEBuffer));
routeSpec2 = calloc (*routeSpecSize, sizeof (NISEBuffer));

routeSpecSize1 = *routeSpecSize;
routeSpecSize2 = *routeSpecSize;
}


errorStatus = niSE_FindRoute (niSEHandle, chan1, chan2, routeSpec1, &routeSpecSize1, &routeCapability1);
if (errorStatus != 0)
{
return errorStatus;
}

errorStatus = niSE_FindRoute (niSEHandle, chan2, chan1, routeSpec2, &routeSpecSize2, &routeCapability2);
if (errorStatus != 0)
{
return errorStatus;
}



if (routeCapability1 == routeCapability2)
{
if (routeSpec != NULL)
strcpy (routeSpec, routeSpec1);
*routeSpecSize = routeSpecSize1;
*routeCapability = routeCapability1;
}
else if (routeCapability1 == 2)
{
if (routeSpec != NULL)
strcpy (routeSpec, routeSpec1);
*routeSpecSize = routeSpecSize1;
*routeCapability = routeCapability1;
}
else if (routeCapability2 == 2)
{
if (routeSpec != NULL)
strcpy (routeSpec, routeSpec2);
*routeSpecSize = routeSpecSize2;
*routeCapability = routeCapability2;
}

if (routeSpec1)
{
free (routeSpec1);
routeSpec1 = NULL;
}

if (routeSpec2)
{
free (routeSpec2);
routeSpec2 = NULL;
}

return 0;
}

 

Bruno

Message Edité par bruno_p le 05-25-2010 04:49 PM
0 Kudos
Message 9 of 9
(7,964 Views)