From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Returning an array type from a realtime sequence

Hello,

 

I have noticed that it's possible to set the return value of a realtime sequence to an array type. I wasn't really aware of this before so I was quite exited when I realized it. Being able to return more than one value from a realtime sequence would be a huge benefit for our purposes. Unfortunately, when I compile the sequence using the Compiler class of the .NET api, it throws a NotImplementedError exception. If I try to compile the sequence in the stimulus profile editor it just says "files have not been compiled". 

 

I have not found anything in the user-docs regarding this topic. What is the official statement? Should it work or should it not? According to the ReturnDeclaration class documentation, you can set the datatype to any object that derives from the DataValue class (this includes arrays). 

 

Thanks & Regards

Krid

0 Kudos
Message 1 of 8
(5,656 Views)

Dear Krid,

 

could you post the Link where you find that it is possible to set return value of a realtime sequence to an array type.

 

And also I would ask you to post your "realtime sequence File" where you getting the message "files have not been compiled"

 

 

Kind Regards,

SG3 | Applications Engineering | National Instruments | NIG |

0 Kudos
Message 2 of 8
(5,618 Views)

Hi SG3,

 

as I said, I couldn't find anything in the userdocs regarding the topic. However, according to the .NET API you can set the return-type to any DataValue-Instance. Since DataValueArray derives from DataValue, you can set the type to an array.

 

I have lost the file that triggered the "files have not been compiled" message. Instead, with the file I have attached the stimulus profile editor simply does nothing at all when clicking "run" (Compiler-Class still throws NotImplementedError).

 

Regards

Krid

0 Kudos
Message 3 of 8
(5,613 Views)

Dear Krid,

 

I looked into your File and try to run it but without any success and the reason is that the Array Type is definitely not supported as the "ReturnValue" and the reason is:

 

“The value the real-time sequence returns after it executes. To change the data type, drag any variable that is not an array from the Variables folder in the Primitives palette onto the Return Variable node. If the sequence does not need to return a value, drag the Void Return Variable item onto this node.“ from the VeriStand Context Help

 

So if you want to return an Array out of the Sequence you have to add an Array Parameter in the Sequence and a User Channel in the SDF and store the array over there.

 

 

Kind Regards,

SG3 | Applications Engineering | National Instruments | NIG |

0 Kudos
Message 4 of 8
(5,599 Views)

Hi SG3,

 

how can I add an array user-channel to the SDF? I only know how to create a scalar channel and those cannot be mapped to array parameters. My understanding was that array-parameters are only useful when calling the sequence from another sequence because this is the only possibility to actually pass an array-datatype to the sequence.

 

Thanks

Kird

0 Kudos
Message 5 of 8
(5,592 Views)

Dear Krid,

 

could you please explain why you need to return an array from a Realtime Sequence? The Realtime Sequence is meant to control the target, normally you would not be returning an Array. If you are recording information I would recommend to use the Embedded Data Logger.

 

But If you could give me a broader picture of what you are doing and what you need the system to do I may be able to give specific advice for how you could proceed or work around not having the Array output.

 

 

Kind Regards,

SG3 | Applications Engineering | National Instruments | NIG |

0 Kudos
Message 6 of 8
(5,567 Views)

Hi SG3,

 

our realtime sequences are first of all test sequences. Currently, when some condition is not correct we set a specific bit of the return value and associate a text with that bit (the text later appears in our test-report). This is working OK but the obvious drawbacks of this approach are that each sequence can only report up to 64 errors and also that the associated texts are static (i.e. have to be known when the sequence file is created).

 

If it was possible to return an array it would be possible to return an  "unlimited" number of errors, to store dynamic information for each error, or to actually encode dynamic texts in the return value (which would be a workaround for missing string-support).

 

Regards

Krid

0 Kudos
Message 7 of 8
(5,561 Views)

Dear Krid,

 

I forwarded this issue to our VeriStand R&D and they tell me that is definitely not supported to use Arrays as the return value in a Realtime Sequence.

 

The reason is the same as in LabVIEW. So in LV we only return the first error that occurs. The mindset behind this is that if one error occurs early in the program more errors will occur in the rest of the application. Thus we only need to return the first error, solve the error and then run the system again.

 

 

So we suggested an Embedded Data Logger would be the best practice to log errors because you could selectively record the error's when they occur and then not have to report them back as he is now.

 

 

Kind Regards,

SG3 | Applications Engineering | National Instruments | NIG |

0 Kudos
Message 8 of 8
(5,492 Views)