zzz

Forum Replies Created

Viewing 15 posts - 61 through 75 (of 165 total)
  • Author
    Posts
  • in reply to: More ‘native’ scheme editor #11549
    zzz
    Participant

    I still like the native administrator, its working and effective enough.
    I think it should focus on efficiency, not visual excitement.

    The web approach needs careful planning and good looking and efficient UX design is science. Btw, sophisticated web apps are not small, neither is browser. My complain is that current administrator doesn’t work on Linux natively.

    As to the designer, I also think web app seems the right way to go, since web apps seems to have proved to be strong in graphical excellence…

    • This reply was modified 2 years, 10 months ago by zzz.
    • This reply was modified 2 years, 10 months ago by zzz.
    in reply to: API to access server comm line device status #11548
    zzz
    Participant

    Maybe setup a broker, give the MQTT stuff a test drive, which doesn’t even require a channel setup. 😀

    in reply to: Is that possible autologin just for localhost? #11547
    zzz
    Participant

    You could however just enable v6 autologin, and use nginx‘s access-control rules to restrict RSv6 access to desired ip range.

    Note nginx’s access-control is applied before requests hit RS. You won’t be able to access RS’s web port from these restricted ip either, let alone login.

    in reply to: v6, DrvDsInfluxDB suport InfluxDB or InfluxDB2 or both ? #11505
    zzz
    Participant

    What does read only option mean ?

    This is kind of lifehack to read data from an archive that is written by another ScadaServer. This option ensures that the data is not affected.

    You might want to have a look at the features like Continuous Query and Retention Policy . https://docs.influxdata.com/influxdb/v2.5/process-data/common-tasks/downsample-data/
    With that, the Flux’s aggregation methods become quite versatile and flexible, this can compensate the missing average aggregation from v6.

    I have some question, why not current data?

    All InfluxDB points have timestamp.

    I guess I just want to direct the collected data to influxdb as original as possible without oversampling, you know, e.g. pushing data that is not fresh but just because some configured interval has reached, since with influxdb’s window function can deal with unevenly paced data.

    • This reply was modified 2 years, 11 months ago by zzz.
    in reply to: v6, DrvDsMqtt not publishing anything. #11504
    zzz
    Participant

    Hi Mik, Thanks, the new on-demand approach seems to work as expected.

    
    --------------------------------------------------------------------------------
    2022-11-08 10:04:59 MQTT data source started
    2022-11-08 10:04:59 lineTopic=Communicator/line001/
    2022-11-08 10:04:59 lineTopic=Communicator/line002/
    
    2022-11-08 10:04:59 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-11-08 10:04:59 Subscribe to command topic
    2022-11-08 10:05:00 TryPeek.got tags_len49, cnl_len49, desc, dev#2, ts11/8/2022 2:05:00 AM
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTags len=49
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTag M0,D16_RUN,1
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTag M1,D16_ALMR,2
    ...
    2022-11-08 10:05:00 deviceSlice.ts=11/8/2022 2:05:00 AM,tag_len=49,cnldat_len=49
    2022-11-08 10:05:00 deviceTag.code=D16_RUN,name=M0,cnl=Scada.Data.Entities.Cnl, dlen=1
    2022-11-08 10:05:00 topic=Communicator/line002/device002/D16_RUN
    2022-11-08 10:05:00 payload=0
    2022-11-08 10:05:00 Send Communicator/line002/device002/D16_RUN = 0
    2022-11-08 10:05:00 deviceTag.code=D16_ALMR,name=M1,cnl=Scada.Data.Entities.Cnl, dlen=1
    2022-11-08 10:05:00 topic=Communicator/line002/device002/D16_ALMR
    2022-11-08 10:05:00 payload=0
    ...
    2022-11-08 10:05:00 PublishDeviceSlice returns true
    2022-11-08 10:05:00 PublishCurrentData.Dequeue
    2022-11-08 10:05:00 TryPeek.got tags_len73, cnl_len73, desc, dev#1, ts11/8/2022 2:05:00 AM
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTags len=73
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTag M0,C6_RUN,1
    2022-11-08 10:05:00 DeviceTopics.Initialize(): deviceTag M1,C6_ALMR,2
    2022-11-08 10:05:00 deviceSlice.ts=11/8/2022 2:05:00 AM,tag_len=73,cnldat_len=73
    2022-11-08 10:05:00 deviceTag.code=C6_RUN,name=M0,cnl=Scada.Data.Entities.Cnl, dlen=1
    2022-11-08 10:05:00 topic=Communicator/line001/device001/C6_RUN
    2022-11-08 10:05:00 payload=0
    2022-11-08 10:05:00 Send Communicator/line001/device001/C6_RUN = 0
    2022-11-08 10:05:00 deviceTag.code=C6_ALMR,name=M1,cnl=Scada.Data.Entities.Cnl, dlen=1
    2022-11-08 10:05:00 topic=Communicator/line001/device001/C6_ALMR
    ...
    
    in reply to: Buid Rapid SCADA 6 on Visual Studio Code #11499
    zzz
    Participant

    Nah, until I replace the 500G with 1T or 2T, VS Studio is not my option.
    PS I already have it in Win10 VM, a VM that I have always wanted to get rid of.
    Win10 VM is a hack of painful experience, sometimes it doesn’t start, sometimes it doesn’t shutdown, always Please wait updating… Don’t shutdown. When its up, it occasionally become the bandwidth hog even when I am on a metered slow link. The built-in virus scanner sometime kicks in when I am compiling sth. and nothing can stop it. Thus I got to occasionally pause the VM.

    in reply to: v6, DrvDsMqtt not publishing anything. #11498
    zzz
    Participant

    This issue can be closed now.

    Root cause is the racing condition, when DrvDsMQTT Start() calls InitDeviceTags() before Modbus driver finished populating the deviceTags.
    (all SelectDeivces()>devices.Select() calls happened before the first tagGroup.AddTag call in log)

    Dumb fix is adding a few to tens of seconds of waits before InitDeviceTags() call in Start(), depending on the device templates’ size.

    Proper fix needs a mechanism for extension/driver/plugins to tell if device/all devices of a commline has finished populating the device tags.
    or blocks IContext iteration until the tag population is completed or ?

    in reply to: Buid Rapid SCADA 6 on Visual Studio Code #11495
    zzz
    Participant

    I am not a dotnet guy, this core thing is especially new to me. Is there any way to debug current app in VSCode. I mean like set a breakpoint, inspecting some variables etc ?

    The API tooltip and Go To Definition command sometimes works, sometimes not, which is really annoying. I have to switch solution back and forth (the pull up menu on button bar) and wait for OminiSharp to finish, only after that the intellisensce seems to again become aware of the classes, methods etc.
    Do you guys have this kind of glitches ? Could i5-5300+8G (disk:ssd) to be slow for this type of development?

    in reply to: v6, DrvDsMqtt not publishing anything. #11493
    zzz
    Participant

    Ok, it seems that a 3 seconds sleep before FillDeviceTopics() fixes things most of the time.

    But I only have 77 tags. there could be 777,777 tags or more, waiting for a proper fix. I can’t find any tag population completion indicator on CommLine or DeviceLogic.

    Considering that v6 is supposed to support millions of tags, this could become an issue when an project reaches that scale.

    • This reply was modified 2 years, 11 months ago by zzz.
    in reply to: v6, DrvDsMqtt not publishing anything. #11491
    zzz
    Participant

    Argh, there seems to be a sequence issue, DrvDsMqtt’s topics are populated before Modbus Driver’s deviceTags are populated.

    Is there any event or flag that DrvDsMqtt could listen/wait for before FillDeviceTopics() in Start() ?

    
    // ScadaComm/ScadaComm/ScadaCommEngine/CommLine.cs
    
    // around L192
            /// <summary>
            /// Adds the device to the communication line, eliminating duplication of devices.
            /// </summary>
            private void AddDevice(DeviceLogic deviceLogic)
            {
                Log.WriteInfo("AddDevice: #{0} T{1}", deviceLogic.DeviceNum, deviceLogic.Title);
                if (!deviceMap.ContainsKey(deviceLogic.DeviceNum))
                {
                    Log.WriteInfo("AddDevice not in devMap: #{0} TagCnt:{1}", deviceLogic.DeviceNum, deviceLogic.DeviceTags.Count);
                    DeviceWrapper deviceWrapper = new DeviceWrapper(deviceLogic, Log)
                    {
                        DeviceIndex = devices.Count,
                        InfoFileName = Path.Combine(coreLogic.AppDirs.LogDir,
                            CommUtils.GetDeviceLogFileName(deviceLogic.DeviceNum, ".txt"))
                    };
                    Log.WriteInfo("AddDevice > deviceWrapper.DeviceLogic: #{0} TagCnt:{1}", 
                        deviceWrapper.DeviceLogic.DeviceNum, 
                        deviceWrapper.DeviceLogic.DeviceTags.Count);
    
    // around L813
    
            /// <summary>
            /// Selects all devices on the communication line.
            /// </summary>
            public IEnumerable<DeviceLogic> SelectDevices()
            {
                foreach (DeviceWrapper dw in devices)
                {
                    Log.WriteInfo("SelectDevices:devices.deviceLogic.DeviceTags len={0}", dw.DeviceLogic.DeviceTags.Count);
                    foreach (DeviceTag deviceTag in dw.DeviceLogic.DeviceTags)
                    {
                        Log.WriteInfo("SelectDevices:devices.deviceLogic.DeviceTags.deviceTag {0},{1},{2}", deviceTag.Name, deviceTag.Code, deviceTag.TagNum);
                    }
                }
                return devices.Select(dw => dw.DeviceLogic);
            }
    
    
    2022-11-04 14:28:15 Communication line [1] Bus1 is stopped
    --------------------------------------------------------------------------------
    2022-11-04 14:28:19 AddDevice: #1 T[1] Sta1
    2022-11-04 14:28:19 AddDevice not in devMap: #1 TagCnt:0
    2022-11-04 14:28:19 AddDevice > deviceWrapper.DeviceLogic: #1 TagCnt:0
    2022-11-04 14:28:20 SelectDevices:devices.deviceLogic.DeviceTags len=0 
    2022-11-04 14:28:20 SelectDevices:devices.deviceLogic.DeviceTags len=0
    2022-11-04 14:28:20 SelectDevices:devices.deviceLogic.DeviceTags len=0
    --------------------------------------------------------------------------------
    2022-11-04 14:28:20 Start communication line [1] Bus1
    Load device template from file KpModbus_BeiChenFxConv_STA1.xml
    2022-11-04 14:28:20 SelectDevices:devices.deviceLogic.DeviceTags len=0  <-- SelectDeivces() happens before .AddDeveices() ?
    2022-11-04 14:28:20 tagGrp.AddTag C6_RUN,M0
    2022-11-04 14:28:20 tagGrp.AddTag C6_ALMR,M1
    2022-11-04 14:28:20 tagGrp.AddTag C7_RUN,M2
    2022-11-04 14:28:20 tagGrp.AddTag C7_ALMR,M3
    

    meanwhile in drvdsmqtt’s log

    
    2022-11-04 14:28:16 MQTT data source stopped
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-11-04 14:28:20 MQTT data source started
    2022-11-04 14:28:20 lineTopic=Communicator/line001/
    2022-11-04 14:28:20 deviceTopic=Communicator/line001/device001/
    2022-11-04 14:28:20 topicByDevice[1]=topics[0]
    2022-11-04 14:28:20 lineTopic=Communicator/line002/
    2022-11-04 14:28:20 deviceTopic=Communicator/line002/device002/
    2022-11-04 14:28:20 topicByDevice[2]=topics[0]
    
    2022-11-04 14:28:20 Connect to 127.0.0.1:1883
    Connected successfully
    
    • This reply was modified 2 years, 11 months ago by zzz.
    in reply to: v6, DrvDsMqtt not publishing anything. #11489
    zzz
    Participant

    The DeviceTags is passed around many places, this will take some time without help.
    So I just did a simple test with diagslave – a modbus slave simulator (./diagslave -m enc -a 1 -p 50502, enc: RTU over TCP mode ). Added a CommLine:MBBus, Device:MBDevice, Channel:V1 in HelloWorld project on the helloworld debian10 box, the simulator’s line001/xxx topics published as usual, but there is no topic about newly added modbus line002,
    scadacomm and scadaserver service both have been restarted many times .

    • This reply was modified 2 years, 11 months ago by zzz.
    in reply to: v6, DrvDsMqtt not publishing anything. #11488
    zzz
    Participant

    I see the tags are populated via device driver’s InitDeviceTags() call.

    
    // ScadaComm/OpenDrivers/DrvModbus.Logic/DevModbusLogic.cs
    // around line 310
                        // add device tag
                        tagGroup.AddTag(elemConfig.TagCode, elemConfig.Name).SetFormat(GetTagFormat(elemConfig));
                        Log.WriteInfo("tagGrp.AddTag {0},{1}", elemConfig.TagCode, elemConfig.Name);
    
                        elemIndex++;
                    }
    
                    if (groupActive)
                    {
                        elemGroup.InitReqPDU();
                        elemGroup.InitReqADU(deviceModel.Addr, transMode);
                        deviceModel.ElemGroups.Add(elemGroup);
                    }
    
                    DeviceTags.AddGroup(tagGroup);
                    Log.WriteInfo("DeviceTags.AddGroup(name={0})", tagGroup.Name);
    
                }
                Log.WriteInfo("DeviceTags.Count={0}", DeviceTags.Count);
    
    
    2022-11-04 11:31:44 Communication line [2] Bus2 is stopped
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-11-04 11:31:48 Start communication line [2] Bus2
    Load device template from file KpModbus_BeiChenFxConv_STA2.xml
    2022-11-04 11:31:48 tagGrp.AddTag D16_RUN,M0
    2022-11-04 11:31:48 tagGrp.AddTag D16_ALMR,M1
    2022-11-04 11:31:48 tagGrp.AddTag D17_RUN,M2
    2022-11-04 11:31:48 tagGrp.AddTag D17_ALMR,M3
    ...
    2022-11-04 11:31:48 tagGrp.AddTag RV1,
    2022-11-04 11:31:48 tagGrp.AddTag RV2,
    ...
    2022-11-04 11:31:48 DeviceTags.AddGroup(grp_name=Runs)
    2022-11-04 11:31:48 DeviceTags.Count=48   
                                        ^^^
    DevModbusLogic.DeviceTags.Count IS NOT ZERO after InitDeviceTags()
    Everything looks fine in Communicator line00x.txt and line00x.log
    

    Any ideas ?

    in reply to: v6, DrvDsMqtt not publishing anything. #11487
    zzz
    Participant

    The server’s project is not modified from HelloWorld. I just copy the compiled version to server, managed to get it running and choose download the project and build from there.

    I think playing with the project configuration is taking too much time.
    I’d rather spend some time debugging from the code side.
    I am not saying the code has any issue, but looks like its easier to find the cause, otherwise I would still be stuck here wondering what is going on inside the mqtt plugin.
    Also it helps to understand how the v6 works.

    Do you have any suggestion of what could be causing the issue, which part of the code or what object worth inspection from where ? I just need some hints.

    in reply to: v6, DrvDsMqtt not publishing anything. #11479
    zzz
    Participant

    Oh the direction is wrong, too much focus has been put on the MQTT part.
    I did some debugging, and got some new clue, but not sure where to dig now:

    
    // ScadaComm/OpenDrivers/DrvDsMqtt.Logic/MqttDSL.cs
    // around line :114
    
                    dsLog.WriteInfo("lineTopic={0}", lineTopic);
                    foreach (DeviceLogic deviceLogic in devices)
                    {
                        string deviceTopic = lineTopic + CommUtils.GetDeviceLogFileName(deviceLogic.DeviceNum, "") + "/";
                        DeviceTopics deviceTopics = new();
                        dsLog.WriteInfo("deviceTopic={0}", deviceTopic);
    
                        foreach (DeviceTag deviceTag in deviceLogic.DeviceTags)
                        { // <------- NEVER ENTERED, code fall through with no hint in log.
                            dsLog.WriteInfo("deviceTag {0},{1},{2}", deviceTag.Name, deviceTag.Code, deviceTag.TagNum);
                            if (!string.IsNullOrEmpty(deviceTag.Code))
                                deviceTopics[deviceTag.Code] = deviceTopic + deviceTag.Code;
                        }
    
                        dsLog.WriteInfo("topicByDevice[{0}]=topics[{1}]", deviceLogic.DeviceNum, deviceTopics.Count);
                        if (deviceTopics.Count > 0)
                            topicByDevice[deviceLogic.DeviceNum] = deviceTopics;
                    }
    

    In the DrvDsMqtt log now I get

    
    2022-11-03 11:52:38 MQTT data source stopped
    --------------------------------------------------------------------------------
    --------------------------------------------------------------------------------
    2022-11-03 11:52:51 MQTT data source started
    2022-11-03 11:52:51 lineTopic=Communicator/line001/
    2022-11-03 11:52:51 deviceTopic=Communicator/line001/device001/
    2022-11-03 11:52:51 topicByDevice[1]=topics[0]
    2022-11-03 11:52:51 lineTopic=Communicator/line002/
    2022-11-03 11:52:51 deviceTopic=Communicator/line002/device002/
    2022-11-03 11:52:51 topicByDevice[2]=topics[0]
    
    2022-11-03 11:52:51 Connect to 127.0.0.1:1883
    Connected successfully
    
    2022-11-03 11:52:51 Subscribe to command topic
    2022-11-03 11:52:51 TryPeek.got tags_len73, cnl_len73, desc, dev#1, ts11/3/2022 3:52:51 AM
    2022-11-03 11:52:51 PublishDeviceSlice returns true
    2022-11-03 11:52:51 PublishCurrentData.Dequeue
    2022-11-03 11:52:51 TryPeek.got tags_len49, cnl_len49, desc, dev#2, ts11/3/2022 3:52:51 AM
    2022-11-03 11:52:51 PublishDeviceSlice returns true
    2022-11-03 11:52:51 PublishCurrentData.Dequeue
    ....
    

    After I noticed deviceTag.Code is being used,
    I filled the Code column in ConfDatabase\Devices which used to be empty. Re-upload and restarted the communicator, nothing changed,
    then re-upload and restarted server + communicator, nothing changed.

    My device setting

    
      <Device>
        <DeviceNum>    1</DeviceNum>
        <Name>         Sta1</Name>
        <Code>         sta1</Code>
        <DevTypeID>    214</DevTypeID>
        <NumAddress>   1</NumAddress>
        <StrAddress>   192.168.1.1</StrAddress>
        <CommLineNum>  1</CommLineNum>
        <Descr>        STA1</Descr>
      </Device>
      <Device>
        <DeviceNum>    2</DeviceNum>
        <Name>         Sta2</Name>
        <Code>         sta2</Code>
        <DevTypeID>    214</DevTypeID>
        <NumAddress>   1</NumAddress>
        <StrAddress>   192.168.2.1</StrAddress>
        <CommLineNum>  2</CommLineNum>
        <Descr>        STA2</Descr>
      </Device>
    </ArrayOfDevice>
    

    Below is how one of my two device templates looks like, they are similar

    
    <DeviceTemplate>
      <Options>... </Options>
      <ElemGroups>
        <ElemGroup active="true" dataBlock="DiscreteInputs" address="0" name="Runs">
    <!-- Unused registers have their name left "" -->
          <Elem tagCode="C6_RUN"   name="M0" />
          <Elem tagCode="C6_ALMR"  name="M1" />
          <Elem tagCode="C7_RUN"   name="M2" />
          <Elem tagCode="C7_ALMR"  name="M3" />
    ...
          <Elem tagCode="RSV1"     name="" />
          <Elem tagCode="RSV2"     name="" />
    ...
          <Elem tagCode="Z1_RUN"   name="M66" />
          <Elem tagCode="Z6_ALMR"  name="M67" />
          <Elem tagCode="RSV19"    name="" />
          <Elem tagCode="RSV20"    name="" />
          <Elem tagCode="RSV21"    name="" />
          <Elem tagCode="RSV22"    name="" />
    
    • This reply was modified 2 years, 11 months ago by zzz.
    in reply to: v6, DrvDsMqtt not publishing anything. #11475
    zzz
    Participant
    
        <IsBound>             true</IsBound>
        <SendModifiedData>    true</SendModifiedData>
        <SendAllDataPeriod>   60</SendAllDataPeriod>
        <EnableCommands>      true</EnableCommands>
        <EnableFileCommands>  true</EnableFileCommands>
        <StartLinesOnCommand> false</StartLinesOnCommand>
        <MaxLogSize>          1</MaxLogSize>
    
Viewing 15 posts - 61 through 75 (of 165 total)