- What is FAL?
- Pre-requisites
- Steps to implement FAL for another instrument function
- Directory structure of FAL
- Migrate the existing instrument class to Measurement Plug-In
- Using FAL in Measurement Plug-ins
- Note
The Functional Abstraction Layer (FAL) enables users to develop applications agnostic of instrument models and types by abstracting them by their functionality (a DMM and SMU can both measure Voltage).FAL in Measurement Plug-ins allows users to work with different instrument models and types that support same functionality without modifying the implementation. This FAL implementation leverages pins from the pin map to determine the instrument model implementation to achieve the functionality (measure voltage).
Example usage - A Measurement Plug-in developed with a logic to measure voltage can be enable to use a DMM, SMU or a DAQ AI without changes to the measurement logic by leveraging the FAL for measure voltage functionality.
- Fundamentals of FAL
- Intermediate-level expertise in Python
- Understanding of the session management in the measurement plug-ins
- To implement FAL, create a new directory to contain all files related to the FAL implementation. This newly created directory will serve as the root directory for the FAL implementation.
- Follow the recommended directory structure of FAL when creating directories for the implementation.
- Add an
__init__.pyfile to this directory. This marks the directory as a Python package, allowing you to import the FAL modules into your measurement plug-in.
- In the root directory, create
session_helper.pyand implement initialize method that will reserve and initialize instrument sessions for the provided pin names in the measurement.- [Optional] Additionally, implement create and destroy methods for instrument sessions that can be used in the TestStand fixture module.
- Refer to the
session_helper.pyfile in this FAL example for more insight.
- Create abstract classes for the required instrument functionalities (such as source voltage,
measure voltage, source current, measure current, etc.,) as separate Python files in the root
directory. Example:
source_dc_voltage.pyandmeasure_dc_voltage.py. - Within the root directory, create subdirectories for each instrument model. Example:
nidcpower,nidmmandkeysightdmm.- For naming the subdirectory, refer to the table with directory names for NI and custom instruments in the Notes section.
- Each of these subdirectories must contain a module (
.pyfile) with the same name as the directory.- The module must have a
Sessionclass which inherits the abstract classes of the required instrument functionalities and implements its methods.
- The module must have a
The recommended directory structure for FAL is shown below:
<fal_root_directory>
├── __init__.py
├── session_helper.py
├── initialize_session.py
├── <functionality_1_abstract_class>.py
├── <functionality_2_abstract_class>.py
.
├── <functionality_n_abstract_class>.py
.
.
.
├── <instrument_model_1>
│ └── <instrument_model_1>.py
├── <instrument_model_2>
│ ├── <instrument_model_2>.py
│ └── <driver session related files>
.
├── <other instrument model(s)>
.
.
.
├── teststand_helper.py
└── utilities
└── _visa_grpc.py
Example:
fal
├── __init__.py
├── session_helper.py
├── initialize_session.py
├── source_dc_voltage.py
├── measure_dc_voltage.py
├── keysightdmm
│ ├── keysightdmm.py
│ └── <driver session related files>
├── nidmm
│ └── nidmm.py
├── nidcpower
│ └── nidcpower.py
├── teststand_helper.py
└── utilities
└── _visa_grpc.py
If an class-based implementation of Functional Abstraction Layer exists, the following steps are recommended,
- Review the example implementation of the FAL in this repo
- Understand the difference in class implementation between the example and existing codebase
- Take the example from this repo as starter
- Extend the implementation to use the existing codebase by importing and calling at appropriate locations or copying core logic into the new structure.
- Package the FAL implementation and deploy for seamless reusability (not covered in this example)
If a non-class-based implementation of Functional Abstraction Layer exists, the following steps are recommended,
- Take the example from this repo as starter
- Extend the implementation to use the existing codebase by importing and calling at appropriate locations or copying core logic into the new structure.
- Package the FAL implementation and deploy for seamless reusability (not covered in this example)
The following diagram depicts the high level process to use a FAL developed as per the above recommendations in Measurement Plug-ins,

-
Directory names for different NI instrument types.
Instrument type Directory name NI-DCPower nidcpower NI-DMM nidmm NI-Digital Pattern nidigitalpattern NI-SCOPE niscope NI-FGEN nifgen NI-DAQmx nidaqmx NI-SWITCH nirelaydriver -
The
INSTRUMENT_TYPE_IDfor custom instruments should be a single word, adhering to Python standards. Accordingly, the directories for the instrument models should also be in lowercase. Example:keysightdmm.

