AdvancedHMI Software

General Category => Open Discussion => Topic started by: Archie on February 21, 2019, 10:49:56 AM

Title: Trending Chart
Post by: Archie on February 21, 2019, 10:49:56 AM
For those not following the latest 3.99y beta updates. I wanted to point out that beta 21 now includes a ChartWithLogging control. This is the combination of a BasicDataLogger, ChartBySampling, and a historical data viewer.

You simply add it to the form, add some PCLAddressValueItems, then run the application.

This was one of the top requested controls that has been missing from AdvancedHMI. It will close some of the gap between AdvancedHMI and other HMI packages.
Title: Re: Trending Chart
Post by: DavidSr on February 26, 2019, 11:54:58 AM
Anyway to limit number of decimal places?
Title: Re: Trending Chart
Post by: Archie on February 26, 2019, 01:13:40 PM
Not in the current version, but it will be in the next update. A new property of YAxisNumericFormat has been added
Title: Re: Trending Chart
Post by: DavidSr on February 26, 2019, 02:19:44 PM


Custom time stamp on event at the bottom would be helpful also, Such us just hour and minute of capture without date.


This is really a great addition Archie, I can see a lot uses for this, I want to test some rapid captures as soon as I can. Use it like a Chart recorder so the ability to start and stop the logging anytime would be useful also.   For that just a minute and sec time stamp would be useful. I can see the benefit of putting one of these on a a form by itself fort that purpose.
Title: Re: Trending Chart
Post by: DavidSr on February 28, 2019, 07:41:05 AM
Archie I have been running different variations / configurations for several days now. It seems to work very well.
A few observations , some I already shared. Some of these might not be practical but I will just throw them out for whatever value they bring. I am sure you are working on some things I don't know about.
Main thing for me is configuration options.

1. Ability to start and stop the chart from the U/I
2. Time Stamp Options - Don't always need everything- Minute and second only for faster scans. Hour and minute, Day and time/ Don't see much need for the year.
3. Log File Location. Would like to choose directory withot it adding  "\datalog\2019"  to the path
4 Custom Labels

This may be too much to ask:
a.) Changing Logging parameters while HMI is running
            Such as - PLC address(s) to log  but this could be accomplished from the HMI without you to changing anything by changing the value of the address that has been configured using indirect addressing in the PLC and putting a control on the HMI to change the value. A menu would do that.
b.) Time interval
I think these things could make the chart more flexible and perhaps even aid in troubleshooting intermittent problems on a machine.  We have used external recorders for that in the past. eliminating the need to program traps in the PLC.
I would be interested in your and others thoughts on these things.

Maybe VB is not up to the task for some of that or at least not easily.
Title: Re: Trending Chart
Post by: Archie on February 28, 2019, 07:47:26 AM
Some of these items have been added. I'm still working on a few others. I should have an update available today or tomorrow.
Title: Re: Trending Chart
Post by: DavidSr on February 28, 2019, 07:56:35 AM
Some of these items have been added. I'm still working on a few others. I should have an update available today or tomorrow.
Great-!

As I look at the chart config options and AdvancedHMI overall I wonder if  the configuration options for many of the controls could have an option to use a specific value as is currently done or a PLC address.

   I am thinking of an option to select one or the other when configuring the control

Maybe you are doing that somewhere, Since I am new to ADVHMI I have not seen all of it.
Title: Re: Trending Chart
Post by: Gene T. on March 01, 2019, 12:20:41 PM
Archie, I know I probably can't see the forest for the trees here but I am missing something.
I created two forms each with a ChartWithLogging trend. On the first form in the Properties for DataDirectory I put
.\Pressure Trend and a Folder was created called Pressure Trend and inside of that folder the datalog and 2019 folders
were created with the datalog.csv created in the 2019 folder. On the second form for the DataDirectory I put .\Vibration Trend. This Folder isn't being created thus the trend is not working. So what am I not understanding here?

PS. I am using v399yBeta26

