Pictory e02.json export template questions

Topics about the Software of Revolution Pi
Post Reply
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Pictory e02.json export template questions

Post by RR4711 »

Hi,
I just made a new project with a RevPi Connect 32+, a DIO and a AIO. I export all variables in the configuration to get an offset list for my C code accessing the process image via an overlayed C structure.
(I export the configuration as "offset list" using the e02.json template via the export menu.)

I get this:

Code: Select all

InputValue_1		 0	 //INT P1000 goes here (Range 10V for safety reasons!) 
InputValue_2		 2	 //INT  
InputValue_3		 4	 //INT  
InputValue_4		 6	 //INT  
InputStatus_1		 8	 //BYTE  
InputStatus_2		 9	 //BYTE  
InputStatus_3		 10	 //BYTE  
InputStatus_4		 11	 //BYTE  
RTDValue_1		 12	 //INT  
RTDValue_2		 14	 //INT  
RTDStatus_1		 16	 //BYTE  
RTDStatus_2		 17	 //BYTE  
OutputStatus_1		 18	 //BYTE  
OutputStatus_2		 19	 //BYTE  
OutputValue_1		 20	 //INT  
OutputValue_2		 22	 //INT  
Input1Range		 24	 //You must use wire bridges for current measurement! ##ATTR_COMMENT## 
Input1Multiplier		 25	 // ##ATTR_COMMENT## 
Input1Divisor		 27	 // ##ATTR_COMMENT## 
Input1Offset		 29	 // ##ATTR_COMMENT## 
Input2Range		 31	 //You must use wire bridges for current measurement! ##ATTR_COMMENT## 
Input2Multiplier		 32	 // ##ATTR_COMMENT## 
Input2Divisor		 34	 // ##ATTR_COMMENT## 
Input2Offset		 36	 // ##ATTR_COMMENT## 
Input3Range		 38	 //You must use wire bridges for current measurement! ##ATTR_COMMENT## 
Input3Multiplier		 39	 // ##ATTR_COMMENT## 
Input3Divisor		 41	 // ##ATTR_COMMENT## 
Input3Offset		 43	 // ##ATTR_COMMENT## 
Input4Range		 45	 //You must use wire bridges for current measurement! ##ATTR_COMMENT## 
Input4Multiplier		 46	 // ##ATTR_COMMENT## 
Input4Divisor		 48	 // ##ATTR_COMMENT## 
Input4Offset		 50	 // ##ATTR_COMMENT## 
ADC_DataRate		 52	 //Use lowest value for highest precision and a maximum 50 Hz suppression ##ATTR_COMMENT## 
RTD1Type		 53	 // ##ATTR_COMMENT## 
RTD1Wiring		 54	 //You must use wire bridges for 2-wire sensors! ##ATTR_COMMENT## 
RTD1Multiplier		 55	 // ##ATTR_COMMENT## 
RTD1Divisor		 57	 // ##ATTR_COMMENT## 
RTD1Offset		 59	 // ##ATTR_COMMENT## 
RTD2Type		 61	 // ##ATTR_COMMENT## 
RTD2Wiring		 62	 //You must use wire bridges for 2-wire sensors! ##ATTR_COMMENT## 
RTD2Multiplier		 63	 // ##ATTR_COMMENT## 
RTD2Divisor		 65	 // ##ATTR_COMMENT## 
RTD2Offset		 67	 // ##ATTR_COMMENT## 
Output1Range		 69	 // ##ATTR_COMMENT## 
Output1EnableSlew		 70	 //Enable slew rate deceleration ##ATTR_COMMENT## 
Output1SlewStepSize		 71	 //Slew rate step size ##ATTR_COMMENT## 
Output1SlewClock		 72	 //lock rate of slew rate deceleration in kHz ##ATTR_COMMENT## 
Output1Multiplier		 73	 // ##ATTR_COMMENT## 
Output1Divisor		 75	 // ##ATTR_COMMENT## 
Output1Offset		 77	 // ##ATTR_COMMENT## 
Output2Range		 79	 // ##ATTR_COMMENT## 
Output2EnableSlew		 80	 //Enable slew rate deceleration ##ATTR_COMMENT## 
Output2SlewStepSize		 81	 //Slew rate step size ##ATTR_COMMENT## 
Output2SlewClock		 82	 //lock rate of slew rate deceleration in kHz ##ATTR_COMMENT## 
Output2Multiplier		 83	 // ##ATTR_COMMENT## 
Output2Divisor		 85	 // ##ATTR_COMMENT## 
Output2Offset		 87	 // ##ATTR_COMMENT## 
I_1		 89.0	 //BOOL  
I_2		 89.1	 //BOOL  
I_3		 89.2	 //BOOL  
I_4		 89.3	 //BOOL  
I_5		 89.4	 //BOOL  
I_6		 89.5	 //BOOL  
I_7		 89.6	 //BOOL  
I_8		 89.7	 //BOOL  
I_9		 89.8	 //BOOL  
I_10		 89.9	 //BOOL  
I_11		 89.10	 //BOOL  
I_12		 89.11	 //BOOL  
I_13		 89.12	 //BOOL  
I_14		 89.13	 //BOOL  
I_15		 89.14	 //BOOL  
I_16		 89.15	 //BOOL  
Output_Status		 91	 //WORD  
Status		 93	 //WORD  
Counter_1		 95	 //DINT  
Counter_2		 99	 //DINT  
Counter_3		 103	 //DINT  
Counter_4		 107	 //DINT  
Counter_5		 111	 //DINT  
Counter_6		 115	 //DINT  
Counter_7		 119	 //DINT  
Counter_8		 123	 //DINT  
Counter_9		 127	 //DINT  
Counter_10		 131	 //DINT  
Counter_11		 135	 //DINT  
Counter_12		 139	 //DINT  
Counter_13		 143	 //DINT  
Counter_14		 147	 //DINT  
Counter_15		 151	 //DINT  
Counter_16		 155	 //DINT  
O_1		 159.0	 //BOOL  
O_2		 159.1	 //BOOL  
O_3		 159.2	 //BOOL  
O_4		 159.3	 //BOOL  
O_5		 159.4	 //BOOL  
O_6		 159.5	 //BOOL  
O_7		 159.6	 //BOOL  
O_8		 159.7	 //BOOL  
O_9		 159.8	 //BOOL  
O_10		 159.9	 //BOOL  
O_11		 159.10	 //BOOL  
O_12		 159.11	 //BOOL  
O_13		 159.12	 //BOOL  
O_14		 159.13	 //BOOL  
O_15		 159.14	 //BOOL  
O_16		 159.15	 //BOOL  
PWM_1		 161	 //USINT  
PWM_2		 162	 //USINT  
PWM_3		 163	 //USINT  
PWM_4		 164	 //USINT  
PWM_5		 165	 //USINT  
PWM_6		 166	 //USINT  
PWM_7		 167	 //USINT  
PWM_8		 168	 //USINT  
PWM_9		 169	 //USINT  
PWM_10		 170	 //USINT  
PWM_11		 171	 //USINT  
PWM_12		 172	 //USINT  
PWM_13		 173	 //USINT  
PWM_14		 174	 //USINT  
PWM_15		 175	 //USINT  
PWM_16		 176	 //USINT  
InputMode_1		 177	 // ##ATTR_COMMENT## 
InputMode_2		 178	 // ##ATTR_COMMENT## 
InputMode_3		 179	 // ##ATTR_COMMENT## 
InputMode_4		 180	 // ##ATTR_COMMENT## 
InputMode_5		 181	 // ##ATTR_COMMENT## 
InputMode_6		 182	 // ##ATTR_COMMENT## 
InputMode_7		 183	 // ##ATTR_COMMENT## 
InputMode_8		 184	 // ##ATTR_COMMENT## 
InputMode_9		 185	 // ##ATTR_COMMENT## 
InputMode_10		 186	 // ##ATTR_COMMENT## 
InputMode_11		 187	 // ##ATTR_COMMENT## 
InputMode_12		 188	 // ##ATTR_COMMENT## 
InputMode_13		 189	 // ##ATTR_COMMENT## 
InputMode_14		 190	 // ##ATTR_COMMENT## 
InputMode_15		 191	 // ##ATTR_COMMENT## 
InputMode_16		 192	 // ##ATTR_COMMENT## 
InputDebounce		 193	 // ##ATTR_COMMENT## 
OutputPushPull		 195	 // ##ATTR_COMMENT## 
OutputOpenLoadDetect		 197	 // ##ATTR_COMMENT## 
OutputPWMActive		 199	 // ##ATTR_COMMENT## 
OutputPWMFrequency		 201	 // ##ATTR_COMMENT## 
RevPiStatus		 202	 //BYTE  
RevPiIOCycle		 203	 //BYTE  
RS485ErrorCnt		 204	 //WORD  
Core_Temperature		 206	 //BYTE  
Core_Frequency		 207	 //BYTE  
RevPiLED		 208	 //BYTE  
RS485ErrorLimit1		 209	 //WORD  
RS485ErrorLimit2		 211	 //WORD  

