Skip to content
Snippets Groups Projects
play_with_almemo2490.py 2.59 KiB
# -*- coding: utf-8 -*-
"""
Created on Mon Jan  2 16:55:57 2023

@author: michael pawelzik
"""

# import module with python class for ahlborn
import almemo2490

# variables for selection in used methods
# numbmer format: 'xy'  where x has to be [0-9] and y has be [0-1]
# x is the measurement channel and y is the sensor port
sel_channel_no = '10'
sel_channel_name = 'T,t'
item = 0

try:
    
    # create object for python class of almemo710
    almemo2490_obj = almemo2490.almemo2490(ip='192.168.115.44')

    # set date to catual date
    almemo2490_obj.set_date()
    
    #set time to actual time
    almemo2490_obj.set_time()
    
    # request date from almemo 710  
    date = almemo2490_obj.get_date()
    
    # request time from almemo 710
    time = almemo2490_obj.get_time()
    
    # set name of measurment channel 0.1 from almemo 710  
    almemo2490_obj.set_channel_name(sel_channel_no,sel_channel_name)
    
    # request name of measurement channel from almemo 710
    channel_name = almemo2490_obj.get_channel_name(sel_channel_no)
        
    # request list of all sensors channels that are currently active
    # store this data in data frame of class_object
    almemo2490_obj.request_sens_channel_list()
 
    # trigger single measurement an request the measured values for all measurment channels
    # of almemo 710
    # store measured values in data frame of python class
    almemo2490_obj.request_meas_vals_all_channels()
    
    # get measuerement buffer of class object
    meas_buffer = almemo2490_obj.meas_buffer
    
    # fetch parameter of selected measurement channel from meas_buffer of class object
    # input of channel name or channel number is possible
    # numbmer format: 'xy'  where x has to be [0-9] and y has be [0-1]
    meas_channel_data, num_matches = almemo2490_obj. \
        fetch_channel_param_from_meas_buffer(pattern = sel_channel_name, index = item)
    
    # get measurement date from selected measurement channel
    meas_date = meas_channel_data.meas_date
    
    # get measurement time from selected measurement channel
    meas_time = meas_channel_data.meas_time
    
    # get measurement value from selected measurement channel
    meas_value = meas_channel_data.meas_val
    
    # get sensor unit from selected measurement channel
    channel_unit = meas_channel_data.channel_unit
    
    # get channel name from selected measurement channel
    channel_name = meas_channel_data.channel_name
    
    # get channel number from selected measurement channel
    sens_channel = meas_channel_data.sens_channel

finally:
    
    # close telnet connection
    almemo2490_obj.close()