Thanks,
Gene
Title: Re: Trending Chart
Post by: Archie on March 01, 2019, 03:03:37 PM
Archie, I know I probably can't see the forest for the trees here but I am missing something.
I created two forms each with a ChartWithLogging trend. On the first form in the Properties for DataDirectory I put
.\Pressure Trend and a Folder was created called Pressure Trend and inside of that folder the datalog and 2019 folders
were created with the datalog.csv created in the 2019 folder. On the second form for the DataDirectory I put .\Vibration Trend. This Folder isn't being created thus the trend is not working. So what am I not understanding here?
Does the chart show data at all?

If so,my first guess is this is caused by a .NET issue where it doesn't "dispose" of hidden forms when the application is closed. The ChartWithLogging caches the days data for performance purposes. It relies in proper disposing to write the cache on closing (or a change of day). In the MainForm there is this piece of code that takes care of that issue:
Code: [Select]
       Dim index As Integer
        While index < My.Application.OpenForms.Count
            If My.Application.OpenForms(index) IsNot Me Then
                My.Application.OpenForms(index).Close()
            End If
            index += 1
        End While

If you removed that code or created your own startup form, then it will not dispose the items correctly.
Title: Re: Trending Chart
Post by: Gene T. on March 01, 2019, 03:50:10 PM
The first chart shows data just fine. The second chart is blank.
I did not remove any code. I added two formchangebuttons on the mainform
one for each form containing a chart. I am sure that it must be something with my setup but I wanted to verify that I have the DataDirectory configured properly.
Title: Re: Trending Chart
Post by: Archie on March 01, 2019, 04:09:27 PM
The first chart shows data just fine. The second chart is blank.
I did not remove any code. I added two formchangebuttons on the mainform
one for each form containing a chart. I am sure that it must be something with my setup but I wanted to verify that I have the DataDirectory configured properly.
Does it work if both charts are on the same form?
Title: Re: Trending Chart
Post by: Gene T. on March 01, 2019, 04:29:40 PM
Yes it works fine if both are on the same form.
Title: Re: Trending Chart
Post by: Archie on March 02, 2019, 05:19:23 AM
Yes it works fine if both are on the same form.
Does your second form have a driver instance on it?
Title: Re: Trending Chart
Post by: Gene T. on March 02, 2019, 08:52:22 AM
Does your second form have a driver instance on it?
Yes it has a different driver instance.





Title: Re: Trending Chart
Post by: Archie on March 02, 2019, 04:02:29 PM
I wasn't able to replicate exactly, but some issues were fixed that was possibly related. These are in the Beta27 release
Title: Re: Trending Chart
Post by: Gene T. on March 02, 2019, 06:44:23 PM
OK I will check and see if I can make it work.
Thanks!!

Gene
Title: Re: Trending Chart
Post by: Gene T. on March 02, 2019, 09:40:31 PM
I wasn't able to replicate exactly, but some issues were fixed that was possibly related. These are in the Beta27 release
I am still having the same issue. First chart works on form1 and chart on Form2 does not. Since you can't replicate the problem it must be something that I am not doing correctly but I surely can't put my finger on it at the moment. I tried with the driver on each form pointed to the same plc and tried pointing each at a different plc.
Title: Re: Trending Chart
Post by: Godra on March 02, 2019, 10:50:54 PM
I just tried this with ChartWithLogging on each, the MainForm with the FormChangeButton and the Page2 form as it is, each with its own ModbusTCP driver pointing to MODRSsim2 simulator (2 simulators all together, setup with different ports).

Both charts were working and logging to separate directories.
Title: Re: Trending Chart
Post by: Gene T. on March 02, 2019, 11:43:07 PM
I just tried this with ChartWithLogging on each, the MainForm with the FormChangeButton and the Page2 form as it is, each with its own ModbusTCP driver pointing to MODRSsim2 simulator (2 simulators all together, setup with different ports).

