Commit 62f9e4bf authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

moves examples into new directory

Showing with 582 additions and 0 deletions
+582 -0
[
{
"id": "6fef03d5598b4c7a",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "77db8af51a12093d",
"type": "mqtt in",
"z": "6fef03d5598b4c7a",
"name": "",
"topic": "ohmpi_0001/exec",
"qos": "2",
"datatype": "auto",
"broker": "5a09c1ee2a3419c3",
"nl": false,
"rap": false,
"inputs": 0,
"x": 410,
"y": 500,
"wires": [
[
"b30d9b90bda62986",
"3f46bb85053b613c"
]
]
},
{
"id": "b30d9b90bda62986",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 500,
"wires": []
},
{
"id": "d9745ad9da06b862",
"type": "mqtt in",
"z": "6fef03d5598b4c7a",
"name": "",
"topic": "ohmpi_0001/data",
"qos": "2",
"datatype": "auto",
"broker": "5a09c1ee2a3419c3",
"nl": false,
"rap": false,
"inputs": 0,
"x": 400,
"y": 600,
"wires": [
[
"c5dc2f808ccac105",
"3ef697f4f3fdc90e",
"a67154e86b9510f8",
"1bc67267d61f8ac7"
]
]
},
{
"id": "c5dc2f808ccac105",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 600,
"wires": []
},
{
"id": "bafb34347dc3236b",
"type": "mqtt out",
"z": "6fef03d5598b4c7a",
"name": "MQTT ctrl",
"topic": "ohmpi_0001/ctrl",
"qos": "2",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "5a09c1ee2a3419c3",
"x": 840,
"y": 180,
"wires": []
},
{
"id": "8dc72d9df180684c",
"type": "mqtt in",
"z": "6fef03d5598b4c7a",
"name": "",
"topic": "ohmpi_0001/soh",
"qos": "2",
"datatype": "auto",
"broker": "5a09c1ee2a3419c3",
"nl": false,
"rap": false,
"inputs": 0,
"x": 400,
"y": 700,
"wires": [
[
"9ecd9ccb499016d2"
]
]
},
{
"id": "9ecd9ccb499016d2",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 700,
"wires": []
},
{
"id": "78c8945000eccf7d",
"type": "ui_button",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "142ad6ae.d55e29",
"order": 0,
"width": "2",
"height": "1",
"passthru": false,
"label": "Run",
"tooltip": "",
"color": "",
"bgcolor": "green",
"className": "",
"icon": "",
"payload": "{\"cmd_id\" :\"0\", \"cmd\":\"run_sequence\"}",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 370,
"y": 80,
"wires": [
[
"bafb34347dc3236b"
]
]
},
{
"id": "819bb1f07e51b8c6",
"type": "ui_button",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "142ad6ae.d55e29",
"order": 0,
"width": "2",
"height": "1",
"passthru": false,
"label": "Interrupt",
"tooltip": "",
"color": "",
"bgcolor": "red",
"className": "",
"icon": "",
"payload": "{\"cmd_id\" :\"0\", \"cmd\":\"stop\"}",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 380,
"y": 140,
"wires": [
[
"bafb34347dc3236b"
]
]
},
{
"id": "4ec24224cfd4e4e8",
"type": "ui_form",
"z": "6fef03d5598b4c7a",
"name": "Commands",
"label": "",
"group": "142ad6ae.d55e29",
"order": 4,
"width": 0,
"height": 0,
"options": [
{
"label": "cmd_id",
"value": "cmd_id",
"type": "text",
"required": false,
"rows": null
},
{
"label": "cmd",
"value": "cmd",
"type": "text",
"required": true,
"rows": null
},
{
"label": "args",
"value": "args",
"type": "text",
"required": false,
"rows": null
}
],
"formValue": {
"cmd_id": "",
"cmd": "",
"args": ""
},
"payload": "",
"submit": "submit",
"cancel": "cancel",
"topic": "topic",
"topicType": "msg",
"splitLayout": "",
"className": "",
"x": 390,
"y": 340,
"wires": [
[
"547fb5791365f6f7",
"bafb34347dc3236b"
]
]
},
{
"id": "3f46bb85053b613c",
"type": "ui_text",
"z": "6fef03d5598b4c7a",
"group": "7792ecc419ecbb59",
"order": 0,
"width": "16",
"height": "12",
"name": "MQTT exec",
"label": "Execution",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 850,
"y": 540,
"wires": []
},
{
"id": "3ef697f4f3fdc90e",
"type": "ui_text",
"z": "6fef03d5598b4c7a",
"group": "7792ecc419ecbb59",
"order": 1,
"width": "16",
"height": "12",
"name": "MQTT Data",
"label": "Data",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 850,
"y": 640,
"wires": []
},
{
"id": "547fb5791365f6f7",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 360,
"wires": []
},
{
"id": "c7c6c06cfd2c4646",
"type": "ui_button",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "142ad6ae.d55e29",
"order": 0,
"width": "2",
"height": "1",
"passthru": false,
"label": "Set sequence",
"tooltip": "",
"color": "",
"bgcolor": "green",
"className": "",
"icon": "",
"payload": "{\"cmd_id\":\"\",\"cmd\":\"set_sequence\",\"args\": \"5 6 7 8\\n10 11 12 13\"}",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 400,
"y": 200,
"wires": [
[
"bafb34347dc3236b"
]
]
},
{
"id": "68a3f36a08839f62",
"type": "ui_button",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "142ad6ae.d55e29",
"order": 0,
"width": "2",
"height": "1",
"passthru": false,
"label": "Update settings",
"tooltip": "",
"color": "",
"bgcolor": "green",
"className": "",
"icon": "",
"payload": "{\"cmd_id\":\"\",\"cmd\":\"update_settings\",\"args\":{\"sequence\":\"5 6 7 8\\n10 11 12 13\"}}",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 400,
"y": 260,
"wires": [
[
"bafb34347dc3236b"
]
]
},
{
"id": "b7f0b15aea29d7d2",
"type": "ui_chart",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "7792ecc419ecbb59",
"order": 3,
"width": "11",
"height": "7",
"label": "chart",
"chartType": "line",
"legend": "true",
"xformat": "HH:mm:ss",
"interpolate": "linear",
"nodata": "",
"dot": true,
"ymin": "",
"ymax": "",
"removeOlder": 1,
"removeOlderPoints": "",
"removeOlderUnit": "3600",
"cutout": 0,
"useOneColor": false,
"useUTC": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"outputs": 1,
"useDifferentColor": false,
"className": "",
"x": 1270,
"y": 640,
"wires": [
[]
]
},
{
"id": "1bc67267d61f8ac7",
"type": "function",
"z": "6fef03d5598b4c7a",
"name": "function 1",
"func": "var msg2 = { payload: JSON.parse(msg.payload.split(' | ')[2].slice(6,).split(`'`).join(`\"`))[\"R [ohm]\"] };\nreturn msg2;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1120,
"y": 640,
"wires": [
[
"249d43079fd9a894",
"b7f0b15aea29d7d2"
]
]
},
{
"id": "249d43079fd9a894",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1280,
"y": 700,
"wires": []
},
{
"id": "24e6dbe73ec692f9",
"type": "ui_gauge",
"z": "6fef03d5598b4c7a",
"name": "",
"group": "7792ecc419ecbb59",
"order": 4,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "Measured Resistances",
"label": "R [Ohm]",
"format": "{{value}}",
"min": 0,
"max": "50",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"className": "",
"x": 1320,
"y": 560,
"wires": []
},
{
"id": "a67154e86b9510f8",
"type": "function",
"z": "6fef03d5598b4c7a",
"name": "function 2",
"func": "var msg2 = { payload: JSON.parse(msg.payload.split(' | ')[2].slice(6,).split(`'`).join(`\"`))[\"R [ohm]\"] };\nreturn msg2;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1120,
"y": 560,
"wires": [
[
"24e6dbe73ec692f9",
"df445e407bbcd544"
]
]
},
{
"id": "df445e407bbcd544",
"type": "debug",
"z": "6fef03d5598b4c7a",
"name": "debug 3",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1300,
"y": 500,
"wires": []
},
{
"id": "5a09c1ee2a3419c3",
"type": "mqtt-broker",
"name": "ohmpi_local",
"broker": "127.0.0.1",
"port": "1880",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "142ad6ae.d55e29",
"type": "ui_group",
"name": "Buttons",
"tab": "5d888f29.07334",
"order": 3,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "7792ecc419ecbb59",
"type": "ui_group",
"name": "Messages",
"tab": "5d888f29.07334",
"order": 2,
"disp": true,
"width": "16",
"collapse": true,
"className": ""
},
{
"id": "5d888f29.07334",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
\ No newline at end of file
import os
import numpy as np
import time
os.chdir("/home/pi/OhmPi")
from ohmpi import OhmPi
### Define object from class OhmPi
k = OhmPi()
### Update settings if needed
k.update_settings({"injection_duration":0.2})
### Set or load sequence
k.sequence = np.array([[1,2,3,4]]) # set numpy array of shape (n,4)
# k.set_sequence('1 2 3 4\n2 3 4 5') # call function set_sequence and pass a string
# k.load_sequence('ABMN.txt') # load sequence from a local file
### Run contact resistance check
# k.rs_check()
### Run sequence
k.run_sequence()
# k.run_sequence_async()
# time.sleep(2)
# k.interrupt()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment