• Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral


About AzeoTech

  • Rank

Recent Profile Visitors

51,012 profile views
  1. AzeoTech

    File name truncated

    I'm not a big fan of the edit box in HMI's, so my first suggestion is to consider using a variable value control to display the current settings, and a button next to it that pops up a query for the value. If you really want to use edit boxes, then my second suggestion is to put them in a popup that only updates the filename when the popup is dismissed with an OK button. Putting edit boxes on the primary pages of your HMI is a bad idea, for reasons I explain here: Chances are the issue is that the edit box hasn't lost focus and updated the strContents. You could use the setFocus() function of any other screen element to force the loss of focus, or you can probably do page.myPage.submit()
  2. AzeoTech

    New protocol not saving

    The DAQFactory installation folder is read-only by default unless you run DAQFactory with administrative rights (which is not the same as being logged in as an admin). I am guessing that DAQFactory is unable to save the ddp to its installation folder. I would go into Windows Explorer and change the security settings on the DAQFactory installation folder to allow "Everyone" the ability to write. Keep it this why while you are developing the ddp, then when done revert it back, leaving the ddp file in the installation folder.
  3. AzeoTech

    COM port access

    Unless you can reproduce on a physical port the issue is in the USB driver. Pretty much all those virtual com port drivers use the same core code so have the same issues. DAQFactory uses simple core Windows functions for communicating on the serial port. There isn't much to it as Windows itself takes care of everything. But virtual com ports are really just a trick (hack really) and so aren't particularly reliable. DAQFactory can't bypass them, so we are completely at the mercy of the quirks in the virtual driver. I've been saying for many, many years that people should avoid USB -> serial devices and use Ethernet->Serial if they want true reliability. This is because DAQFactory can connect to the Ethernet->Serial device directly using Windows sockets and not be reliant on some 3rd party driver. Alternatively, though more expensive, is to purchase an industrial computer with native serial ports. There are also other issues with using USB in general in systems that require high reliability, which I can go on and on about, mostly related to the fact that one device can easily crash all the devices on the USB bus. USB is convenient, and for many applications, a failure isn't a problem so we support devices like the LabJack U3 that is USB only. But I would never use a U3 or any other USB device in a case where its failure would cause major issues. I would instead use a LabJack UE9 or T7 which is Ethernet based, or some other Ethernet based device. Likewise, USB->Serial is cheap and convenient, but it isn't reliable, especially if you just buy a random converter from an unknown vendor, but in many cases it doesn't matter. And often you can script around it, such as in your case. But you are going to get weird things happen like what you are seeing. Note: Over the years we have found that the serial converters from SeaLevel tend to be much more reliable than the generic ones from the generic web, so if you have to use a USB to serial converter, buy one from them.
  4. AzeoTech

    Write a txt file additively

    You could use an export set, or if you want real control over the file format, use the low level file functions. For example: private handle ="c:\data\myfile.txt",0,1,1,1) file.write(handle, "Here is some data:" + myChannel[0]) file.close(handle) The Logging part of the user's guide has the description of all the file. functions. Those 0's and 1's in open correspond to: Read, Write, Append, Text, so what I have in the example is not to read, but to write; to append and not overwrite data, and that I'm writing a text file (which means it generates a new line with every call to write())
  5. AzeoTech

    COM port access

    Opening the configuration screen and clicking save reinitializes the port, which apparently is what your port requires. I've seen this occasionally with USB->Serial converters. You can achieve the same thing in script by simply doing: device.myDevice.initComm() and with that you can easily right a little script that reinitializes the port whenever it doesn't see any data for some time period, say, a few seconds.
  6. AzeoTech

    Remote channel Persistence

    You need to provide the channel name in quotes. Otherwise the function looks for the value of the symbol HV_Power_Active locally. So it should be: remotelite.GetHistory("HV_Power_Active", 0, 3000) Note that GetHistory will clear the history on the machine that calls the function. The new data coming in overwrites any data already accumulated.
  7. AzeoTech

    Filtering Graph Data

    PlotData will become an array of CData objects over time, so you'll have to create multiple traces. But to start, if you only have the code above, it would be: component.Graph2D.test1.strYExpression = "plotData[0].ydata" component.Graph2D.test1.strXExpression = "plotData[0].xdata" Once you have more data sets, you'll have to create more traces, then index into plotData to access the different data sets.
  8. AzeoTech


    I'm not completely sure it is causing the crash, but you have a while(1) loop with no delay in it, so that sequence, when run, is going to run as fast as the CPU will allow and use all the CPU power of one of your cores. I would add at least a delay(0.1) before the endwhile and see if that helps. If it does not, then you should consider upgrading to the latest release.
  9. AzeoTech

    Change Trace color through scripting

    You have to give both the Graph itself and the trace a name. The graph is named just like any other component. The trace name is set on the Trace properties page, or if programatically adding traces. Then it is simply: component.myGraph.myTrace.Color = RGB(255,0,0) for example. This would set the trace to red.
  10. AzeoTech

    change slave ID

    That would have to be done on the device. The method would vary depending on the device. More modern Ethernet devices often have a web server so you can just browse to the device. Serial based devices often either have DIP switches, or alternatively, use a specific Modbus register to change the slave ID, however, that register # is not universal, so you'd have to read the device's documentation to determine this.
  11. Yes, this is expected. It has to do with how Modbus addressing works and is a side effect of a poor choice they made when they first created Modbus. At that time they for some reason thought that electricians, who were the primary people installing PLCs at the time (like 40+ years ago), could not count from 0 like programmers do. Silly really as all the electricians I know are quite smart. So, even though Modbus internally numbers everything from 0, they started addresses at 1. On top of that, they put a digit in the 10,000's place to indicate the type of register. So 40,001 is the first Holding register, and 30,001 is the first Input Register. 10,000 is input status and 0 is coils. I don't know why they skipped the 20,000 range. Anyhow, when you ask for 40,001, what actually is put in the Modbus query is 0. And when you ask for 40,184, what actually gets asked for is 183. This was all fine for a while, but then PLC's got fancy enough that they needed more than the 9,999 register limit of this notation. Modbus itself allows for 65336 registers in the protocol, but the notation was limiting it to 9999. So, manufacturers started simply documenting registers the way it is in the Modbus packet instead of this arbitrary notation. So, 0 is 0, 1 is 1, and 65535 is 65535. Nowadays the problem is that some device manufactures document their hardware using the 40,001 notation, and others use the 0 indexed notation. And yet others just do it completely wrong, using 40,001 notation but actually keeping 40,001 in the packet, or using 0 indexed, but subtracting 1. Those are rarer fortunately. DAQFactory tries to figure this out for you, but doesn't always do the best job. Basically, until you read a register in the 30,000-50,000 range, it will assume that the channel # you ask is exactly how it should go out to the device. So, 1 is 1, 5, is 5, 0 is 0. Once you read something in the 30,000-50,000 range, it assumes you are going to stick with that notation, so 40,001 becomes 0; 40,002 becomes 1, etc. It just strips the 10,000's place and subtracts 1. The type of register is determined by the I/O type. Now the problem is if you go back and ask for Channel #1, it is still doing this, so 1 becomes 0 now instead of 1. This is why it didn't work until you read 40,001, and then did work after that. The register is actually at 0, but you tried to read 1, which is invalid for a float that requires 2 registers and starts at 0. Once you read 40,001, DAQFactory requested register 0, the correct register, even when you subsequently requested 1. The bottom line is that you have to choose which notation you want to use. It is totally a documentation thing and has nothing to do with the actual protocol and communications or the device, as that is always using 0 indexed register numbers. I personally do everything in 0 indexed notation and just translate in my head. So when I see 40,001 I just tell DAQFactory to read register 0. And when I see 43,483 I put in 3482. I don't really ever put use the 40,001 notation, even when the device's docs are provided using those numbers.
  12. AzeoTech

    Filtering Graph Data

    You'd have to make a copy of the data. So if your X/Y was plotting channelX vs channelY, you could do something like: global chanXData = channelX global chanYData = channelY then plot chanXData vs chanYData. Then do channelX.clearHistory() and channelY.clearHistory() before each run to start anew. The best way to handle this in script, if you expect to do this several times, is to actually use an object: class CData local XData local YData endclass Then instead of what I did above, create a global variable called "PlotData". Then for each run: private newData = new(CData) newData.xdata = channelX newData.ydata = channelY PlotData.append(newData) channelX.ClearHistory() channelY.ClearHistory() Now you can plot: PlotData[0].xdata vs plotData[0].ydata and change the 0 to other numbers as you accumulate more data sets. This allows you to dynamically add/remove data sets. Just add some script to add new traces on the fly too.
  13. AzeoTech

    X-Y plot data offset

    The graph may be attempting to align the data. Go to the Bottom Axis settings and set the alignment threshold to 0 so that points have to be exactly aligned, or try a negative number, which will turn alignment by time off completely and just go by data point.
  14. AzeoTech

    Remote channel Persistence

    It is actually just a subset on the other end, so you could just use index, i.e: remotelite.GetHistory(HV_Power_Active, 0, 99) On the remote it just does: remotelist[0,99] and sends it back.
  15. AzeoTech

    Remote channel Persistence

    So, first a short explanation: DAQFactory is used in a very wide variety of applications and as such, a few things that might be feasible to be automatic in certain applications is not automatic in DAQFactory because in other applications it can cause complications. For example, if DAQFactory is running on a remote site with limited bandwidth, accessing the full history from the remote would cause problems. As such, this is not automatic. Instead, you have to use a function to request the data on startup. The function goes something like this: myConnection.GetHistory(channelName, startTime, endTime) The data transfer is async, so the function will return immediately, and once the remote gets the command it will send the data back if available, and put it in the channel locally. This is a somewhat undocumented feature and not often used so I don't remember if it goes to persist. I suggest just giving it a try and see how it works for you.