TCP/IP sending data from other program to qdex



  • Abbey Desjarlais

    Yes, you can receive data in qdex in much the same way that you send it. First you need to add a client tag, and specify the IP address and port number that you will be receiving from.

    <client name="streamName" uri="tcpip://" />

    You can then access the data from the stream using a simulation. Note that the simulation will need to be started before qdex will start sending/receiving data. I recommend using a button for this.

    <button name="thisButton" content="Start Client">
    if thisButton.Text == "Start Client" then
    thisButton.Text = "Stop Client"
    thisButton.Text = "Start Client"
    <simulation period="0.01" name="thisSim"> <solver name="solver"> <series> <signal ref="mySection.streamName" /> <probe ref="mySection.myPlot" /> </series> </solver> </simulation>

    Using the simulation you can take the received data and directly plot it, or you can save it to a variable for saving or manipulation. More information on how to receive data can be found on the Knowledge Base

    Comment actions Permalink
  • Jonathan Sebastian

    How about taking it as "Text Fields" rather than as a graph using simulation, is that possible? Sorry I am new to this.

    Comment actions Permalink
  • Abbey Desjarlais

    Yes, you can use a custom system to update a textField with the value from the client. E.g.

    <client name="myStream" uri="tcpip://" />

    <textField name="myField" />
    <simulation period="1.5" name="sim"> <solver name="solver"> <series> <signal ref="mySection.myStream" width="1" /> <system name="myCustomSystem"> <input name="myReceivedData" width="1" /> <onOutputs> myField.Text = string.format("The received value is %.3f", myReceivedData[1]) </onOutputs> </system> </series> </solver> </simulation>
    Comment actions Permalink

Please sign in to leave a comment.