Skip to main content

Tester-Agnostic Sequencer for Hardware-Testing in Python

Project description

FLooPy
Tester-Agnostic Sequencer for Hardware-Testing in Python

Tests

  • ... can performed within different test-environments
  • ... can organized in hierarchical layers with (sub-) tasks
  • ... can have setup, task/test, teardown, final and output functions
  • Every variable
    • ... has an unique namespace
    • ... is stored as a time-signal with timestamps
    • ... can be sub-classed
  • Data dependencies between functions are resolved by a graph-based approach
  • Auto-Save for loop-recovery and post-processing (experimental)
  • Can handle non-reentrant tests by an extra extension (unpublished)

Loops

  • Flexible loop configuration (nested, zipped, concatenated)
  • Standard loops: loop_items, loop_lin, loop_log, loop_bisect
  • Feedback for HiL possible

Getting Started

Suppose we want to test if the internal resistance of an battery rbat is inside the test-limits:

  • The test-environment is abstracted by the namespace of the dut input and must be specified later, just before running the test-case.
  • The loop over the load current i_load can be either configured locally inside the test-case or later, just before running the test-case.

Test-Case

import floopy as fly


class Test_Rbat_Charged(fly.Task):
    dut = fly.Input()  # object to stimulate device-under-test and measure response
   
    i_load = fly.Input(min=0, max=1.5, unit='A', default=fly.loop_lin(num=3))
    
    def task(dut, i_load):
        dut.current = i_load
        return dut.voltage

    def final_fit(i=fly.Squeeze(task.i_load), v=fly.Squeeze(task)):
        import numpy as np
        return np.polyfit(i, v, deg=1)
        
    @fly.Output(min=0, ltl=0.2, utl=2, max=10, unit='ohm')
    def rbat(coeffs=final_fit):
        return coeffs[0]

Test-Plan

Now, the test-case Test_Rbat_Charged can be used with different loop-configurations and within different test-environments. For demonstration we just use the simple resistor equation as a simulation-environment.

class TestPlan_BatterCheck(fly.Task):
    def dut():
        class Dut:
            @property
            def voltage(self):
                resistance = 0.8  # ohm
                return resistance * self.current
        return Dut()

    test_rbat_charged = Test_Rbat_Charged(dut, i_load=fly.loop_log(0.1, 1, num=5))

Note, that we changed the default loop-configuration of i_load to a logarithmic scaling.

In order to perform the Test-Plan we need a DataManager saving all loop-states and measurement results as time-signals in a json-file.

>>> dm = fly.DataManager()
>>> dm.run_live(TestPlan_BatterCheck)

╭─ TestPlan_BatterCheck ─╮
    test_rbat_charged  
╰────────────────────────╯
File: dm/dm_2024-10-10_16:00:29.json

The test results and all variables can be analyzed via pandas-tables.

>>> dm.read_task(TestPlan_BatterCheck)
test_rbat_charged
rbat check
0.8 True
>>> tp = TestPlan_BatterCheck()
>>> dm.read_task(tp.test_rbat_charged.task)
i_load __return__
TestPlan_BatterCheck.test_rbat_charged.i_load
0.100000 0.100000 0.080000
0.177828 0.177828 0.142262
0.316228 0.316228 0.252982
0.562341 0.562341 0.449873
1.000000 1.000000 0.800000

For a real measurement we leave the test-case unchanged and just need to replace the dut function in the test-plan with something like

def dut():
    import instruments
    dut = instruments.PowerSupply()
    return dut

assuming an equal namespace

dut.voltage
dut.current

with an equal behavior.

Further information can be found in the FLooPy-Tutorial which is more detailed.

Install

Simply do either

pip install floopy

or download the repository for a more recent version, change into the floopy folder and

pip install . --user

If necessary you can run the tests with

python -m pytest

Licence

LoopyPlot is licenced under GPL 3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

floopy-0.1.2.tar.gz (60.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

floopy-0.1.2-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file floopy-0.1.2.tar.gz.

File metadata

  • Download URL: floopy-0.1.2.tar.gz
  • Upload date:
  • Size: 60.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for floopy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3500cc2ed75f681a44cad752adb57cb0bc5612c8ba7d632677b37e46f03d0fa6
MD5 3b1ed95837489998effa27786896954f
BLAKE2b-256 4c04826501db2f4f37413b0a3ee7fd1d008dd5c3d4613805f3bc79ef182f0407

See more details on using hashes here.

File details

Details for the file floopy-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: floopy-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for floopy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8e80a9824976538511eacf36f0b0b92c3a1d5c7e6714539298d892fdf976b0
MD5 9b8c21df3c7df58f37069e583c4a5c39
BLAKE2b-256 aed0d13cd6224b07be4e76aad077ac47ad09839d2b31e97610782187d57f1809

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page