Where does the ##ATTR_COMMENT## come from, and is this actually an indication that this offset is not run-time accessible, but set only during the module configuration by the driver (as it appears to me)?
Can someone confirm this is the case?

Is there a way of writing an own template file to directly generate a C structure declaration?
Right now it's very tiresome work doing this manually.

Markus
User avatar
dirk
KUNBUS
Posts: 1942
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Pictory e02.json export template questions

Post by dirk »

Hi Markus, this is a feature that has minimal documentation. Have a look here:
2020-11-18 15_11_35-pictory export.jpg
2020-11-18 15_11_35-pictory export.jpg (42.99 KiB) Viewed 2282 times
So the best way is to take copy and modify an existing file - here is the list:

Code: Select all

pi@RevPi40302:~ $ find /var/www/pictory -iname e0*.json
/var/www/pictory/resources/data/patterns/export/e04.json
/var/www/pictory/resources/data/patterns/export/e02.json
/var/www/pictory/resources/data/patterns/export/e03.json
/var/www/pictory/resources/data/patterns/export/e01.json
It seems that you are right with the assumption that the "##ATTR_COMMENT##" variables are not run-time accessible.
I'll try to clarify this.
just an idea - the RevPiModIO Python library might be a better starting point a it parses the PiCtory configuration and creates a mapping.
User avatar
RR4711
Posts: 228
Joined: 22 Feb 2018, 13:28
Answers: 0

