testPython/database

2020.06.22

Author:
Marty Kraimer
WARNING
This is a work in progress.

This product is available via an open source license

Table of Contents

Introduction

This document describes the IOC database used by the Python examples.

See index For installation instructions.

testPython/database creates an IOC database that can have DBRecords for any of the record types provided by EPICS base. In addition it has PVRecords used by the Python code in examples qtimage, maldebrot and plot2dcurves.

When the database is started as follows:

mrk> pwd
/home/epics7/testPython/database/iocBoot/testPython
mrk> ../../bin/linux-x86_64/testPython st.cmd 

It has the following records:

epics> dbl
TPYcounter01
epics> pvdbl
TPYaddRecord
TPYmandelbrotRecord
TPYqt2dimageRecord
TPYqtpeakimageRecord
TPYremoveRecord
TPYtraceRecord
epics> 

Description of Build environmant

When make is executed in testPython/database, An IOC database is created that contains the records shown above. In addition this can be used as a model for creating other IOC databases that has a combination of DBRecords and PVRecords. It can create DBRecords of any type implemented by epics-base The following briefly describes the various subdirectorys of database.

database

RELEASE.local
This is the only file in this directory that needs modification.
The only thing that is normaally changed is EPICS7_DIR=/home/epics7/base-7.0.3.1 It must be changed to access your EPICS7 system.
CONFIG_SITE.local
This should not need any changes.
Makefile
This should not need any changes.
configure/*
None of these files need any changes.

database/src and database/src/pv

This is where code for special PVRecords are created. For each, four files are required. For example mandelbrotRecord has the following files:

Makefile
pv/mandelbrotRecord.h
mandelbrotRecord.cpp
mandelbrotRecordRegister.cpp
mandelbrotRecordRegister.dbd
Makefile
Look at it to see what it does.
pv/mandelbrotRecord.h
This and the following C++ file implement code that creates a maldebrot image. It can be used as a model of how to create your own PVRecords.
mandelbrotRecord.cpp
This is the implementation.
mandelbrotRecordRegister.cpp
This implements the code that is called via the iocshell to create mandelbrot records.
mandelbrotRecordRegister.dbd
This is the definition that makes the iocshell aware of mandelbrotRecordRegister.

dbSrc

This is where DBRecords are configured.

database/iocSrc

This is where the actual IOC code is built. Look at Makefile and testPythonInclude.dbd.

database/iocBoot

Just look at the files. Anyone who has built IOCs should be familar with the details.

Brief description of each PVRecord

TPYmandelbrotRecord

This has fields:

    structure
        time_t timeStamp
            long secondsPastEpoch
            int nanoseconds
            int userTag
        structure argument
            double xmin
            double xmax
            double ymin
            double ymax
            int width
            int height
            int nz
        structure result
            ubyte[] value

This is used by testPython/mandelbrot/DisplayImagePVAPY.py
It computes mandelbrot images.
See : mandelbrot for a description.

TPYqt2dimageRecord

This has fields:

    structure
        time_t timeStamp
            long secondsPastEpoch
            int nanoseconds
            int userTag
        string name
        double[] x
        double[] y
        double xmin
        double xmax
        double ymin
        double ymax
        structure argument
            structure format
                int index
                string[] choices
            int height
            int width
        structure result
            union value
                ubyte[] uint8
                ushort[] uint16
                uint[] uint32

This is used by testPython/plot2dcurve and can also be used by testPython/qtimage.

See plot2dcurve and qtimage For details.

TPYqtpeakimageRecord

This has fields:

    structure
        time_t timeStamp
            long secondsPastEpoch
            int nanoseconds
            int userTag
        structure peak
            double x
            double xwidth
            double y
            double ywidth
            double intensity
        structure argument
            structure format
                int index
                string[] choices
            int height
            int width
        structure result
            union value
                ubyte[] uint8
                ushort[] uint16
                uint[] uint32

This is used by testPython/qtimage.

See qtimage For details.

TPYaddRecord,TPYremoveRecord, and TPYtraceRecord

These are implemented by pvDatabaseCPP.
testPython/plot2dcurve uses TPYaddRecord. The others are not used in this application but may be of interest to other applications.