Both charts were working and logging to separate directories.
I started from a clean slate and added charts to mainform and page 2 just as you stated and it works just as you stated. I started from a clean slate again and created two forms with a chart on each. The first trend worked the first time I went to form1. The second chart on form2 did finally work but I had to return to mainform and back to form2 three times with trending data showing on the third attempt. I know that sounds strange but at least it is working for me know. Thanks for the help.

Gene
Title: Re: Trending Chart
Post by: Godra on March 02, 2019, 11:49:45 PM
Since you are creating new forms then look at the code from Page2 and make sure that necessary sections are copied to your new forms as well.
Title: Re: Trending Chart
Post by: Gene T. on March 03, 2019, 02:07:12 PM
OK my problem returned when I tried to implement into my application instead of just the simple pages I was using.
What I have found is that if I use the same tag each with a different comcomponent the chart will not work. SO if I read System_Pressure from EthernetIPforCLXCom1 everything is fine. If I add System_Pressure from EthernetIPforCLXCom2 to the same chart it will not work.

Gene
Title: Re: Trending Chart
Post by: Archie on March 03, 2019, 02:50:38 PM
What I have found is that if I use the same tag each with a different comcomponent the chart will not work. SO if I read System_Pressure from EthernetIPforCLXCom1 everything is fine. If I add System_Pressure from EthernetIPforCLXCom2 to the same chart it will not work.
- In Solution Explorer, expand down the AdvancedHMIControls Project
- Expand down the Controls folder
- Expand down the Charting folder
- Right click ChartWithLogging.vb and select View Code
- Go to line 362 and change to this:
Code: [Select]
If String.Compare(e.PlcAddress, m_PLCAddressValueItems(index).PLCAddress, True) = 0 And (sender Is m_PLCAddressValueItems(index).ComComponent) Then
Title: Re: Trending Chart
Post by: Gene T. on March 03, 2019, 05:00:27 PM
That took care of the problem, however, I discovered that if one of the plc's has no communication that will also keep the chart from working. so maybe I must rethink the way I group the charts. I have anywhere from 2 to 8 machines in a system. I usually trend all of the alike variables on the same chart, so maybe I need to just trend all variables from one machine on a single chart since it is not uncommon to power down a machine for maintenance purposes. Thanks for your help.

Gene
Title: Re: Trending Chart
Post by: Archie on March 03, 2019, 05:31:21 PM
That took care of the problem, however, I discovered that if one of the plc's has no communication that will also keep the chart from working.
On startup this would be true, but once the chart has started if a PLC goes down it will not stop the chart. I will look into a way to make this work even if the PLC is down.
Title: Re: Trending Chart
Post by: Gene T. on March 03, 2019, 07:36:29 PM
Thanks Archie!
Title: DATA LOG FILE CREATION
Post by: DavidSr on March 05, 2019, 11:26:25 AM
I am still running B26 so maybe this is resolved.
I am not seeing the log file getting created again after creating new charts.  When is it supposed to create the file(s) ?
Title: Re: DATA LOG FILE CREATION
Post by: Archie on March 05, 2019, 12:49:35 PM
I am still running B26 so maybe this is resolved.
I am not seeing the log file getting created again after creating new charts.  When is it supposed to create the file(s) ?
The first file is created at a change of day (midnight) or when the app is closed. It was necessary to cache the data in order to make the chart very responsive. If the app is not properly closed, such as using the stop button in VS, then the file will not be written. This will probably eventually be changed to write the cache on some interval.
Title: Re: Trending Chart
Post by: DavidSr on March 05, 2019, 12:54:45 PM
...................This will probably eventually be changed to write the cache on some interval.
That would seem to be a good solution and would provide some sort of crash protection.
Any consideration for users choice in log file name? or at least part of it?  Or is it already there and I don't see it?
Title: Re: Trending Chart
Post by: Phrog30 on March 05, 2019, 02:21:20 PM
Archie, have you considered using SQLite?  I created some trends a few years ago and they were pumping data, it was very responsive.  Now, I was using MySQL back then, but I would expect SQLite to be the same.  I like SQLite because it's very easy to integrate into a project.  Just my two pennies.
Title: Re: Trending Chart
Post by: Archie on March 05, 2019, 05:48:02 PM
Archie, have you considered using SQLite?
I looked at a number of packages that supported using SQL for data retrieval because it would have made life much easier, but none of them fit the bill. I had to rule out SQLLite because it is based on native code. Whenever a .NET application steps out of managed code, it risks future compatibility with other frameworks, such as the .NET core, and can also create cross platform issues. The goal is to keep AdvancedHMI 100% managed code for future possibilities of moving to .NET Core and/or .NET Standard.
Title: Re: Trending Chart
Post by: Phrog30 on March 05, 2019, 06:20:13 PM
OK, is this not what you were looking for?
https://www.infoq.com/news/2009/08/SQLite-Has-Been-Ported-to-.NET (https://www.infoq.com/news/2009/08/SQLite-Has-Been-Ported-to-.NET)
Title: Re: Trending Chart
Post by: Archie on March 05, 2019, 07:26:01 PM
OK, is this not what you were looking for?
https://www.infoq.com/news/2009/08/SQLite-Has-Been-Ported-to-.NET (https://www.infoq.com/news/2009/08/SQLite-Has-Been-Ported-to-.NET)
That would be an ideal solution. It looks like it has been abandoned. Might be a good project to pick up on.

