Metroltek
  • Home
  • Products
  • Services
  • About
  • Contact
  • Blog

Advanced Math in C# Applications

1/20/2015

 
Recently I've had a need to include robust and complex math calculations in my c# applications such as polynomial curve fitting, calculus and advanced statistics. I am pleased to say I've found an excellent .NET math code library called NMath from CenterSpace Software. The company is extremely customer friendly, has both email and phone support, and has an easy to use object model. Check them out if you need this kind of functionality.

C# .NET or LabVIEW

12/3/2014

 
When developing applications I'm often faced with the decision of whether to develop in LabVIEW or C# since I'm proficient in both. Some of my colleagues have strong opinions about which one is best, or some have expertise in one or the other. I though it may be informative to describe my decision making process when choosing one or the other for a particular application:
  • If customer has a particularly strong preference then I go with the language of their choice. Often times this has to do with the skill level in their company in order to allow their ongoing support after I've completed the project. This selection trumps all the others list below.
  •  If the application involves multiple buses other that serial, I generally go with LabVIEW since there are just so many already available drivers in the LabVIEW community.
  • If the application only involves data analysis and, at most, serial communication, I generally go with C#.
  • A big advantage of LabVIEW is its extensive library of built in function not always available with C#. So an application requiring one or more advanced functions already available in LabVIEW this favors LabVIEW. However, If I'm coding in C# and I need advanced functionality, I can typically find it in an online post or a third party tool.
  • A big advantage of C# is it can provide a much richer user interface and can be more easily be configured to provide a modern user interface. The are also several very good third party feature rich control suites.
  • Both LabVIEW and C# have an extensive online presence, both in forums and with MSDN for C# and the national Instruments website for LabVIEW. Extensive coding examples can be found for both languages, and with LabVIEW many examples are provided inside the LabVIEW development environment.
  • LabVIEW has an advantage with support since it has both email and phone support.
  • Both LabVIEW and C# have good training models, typically online although you can get customer led onsite classes with LabVIEW.

My favorite C# .NET third party controls

12/3/2014

 
Microsoft provides a basic set of controls in their .NET framework, but for extended functionality and appearance I prefer to use third party controls for my applications. The two I've incorporated are:

  • DevComponents DotNetBar Win form control suite - A fairly wide ranging set that includes two of my favorites. The Ribbon control is the easiest ribbon control I found to configure and edit. The other control in this suite I like is the SuperGrid control. It offers an exceptionally easy way to create a mater detail grid.
  • SpreadSheetGear - This control provides an on-screen representation of an Excel workbook while not really using the Excel API. This allows placing applications build with SpreadSheetGear to run on a server that does not have Microsoft Excel installed.

Distribution Visualization and Outliers

12/3/2014

 
Two common ways of visualizing a distribution of tested UUTs is to use a Histogram  or a BoxPlot as shown below. Of special importance are points that fall outside the expected population, otherwise known as outliers. If the population comes from a passing universe, outliers may still be of concern since they may pose a reliability or intermittent problem. For example, a junction leakage of a power FET may indicate a surface leakage issue that may, in time, fail in the end applications. Another example is an outlier in a "tested good" power supply module. This may indicate improperly built magnetic components that may eventually fail intermittently or produce internal hot spots leading to eventual failure.
Picture
BoxPlot
In the Histogram, the red area are the Histogram bins and the top section are the individual data points. Statistical outliers can be determined as follows:

  • Compute the mean and standard deviation of the total population.
  • Identify any point from the main population that falls outside +/- 3 standard deviations. These are considered outliers.
A BoxPlot is shown in the bottom chart. Here the outliers, or unusual points are defined as points falling outside a percentile range such as 10%/90%, although other choices can be made such as 1%/99%.

Note that the main difference between the two types of distribution charts is that a Histogram deals with bins of data and the BoxPlot deals in percentiles.

C# and DataGridView

11/30/2014

 
I use DataGridView a lot in my C# applications. Why? It provides an efficient way to tabulate and organize data where all rows in a column are of the same data type, like the structure of a database table. For example, a query of a database can be loaded into a .NET DataTable and this can, in turn, be a DataSource for a DataGridView GUI element.

LabVIEW and SPC

11/30/2014

 
LabVIEW has many statistical function that enable adding SPC to your application. I use the functions extensively in my applications and am glad I don't have to revert to a third party tool or write my own. Here are a few of my favorites:

  • Histogram.vi - Creates histogram bins from raw data
  • Continuous Random.vi - Creates a distribution of data points based on a few key parameters. For example, a normal distribution can be created by specifying the sample size, mean and standard deviation. I use this when implementing Monte Carlo analysis.
  • Statistics Express VI - This express VI contains numerous statistics parameters all in the same VI.

    Author

    Jim Dougherty, owner of Metroltek with specialties in national Instruments LabVIEW, C#, database and SPC (statistical process control) and, test system design.

    Archives

    January 2015
    December 2014
    November 2014

    Categories

    All
    C#
    Labview
    Math
    Spc

Site powered by Weebly. Managed by Bluehost