Storing labview TCP connection in TestStand object reference
I have a LabVIEW routine (GetFileGlobal) that uses the TestStand SequenceContext->FileGlobals to do a lookupString and determine the GetType if the string 'Exists'. I have a LabVIEW case statement that captures values of '1' for GetValString, '2' for GetValBoolean, and '3' for GetValNumber. I have a LabVIEW TCP connection that gets opened that we need to store in TestStand in a FileGlobal. What type is necessary in TestStand to store a TCP Conn? AND, given the (tbd) type in TestStand, what is the value I would need in my case statement to capture this new (tbd) type coming out of the GetType?
I've asked this on another thread, but I'm just not understanding the exact implementation. In TestStand, the LabVIEW IO Controls type is made up of a DeviceName and a SessionNumber, but in LabVIEW I have a TCP Network Connection. I have routines that let me Get/Set TestStand File Globals if they are Boolean, String, or Number. Now, if I use LabVIEW IO Controls in TestStand, what is the exact way I stuff a TCP Network Connection in there. I've attached a VI that I use to GET the FileGlobal value from TS. I need to grow it to allow me to get the TCP connection (i.e. LabVIEW IO Controls), but I'm not sure how to do that. The types are messing me up. Also, I'm not sure what the 'GetType' wants to see
Attachments:
FTW_ATE_UTIL_GetFileGlobal.vi 25 KB
Similar Messages
-
TCP connection in labview and C program
Hi there,
I have a server program written in C and running under linux, it
accept connection from client and send series of data to client
through TCP socket. I was using the "simple data client.vi" as the
client.
I tried to send integer number 1, 2,3.. , but the client failed to
correctly decode the data since it read everything as string. I was
wondering if there is a solution to read binary data in labview TCP
connection? I really don't want to encode the double into string and
send it to client through TCP socket in my server program, since it's
not efficient.
thanks !> I have a server program written in C and running under linux, it
> accept connection from client and send series of data to client
> through TCP socket. I was using the "simple data client.vi" as the
> client.
> I tried to send integer number 1, 2,3.. , but the client failed to
> correctly decode the data since it read everything as string. I was
> wondering if there is a solution to read binary data in labview TCP
> connection? I really don't want to encode the double into string and
> send it to client through TCP socket in my server program, since it's
> not efficient.
> thanks !
>
The string is often used in LV as a general buffer. Type Cast the
string as the appropriate integer and it should be fine. If the integer
has been transmitted in litt
le endian byte order, you will need to use
the Advanced byte and word swapping functions in LV in order to reorder
the integer contents -- LV always assumes big-endian binary format.
Greg McKaskle -
Pass object reference from TestStand to C#
Hi,
I have created a GUI in .NET which i invoke in TestStand (through a custom step type). User can enter a object reference teststand variable in the UI input expression box. So i need to get the object value in that variable and use it to call some .net functions. To get the values from expression box of UI and put in TestStand step variable i use:
PropertyObject.SetValInterface("Step.TestStationObj", 0, tsexprTestStationObj.DisplayText.Trim()); To check the value in the step variable if i do:
MessageBox.Show("TestStation obj after setting:",PropertyObject.GetValInterface("Step.TestStationObj",0).ToString());
But i do not get any value. Guess it is null. Is this a correct way? My intension is to get the value corresponding to a teststand object reference and pass it to C#. The C# UI control is of type NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEditThanks Andy.
I still get the error when i am trying to pass the object created from C# to Teststand. I have explained what i am trying to do. Kindly requesting your assitance on this issue.
I have 2 classes in C# (code given below), I am trying to pass the object of "Counter" (c1) class from the "Mainfrm" to teststand. In teststand(counter.seq), I am trying to access the function "GetCount() and SetCount()". I have attached the snapshot of the error that i get from teststand.
Class Counter
private int count;
public int GetCount ()
return (count);
public void SetCount(int _count)
count = _count;
Class Mainfrm : Form
public Counter c1;
private void Mainfrm (object sender, EventArgs e)
InitializeComponent();
axApplicationMgr1.Start();
mEngine = axApplicationMgr1.GetEngine();
currentFile = axApplicationMgr1.OpenSequenceFile(@"Counter.seq");
pobj = mEngine.NewPropertyObject(NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Container, false, "", 0);
pobj.NewSubProperty("Parameters.ObjRef1", NationalInstruments.TestStand.Interop.API.PropertyValueTypes.PropValType_Reference, false, "", 0);
pobj.SetValInterface("Parameters.ObjRef1", 0, (object)c1);
mExecution = mEngine.NewExecution(currentFile, "MainSequence", null, false, 0, pobj, null, null);
Attachments:
ErrorFromTestStand.JPG 28 KB -
Can a "object reference" type from TestStand be used for Labview VIs
I am creating a test sequence in Test Stand and I am looking to use a "object referrence" type stored in the globals of TestStand as an input to VIs that I will use later in TestStand. The object can be from .NET or ActiveX. I need to know if I can use a input that will support either type.
Hi Mcfrenzy36,
Object references can be used for LabVIEW. I have found an article that teaches how TestStand handles Activex object references. Here is the linkt o it:
http://zone.ni.com/devzone/cda/tut/p/id/2984
I hope that this helps.
Regards,
Perry S.
Applications Engineer
National Instruments -
A simple teststand applicatio​n passing object reference to C#
Hi,
I have a .NET application written in C# which has a UI with NationalInstruments.TestStand.Interop.UI.Ax.AxExpressionEdit controls. This UI is invoked by a custom step in TestStand. One of the values, entered by user in the UI is a object reference variable created in a previous step. I need to store the values entered in the UI during the edit mode of the step, into the TestStand Step variables. And during the run mode i use these values to execute the logic in C#.
The problem is during edit time, the object reference variable, entered in the UI, has no value. It is null. So there is no use storing it at edit time. During the runtime i am trying to retrieve the value of the object reference variable using GetValInterface(...) and GetValIDispatch(..) methods of PropertyObject. But the object returned to C# is of type System.__COMObject wherease in TestStand that object reference is of type .NET.
I don't know how a .NET object reference is converted to COM object when it is returned to .Net function.
Also is there any other method to send this object reference variable's (whose value is '.NET' in previous step itself) value to .NET as a .NET object only so that i can typecast to appropriate type and start using.
Thanks.
Please let me know if anything is not clear.
I have attached the .Net project, .ini file for the custom step and a example sequence file.
Attachments:
CCustomStepObj.zip 23 KBHello Shivapriya,
The example you've sent doesn't compile. And it without it I'm affraid I do not understand the problem you're describing.
You've given references to libraries that you've not attached with your files.
For the C# I see these are the
IADCore.dll
InstrimentInterfaces.dll
TestStand also seems to want to reach for the assembly named TestSystem.dll.
I can only tell you that I have used successfully in the past the Variables in TestStand to hold .NET object references, and call methods on them and I experienced nothing similar that you describe, but I don't quite follow what is the problem here, as I can't use the example.
I would appriciate if you cold narrow down the example to 1 dll or something where the problem occurs and than resend it.
Regards,
Maciej
Message Edited by Mac671 on 09-28-2009 02:59 AM -
Loading TestStand Engine reference into the runnable objects table
Has anyone ever used the Running Objects Table (ROT) to store the TestStand execution reference so other running programs have access to it?
I have a test sequence that instantiates an ActiveX Exe script engine, then calls the script engine using the activeX adapter steps to run script files. I need to access TestStand context variables from inside one of these scripts, but I can only pass (space delimited) string parameters to the scripts, (I didn't write the interface...) so I don't believe I can pass ThisContext directly.
I'd really appreciate a reply from anyone who has experience storing TestStand references in the ROT (& knows whether this would work), or using any other method of making the TestStand reference available to another running program.
I don't really understand how the ROT works, but I found some DLL calls that register and unregister references in it. I've stumbled about with trying it, but don't really understand what I'm doing.
thanks - MarkSorry, found the answer already at this forum.
-
Find memory leakage when passing Object Reference from Teststand to vi
I am using Teststand to call labview vi, and pass ThisContext of sequence to vi as object reference, but if I just loop this step and I can find the memory using keep increasing, how can I avoid the memory leakage inside the vi.
see my vi, it is to post message to UI.
Solved!
Go to Solution.You should be using a close reference node to close the references you get as a result of an invoke. In the code below you should be closing the references you get from the following:
AsPropertyObject
Thread
Close those two references once you are done with them.
Also make sure you turned off result collection in your sequence or you will be using up memory continually for the step results.
Hope this helps,
-Doug -
How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
How do I get an activeX object reference from a LabVIEW ActiveXContainer ref?
I'm trying to control an ActiveX object (a Web Browser) from another VI and need to get the object reference programmatically. I can get the LabVIEW ActiveXContainer reference, but am lost on how to get the reference for the object _inside_ the container.Hi Lee,
The reference to the container is actually also accessing the object inside the container. Use the Property Node and Invoke Node to access properties and launch methods for the object. I've attached a small example that passes the reference to a SubVI and invokes a method inside the SubVI.
- Philip Courtois, Thinkbot Solutions
Attachments:
WebContainer.zip 21 KB -
"Object reference not set to an instance of an object" on stored proc.
So, I use VS 2005 with Oracle 11 rel. 11.1.06.0.
I installed ODP for .net (ODAC 11.10621).
but, when I call some stored proc wich was working previously, when calling stored proc:
oProcAppendWebFolder2.Parameters("p_siteid").Value = vSiteID
oProcAppendWebFolder2.Parameters("p_webfoldername").Value = vWebFolderName
oProcAppendWebFolder2.Parameters("p_includestartpage").Value = IIf(vIncludeStartPage, "Y", "N")
oProcAppendWebFolder2.ExecuteNonQuery()
I often got message:
Object reference not set to an instance of an object. (I got this message when calling ExecuteNonQuery)
proc is simple:
FUNCTION AppendWebFolder(p_SiteID IN NUMBER, p_WebFolderName IN VARCHAR2, p_includeStartPage IN char) RETURN NUMBER AS
v_errcode PLS_INTEGER :=0;
v_retval PLS_INTEGER :=0;
BEGIN
UPDATE DBSEQUENCES SET VALUE=NVL(VALUE,0)+1
WHERE seqid=4
RETURNING VALUE INTO v_retval;
INSERT INTO WEBFOLDERS(webfolderid, siteid, webfoldername, include_startpage)
VALUES (v_retval, p_siteid, p_webfoldername, p_includestartpage);
RETURN (v_retval);
EXCEPTION
WHEN OTHERS THEN
v_errcode := SQLCODE;
g_errm := SUBSTR(SQLERRM,1,LONG_VARCHAR);
Appenderror(g_errm, 0, class_name, 'AppendWebFolder', 'siteid: ' || p_siteid || ' webfoldername: ' || p_webfoldername,0);
RETURN (v_errcode);
END AppendWebFolder;
procedure call declaratiion in .net is:
oProcAppendWebFolder2 = New OracleCommand("appendwebfolder", oConn)
oProcAppendWebFolder2.CommandType = CommandType.StoredProcedure
oProcAppendWebFolder2.Parameters.Add("retval", OracleDbType.Int32, ParameterDirection.ReturnValue)
oProcAppendWebFolder2.Parameters.Add("p_siteid", OracleDbType.Int32, ParameterDirection.Input)
oProcAppendWebFolder2.Parameters.Add("p_webfoldername", OracleDbType.Varchar2, ParameterDirection.Input)
oProcAppendWebFolder2.Parameters.Add("p_includestartpage", OracleDbType.Char, 1, "", ParameterDirection.Input)
oProcAppendWebFolder2.Prepare()
note that such error was not appearing when I used oracle XE
Edited by: user465054 on Dec 17, 2008 9:47 AMIf it is a web application, I would suggest using HTTP sessions to store the ReportDocument object.
See this KB for reference code on how to use session.
http://search.sap.com/ui/notes?id=0001985571&boj=/sap/bc/bsp/spn/scn_bosap/notes.do?access=69765F6D6F64653D3939382669765F7361706E6F7465735F6E756D6265723D30303031393835353731&ssocompatible
If that does not resolve the issue, provide below info.
- Version of CR with patch level.
- Version of VS
- Win or web app?
- What happens when you refresh the report in viewer using refresh button?
Thanks,
Bhushan -
When does LabVIEW actually close object references?
I wanted to find out how LabVIEW manages references to objects when a reference is distributed among more than one property node located within different structures. So I created a little test where I passed a reference into a for loop, modified the referenced object with a property node and closed the reference inside the loop, then ran the loop several times.
To my surprise, the VI ran without generating any errors. This doesn't make sense because once I closed the reference in the first iteration of the loop, when the second iteration occurred, the reference should have been invalid. Why did I not receive any errors?
This begs the question: what happens to references when they are passed to more than one
location within a VI? Does the reference need to be closed each time it is used, or only after it's been used for the last time?
Also, if the cluster "controls[]" property is used, do the references to all of the controls within the cluster have to be closed as well as the reference to the cluster itself?
This issue is very important to me because I am developing a very large VI that is meant to be run for days at a time, and at the moment, there is a memory leak in the program. I want to make sure that all of my references are closed before exiting any sub VIs and I'm not positive that simply closing the original reference passed into a sub VI is actually freeing up all of the memory. On the other hand, I'm afraid of closing references after each time they are used if they are going to be used again in the same VI before it finishes executing.
Does anybody have any insight on this matter?> I wanted to find out how LabVIEW manages references...
Unfortunately, this depends a bit on which version of LV you are using.
It was changed for LV6.1 to ensure that front panel object references
wouldn't cause memory leaks, or more correctly, memory hoarding.
In LV6, the guideline is to close the reference the same number of times
you opened it or asked for its value. Opens are easy to spot. The
asking needs some more explanation. When you read the Controls[]
property for a cluster or the panel, you are asking the cluster or panel
to provide you with a bunch of references. In LV6, these were unique
references each time they were asked. If you do not want these
references to build up, your diagram needs to call Close on each of the
asked or opened references. Technically these aren't a leak since LV
still knows that they are allocated, and when the top-level VI finishes,
LV will clean them up. But in applications where the top-level VI run
continuously, then this hoarding of memory is the same as a true leak.
The size of the leak per reference is something like 20 to 40 bytes, so
not huge, but still a leak/hoard.
In LV6.1, the asking for references changed. They always return the
same reference, and it is a reference that cannot be closed by the user.
Trying to close it is not an error, but it will be ignored. This
means that the first time someone wants a reference to a control, a
reference is generated, and it will be the reference that is returned
everytime someone asks for the control reference. If your diagram calls
close already, no harm. If your diagram doesn't call close, no harm.
When this panel leaves memory and the reference no longer makes sense,
it will be torn down.
I need to make it clear that the new LV6.1 behavior is for control
references that are asked for. References returned from Open are the
same as before and should be Closed. So this doesn't affect VISA, File
I/O, and other types of references, it is specific to front panel
references.
In case it still isn't clear why the behavior changed, we started seeing
many diagrams written such that they leaked or hoarded memory. In
reality, spotting where a diagram asks for a reference is hard, and
everyone was missing them some of the time. So we changed the
implementation to be more forgiving. The downside is that LV now hoards
one reference and you can't tell it that you are totally finished with
it, but it is no longer a leak.
I hope this sheds some light. If you have additional questions, just ask.
Greg McKaskle -
An error occured while opening the connection: Object reference not set to
After I uninstalled Oracle Developer Tools for Visual Studio .NET 10.1.0.4 and installed Oracle Developer Tools for Visual Studio .NET with Oracle10g Release 2 ODAC 10.2.0.2.21 I got the error message below when I want to connect to my 10g database using Oracle Explorer.
Error:
An error occured while opening the connection: Object reference not set to an instance of an object
I use OracleConnection to open also cannot be done. But I use Oracle SQL Developer I can connect to orcl that I cannot connect using ODAC 10.2.0.2.21 in my laptop.
Please help me.
Ming ManSorry my mistake, I double checked, the one I uninstalled is ODAC 10.2.0.2.20 and not ODAC 10.1.0.4.
But I have that error.
Ming Man -
//Initialize the Engine
EngineClass myEngine = new EngineClass();
myEngine.LoadTypePaletteFilesEx(TypeConflictHandlerTypes.ConflictHandler_Prompt, 0);
Step myStep = myEngine.NewStep(AdapterKeyNames.DotNetAdapterKeyname,StepTypes.StepType_Action);
myStep.Name = "object";
DotNetModule dotnetmodule = myStep.Module as DotNetModule;
dotnetmodule.SetAssembly(DotNetModuleAssemblyLocations.DotNetModule_AssemblyLocation_File,@"C:sequence.dll");
dotnetmodule.ClassName = "CN";
dotnetmodule.MemberType = DotNetModuleMemberTypes.DotNetMember_GetProperty;
dotnetmodule.MemberName = "ISI";
mySequence.Locals.NewSubProperty("object", PropertyValueTypes.PropValType_Reference, false, "", 0);
Sequence mySequence = myEngine.NewSequence();
mySequence.Locals.NewSubProperty(varName, PropertyValueTypes.PropValType_Reference, false, String.Empty, 0);
mySequence.InsertStep(myStep, 0, StepGroups.StepGroup_Main);
SequenceFile seqFile = myEngine.NewSequenceFile();
seqFile.InsertSequence(mySequence);
seqFile.Save("C:\\mySeq.seq");
I have done this,dynamically creating a sequence file in teststand programatically through c#.
Problem is
1.I created an action step and object Reference variable for the step, but i am not able to pass parameter values to the objectReference
2.I am not able to load the sequence in to the main Sequence of the sequence file in the teststand. How can I do these two things.Hi,
have you ever followed on my Links ?!?!?
If not please jump to this one
http://forums.ni.com/ni/board/message?board.id=330&thread.id=26880
and read the the answer from Mannoch
starting with this words:
Anthony -
Currently, functionality for retrieving the Metadata Token for a class constructor or member is not fully provided in the TestStand .NET Adapter API. The DotNetModule.GetConstructorMetadataToken() and DotNetModule.GetMetadataToken() methods only return the correct Metadata Token when the member/constructor prototypes have already been loaded. Thus, in the case of your code, when you call DotNetModule.GetMetadataToken(), the method is returning -1 because the member prototype for the Step you are referring to has not yet been loaded.
That means have to do a workaround for your stuff.
Juergen
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e= -
Object Reference / Data Connection Error may be due to web.config
i am just a beginner in webpart and facing error in my webpart when connecting to database,
error is: object reference not set to an instance of an object.
troubleshooting tips is
check to determine if the object is null before calling the method
error occur on this line:
SqlDataAdapter dba = new SqlDataAdapter(QryString, ConfigurationManager.ConnectionStrings["QString"].ConnectionString);
where QString is reference to my web.config file which contains
<connectionStrings>
<add name="QString" connectionString="Data Source=(local)\SP2013;Initial Catalog=SPUserAuthWP;Integrated Security=True;" providerName="System.Data.SqlClient"/>
</connectionStrings>
As in webpart solution explorer, web.config not automaticaly add so i add it maunally.
kindly guide how to overcome this problemHello,
Just find "</SharePoint>" web.config and paste below tag just below of "</SharePoint>". You also need to pass userId, password and DB server name/IP in below connection string.
</SharePoint>
<connectionStrings>
<add connectionString="user id=username; password=password; Data Source=your DB server name;Initial Catalog=SPUserAuthWP" name="QString" />
</connectionStrings>
Then use below code:
string strcon = System.Configuration.ConfigurationManager.AppSettings["QString"];
using (SqlConnection con = new SqlConnection(strcon))
{//your code goes here}
Let us know your result
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help -
I want to create a local object reference variable in a TestStand sequence file programatically using C#.
Hi,
Accoring to your reply in this Thread
http://forums.ni.com/ni/board/message?board.id=330&thread.id=26984
Just try this example. There you will create a numeric variable during excuting a sequence!
Hope this is what you are looking for.
Please attach all your questions here.
juergen
=s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
Attachments:
CTestStandDialog.zip 31 KB -
Any Resources for Learning Object Reference in TestStand?
Hi All,
I have been using Active X servers in TestStand for several years and now some of the newer stuff I am being supplied with is Dot Net objects. Does anyone know of somewhere to learn the correct way to use object references in TestStand. I don't understand when you should create a new object vs just using an existing object reference. I also would like to understand how to use an object reference variable.
I looked at the TS examples, but there is not an explanation.
Any ideas?
TIA,
JimJim,
You may try reading through the NI TestStand Advanced Architecture Series, specifically Chapter 2: Using the NI TestStand Object Model. These may shed some light on the issue.
Regards,
Steven Zittrower
Applications Engineer
National Instruments
http://www.ni.com
Maybe you are looking for
-
Windows 8 and GoPro converting to DVD
Just purchased a new computer, with windows 8 and I want to convert GoPro movies HD Mp4 and burn them to DVD to watch on TV. My question is what adobie soft ware will handle this task ?
-
I want to publish/share my Premiere Elements 11 video such that I can store it on Amazon S3 and then link to it in my blog, facebook, autoresponder. I know I DON"T want the Online settings because I am not directly uploading to YouTube, etc. There a
-
i am getting a installation failed for photoshop, illustrator,and dreamreaver ---- Payload: Microsoft Visual C++ 2012 Redistributable Package (x64) 11.0.61030.0 {3E272A93-C06B-4206-AD02-0EBE02535E20} ----------- ERROR: Third party payload installer
-
I recently downloaded / installed FCP X into the same folder as a previous version of FCP before reading to NOT do that. I've trashed the older version of FCP, but now what? Has there been damage done? Should I trash FCP X and reinstall it?
-
I've been using premiere pro for years now, and every computer I've used is well beyond the recommended specifications to run any premier pro I've usd in the past. I'm not using CS5 currently. So every time I start editing my videos and when I clic