I did find another .NET SQL database project that seemed to be active and very promising, but I was not able to get it to work. When I emailed the support page it went to a bad link, so I took it as a bad sign and gave up on it. I don't even remember what the name of that project was.
Title: Re: Trending Chart
Post by: Phrog30 on March 05, 2019, 08:10:16 PM
It looks like it's being actively developed, https://www.nuget.org/packages/sqlite-net/ (https://www.nuget.org/packages/sqlite-net/), there is a beta as a month ago.  If the 2014 version is stable, it's probably worth looking into.
Title: Re: Trending Chart
Post by: Archie on March 05, 2019, 08:22:45 PM
It looks like it's being actively developed, https://www.nuget.org/packages/sqlite-net/ (https://www.nuget.org/packages/sqlite-net/), there is a beta as a month ago.  If the 2014 version is stable, it's probably worth looking into.
That one looks like a different project because on GitHub it says it is a wrapper around SQLite.

https://github.com/praeclarum/sqlite-net

The C#-SQLite is a full implementation. The last activity I saw for it was 2014
Title: Re: Trending Chart
Post by: Archie on March 05, 2019, 08:25:01 PM
This one looks like the full .NET version of SQLite :

https://www.nuget.org/packages/Csharp-Sqlite/
Title: Re: Trending Chart
Post by: Phrog30 on March 05, 2019, 08:42:18 PM
It looks like it's being actively developed, https://www.nuget.org/packages/sqlite-net/ (https://www.nuget.org/packages/sqlite-net/), there is a beta as a month ago.  If the 2014 version is stable, it's probably worth looking into.
That one looks like a different project because on GitHub it says it is a wrapper around SQLite.

https://github.com/praeclarum/sqlite-net

The C#-SQLite is a full implementation. The last activity I saw for it was 2014

I guess I didn't look close enough.
Title: Re: Trending Chart
Post by: DavidSr on March 06, 2019, 05:16:27 AM
Archie would it be impractical to implement an option to schedule a start and stop time for the chart?
  - After thinking on this a bit, If it is not too difficult to start and stop the chart by using a plc bit to trigger it, then that would accomplish three scenarios.

1.) Stopping an starting from the HMI
2.) Starting / stopping the chart by an event in the PLC
3.) Scheduling the Chart by triggering a bit in the PLC  based on the PLC clock.

I don't know what the difficulty would be to implement that. What do you think?
Title: Re: Trending Chart
Post by: Archie on March 06, 2019, 07:48:47 AM
Archie would it be impractical to implement an option to schedule a start and stop time for the chart?
  - After thinking on this a bit, If it is not too difficult to start and stop the chart by using a plc bit to trigger it, then that would accomplish three scenarios.

