This project has moved. For the latest updates, please go here.

Dynamic Calculator Expression Text

Jan 17, 2013 at 4:59 PM

does the express text allow conditional statements, such as (a==0)?0.1:a

additionally, are there any support for fuctions on double problems, such as IsNan(a) or IsInf(a), etc?

Jan 17, 2013 at 6:00 PM

Hi patpentz,

There is a conditional in the form of "If(condition, trueExpression, falseExpression)". Refer to the following page for information about expressions that are allowed.

Also, the dynamic calculator includes all functions from the Math class by default, but can be modified to include other static functions from any .NET assembly. In the connection string for the adapter, the 'imports' parameter specifies a semicolon separated list of "AssemblyName, TypeName" pairs, and should allow you to import any .NET type which declares static functions that you would like to use in your expressions.


Jan 17, 2013 at 6:29 PM

thanks, jut what I needed. I will see if Math provides IEEE float special tests

Jan 17, 2013 at 6:38 PM

final question... are expressions such as the following allowed?

if (double.IsNaN(var), 0, var)

if(double.IsInfinity(var), 10000)


and, are the concepts of positive and negative zero ever meaningful in expressions? Or anywhere else in openPDC?

Jan 17, 2013 at 7:25 PM

Try setting this as the value for the imports parameter:

AssemblyName={mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089}, TypeName=System.Math;AssemblyName={mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089}, TypeName=System.Double

Jan 18, 2013 at 7:46 PM

I have been creating my adapters via a C# program. I notice that the data for the 'imports' parameter are visible in the openPDC Manager display, but are not present in the connectionString parameter in the SQL Server database in table CustomActionAdapter. How are the 'imports' added - I assume at runtime?