manjey73

Forum Replies Created

Viewing 15 posts - 61 through 75 (of 856 total)
  • Author
    Posts
  • in reply to: Reading event log from modbus device #16700
    manjey73
    Participant

    and 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?

    in reply to: Unit prefix #16691
    manjey73
    Participant

    The division command for the input channel looks like this Cnl/1000

    in reply to: Multi-Channel Data Trigger #16685
    manjey73
    Participant

    The 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.

    in reply to: Using Internal variables/channels #16676
    manjey73
    Participant

    1. ModDiffCalculator – One of the options that solves this problem.
    2. Channel 1, to save the total reading every hour EveryHour(() => 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.

    in reply to: HourStarted() doesn’t evaluate to true #16666
    manjey73
    Participant

    As 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 🙂

    in reply to: HourStarted() doesn’t evaluate to true #16663
    manjey73
    Participant
    The 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.
    in reply to: HourStarted() doesn’t evaluate to true #16662
    manjey73
    Participant

    HourStarted() is running with a delay. The revision of the formulas has apparently not yet been included in the release.

    HourStarted

    Use a translator if you need to understand.

    in reply to: Swapping command values #16661
    manjey73
    Participant

    if you are using an enumeration, then add your own.
    ONN: green; OFF:red
    by analogy, or any other at your discretion

    in reply to: Using Internal variables/channels #16650
    manjey73
    Participant

    SetVal(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.

    in reply to: Using Internal variables/channels #16649
    manjey73
    Participant

    CheckComm – The multiplier formula
    CheckComm1 – The formula is without using a multiplier, in fact, the multiplier is 1 if you use the first one

    in reply to: Using Internal variables/channels #16648
    manjey73
    Participant
    public 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"))

    in reply to: Using Internal variables/channels #16647
    manjey73
    Participant

    Try different options, as different channel processing scripts are required for different tasks.

    in reply to: Using Internal variables/channels #16646
    manjey73
    Participant

    Input and Outputs Scrips

    An 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);
    }
    
    in reply to: Using Internal variables/channels #16644
    manjey73
    Participant

    you 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

    in reply to: Faster thread #16642
    manjey73
    Participant

    Start with scripts in which you read or write to files, and the like. That is, some more complex scripts that you use.

Viewing 15 posts - 61 through 75 (of 856 total)