1.) Stopping an starting from the HMI
2.) Starting / stopping the chart by an event in the PLC
3.) Scheduling the Chart by triggering a bit in the PLC  based on the PLC clock.

I don't know what the difficulty would be to implement that. What do you think?
The latest version has a PLCAddressEnableLogging property that lets you start/stop with a PLC bit. Or you could use the EnableLogging property and control it via VB code.
Title: Re: Trending Chart
Post by: Gene T. on March 06, 2019, 05:20:32 PM
I keep having a problem with the chart stopping. I get this error when I try to navigate to the chart. I can select continue and when the chart opens it is not showing real time data even though I checked the log and I see entries in the CSV file.
The error is attached.

Also wanted to say that this error only occurs while running the application by starting with the advancedHMI.exe. If I run inside of visual studio starting the application in debug the chart will stop but I don't get any error that I am aware of.

Gene
Title: Re: Trending Chart
Post by: Archie on March 06, 2019, 05:46:27 PM
I keep having a problem with the chart stopping. I get this error when I try to navigate to the chart. I can select continue and when the chart opens it is not showing real time data even though I checked the log and I see entries in the CSV file.
The error is attached.

Also wanted to say that this error only occurs while running the application by starting with the advancedHMI.exe. If I run inside of visual studio starting the application in debug the chart will stop but I don't get any error that I am aware of.

Gene
Can you expand down the details and see what vb file and line number the error occurs?
Title: Re: Trending Chart
Post by: Gene T. on March 06, 2019, 10:43:32 PM
I copied the text into a .txt file below. Also wanted to let you know if I click continue on the error screen the chart will open and eventually will start working again but if I leave and return the error pops up again.

Gene
Title: Re: Trending Chart
Post by: prof-nova on March 12, 2019, 09:14:52 AM
Hi, this charting component works fine for me.
However, how can I fix the y scale to a defined value.
Thanks.
Title: Re: Trending Chart
Post by: Archie on March 12, 2019, 09:31:14 AM
Hi, this charting component works fine for me.
However, how can I fix the y scale to a defined value.
The current version only does auto scaling of the Y Axis. I'll see about adding a fixed scale to a future version.
Title: Re: Trending Chart
Post by: prof-nova on March 12, 2019, 10:15:34 AM
Hi, this charting component works fine for me.
However, how can I fix the y scale to a defined value.
The current version only does auto scaling of the Y Axis. I'll see about adding a fixed scale to a future version.
OK thanks anyway
Title: Re: Trending Chart
Post by: Archie on March 19, 2019, 01:32:13 PM
Hi, this charting component works fine for me.
However, how can I fix the y scale to a defined value.
Beta 29 now has YAxisMaximum and YAxisMinimum properties.
Title: Re: Trending Chart
Post by: g.mccormick on May 29, 2019, 05:27:04 PM
I am starting to mess with this and I like it a lot.  I do have a few questions:
1. Is there a way to add the plc address name property to the log data as a header? 
2. Is there a way to have logging be active even if the page is not active?  I would like to use this as historian, but have the page/pages that would be used to display the specific data be a seperate page that is selected from form change button.  The page may only be brought up once a day or week, but I'd like to be able to see past data.   
Title: Re: Trending Chart
Post by: Archie on May 29, 2019, 06:03:35 PM
The code behind the MainForm includes a code snippet that stops communication updates when the form is hidden. The idea of course is to minimize communications for faster updates on the forms that are visible. Since the communications are paused, the Charts and data loggers stop getting data. You can prevent this by commenting out the code behind the form that disables subscriptions.

Right click the form and select View Code and you will see the comments on the code near the top.

When it comes to something that needs continuous communications, my preference is to use the MainMenu driven model and place data loggers on the Main Menu since that form is always active. You can learn more about the Mainmenu here:

https://www.advancedhmi.com/forum/index.php?topic=1549.msg8337#msg8337
Title: Re: Trending Chart
Post by: Archie on May 29, 2019, 06:04:40 PM
1. Is there a way to add the plc address name property to the log data as a header? 
Not in the latest release, but I can see about adding that for the next update.