Daqfactory Program's Size Increases


Recommended Posts

Hi, I have noticed my ctl project file has increased greatly in size. I do realise its because I am using a lot of pasted images. When I was setting up the project I spent most of the time developing a few pages and noticed the project size was about 7mb. Now that I have set up the foundations of the program I have quickly added more pages and now have a file size of 76mb. I have NOT noticed any degradation in performance though. The program will be running on a standalone Windows XP industrial pc with no other programs running (2GB RAM). Apart form the overview screen most of the other pages (about 60) are quite similar. Am I ok at 76mb (it may actually get bigger as I finalise the remaining pages)

Link to comment
Share on other sites

Further to my earlier post, I have read previous posts and have decided that it will be best to create a page template for the pages that are similar, give all the page template symbol components unique names. Then write a sequence that passes variables (symbol parameters) to another sequence that acts like a function (that does not return anything) but just changes the parameters of the symbols on page template to the required values. Does this sound like the way to go? 

Link to comment
Share on other sites

Following on from my previous post. On my page template their will be panel components that have an action of changing the page to a graph page. Because I am reducing e.g. 10 pages down to a 1 page template I need to change what these panel components do. I see that I can access the component in a sequence as follows whereby C01_Select is the panel component: -

 

page.level03.Component.C01_Select.????

 

What goes next to get the panel component to select a page using a variable instead of the actual page name?

Link to comment
Share on other sites

76 mb is pretty big.  The reason its big is almost certainly the pasted images.  For speed reasons they are stored as straight, uncompressed bitmaps, and if you have copies of the same bitmap, they are stored multiple times.  A lot of the reasons for doing this don't apply so much now as they did 13 years ago when DAQFactory was first written, so hopefully we'll work on making this more efficient at some point soon, but its not really a priority since a 76 meg file won't cause a problem.

 

If your pages are identical except for content, then a template makes sense for many reasons, but mostly for ease of maintenance.  If you create 10 pages that are the same except content, then every time you want to make a change, you have to do it 10 times.

 

Its usually best to do this using objects, because then you can point all your components to an object reference variable, and then change which object that variable is referencing and everything updates.  You can also change the components themselves dynamically, but this is a lot harder to manage and slightly more limited.  

 

First, you don't need page.level03.  Unless you have multiple components across your pages with the same name, you can just do Component.C01_Select

 

Second, you can't programmatically change the Action of a screen control.  You instead have to put the logic in the action to handle it all.

Link to comment
Share on other sites

Thanks for that. I have to add 65 graphs to my project. Each graph screen has a header made up of symbol components.

i.e 8 symbol components as follows (some with multiple layers based on an expression).

 

ChannelNo    ChannelStatus    Alarm1 Alarm2 Alarm3   Channel Description     Sensor Reading   EngUnit

 

I don't want to create 65 separate pages. So I am thinking of having all the graphs on one page whereby I make each one visible as required and change the expression in each of the above symbol components based on the graph required. In your last post you mentioned object references. I presume I just need to put a unique object reference in the each of the symbol component expression fields. Have you got an example of doing this? I am not to sure what you mean by "and then change which object that variable is referencing and everything updates"  

Link to comment
Share on other sites

Here's a sample.  For simplicity I stored the name of a channel in each object then used the getData() function to get the data from that channel.  In a program of any size I probably wouldn't do that way because the graph can't optimize.  It only matters if the history lengths are long.  I would instead actually have the objects hold the data in variables, either by having the objects do the polling, or having the channel copy its data into the appropriate object from the Channel's Event.  The channel could then have a history length of 1 and never actually be referenced.  

classPageSample.ctl

Link to comment
Share on other sites

  • 1 year later...

Hi, Further to the above sample classPageSample.ctl. When you say "It only matters if the history lengths are long". I would be creating 50 graphs with history length of only 100 but the persistence is 3144960. Within each graph I would use something like:-

 

Y expression         CO2_Sensor100[sysTime()-rangeFrom,SysTime()-rangeTo]      

(note: rangeTo & rangeFrom are set by graph forward & backwards scroll buttons) 

 

You mentioned that you would normally have the objects hold the data in variables, either by having the objects do the polling, or having the channel copy its data into the appropriate object from the Channel's Event. 

 

I think I would prefer to do as per your sample whereby you stored the name of a channel in each object then used the getData() function to get the data from that channel. Do you think I will be okay to do this as my history lengths are only 100 or could I still end up with optimisation problems?

Link to comment
Share on other sites

With persist data you have to subset, and it has to be right after the channel name, so myChannel[startTime, endTime] works, but (myChannel)[startTime,endTime] won't and will only give you what's in the history.  Also, I typically suggest subsetting based on the Bottom Axis' CurrentScaleFrom and CurrentScaleTo member variables.  That way, you are always just subsetting what is needed for the graph, even if the graph is zoomed or panned.

Link to comment
Share on other sites

  • 3 months later...

Hi, The following works fine but I just want to double check that I am doing this correctly? In particular the evaluate expression for the subsetting. The channels use persist data. Like I said it works fine but I don't want to plough on and find out later there is a problem with this method. 

 

 

The Graph  Y Expression is :      currentObject.getData((SysTime()-100000),(Systime()-0))

 

 

CreateClass sequence: -

////////////////////////////////////////////////////

class SensorPageClass

   
   local string myChannel = ""
      
   function getData(StartTime,EndTime)
            return(evaluate(myChannel+"["+StartTime+","+EndTime+"]"))
   endfunction
   
endclass
///////////////////////////////////////
Link to comment
Share on other sites

I don't have a major problem with what you have.  I have one comment and one suggestion though:

 

Comment: always try and put the subsetting directly after the channel name.  So myChannel[0,10] not (myChannel)[0,10] or anything else.  You do it correctly, I'm only mentioning it for others.  The reason is that when its right after, the subsetting goes all the way to the channel itself and the channel itself only returns the requested data.  When you do something like (myChannel)[0,10] then the channel thinks you want the entire history, and then the subsetting is done afterwards.  Also, Persist can only be accessed if the [] is right after the channel name

 

Suggestion: when using persist in graphs, use the local bottomAxis.currentScaleFrom and bottomAxis.currentScaleTo variables:

 

currentObject.getData(bottomAxis.currentScaleFrom, bottomAxis.currentScaleTo)

 

That way you only retrieve the required data to create the plot from persist.  Those two variables are automatically updated with the min/max scaling parameters of the graph (even if you are using Time Width) so will change as you zoom or pan as well.

Link to comment
Share on other sites

Archived

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