Re: Pictory e02.json export template questions

Post by RR4711 »

dirk wrote: 18 Nov 2020, 15:25 It seems that you are right with the assumption that the "##ATTR_COMMENT##" variables are not run-time accessible.
I'll try to clarify this.
Thanks
just an idea - the RevPiModIO Python library might be a better starting point a it parses the PiCtory configuration and creates a mapping.
Yeah wel OK, but I like my C better :-)
User avatar
dirk
KUNBUS
Posts: 1942
Joined: 15 Dec 2016, 13:19
Answers: 4

Re: Pictory e02.json export template questions

Post by dirk »

Hi well I have some news about it:
##ATTR_COMMENT## is filled from the 'comment' value of the field in the RAP file
Example from the RAP file: RevPiAIO_20170301_1_0.rap
"name": "Input2Range"
"comment": "You must use wire bridges for current measurement!"

I just can say that "MEM" variables are NOT runtime accessible. I.e. look at a Virtual Modbus TCP Master in PiCtory:
2020-11-25 16_38_31-PiCtory - 1.4.3.jpg
2020-11-25 16_38_31-PiCtory - 1.4.3.jpg (9.79 KiB) Viewed 2172 times
There are those two MEM variables:
2020-11-25 16_38_04-PiCtory - 1.4.3.jpg
2020-11-25 16_38_04-PiCtory - 1.4.3.jpg (8.14 KiB) Viewed 2172 times
Post Reply