IFM SBN246 Flowmeter Agent
The IFM SBN246 Flowmeter Agent is an OCS Agent which monitors flow in liters per minute and temperature in Celsius of the cooling loop of the DRs installed at the site. Monitoring is performed by connecting the flowmeter device to an IO-Link master device from the same company; the querying of flowmeter data is done via HTTP requests to the IO-Link master.
usage: python3 agent.py [-h] [--ip-address IP_ADDRESS] [--daq-port DAQ_PORT]
Agent Options
- --ip-address
IP address of IO-Link master.
- --daq-port
Port on IO-Link master that flowmeter is connected to.
Configuration File Examples
Below are configuration examples for the ocs config file and for running the Agent in a docker container.
OCS Site Config
To configure the IFM SBN246 Flowmeter Agent we need to add a FlowmeterAgent block to our ocs configuration file. Here is an example configuration block using all of the available arguments:
{'agent-class': 'FlowmeterAgent',
'instance-id': 'flow',
'arguments': [['--ip-address', '10.10.10.159'],
['--daq-port', '2']]},
Note
The --ip-address
argument should use the IP address of the IO-Link
master.
Docker Compose
The IFM SBN246 Flowmeter Agent should be configured to run in a Docker container. An example docker-compose service configuration is shown here:
ocs-flow:
image: simonsobs/socs:latest
hostname: ocs-docker
network_mode: "host"
volumes:
- ${OCS_CONFIG_DIR}:/config:ro
environment:
- INSTANCE_ID=flow
- SITE_HUB=ws://127.0.0.1:8001/ws
- SITE_HTTP=http://127.0.0.1:8001/call
- LOGLEVEL=info
The LOGLEVEL
environment variable can be used to set the log level for
debugging. The default level is “info”.
Description
The SBN246 Flowmeter is a device from IFM Electronic, and is used to monitor the flow and temperature of the cooling loops at the site. This monitoring is critical, as any change in flow or temperature allows us to immediately diagnose/anticipate DR behavior. The Agent communicates with the flowmeter via an AL1340 IFM Electronic device–an IO-Link master from which the agent makes HTTP requests. The flowmeter plugs into 1 of 4 ports on the IO-Link master, and the agent queries data directly from that IO-Link master port. This is only possible when an ethernet connection is established via the IO-Link master’s IoT port.
IO-Link Master Network
Once plugged into the IoT port on your IO-Link master, the IP address of the IO-Link master is automatically set by a DHCP server in the network. If no DHCP server is reached, the IP address is automatically assigned to the factory setting for the IoT port (169.254.X.X).
IO-Link Visualization Software
A Windows software called LR Device exists for parameter setting and visualization of IO-Link master and device data. The software download link is below should the user need it for changing settings on the IO-Link master. On the LR Device software panel, click the ‘read from device’ button on the upper right (leftmost IOLINK button); the software will then search for the IO-Link master. Once found, it will inform the user of the IO-Link master model number (AL1340) and its IP address.
Agent API
- class socs.agents.ifm_sbn246_flowmeter.agent.FlowmeterAgent(agent, ip_address, daq_port)[source]
Monitor the flowmeter.
- Parameters:
agent (OCSAgent) – OCSAgent object which forms this Agent.
ip_address (str) – IP address of IO-Link master to make requests from.
daq_port (int) – Port on IO-Link master that connects to flowmeter. Choices are 1-4.
- acq(test_mode=False)[source]
Process - Fetch values from the flowmeter using the IO-Link master.
- Parameters:
test_mode (bool, optional) – Run the Process loop only once. Meant only for testing. Default is False.
Notes
The most recent data collected is stored in session data in the following structure. Note the units are [liters/min] and [Celsius]:
>>> response.session['data'] {'timestamp': 1682630863.0066128, 'fields': {'flow': 42.4, 'temperature': 22.8} }