AzeoTech

Administrators
  • Posts

    6,432
  • Joined

Posts posted by AzeoTech

  1. You also need to change/add the channel in the channel table to receive the data.

    It is usually best to first try and resolve the noise in hardware before addressing it in software.  You can easily address noise in software by oversampling (reading faster than you need) and then averaging the data, but this should only be done after you have addressed the noise in hardware as best you can as it can mask real problems.

  2. The problem is that your declarations are wrong.  DAQFactory doesn't declare arrays like C.  They are fully dynamic and so you don't have to specify the size when declaring.  So:

    global prfTrace[12,2]

    is invalid, and just creates a variable prfTrace with no contents.  It does NOT create an 12x2 array full of 0's and so, until you actually assign values to the array, you can't access it.  Your issue is in profile, which you declare as profile[12,3] but then only initialize the first 4 rows.  You are assuming because you did [12,3] that the extra 8 rows are all 0's, but they aren't.  They don't exist, so when you get into your loop and get past the first 4 rows, it fails because there is no data available.

    You have two choices and can implement both:

    1) this applies across many languages: when iterating through an array, don't count to a constant, count to the size of the array.  So, in your case, instead of iterating to cnt, you should iterate to numrows(profile).  Then it won't matter what you initialized the array to, the loop won't go past the end of the array.

    2) you can easily initialize an array with 0's by initializing the last element.  So:

    global Profile = {{3,95,2},{4,120,3},{2,129,3},{5,90,1}}
    profile[11,2] = 0

    global PrfTrace
    prfTrace[11,1] = 0

     

  3. The start sequence tells the LabJack to start streaming.  It then stops running because the LabJack has taken over and will send data as it becomes available.  The stop button / sequence sends a separate command to the LabJack to stop the streaming, at which point the LabJack stops sending data.  When the streaming is running, the yellow LED on the LabJack should blink rapidly.  

    Just to be sure, you are using a U3 / U6 or UE9 correct?  Not a T series or U12?

  4. You are logging the data as a CSV file, but Excel isn't recognizing that, possibly because in your country you use commas as the decimal point.  First, I would recommend ensuring that the filename you log ends with ".csv", so, for example: c:\data\myDataFile.csv   The .csv at the end will tell Excel that you are using commas for delimiters.  This should solve the problem.  

  5. Computers require accuracy, especially in applications like DAQFactory that control real world objects.  DAQFactory, therefore, does not make assumptions, unlike, say, the auto-correct on your cell phone keyboard.  So while we read "C:\program files(x86)" and "C:\program files (x86)" and see they are the same thing except for an added space and is just a typo, the computer / DAQFactory does NOT make this assumption and add the space for you.  You have to have it perfect, and you have to correct it yourself. 

    The (x86) is also important because we are talking about a path within your computer.  It is most likely that you have both a c:\program files\ as well as a c:\program files (x86)\ folder and these are two different things.

  6. OK, can you provide me more detail about what is happening and what isn't working?  The most common error is to not have the path to the LabJackUD.H set correctly.  It is in line 3 of StartStream.  You will have to figure out where your LabJack drivers were installed and update that path.

  7. No, you can stream whatever the LabJack allows.  You just add to the list in the LJM_eStreamStart command (line 33), and then below in the loop, you replicate the lines to retrieve the data.  So for example, to add AIN2 you would change line 33 to:

    LJM_eStreamStart(identifier, {"AIN0", "AIN1","AIN2"}, scanRate, scansPerRead, 1)

    and then copy lines 45 and 46 and paste them right after 46, and make some minor mods.  The entire while(1) loop would become:

    while(1)
       dataIn = LJM_eStreamRead(identifier)
       data = insertTime(dataIn.data.AIN0, st, 1 / scanRate)
       ChannelA.AddValue(data)  // Needs to match channel defined in "Channels".
       data = insertTime(dataIn.data.AIN1, st, 1 / scanRate)
       ChannelB.addValue(data)  // Needs to match channel defined in "Channels".
       data = insertTime(dataIn.data.AIN2, st, 1 / scanRate)
       ChannelC.addValue(data)  // Needs to match channel defined in "Channels".
       st += scansPerRead / scanRate
       backlog = dataIn.ljmscanBacklog
    endwhile

    Of course you can change the names "ChannelA", "ChannelB" and "ChannelC" as they are only for DAQFacotry, but the AIN0, AIN1 and AIN2 names are specific to the LabJack.

  8. Do you want to go faster than 0.01?  If so you'll need to stream.  Yes, you can stream and plot without any issue, but streaming does take some extra steps.  Alternatively, at 0.01, you could try accessing the T7 directly through Modbus instead of going through the LabJack driver.  Make sure the modbus registers are consecutive and only query those two.  Of course this will only help if you are connecting over Ethernet instead of USB.  

  9. I'm not sure, but seems like you can just take the absolute value of the velocity:

    abs(velocity)

    Or put it in your conversion:

    abs(Value) * 1111

    (sorry, I don't remember your scaling factor so just put 1111)

  10. OK, got it this time.  A number of comments:

    1) your Force Conversion has a syntax error.  You have:

    Value * 1695 - Value tareOffset

    Which makes no sense since there is no operator between Value and tareOffset.  You need to remove the second Value:

    Value * 1695 - tareOffset

    2) Your Start button Action has a syntax error.  You put two commands on one line.  The two clearHistory() commands need to be on their own lines.

    3) your Force and Velocity channels that you are graphing in an XY graph have different Intervals.  DAQFactory will do alignment, but it is better to simply acquire the data for both channels at the same rate.

    3) Instead of trying to freeze the graph, I would simply have a sequence do the acquisition.  Do this:

    a) put your force and Velocity into a group called Input.  (They are in Main now) and set their Timing to 0.

    b) create a sequence called, say PollSensors with this script:

    while (1)
       channel.readGroup("Input")
       delay(0.5)
    endwhile

    c) change the Start button sequence to:

    velocity.ClearHistory()
    force.ClearHistory()
    beginseq(PollSensors)

    d) change the Stop button sequence to:

    endseq(PollSensors)

    This will cause it to only acquire data when pollsensors is running, so when you hit stop it will stop reading the inputs and thus stop updating the graph.  This is better than freezing the graph.

    If you want to have force and velocity displayed always, consider adding a second pair of channels with a Timing of, say 0.5 with different names and display them.  They will update continuously, but the two channels you are graphing will only update when PollSensors is running.

  11. If you name the graph (select it, right click and select Component name), then yes.  Let's assume you named it "MyGraph":

    component.myGraph.XAxisFrozen = 1

    Set that to 0 to unfreeze it.  There is a corresponding one for Y, but unless you have the Y axis scaling set to an expression, it isn't really necessary.

  12. In order for DAQFactory to run in Express mode, you have to include the -runAsExpress flag at startup.  You can put this in your shortcut (see the one we install).  It must go before any .ctl file you list:

    c:\daqfactory\daqfactory.exe -runAsExpress "c:\myfiles\myfile.ctl"

     

  13. The easiest way is to clear the history of both channels:

    myChannelX.clearHistory()
    myChannelY.clearHistory()

    Do this from the action of a button.

    A better way is to create a variable that holds the start of the run, and then subset from that variable to the current time.  So in an auto-start sequence put something like:

    global graphStartTime = systime()

    Then, in your trend graph where you are plotting X vs Y (I am assuming) change your Y Expression to:

    myYChannel[graphStartTime,systime()]

    and your X Expression to:

    myXChannel[graphStartTime,systime()]

    Then, in the button to reset the graph, put:

    graphStartTime = systime()

    This can then be extended to make the graph stop updating with a graphEndTime variable.

    There are several other ways to do this as well depending on your end goal.

  14. You can't read the same physical I/O point from two different channels with two different conversions.  You need to combine the conversions and have just one channel.:

    value * 50 - tareoffset

     

  15. Again, I really need to see your complete document, though I am guessing you just have typos.  I see one right in your StartUp sequence where you called the variable tareOff, but then the next line reference it as TareOffset.  Computers aren't smart enough to recognize that one is short for the other, and truthfully, having computers think for themselves in this way is a bad thing, especially in programming.  DAQFactory is not case sensitive, so tareOffset and TareOffset are the same, but tareOff and tareOffset are two completely different names.  

    Also, "Value" is only valid inside a conversion, so line 2 of your startup sequence is incorrect.

    The button component looks fine as long as you rename the variable as I already mentioned.