AzeoTech

Administrators
  • Posts

    6,432
  • Joined

Posts posted by AzeoTech

  1. You can create one.  Just use the logging.myLog.running as the variable, where myLog is the name of your logging set.  So, for example, you would put that in for the expression for an LED component.  Or the expression for a descriptive text component.

  2. V channels are largely deprecated, so I wouldn't recommend them.  They are left over from when we didn't have variables (like 18 years ago!), but so many people seem to use them that we can't really get rid of them.  I think people like it because you can see the contents in a table?  Other than this, and the fact that assignment to a V channel does the equivalent of AddValue() on a variable, a V channel is basically the same as a global variable.  A channel, however, has added features such as persist, conversions, and other things.  If you are getting an input value from the python script that is basically an I/O point, I would use a Channel.  

  3. Unfortunately I don't know the details of the setup for every ODBC data source.  From your screen shot, I would try clicking the DataSource button next to options in your ODBC configuration and see if there is a user/password there.  I would also make sure you don't have another ODBC data source with the same name.  I don't actually know if it matters, but make sure you don't still have a DAQFactory data source in the 64 bit ODBC.

  4. Well, there isn't a built in function for this like min2() or min(val, 2) or something, but it is not hard to do using boolean math, especially if all the values are > 0.  You'd basically have to iterate through, removing values as you go using boolean math:

    private themax = max(myArray)
    private themax2 = max(myArray * (myArray < themax))
    private themax3 = max(myArray * (myArray < theMax2))

    etc...

     

  5. No, channels were purposely designed so that you couldn't remove data from them.  It goes back to the 80's when the discovered the ozone hole.  A group was already down in Antarctica measuring ozone when another group came down, found the hole, published a paper and became famous for finding it.  The first group, that had been down there for years couldn't figure out why they hadn't seen it until they realized they had removed all the data below 50ppb because they assumed it was invalid data.  But of course, the data below 50ppb ended up being the most interesting data!

    So, if you are going to want to add and remove data you really should use a global variable instead of a channel.  There is a way to do it in a channel, but I can't say how that would affect persist files or logging sets, which really are the primary reasons you would choose a channel over a variable.

    Adding to a variable is the same:

    myVar.addValue(5)

    Removing, I just subset:

    myVar = myVar[1,numrows(myvar)-1]

     

  6. Make sure you didn't put a user/password on the data source itself.  This is different than the user/password the data source uses to access the database, but if you don't know better, maybe you put the same user/password in both places.

  7. First, make sure the ODBC connection works by clicking on the Test button in your ODBC configuration.  Also, make sure you created the ODBC data source in the 32 bit version of the control panel applet, and not the 64 bit version.  DAQFactory, as a 32 bit app, only connects to 32 bit data sources.

    You can quickly verify that the ODBC is accessible from DAQFactory by going to the command alert window and typing:

    global dbase = db.open("DAQFactory")

    That will try and open the data source named "DAQFactory".  If it just does it without any message, then you are probably good.  If not, it will display an error message.  If it does work, you'll need to close the connection by then typing:

    db.close(dbase)

    Next, I would probably recommend a logging set if you are just getting started.  It is largely setup the same way, except you just select the channels you want to log.

    Finally, I do not know the dialect of PostgreSQL, so you might have to click the SQL button in the logging/export set next to where you put the data source and tweak the SQL commands to match what PostgreSQL uses.

  8. Any error code that is 8 digits and starts with 800 or similar when doing any network function is going to be a standard networking error code which you can search the internet for.  That said, I get a different error, namely that the username / password are not accepted.  This appears to be because Google is no longer accepting logins with just username / password.  It is once again a case of a big company using excessive requirements to fix security issues that don't apply in all cases.  You can read about it here:

    https://support.google.com/accounts/answer/6010255?hl=en&amp;utm_source=google-account&amp;utm_medium=profile-less-secure-apps-card

    You have two solutions for now:

    1) get a google workspace account, though this is probably a bandaid as I am guessing they may eventually make the same change.  They might not because a lot of corporate customers do things like alarming etc with older hardware and are going to balk at having to replace it all just because the guy down the hall doesn't know how to be safe on the web, but you never know

    2) use a different email service for your outgoing emails

    We will look into using a login they accept, but it will be some time before anything can be implemented.  Of course the best way to ensure you aren't subject to the whims of google or some other big company is to install an email server of your own that only does outgoing email.  You could then use a whitelist in addition to user/password combo to really button down the security, though really, if you are only using the outgoing email address for alarms and notifications to a select few, and never giving it to any website, there is no reason a hacker would pick it up.

     

  9. The best way to do this is to use the AS SQL keyword to provide an alias for the desired tag.  For example:

    select myField as myAlias from myTable;

    This is actually the only way to do SQL function selects, for example:

    select sum(myField) as theSum from myTable;

    or more common:

    select min(myTimeFIeld) as startTime from myTable;

    Of course your SQL commands may differ slightly due to the varying dialects of SQL.

     

  10. Create your 8 channels first, giving each a separate channel name.   Make sure you history is long enough to cover 48 hours, but if it is more than about 1 million, you should consider using Persist as well.  Then create your 2D graph.  Create a trace for each of the 8 channels, assigning them to either Left Axis 1 or Right Axis 1 depending on what you want.  Finally, set the scaling of the graph.  The bottom axis time width would be 3600*48 for 48 hours.  You say autoscale, but then provide fixed numbers, so I'm not sure what you want for vertical scaling.  To scale from 0-10,000, just put 0 for Scale From and 10000 for Scale To.

  11. Please post your script so I can see what you are doing.

    In general, editing text files on the fly is pretty difficult to do unless the lines are fixed length.  Assuming it isn't fixed length lines, you would have to read through the file, counting the carriage returns until you got to the desired line, then write to the file.  But you can only write the exact same number of bytes that are there.  You cannot insert any new bytes.  In order to insert, you would have to read the whole file into memory and write to a new file (or essentially do the same thing in smaller chunks).

    Fixed length lines are much easier, as you can calculate where you want to go and just jump there, but you still can't insert anything without segmenting the file first, likely writing to a temporary file while doing so.

     

  12. OK, so now you can see it is pretty easy to read, and not hard to parse.  Assuming you created a serial device named "myDevice", the script would be something like:

    while(1)
       private string datain = device.myDevice.readUntil(13)
       private string pdata = parse(datain, -1, ",")
       private rh =strToDouble(parse(pdata[0],1,"=")
       private dpc = strToDouble(parse(pdata[1],1,"=")
       private atc = strtodouble(parse(pdata[2],1,"=")
    endwhile

    Then you just have to decide what you want to do with those three private variables with your values.  Probably add them to a channel:

    myRH.addValue(rh)

    etc.

     

  13. It is most likely that you changed two things in debugging and are attributing the solution to the wrong thing because the other thing you did was more minor.  There is, as far as I know, absolutely no connection between the U12 and UE9.  They use different drivers in DAQFactory and they use different drivers from Labjack, and since you were on Ethernet, they wouldn't even share a USB low level driver (which I doubt even if you were on USB for the UE9).  More likely, in the process of doing all this you cycled power on the UE9 which cleared out all the lost connections and opened it up to new connections, or some other little thing.  It goes back to that joke I posted on the forum a few days ago: 4 people get into a car and it won't start.  The electrician says, "It must be the battery", the engineer says "It must be the starter", the chemist says "It must be bad fuel", and the IT guy says "hey guys, why don't we all get out of the car and then get back in and try again!"  It is particularly funny because it is so true.  In computer systems, a reboot (of all systems) solves like 75% of problems. 

  14. You can't put anything but actual numbers or strings inside {} when defining an array.  So: {1,2,3}, or {"a","b","c"} are valid, but {myVar1, myVar2, myVar3} is not.

    I, personally, would consider creating a two dimensional array called simply procedure that has, it looks like, 8 columns and 6 rows?

    global procedure = {{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}}

     

  15. Looks real sharp!

    You might consider working your way towards using objects in your script.  Pretty much any time you have multiple, identical things in real life that need representing in DAQFactory script, an object/class is the way to go.  You basically create a template (a "class") that defines how the object works, along with member variables that characterize the object, then instantiate the class into objects, one for each real world item you need, usually storing that object in array with the rest of the similar objects.  There are a few very useful things about objects in DAQFactory, over and above the normal usefulness in any programming language:
    1) when you have an object stored in a variable called "myObject" and you do: 

    curObject = myObject

    it does not copy the object, but instead copies the reference.  I really used the wrong word in the previous sentence.  Objects aren't "stored" in variables.  Only the reference to the object is stored and that reference is what gets passed around.  The advantage of this is that you can create a global variable like curObject and reference it to different objects depending on which thing you want to have the UI work with.  This makes drill down super easy and scalable.

    2) there is a function for member variables of objects (and really any variable) called "aliasFor" which makes the variable into an alias for another variable or, more usefully, a channel.  That way you can use member variables in objects, which are very structured, to reference channels, which are quite flat (just a long list).  The general format is:

    myVariable.aliasFor("myChannel")

     

  16. There doesn't appear to be anything wrong with the setup.  So:

    1) reboot.  Maybe repower the UE9 as well.  Make sure you don't have any LabJack software running as the LabJack only supports one connection at a time on these devices.  
    2) create a new document in DAQFactory before loading anything.  Create the UD ethernet connection like you did and add the single channel.  Then see if it communicates.  If it does, then try your original document, but we need to make sure you don't have any interference.
    3) if it doesn't work, make sure you have the latest UD software and firmware

    On a separate note on the U12's.  You really need to switch off of ID 0 as soon as possible. Right now it is working, but it is entirely possible that the next time you start, the system will decide that the first found device is ID 1.  This would almost certainly happen if you ever accidently unplugged either of those U12's.