How to set HighLimit/LowLimit in mass?
-
Hi timkk880,
If you already have the limit detectors created, you can use the /data_sources.shtm page, the data points tab, to filter the points to only points with the limit detectors in question. Then you can export them, perform modifications and import them.
If you need to add a heap of them, manipulating the JSON or making programmatic API calls is the current way to go. For instance, this Python script will add a high limit detector to all data points in the input:
import json from StringIO import StringIO #import copy inputFile = open("/path/to/mango-configuration.json") config = json.load(inputFile) inputFile.close() newDetector = json.load(StringIO("""{ "type":"HIGH_LIMIT", "sourceType":"DATA_POINT", "alias":"", "alarmLevel":"NONE", "durationType":"SECONDS", "duration":15, "limit":50.0, "notHigher":false }""")) #can use thisPointsDetector = copy.deepcopy(newDetector) (or reload json) # if you need to change something for the ideal, like the alias for dp in config["dataPoints"] : dp["eventDetectors"].append(newDetectorJson) outputFile = open("/path/to/output.json", "w+") outputFile.write(json.dumps(config, indent=4, sort_keys=False, separators=(",",": "))) outputFile.close()
-
that's useful function, thanks.
By the way, how to set point update periode? it seems only data source can set update periode, one data source may have many points need different frequency to update, is that possible to set point by point? -
That depends on the data source but generally no, you cannot set the update interval on a per-point basis. What type of data source?
If you need to poll a Modbus device at multiple rates for instance, you can do this if it is Modbus IP by creating multiple data sources. If it's Modbus serial, it is not efficient but you could create a scripting data source that calls
RuntimeManager.refreshDataPoint(p123.getDataPointWrapper().getXid());
And then schedule that cron for whatever update rate you need. If that were a third of the points or more, I would just increase the polling rate of the data source and ensure the ones you don't need that density on have interval logging types.
-
yes, it's modbus datasource. the reason why ask this, is because I have many datasource, each of them have 20 points, only one of these points need poll immediately, for example, motor, I want to set it 50ms for poll interval, and other points I accept 5 minutes, if I set them all 50ms, I worry about bandwidth and hardware resource etc.
-
I was asking if it is a Modbus IP data source, but I can guess from the other thread that it probably is. In that case, I would put the point(s) that you need to read that quickly onto a second data source with the faster polling rate.
-
thanks for your proposal, the only thing I worry about is if I set two Modbust IP master to poll data from the same Modbust IP salve, do they conflict or not? for example, I set Master A to poll data every 50ms, Master B poll data every 2 minutes, sometimes, A and B poll data at exactly same timestamp from the same PLC, what will happen?
-
That will depend on the device you are reading. Most devices will support a few concurrent IP connections without issue. Some are configurable.
-
ok, I will try.
-
This post is deleted! -
Hi Peter_John48115, welcome to the forum.
I have no idea what you're asking. That appears to mostly be a copied portion of my second post. Were you asking for some clarification?