Author Topic: Simple Signal Generator / Sliding Scale / Performance Chart  (Read 7167 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Simple Signal Generator / Sliding Scale / Performance Chart
« on: April 21, 2015, 11:21:25 PM »
Original articles can be found here (try to read these including all the comments other users have posted):

http://www.codeproject.com/Articles/30180/Simple-Signal-Generator
http://www.codeproject.com/Articles/30016/Sliding-Scale-Gauge
http://www.codeproject.com/Articles/17564/Simple-Performance-Chart

The first link has a download with examples which includes all 3 DLL files that should be added as a reference to both AdvancedHMI and AdvancedHMIControls projects. Imported Namespaces (SpPerfChart/TB/TB.Instruments) associated with these DLL files should be checked as well in both projects.

Here is another way of adding any 3rd party DLL file to AHMI:
https://www.advancedhmi.com/forum/index.php?PHPSESSID=0d1de9331c3e49e7912a6acbc7d35aa8&topic=612.msg8033#msg8033


TB.Instruments.Test.exe example was the idea behind the attached VB Net SignalGenerator control. That example also shows usage of performance chart and sliding scale.

It should be sufficient to extract all the attached files, besides for the picture, to a single location and then add one by one as Existing Items to PurchasedControls folder, close all open forms and rebuild the project.

If you find any of these controls useful, certainly give a credit to the authors on the links provided above.
« Last Edit: May 20, 2019, 01:38:28 AM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #1 on: April 23, 2015, 10:07:49 PM »
Here is a bit more flexible version of the SignalGenerator control, now using somewhat modified BasicChart (where the Y value range is -32767 to 32767) instead of SimplePerformanceChart (where the range was 0 to 100).

The graph Y range values can be changed with the mouse wheel (just click the chart first).
Note for "External Input" - the mouse wheel currently changes in increments of 25 but there is a combobox with quick values to help speed up the process if you need to make adjustments to see the whole signal.

Also, if you need to stop/start the timer just double click the chart.

The following apply to both versions of SignalGenerator:

"Send to PLC" option was only tested with OPC simulator and was a bit slow to update. Considering that the SignalGenerator output are analog signal values (defined in the code as 'Single' values), this option should only be used with some sort of floating point PLC Input address. I am not sure if the driver might be sort of buffering the values before sending them to the PLC. The graph might get distorted when this option is checked.

User Defined signals are present only under buttons 1 and 2 (positive and negative half-wave sine) so feel free to add any other signals to buttons 3 and 4. The example mentioned in the previous post has 6 different user defined signals.

Phase shift changes might be obvious depending on what device or control is receiving the signal, otherwise it appears as useless.

External Input signal can be displayed on the chart screen (this Input was defined in the code as 'Single' value). If you know what range of values this signal will have then you might need to adjust the chart Y range before clicking this button. "Send To PLC" option will be disabled when the button is clicked.
« Last Edit: April 28, 2015, 12:19:09 AM by Godra »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #2 on: April 26, 2015, 07:24:02 PM »
Here is a dual channel Signal Generator.

Both charts have buttons to the right as common and 1 of the charts will be focus of any clicked button (focused chart will have MediumSlateBlue colored graph while the other chart will have Blue colored graph). Clicking either chart will shift focus but beware of using "User" button prior to shifting focus (at this time due to the design the User section behaves slightly different than other buttons).

This control has 6 public properties, Output1 / Output2 / Input1 / Input2 / Timer1Interval / Timer2Interval, and these should be used to interact with any other control (the attached picture shows a simple usage where Windows built-in chart displays those 2 output signals). Interval properties should be used for any necessary synchronization.
The existing PLCAddress corresponding properties would be for use with a PLC only.

There are also checkboxes to invert either signal and there is also a public event SignalValueChanged which can be used to trigger and change value of any other control's property.

The BasicChart attached here is slightly different than the one in previous post.

Creating any of the controls I have posted is fun and learning experience for me. If anyone finds a good use for them that will be a bonus.
« Last Edit: May 09, 2015, 07:33:10 PM by Godra »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #3 on: April 27, 2015, 03:21:12 PM »
Nice finds! I'll have to look at these in detail.

carvale

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #4 on: May 22, 2015, 03:08:27 PM »
It is my first reply and it is also my first contact with AdvancedHMI using an add aplication to test.
AdvancedHMI is really fantastic. I could not believe when I read a tag without RSLinx from PLC.
I would like if possible more details how I can test this application. I added the all project into AdvancedHMI and referenced the 3 dll in AdvancedHMI and AdvancedHMIControls, but I have 18 errors.
Many thanks!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #5 on: May 22, 2015, 04:32:43 PM »
I'm not able to read your picture of the errors. Can you list the errors or post a picture zoomed in to the error list?

carvale

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #6 on: May 24, 2015, 09:07:31 AM »
I did again and took more care of the details.
In the toolbox show me 4 new tools.
I added into Mainform and as a magic they worked perfectly!
Thanks a lot!

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Simple Signal Generator / Sliding Scale / Performance Chart
« Reply #7 on: July 14, 2015, 05:55:00 PM »
Here is the latest dual channel Signal Generator now with updated User buttons to behave like the other buttons.

BasicChart.vb file is also included.