manjey73

Forum Replies Created

Viewing 15 posts - 226 through 240 (of 856 total)
  • Author
    Posts
  • in reply to: I want to display text from decimal numbers. #15424
    manjey73
    Participant

    This is a test of the second formula.
    You need to create 8 calculation channels and specify in the formula which channel to take data from and which byte to take.
    GetByte1(105, 6) is an example to take the 6th byte. The value can be from 0 to 7

    in reply to: I want to display text from decimal numbers. #15423
    manjey73
    Participant
    in reply to: I want to display text from decimal numbers. #15422
    manjey73
    Participant
    public double GetByte1(int num, int bytenum)
    {
    byte[] mass = BitConverter.GetBytes(Val(num));
    if (bytenum >= 0 && bytenum <= 7)
    {
        return Convert.ToDouble(mass[bytenum]);
    }
    else return double.NaN;
    }

    This formula will probably be more correct with your values

    in reply to: I want to display text from decimal numbers. #15421
    manjey73
    Participant
    public double GetByte(double val, int n)
    {
        UInt64 uintVal = (UInt64)val;
        return (uintVal >> (n * 8)) & 0xFF;
    }

    I’m not sure if this will work correctly. I’ll try to check in VisualStudio

    in reply to: I want to display text from decimal numbers. #15420
    manjey73
    Participant

    Well, do you want exactly what I assumed?

    in reply to: Precision Loss Due 64-bit data #15415
    manjey73
    Participant

    I did not try to check the channel type from the driver immediately before recording, for example, if I created an integer channel directly by the driver, and the user then changed it to double.

    If there is such an opportunity, then it is very good.

    in reply to: I want to display text from decimal numbers. #15407
    manjey73
    Participant

    Do you want to have 8 channels with a number display 111, 114, 98, 111, 108, 108, 101 and 72 ?
    5th version does not support arrays. You will have to get everything into the input channel in double, then make 8 calculation channels and write a script that will pull out the required from the total “number” either in the form of strings or in the form of numbers.

    in reply to: Precision Loss Due 64-bit data #15406
    manjey73
    Participant

    You can assign the channel data type directly in the driver. Including in the View, you also generate code that allows you to use the Channel Creation Wizard based on your driver’s code. That is, the user does not need to think about what type of channel needs to be set for the signal, the channel creation wizard will do everything necessary.

    I don’t remember if it is possible to check channel types from the driver code, since it is configured even before you create channels, but it can definitely help create channels and even specify the required formulas. For example, look at the Modbus code when setting up the bitmask.

    in reply to: Extension DLL Constraints #15404
    manjey73
    Participant

    *View drivers and modules are installed in ScadaAdmin/Lib
    All the forms that the View uses are added directly to the View code. With the exception of some pre-made windows from the Scada core. But they are configured and called anyway from the View code. For example, the Options window for the driver

    1

    Options Window

    For example, the SNMP (View) driver immediately calls the parameters window, or you can arrange to call this window through a button. Everything that changes in this window is included in the device polling parameters. There are other ready-made windows that can be called from the View of your driver or module.

    • This reply was modified 1 year ago by manjey73.
    in reply to: Precision Loss Due 64-bit data #15395
    manjey73
    Participant

    You can check the data type of the channel – integer or double (or null by default) and perform different transformations depending on this.

    Something like this. where cnl.Values is my Cnl dictionary

    if (cnl.Value.DataTypeID == 0 || cnl.Value.DataTypeID == null) // channel data type Double
    {
    ServerContext.WriteCurrentData(cnl.Value.CnlNum, new CnlData(valDouble, 1));
    }
    else if (cnl.Value.DataTypeID == 1) // channel data type Int64
    {
    long val = Convert.ToInt64(fieldObj);
    ServerContext.WriteCurrentData(cnl.Value.CnlNum, new CnlData(BitConverter.Int64BitsToDouble(val), 1));
    }
    
    • This reply was modified 1 year ago by manjey73.
    in reply to: I have issue about database import (MYSQL) #15379
    manjey73
    Participant

    There is another import driver from the database, but I don’t work with the database and I can’t tell how it works

    https://rapidscada.net/store/Module/en/KpDbImportPlus

    in reply to: Logic of archiveMask #15378
    manjey73
    Participant

    Yes, the number of bits is limited for archives and events. But you can create the necessary ones yourself from the code, only the code should do checks when creating, since the code that you assume may be occupied by another or has already been created.

    in reply to: I have issue about database import (MYSQL) #15374
    manjey73
    Participant

    Frankly, I do not know, I have never used this driver. You may have missed something in the settings or made them incorrectly.

    in reply to: I have issue about database import (MYSQL) #15372
    manjey73
    Participant

    There is not a single channel on image1 that would read the Communicator, otherwise you would have a table with data in the Device 1 log of this type

    [2] Energomera_301
    ------------------
    Драйвер       : DrvIEC61107 6.2.0.5
    Статус        : норма
    Время сеанса  : 10.09.2024 14:58:00
    Время команды : не определено
    
    Сеансы  (всего / ошибок) : 739 / 0
    Команды (всего / ошибок) : 0 / 0
    Запросы (всего / ошибок) : 9607 / 0
    
    Текущие данные
    +-------+----------+-----------------+-----------------+---------+
    | Номер | Код      | Наименование    |        Значение |   Канал |
    +-------+----------+-----------------+-----------------+---------+
    | ****************** Счетчик Энергомера CE301 ****************** |
    +-------+----------+-----------------+-----------------+---------+
    | 1     | serial   | Serial #        | 008841163127043 | 201-202 |
    +-------+----------+-----------------+-----------------+---------+
    | 2     | V_L1     | Voltage L1      |         231,241 |     203 |
    +-------+----------+-----------------+-----------------+---------+
    | 3     | V_L2     | Voltage L2      |         233,418 |     204 |
    +-------+----------+-----------------+-----------------+---------+
    | 4     | V_L3     | Voltage L3      |         213,466 |     205 |
    +-------+----------+-----------------+-----------------+---------+
    | 5     | Cur_L1   | Current L1      |          26,860 |     206 |
    +-------+----------+-----------------+-----------------+---------+
    in reply to: Precision Loss Due 64-bit data #15355
    manjey73
    Participant

    Link

    Perhaps this will help you when using LReal (long). Well, look at other methods of working with long, ulong in BitConverter

    That is, first convert your string to long using TryParse and only then add it to the channel via BitConverter. At the same time specifying the Integer data type for example

    • This reply was modified 1 year ago by manjey73.
    • This reply was modified 1 year ago by manjey73.
Viewing 15 posts - 226 through 240 (of 856 total)