Sample Programs

A sample Microsoft Visual C++ makefile, makefile, is provided to build the sample programs. Use this makefile as a basis for constructing makefiles for your own applications.

Note: Depending on how you installed Visual C++, the INCLUDE, LIB, and PATH environment variables may not be automatically set when you install MSDEV. If they are not set automatically, you will have to set them manually or run the following to set them before building any user programs.

\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat

Build a sample program.

Run a sample program.

Review sample programs.

Build a sample program

  1. From the CIMPLICITY Configuration cabinet for your project, select Command Prompt from the Tools menu.

This will ensure that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are set correctly.

  1. In the Command Prompt window, issue the following commands:

<drive>:

cd %BSM_ROOT%\api\ptm_api

Where <drive> is the disk where your CIMPLICITY software is installed.

  1. If the environment variables are not set automatically, issue the following command to set them:

\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat

  1. Now build the executables:

nmake

Run a sample program

The API process name must be stored in the PRCNAM environment variable for a sample program to run. The name is an arbitrary character string of up to 10 characters. To create PRCNAM, enter the following command in the Command Prompt window:

set PRCNAM=<name>

Where <name> is the API process name.

To run a sample program, following the instructions below.

Review sample programs

The following sample programs demonstrate how point information is collected on the system.

 

Program

Illustrates collecting:

ptq_snap.c

Data via SNAPSHOT requests.

The application receives only the point data value when the request is processed.

ptq_onchange.c

Data via ONCHANGE requests.

The application receives the current point data value, and then receives an updated point data value whenever the data value changes.

ptq_onchgstru.c

Data from structure points via ONCHANGE requests

ptm_monitor.c

Multiple points via ONCHANGE requests

The following sample programs demonstrate how point values can be modified.

 

Program

Illustrates changing:

ptq_setpoint.c

Point values using raw data values

ptq_setpt_eu.c

Point values using data values expressed in engineering units

ptm_script.c

Multiple point values using raw data values

When you run any of the PTQ programs, you will be prompted to enter a Point ID.

The point ID that you specify must be:

For a point that has been configured through the application configuration functions.

Defined in the current running project.

If the point is not in the current running project, an error message such as "Null Point Address" is displayed.

The system must be updated with that configuration data.

Before you run any of the test programs (or one of your own applications), you must always be sure that the CIMPLICITY processes have completed their startup.

Note: When you run the ptm_monitor and ptm_script programs, you will be prompted for an input file to be used. Sample monitor.input and script.input files are provided for references.

More information

Point Management API getting started.