TCP/IP sending data from other program to qdex

Comments

3 comments

  • 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://192.168.0.101:10000" />

    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">
    <onClick>
    if thisButton.Text == "Start Client" then
    thisSim:Start()
    thisButton.Text = "Stop Client"
    else
    thisSim:Stop()
    thisButton.Text = "Start Client"
    end
    </onClick>
    </button>
    <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

    0
    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.

    0
    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://192.168.0.101:18000" />

    <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>
    0
    Comment actions Permalink

Please sign in to leave a comment.