Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Output conversion

Dear all,

I have few problem with a .net assembly. I should use this .dll library to control a x-ray detector. I called the constructor, add property node and I just obtain the result '#0' .. I tried to convert this (blue) output in a double and then I summed 10000 to this output and I still obtain 0..shouldn't I obtain 10000????

Then, If I add some invoke node, they don't give me a ref.output and their presence blocks the loop...any suggestion? I attach here a screenshot: in the red circle you can see the magical sum 0+10000 = 0 🙂

 

Could you please help me?

Cheers!

0 Kudos
Message 1 of 9
(5,314 Views)

Hi,

 

I looked at the attachment you sent and noticed a few things.

 

The Property Node on your diagram returns an array of integer (blue) values (I think these will be containing some image data?).

 

When you use highlight execution, the highlighting on an array shows you the number of elements in it (ie #5 would be 5 element array). In this case, it has 0 elements, so the node has returned an empty array, it hasn't found any data.

 

Using the add function with an array input will add 10000 to each element, but there are no elements, so it seems like nothing happened.

 

I can suggest one possible reason why this may be occuring.

You have closed the reference in the loop, and LabVIEW may execute this before it executes the property node, which means the reference would be invalid. Good coding practice is to open and close references outside the loop, which means they will only execute once.

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 9
(5,303 Views)

The problem is that for example the 'start' option doesn't give any ref out, so the ref doesn't close..hence the loop stops without any reason...any suggestions?

0 Kudos
Message 3 of 9
(5,295 Views)

It might be useful to know exactly what you are trying to do with your code, is the process set out clearly?

 

When I mentioned opening the reference, I was talking about the .NET constructor node, which returns a reference. When we deal with references, I would normally set it out like this

 

snippet.png

 

 

Do you have any experienced labview programmers around? If you can get someone to help lay out the basic code, it will make things much easier in the longer term, or if you are going to be using LabVIEW a lot for your work, you might consider taking a training course. Otherwise, keep pinging me questions and I'll do my best to keep on helping out!

 

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 4 of 9
(5,285 Views)

Thank Ian! I used Labview before but obviously I'm not an expert/ I don't think that the 'reference' issue is that important..I explain to you:

in the attached imege, you can see all the 'pieces' of my code. I want to connect with the camera (x-ray detector) and read numerical values of each pixel.

 

there are mainly 4 object: the constructor (OtbCamera), OtBCamera - start, OtBCamera - CaptureImageLine and the output.

 

If the connection is established, the 'lastOperationalErrored' is FALSE. So this is some setup I tryed:

1) Just Constructor and Output..the loop works, the constructor continuosly gives impulse, the 'lastOperationalErrored' gives FALSE but the ImageLine stays empty.

2)Contructor, Output and CaptureImageLine (with its 2 input) .. the loop stops, CaptureImageLine doesn't give a reference out and ImageLine stays empty.

3)As case 2, but adding the 'start' call...same problem as above, no ref out hence the loop stops...ImageLine always empty.

 

NB - the lastOperationalErrored is always FALSE. I test the connection of the camera, it is working properly.

You can see why I don't think that references are the problems..in the first case the loop works also if I don't close it! Obviously I'm going to close them properly as you shoved me! But I don't think that that is the solution!

Btw, thanks for your help!!!!

 

0 Kudos
Message 5 of 9
(5,282 Views)

I changed the reference closure and nothing changed..does anybody know how to 'repair' a node that doesn't produce a reference out?

 

Thanks!

0 Kudos
Message 6 of 9
(5,274 Views)

Hi Elena, 

 

It will be worth setting the code out in line with how I had it in my picture, the way you have set it out, the close references will still be causing problems in the loop.

 

It shouldn't take too long to try, put the constructor on the left, pass the reference wire into the loop, get the data in the loop, and pass the reference to the outside to close it.

 

Let me know how you get on.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 7 of 9
(5,266 Views)

Hey Ian,

Thanks for the answer...I already did that..the thing is that from the methods, the reference doesn't go out..there is no signal going out so it doesn't close..any idea on how to fix it? 🙂

 

Thanks!!!

0 Kudos
Message 8 of 9
(5,256 Views)

Hi Elena,

 

As long as you haven't closed the reference somewhere else in the code, the method should return the same reference that went into it from the top output, this is the behaviour that occurs on any method or invoke node.

 

Ian

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 9 of 9
(5,238 Views)