Accessing otii's calculated values for average current consumption over a period of time

Hi!

I’m using an Otii to test current values on a device during different specific events. We’re using the TCP server configuration to run python scripts, and we want to collect the avg current consumption over a certain time interval (these are shown in the Otii graph windows top right corner). Right now we have to collect all of the data values from the mc channel via a JSON request to the TCP server in order to calculate the avg ourselves, which slows down the program tremendously. Is there a way to only request Otii’s calculated avg instead?

Thanks in advance,

Joel

Hi Joel,

The average is not available, you need to calculate it in the script.

Best regards ,
Björn

Hello,

I have tried LUA scripting before on OTII and it was okay. Now that I was trying to achieve the same functionality in the Python (Energy and current average mesaurement) using below code
#-- Get the recording id of the last recording
recording_id = project.get_last_recording()

#-- Get the number of samples from the main energy channel
count = recording_id.get_channel_data_count(my_arc,“me”)

But i always hit the error i.e
Traceback (most recent call last):
File “C:\Ashu_Drive\Docs\Scripts\Amarisoft_OTII\test_python_otii_Ashu_Test.py”, line 77, in
count = recording_id.get_channel_data_count(my_arc,“me”)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\otii_tcp_client\recording.py”, line 68, in get_channel_data_count
response = self.connection.send_and_receive(request)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\otii_tcp_client\otii_connection.py”, line 115, in send_and_receive
json_msg = json.dumps(request)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\json_init_.py”, line 231, in dumps
return _default_encoder.encode(obj)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py”, line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py”, line 257, in iterencode
return _iterencode(o, 0)
File “C:\Users\adas\AppData\Local\Programs\Python\Python36-32\lib\json\encoder.py”, line 180, in default
o.class.name)
TypeError: Object of type ‘Arc’ is not JSON serializable

Any idea if i have to change/update teh JSON package in my Python library to support OTII data exchange?

It should be:
count = recording_id.get_channel_data_count(my_arc.id,“me”)

Best regards,
Björn

1 Like