Daqfactory Program's Size Increases


Recommended Posts

The problem is almost certainly the number of bitmap images you use.  They are all pretty small, but there are a lot of them, and every time you use one in a new component, even if its the same image as an old component, a copy is made.  And, they are all stored as bitmaps, not as jpeg or other compressed format.  As for deleting the pages and the file is still big, I'd probably try that, but then restart and load the saved document, make a small change, then resave.  Its possible that some stuff was still cached and saved with the document.

 

Finally, you have 6 or 7 pages that are pretty much identical in look and only appear to be different in terms of what information they show.  I'd strongly recommend figuring a way to create a single page to do this.  There are two common techniques, one is to use a lot of execute() and evaluate() and change a string that identifies where the data should come from before changing the page.  The other is to use objects.  Besides the fact that this takes a lot of disk space with all the images repeated 6 or 7 times, it is very difficult to maintain.  If you want to change the page, you have to repeat your changes 6 or 7 times.

Link to comment
Share on other sites

Hi, Guru,

 

thank you very much. I will use common function and pages to decrease pages.

 

About program size, I deleted all pages, then size was only 1 MB smaller. And I tried to set all history from 3600 to 30, no effect. If there is no way to small this, I will write this program again

Link to comment
Share on other sites

I have the same problem. I am sure it is because once when I was first creating my project I did a save with history. Now I seem to be stuck in save to history no matter which save I use. The reason I think it is still saving history is that If I clear history then save the file is less than 1 MB but if I run it for a while and save it the size is > 8MB. 

Link to comment
Share on other sites

This is a very serious problem! I'm testing another project using this software.

 

After running for 2 hours, its size increases from 965kB to 11.9MB!! I didn't select save with history, I don't do normal operations - click save button while I made some change. I can't imagine if I run this software for a month!

 

How to clean the saved history inside ctl?

And how to prevent this happen again?

Link to comment
Share on other sites

The issue is your V channels.  You have nearly 500,000 data points (418661 to be exact) stored in V channels and all that data gets saved when you save your document.  I personally don't use V channels, they are largely left over from when DAQFactory didn't have variables, but a lot of people do, so I'm not going to tell you not to use them, though I might suggest alternatives if you'd like to explain why you chose to use V channels.   V channels do have a history length, so you could limit the history of your V channels and that would help a lot.

 

500,000 data points at about 16 bytes per data point is 8 meg which is most of your file size.

 

FYI: I was able to quickly determine the number of data points in your V channels using this script.  I'm posting it here as a learning example:

 

private string chanList = v.channel.ListAll()
private count = 0
for (private x = 0, x < numrows(chanList), x++)
   count += evaluate("numrows(v." + chanList[x] + ")")
endfor
? count
Link to comment
Share on other sites

Hi, Guru

 

Why I use so many V channels is because, I read words from other device via serial port. But each word contains 16 bits, each of the bit has its own meaning. The remote device combine 16 off bits together as one word, then send to me. So I have to divide them to 16 off variables, then I can use them.

 

I look channels as communicating variables, and V channels as local variables.

 

Actually, I need to declare public variables as soon as the program starts, then I can use them at anytime. eg, I tried to write a function, made it auto-start, define global variables inside, but after doing that I suspect, are these global variables be created every scanning and cleared? That's not what I want.

 

And I need a process to divide each word into 16 off bits, continuously. First I used testbit in an auto-start sequence, later I used addvalue in the event of channels. I use channels to receive these words, and use v channels to save these bits.

 

ps, so far I still don't understand why each channel or v channel should has 3600 points. In other softwares, I didn't see this.

I'm not used to this sw, and get confused for a long time. Thanks for your clarification

Link to comment
Share on other sites

OK, first, as I mentioned in your other post, if you can use coils instead of packed holding registers, you should go that route.  Then you can work with each bit instead of having to deal with the packing / unpacking.

 

