Forum Replies Created
-
AuthorPosts
-
manjey73
Participantand if the value is 5 but you read 10, will there be an error or just zeros? and how are the events arranged? are these consistent occurrences? how will you identify them?
manjey73
ParticipantThe division command for the input channel looks like this Cnl/1000
manjey73
ParticipantThe module does not support multi-channel like. Or no more than 2 in the 6th version. I haven’t watched it for a long time. You can create a Calculated channel for applying any scripts in which you will compare the required channels and only then apply the module to this channel.
manjey73
Participant1. ModDiffCalculator – One of the options that solves this problem.
2. Channel 1, to save the total reading every hourEveryHour(() => Data(327))
(Channel 327 – Total Energy from device)
Channel 2 –EveryHour(() => Val(360) - PrevVal(360))
(Difference. Channel 360 here is Channel 1)There may be different approaches.
manjey73
ParticipantAs the author noted, the delay in hourly formulas can be useful, but here it is necessary to combine the minute with the hour, and this usefulness went sideways 🙂
manjey73
ParticipantThe reason turned out to be that the HourStarted formula was triggered after 30 seconds, as the hour arrived, and EveryMin was triggered at 0 seconds. The delay in the HourStarted formula is useful in some cases. You can update the Scripts table in the Calendar entry to make it work.:
EveryMin(() => HourStarted() ? 0 : Val() + 1)
These changes will be included in the project template in the next release.
-
This reply was modified 2 months, 3 weeks ago by
manjey73.
manjey73
ParticipantHourStarted() is running with a delay. The revision of the formulas has apparently not yet been included in the release.
Use a translator if you need to understand.
manjey73
Participantif you are using an enumeration, then add your own.
ONN: green; OFF:red
by analogy, or any other at your discretionmanjey73
ParticipantSetVal(500.34) does not work, presumably because the Val() formula cannot display the channel value without a status. I also came across this. There is also the Data() formula, but I haven’t tried it yet, somehow it wasn’t necessary. It works a little differently, if I understood correctly.
You can change the values from the range directly in the channel formula, try using the combined CheckComm formulas inside the SetVal formula as shown above.If you plan to use formulas inside other formulas, make it a rule to convert to double yourself, even if returning bool is enough for you. Then it becomes possible.
manjey73
ParticipantCheckComm – The multiplier formula
CheckComm1 – The formula is without using a multiplier, in fact, the multiplier is 1 if you use the first onemanjey73
Participantpublic double CheckComm(double min, double max, double mult, string str = "" ) { if (Cmd < min || Cmd > max) throw new Exception($"The value must be within {min} - {max} {str}"); return Cmd*mult; } public double CheckComm1(double min, double max, string str = "" ) { if (Cmd < min || Cmd > max) throw new Exception($"The value must be within {min} - {max} {str}"); return Cmd; }
You can also use formulas with verification to control the input parameters.
I’ve been making universal ones for myself here.The method of application in the output formula of the channel
Output channel
CheckComm(16, 32, 10, "degrees")
Calculated/Output
SetVal(CnlNum, CheckComm(16, 32, 10, "degrees"))
manjey73
ParticipantTry different options, as different channel processing scripts are required for different tasks.
manjey73
ParticipantAn example of using formulas in Calculated channels
The Val() formula allows you to show the value after you enter it, but it will reset on reboots.
There is a formula that allows you to use the default value for reboots, suggested by Mikhail.// Set the default setpoint value. // For channels of the Calculated/output type public CnlData GetDefaultData(double val) { return Stat() > 0 ? Data() : NewData(val, 1); }
manjey73
Participantyou need to use formulas in channels. the simplest is Val() for input and SetVal(CnlNum, Cmd) for output formulas.
well, there is also the possibility of using more complex formulas. The channel must be Calculated/Output
manjey73
ParticipantStart with scripts in which you read or write to files, and the like. That is, some more complex scripts that you use.
-
This reply was modified 2 months, 3 weeks ago by
-
AuthorPosts