Forum Replies Created
-
AuthorPosts
-
October 15, 2024 at 8:27 am in reply to: Seeking Guidance on Rapid SCADA Configuration for Real-Time Monitoring #15518
manjey73ParticipantData Acquisition: How do I connect my PLC to Rapid SCADA: ?? Are there specific drivers or protocols I should be aware of: ??
What kind of PLC do you have?
Does it support the Modbus protocol?Visualization: I want to create user friendly dashboards. What are the best pracices for designing visualizations in Rapid SCADA:?? Any tips on using the built-in components effectively: ??
What exactly do you want to draw?
There are video tutorials on Yutube
September 14, 2024 at 12:07 pm in reply to: How to retrieve data from the Channels table in a custom module? #15457
manjey73ParticipantCnl CnlArc = ServerContext.Cnls.ArcCnls.Values.Where(x => x.CnlNum == cnlNum).FirstOrDefault();It is possible to get from the Scada Module in this way through the required channels.
where is CnlNum the channel number you needThere are 4 types of channel lists
ArcCnls – all channels that can be saved in the database
CnlOut – output channels only
Calculated and another one where the input channels are// Каналы Archive - все Input, InputOutput, Calculated, CalculatedOutput try { Cnl CnlArc = ServerContext.Cnls.ArcCnls.Values.Where(x => x.CnlNum == cnlNum).FirstOrDefault(); if (CnlArc != null) { if (!dictCnl.ContainsKey(Name)) // Сразу добавлять в словарь наверное не получится, так как неизвестен поток ??? Известна программа { dictCnl.Add(Name, CnlArc); } } } catch { moduleLog.WriteLine($"НЕТ ArcCnls"); // TEST } // Каналы Output try { Cnl CnlOut = ServerContext.Cnls.OutCnls.Values.Where(x => x.CnlNum == cnlNum).FirstOrDefault(); if (CnlOut != null) { if (!dictCnl.ContainsKey(Name)) { dictCnl.Add(Name, CnlOut); } } } catch { moduleLog.WriteLine($"НЕТ OutCnls"); // TEST } }So I add the channels I need to my dictionaries as an example.
Next, you can study Cnl CnlArc and take the necessary actions depending on the Data Types, format, etc.
-
This reply was modified 1 year, 4 months ago by
manjey73.
manjey73ParticipantThis 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
manjey73Participant
manjey73Participantpublic 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
manjey73Participantpublic 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
manjey73ParticipantWell, do you want exactly what I assumed?
manjey73ParticipantI 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.
manjey73ParticipantDo 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.
manjey73ParticipantYou 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.
manjey73Participant*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
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, 4 months ago by
manjey73.
manjey73ParticipantYou 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, 4 months ago by
manjey73.
manjey73ParticipantThere is another import driver from the database, but I don’t work with the database and I can’t tell how it works
manjey73ParticipantYes, 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.
manjey73ParticipantFrankly, I do not know, I have never used this driver. You may have missed something in the settings or made them incorrectly.
-
This reply was modified 1 year, 4 months ago by
-
AuthorPosts


