Forum Home › Forums › Understanding the Software › Using Formulas › Calculated Real working unreliable
- This topic has 21 replies, 3 voices, and was last updated 7 years, 11 months ago by radix.
-
AuthorPosts
-
April 14, 2016 at 12:04 pm #957inpelsaParticipant
Hi!
I have four channels with this equivalent formula: Input channel 808=Cnl/( Val(768)*100 + (1-Val(768)) )
input Channel 768 is just a “1” or “0” to indicate ‘divide by 100’
(of course each channel formula refers to their respective 768 input channel)As I read the documentation I should use a Calculated Real for 808 as it depends on another channel and 808>768 so it should already have updated the lowest channel
But three scenarious can happen along the time without changing the config:
– It works perfectly as spected
– It stores an old value forever (while seeing Communications service getting the right value)
– Sometimes when the value changes from 0 to 1 it doesn’t changes until next cycle.If I restart the whole server or some service (WWW, commserv, scadaserv) it updates the value (but keeps it forever again) or starts to work well for some time.
Any clue?
April 14, 2016 at 7:43 pm #961MikhailModeratorIf you receive data from Communicator in the channel 808, you have to turn it to Real channel type.
If the channel type is Real, the formula is calculated only when SCADA-Server receives data from SCADA-Communicator.
So you need to create an additional channel of Calculated Real type that will be quickly response to changes of the channel 768, and it depends on 768 and 808 channels.
April 14, 2016 at 7:46 pm #962MikhailModeratorCnl/( Val(768)*100 + (1-Val(768)) )
you can change to
Cnl / (Val(768)>0?100:1)April 15, 2016 at 9:14 am #965inpelsaParticipantAll done! 🙂
Let’s see how it works…April 15, 2016 at 7:17 pm #970inpelsaParticipantmmm… no data on source channels = 0 on the new channel
I would like to have the new channel as nothing/null/no data.
Is this possible?
April 15, 2016 at 8:02 pm #971MikhailModeratorProvide more details, please.
April 15, 2016 at 9:33 pm #973inpelsaParticipantIts easy, communicator service was not able to retrieve data from any channel because the souece (virtual COM port from a lantronix RS485-Ethernet converter) had no TCP/IP connectivity.
Real channels got no data and nothing is shown on the graph, and you notice it. But the calculated channel reflects 0 and no way to know it was disconnectes.
Should I play with the status part of the channel to reflect the wrong situation??
Thanks in advance!
April 16, 2016 at 11:00 am #975MikhailModeratorYes, you should set status of calculated channel by a formula.
Formula example:
Val(1)+Val(2); Stat(1)April 22, 2016 at 10:04 am #1004inpelsaParticipantAt the end the calculated real was not reliable enough…
Once a day data rises above 100 and it doesn’t get the right number, graph is useless with a data point 100 times above the rest.
Maybe it needs a perfect channels sync read or power regulator device updates too fast.
Anyway, it has an easy fix: Cnl>100 ? Cnl/100 : Cnl
April 22, 2016 at 10:18 am #1007MikhailModeratorAfter getting every block of data from Communicator, the calculated channels are updated. Could you describe the issue in details?
May 7, 2016 at 12:10 pm #1099radixParticipantHi,
We required formula to be calculated as below.
Input channel data is 9 -> which is then converted to 1001
This value denotes alarm for 2 address, (10 for channel 2 , next 01 for channel 1)
(1 means either High or Low based on which position it occurs , & 0 is normal alarm stage). Based on this formula we need to update the input channel valueSo how we should implement it ?
Thanks in advance.May 7, 2016 at 12:53 pm #1100inpelsaParticipantMaybe you can use the byteorder field to split it in two channels right in the origin.
One channel has byteorder “0” and on the other just “1”
May 7, 2016 at 1:41 pm #1101inpelsaParticipantForget it, I didn’t read it well.
But splitting it as string and then playing with bit operators in a function should work.
You have some examples of bit-level working on the forumSorry, not able to help you more at this moment.
May 7, 2016 at 5:53 pm #1102MikhailModeratorRadix, could you write the required formula using C++, C# or math? In this case, I can tell how to apply it to Rapid SCADA.
May 9, 2016 at 12:26 pm #1106radixParticipantHi,
I can write function in c#. Please let me know How & where to implement it in rapid Scada? Below is sample function for our requirement.
Output from below function (Alarm High/Low) need be stored into separate channel & then will be shown from front end to user.void CalAlarm(int number, out string Channel1HighAlarm, out string Channel1LowAlarm, out string Channel2HighAlarm, out string Channel2LowAlarm) { //number = 20; var result = Convert.ToString(number, 2); // result = 1010 // Channel 1 calculation if (result.Substring(result.Length-1 , 1) == "1") Channel1HighAlarm = "HIGH"; else Channel1HighAlarm = "NORMAL"; if (result.Substring(result.Length-2, 1) == "1") Channel1LowAlarm = "LOW"; else Channel1LowAlarm = "NORMAL"; // Channel 2 calculation if (result.Substring(result.Length -3, 1) == "1") Channel2HighAlarm = "HIGH"; else Channel2HighAlarm = "NORMAL"; if (result.Substring(result.Length - 4, 1) == "1") Channel2LowAlarm = "LOW"; else Channel2LowAlarm = "NORMAL"; //Output //Channel1HighAlarm =NORMAL //Channel1LowAlarm =LOW //Channel2HighAlarm =NORMAL //Channel2LowAlarm =LOW }
Thanks in advance
-
AuthorPosts
- You must be logged in to reply to this topic.