Personally, I'd use test channels instead of V channels.  What I mean by a test channel, is a channel (not a V channel), device type "Test", I/O Type "A to D" and Timing = 0.  Then you can stuff any data you want into the channel(s) and it otherwise works like a regular channel.  This means, for example, that you can use a logging set with it, something you can't do with V channels.  You already have good script for splitting the bits, you just need to put the data in a channel instead of V channel.  For example, in CANOPENER1_40603 you have:

 

   private bits = to.Bit(CANOPENER1_40603[0])
   
   V.CANOPENER1_IO_OUTPUT1.addvalue(bits[0][16])
   V.CANOPENER1_IO_OUTPUT2.addvalue(bits[0][15])
   V.CANOPENER1_IO_OUTPUT3.addvalue(bits[0][14])
   V.CANOPENER1_IO_OUTPUT4.addvalue(bits[0][13])
 
You can just change it to:
 
   private bits = to.Bit(CANOPENER1_40603[0])
   
   CANOPENER1_IO_OUTPUT1.addvalue(bits[0][16])
   CANOPENER1_IO_OUTPUT2.addvalue(bits[0][15])
   CANOPENER1_IO_OUTPUT3.addvalue(bits[0][14])
   CANOPENER1_IO_OUTPUT4.addvalue(bits[0][13])

 

after making CANOPENER1_IO_OUTPUT1 through 4 into test channels.

 

Test channels don't persist to disk when you save the file unless you do save with history.

 

As for why channels default to 3600:  History is the amount of data kept in ram for fast retrieval and use in graphs etc. 3600 was just a good default, one hour at 1 second update rate.  I don't know how other software works, I'm guessing they are database driven, which is in some ways a little easier to use, however, performance wise it is MUCH slower.  DAQFactory is designed to run on much smaller PC systems than the big guys like Citect, and therefore we had to make some choices to maintain performance on these smaller computers.  I doubt you'd see those others running on a embedded pentium system, but there are a number of just that sort of installation of DAQFactory.  

Link to comment
Share on other sites

Hi, Guru

 

I used this 'test' channels to replace 'V' channels. The main use is I allocate the data from device channels into these 'test' channels.

 

The other use is what I felt strange. I read a two column csv file, fill the numbers inside to 'test' channels. Then I check these 'test' channels, found the value were extremely different, and don't know why. At last, I defined some 'V' channels, fill csv values into 'V' channels, found it's ok.

 

I can't attach pictures here, hope you can understand

Link to comment
Share on other sites

How are you putting the data into the channel?  You can't use:

 

mychannel = valueArray

 

if its an A to D channel as this will simply trigger the Test driver to generate a sin wave, and it only works with scalars if its a D to A.  Instead you should use addvalue:

 

myChannel.AddValue(valueArray)

Link to comment
Share on other sites

Hi, Guru, I have another question, still about this V channel

 

On 16 floor, you advise me to use test channel instead of V channel. You mention, Test device type, A to D IO type, 0 timing.

Besides these, how about D#, chn#, should they be same or different?

As you know, I use this test channel to get bit value from the word coming from external device. If I want to do the opposite, packing these bits into an output channel, then how about the definition of these test channels?

 

Thank you in advance

ps, I've deleted all v channels, the file size decreases from 30M to 1.43MB.

Link to comment
Share on other sites

AddValue always adds to the top [0] position.  This is because most of the time you want the most recent value, and its much easier to put [0] then to try and figure out the length of the array to specify the last element.  If you want it in reverse, consider using a variable instead.

Link to comment
Share on other sites

D# and Chn # don't matter if you are using AddValue().  They are only used by the device driver, and AddValue() bypasses the device driver.

 

For output, you could create 16 test channels, each for one bit.  Use D/A this time, and give them unique channel #'s.  Then in each event simply call a sequence function that packs the bits and sends it out the output.  Then you can do:  bit3 = 1 and it will update the output.  The event would read something like:

 

packAndSend()

 

Where packAndSend is a sequence, something like:

 

private out

out [0][0] = bit0

out[0][1] = bit1

// etc..

out[0][15] = bit15

outputChannel = from.bit(out)

Link to comment
Share on other sites

  • 6 months later...

I'm having CTL file size issues. I've looked here on the forum to try to find an answer, but still don't have it figured out. No matter what I do now all my saved files seem to be growing in size.

 

Some time ago I created 3 simple sequences experimenting with to and from json. When I saved the file then the CTL file size was only 17K. Now if I start DAQFactory fresh, load that same 17K project file and then save it to a new location, the file size in Windows Explorer shows up as 605K.

 

Why is it doing this and how do I get it back down to the original 17K file size?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.