NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Numeric Type of a member in Type Palettes' *.ini file

In Type Palettes, I tried to get a member type from a type in a *.ini file, the member numeric type is Signed 32 bit integer (as indicated in Properties, C Struct Passing), but when I used Common C Adapter, methods GetStructMemberType(), it returns StructMemberType_Float64. Is this method has a bug, or do I have to use different method to get member numeric type?

Thank you so much for the help.

0 Kudos
Message 1 of 10
(4,328 Views)

"numeric type is Signed 32 bit integer (as indicated in Properties, C Struct Passing)" - I quess these are properties from "Memory Layout for Property" section, of the Type Properties -> C Struct Passing. So this is just about how number will be processed/held in memory while struct passing, but not its representation in TestStand iteself. So that function GetStructMemberType() returns everything correct - b/c if you'll check representation of number in type properties (right-click - Representation...) you'll see there just 64-bit formats.

Hope, this will help.


logos_middle.jpg

0 Kudos
Message 2 of 10
(4,295 Views)

So is there any way that allow me to extract the Numeric Type in C Struct Passing, "Memory Layout for Property"?

Thanks

0 Kudos
Message 3 of 10
(4,289 Views)

I could get it by doing this:

RunState.Engine.GetAdapterByKeyName(FlexCAdapterKeyName).AsCommonCAdapter.GetStructMemberType(RunState.Engine.GetTypeDefinition("Name Of Type"), "Lookup String")

 

For example if I had a type call Foo which was a container with a numeric in it called MyNumber then my function would look like:

RunState.Engine.GetAdapterByKeyName(FlexCAdapterKeyName).AsCommonCAdapter.GetStructMemberType(RunState.Engine.GetTypeDefinition("Foo"), "MyNumber")

 

This will return the numeric value which represents the enumeration found in the help here:

http://zone.ni.com/reference/en-XX/help/370052P-01/tsapiref/reftopics/structmembertypes/

 

So for instance Float32 will return a 0.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 10
(4,276 Views)

This maybe is a dumb question, but how do I start RunState?

0 Kudos
Message 5 of 10
(4,252 Views)

You have to have an execution.  How are you calling the type?  Is this done in TestStand or another language?

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 10
(4,249 Views)

I'm attaching a small example that demonstrates this.  Let me know if this helps.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 10
(4,244 Views)

This is done in C#, and my program parse the existing sequence file. Basically, this is how I do it, starting with:

_appMgr.LoginOnStart = false;
_appMgr.Start();
_engine = _appMgr.GetEngine();

_dllAdapter = _engine.GetAdapterByKeyName(TS.AdapterKeyNames.FlexCAdapterKeyName) as TSAdp.DllAdapter;
_commonAdapter = _dllAdapter.AsCommonCAdapter();
TSAdp.StructMemberTypes elementType = _commonAdapter.GetStructMemberType(typeDefStructProObj, elementName);

 

The above elementType always return StructMemberType_Float64, but it is actually 32 bit integer.

0 Kudos
Message 8 of 10
(4,243 Views)

I don't have a C# compiler on my machine.  I tried what you are talking about in LabVIEW only and it works flawlessly.  hmmm?

 

What  version of TestStand are you using?  I tested mine in 2010.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 9 of 10
(4,234 Views)

NI TestStand 2010. I am new and I don't know why. Thanks for your help

0 Kudos
Message 10 of 10
(4,220 Views)