Model#

A model describes the registers of a component, mainly its local address and the encoding and decoding of its values

File naming convention#

Naming convention for model files is given in the table below. Values between {} are mandatory while those between [] are optional.

grammar

definition

exemple

{component}.csv

unique file name

ltm4677.csv
si5391.csv

{component}

the name of the component in lower case

ltm4677
si5391
max10_sequencer

Parameters defining a model#

A model is a CSV file with 18 columns. The columns marked with (*) has to be defined for each register.

label (str) (*)

user name for a register or a group of them. Word in upper case separated by underscore.

paged (int) (*)

0 (1) no (yes) respectively

page (hexa)

page number. Mandatory when paged is 1

regadd (hexa) (*)

address of the first register

nregisters (int) (*)

number of contiguous registers to be read, from 1 to 8.

concat_registers (str) (*)

list defining the order of bytes get from contiguous registers, e.g 0, 1 for little-endian (LSB, MSB) and 1, 0 for big-endian (MSB, LSB)

access (str) (*)

Possible values are: S (as in Send or Self Clearing), R, R/W, W

data_format (str) (*)

encoding or decoding to be applied to the full word. Possible values are ASCII, DIR, HEX, L11, L16, L1613, REG T12, T12EXT, V18, 2SC (2’s complement).

mask (hexa)

mask to be apply to the full word. Mandatory for the REG data format. The size of the mask depends on nregisters

shift (int)

right shift to be applied to the full word. Mandatory for the REG data format.

bmr (str)

parameters for the DIR data format: \(x = (y\times 10^{-R} - b) / m)\) where \(x\) is the real value and \(y\) the 2’s complement integer from the PMBus device. The value of \(b, m, R\) are separated by a comma.

scale_to_mksa (float)

scale factor to convert value to MKSA system. The scale factor is not applied when it is not defined.

mksa_unit (str)

MKSA unit (A, °C, Hz, kg, m, s, V, W, …)

min (float)

minimum value

max (float)

maximum value

round (int)

round to \(n\) digit after the decimal point. Rounding is not applied when it is not defined

description (str)

description of the register

Checking a model#

The package p400model expose the command p4x_check verifying that the content of the CSV file is correct

  (venv) $ p4x_check -h
  (venv) $ p4x_check -c ltm4677
  (venv) $ p4x_check -pcsv my_working_directory/my_cmpt.csv

The python class modeling a component#

A component is described by a class in the python code. The class read the model file and provided high level method to interact with it: configure, voltage at the input, output current on channel \(x\), status, etc.

Available models are in the python package p400-model