Defining Calculation Options

APM can define calculation options that assist in the use of calculated indicators, calculated indicator reading states, asset health, asset degradation, and triggered calculations. For example, default starter templates for VB.NET and C# complete class calculations are supplied with APM, and these templates can be modified to suit your specific organizational needs.
APM allows you to specify the names of DLL files that can be referenced in a calculation. These files generally reside in the APM bin folder or be a .NET DLL.
Tip: To reference DLL files in APM, you should be familiar with DLL files, .NET, and the Global Assembly Cache (GAC). For detailed information, refer to Microsoft’s website.
Shared VB.NET and C# code can be defined and reused in multiple calculations. The shared code is written and saved within APM.
From time to time, you might need to remove all unused or compiled DLLs and their source code files that have been used in APM calculations. When these files are cleaned up, APM automatically recompiles the DLL files when calculations are performed.
APM administrators can set the scripting permissions for .NET and VB scripts. By default, .NET scripting permission is set to “Sandbox” for all installations. (The Sandbox setting applies a security mechanism for untrusted code.) For new installations, the default VB script permission is set to “Disabled”, otherwise, it is set to “Enabled”.
This topic describes how:
To View and Edit the C# Class Template
To View and Edit the VB.NET Class Template
To View and Add DLL References
To Create a Shared Code File
To Clean up Files
To Add Scripting Permissions to Calculations

To View and Edit the C# Class Template

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the C# Class Template tab. This tab displays the contents of the default template for C# complete class scripts. For example:
3.
Tip: Easy to identify placeholders appear in the class template represented by [[CONSTANTS]], [[VARIABLES]], [[RETURNTYPE]], and [[CODE]] are to be replaced with user-defined content.
Note: In order to apply these changes to an existing calculation, you must click Regenerate from Template on the calculation’s Expression tab.
4.
When you are finished, click OK to save the changes to the template script and close the Calculation Compile Options dialog.

To View and Edit the VB.NET Class Template

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the VB.NET Class Template tab. This tab displays the contents of the default template for VB.NET complete class scripts. For example:
3.
Tip: Easy to identify placeholders appear in the class template represented by [[CONSTANTS]], [[VARIABLES]], [[RETURNTYPE]], and [[CODE]] are to be replaced with user-defined content.
Note: In order to apply these changes to an existing calculation, you must click Regenerate from Template on the calculation’s Expression tab.
4.
When you are finished, click OK to save the changes to the template script and close the Calculation Compile Options dialog.

To View and Add DLL References

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the DLL References tab. This tab lists external DLL files located in the bin folder of the APM installation folder. For example:
3.
Click New. The DLL Reference dialog appears.
4.
5.
When you are finished, click OK to save the changes to the template script and close the Calculation Compile Options dialog.

To Create a Shared Code File

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the Shared Code tab. This tab lists shared code files for use in APM calculations. For example:
3.
Click New to add shared code. The Shared Code File dialog appears. For example:
4.
5.
When you are finished, click OK to close the Shared Code File dialog. The shared code file appears in the list.
6.
When you are finished, click OK to save the shared code file and close the Calculation Compile Options dialog.
Note: If the shared code file cannot be compiled, an error message appears and the code must be corrected in order to successfully save the shared code file.

To Clean up Files

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the File Cleanup tab.
3.
Click Clean Up Files, and then click Yes to confirm. Unused files are removed and all DLLs are recompiled.
4.
When you are finished, click OK to save your settings and close the Calculation Compile Options dialog.

To Add Scripting Permissions to Calculations

1.
From the Enterprise window, select the Administration menu and then Calculation Options. The Calculation Compile Options dialog appears.
Tip: APM administrators may also select the Customization Center view from the Enterprise window, select the Calculations tab, the Compile Options tab, and then click Edit Compile Options.
2.
Select the Scripting Permissions tab.
3.
Disabled is the default setting for a new APM installation, otherwise the default setting is Enabled.
Note: You must be logged in as an APM administrator in order to change these values.
4.
When you are finished, click OK to save your settings and close the Calculation Compile Options dialog