Forum Home › Forums › Understanding the Software › Retain Variable
- This topic has 16 replies, 4 voices, and was last updated 2 years, 10 months ago by
Mikhail.
-
AuthorPosts
-
May 25, 2019 at 11:55 am #5480
scadarapid
ParticipantHi,
I use modbus protocol.
I have noticed when the communication of device and Rapid Scada have loss, the value of devices become zero and it will show on the graphic on the web that the device is off but I need to hold the old value until the communication come back and check it again to show the true status.if the communication have loss, How can we hold the old value until the communication come back.
Thank you so much.
May 27, 2019 at 6:13 am #5482Mikhail
ModeratorHi,
When communication lost, you should get — in a screen. Why you get zero?
How can we hold the old value until the communication come back.
Try the formula: Cnl > 0 ? Cnl : Val()
But this is a bad approach because an operator will be deceived in this situation.May 27, 2019 at 9:00 am #5484scadarapid
ParticipantThank you so much.
December 13, 2019 at 4:30 pm #6187SGG
ParticipantHello Mikhail,
i use modbus protocol to communication over GPRS to my remote devices which include a master and a slave device.
i want to retain values (of the slave devices) after a temporary loss of communication on the rapid scada interface. This retained values should only change after communication is established and the actual value is polled.
you suggested the use of a formula ” Cnl > 0 ? Cnl : Val() ” in post #5482 BUT i already have formulas in most of the channels.
How do i combine my formula with your suggested formula to resolve my issue or is there any other solution?
December 14, 2019 at 7:24 pm #6188SGG
ParticipantHello Mikhail,
sequel to my previous post #6187
I was able to come up with a solution to retain the last polled value when there’s a temporary loss in communication. i created another input channel to retain the value using formula
(Val(810) > 0 ? SetData(840, Val(810),114) : SetData(840,Val(840),103))Now I have a new question. how do i create a timestamp for that retained value so that an operator will be able to know how current the display values are?
Thanks.
December 15, 2019 at 7:03 am #6189Mikhail
ModeratorHi,
For the both questions:
You could create a new formula in the Formulas table. Something like that:double UpdateTime(double val, int timeCnlNum) { SetVal(timeCnlNum, EncodeDate(DateTime.Now)); return val; }
and use it for example
Stat > 0 ? UpdateTime(Cnl * 100 + 1, 1001) : Val()
The formulas are not tested.December 15, 2019 at 1:23 pm #6190SGG
ParticipantHello,
Thanks for your formula in post #6189, it gave me direction on the actual formula to use.Now another issue arose. when i open a table on the web, i see an error that says
“Error updating hourly data”.This error occurs only in this table, other tables are okay.I searched the forum for possible solutions but nothing. The link below is a screenshot of the error page, i also clicked F12 to open the console for error log.
https://drive.google.com/open?id=1qZPN28KPX8ExPyxQXJ_Iyi45tF-pV8Ux
Please, how do i solve this?
December 16, 2019 at 6:44 am #6191Mikhail
ModeratorHello,
For the question that is not related to the current topic, please create a new topic.
October 9, 2022 at 6:40 pm #11207gabeirinhas
ParticipantHi, I need help with the following,
I am connecting to a modbus tcp ip device,
At certain times the connection stops and after a while it is re-established,
This connection sends me MW memory zones, where some bit by bit alarms are located,
I use the automatic module so that when these alarms are triggered, it sends me an email.
In the connection it is usual to have a couple of alarms that are constant, when the connection is interrupted and returns to its normal state, it sends the alarms every day.
I want this state to be stored and persist until the connection reconnects.
I also want it to log if the alarm is cleared after successful communication.
I have tried the following formula without success,
Cnl > 0 ? Cnl: GetBit (Val (188), 0)
Thanks in advance, best regards
-
This reply was modified 2 years, 10 months ago by
gabeirinhas.
October 10, 2022 at 11:43 am #11210gabeirinhas
ParticipantHi, I need help with another formula,
I would really appreciate your help,
when a signal from a modbus device = 0,
Cnl == 0,
I copy the received value from another channel,
something like this,
Cnl == 0 ? Cnl: Val(743)
For some reason it copies the value continuously, instead of only when this value = 0.
Thanks in advance, best regards
October 10, 2022 at 1:43 pm #11217Mikhail
ModeratorHi,
Please provide screenshots that illustrate the question.October 10, 2022 at 1:57 pm #11219gabeirinhas
ParticipantHello,
Attached is a formula 1 case, where I need to hold the value of an offline alarm.
https://drive.google.com/drive/folders/1eq1SSBFbwBZMmfHLElJGJAZVyXbyMaLO?usp=sharing
Attached case formula 2, where I need to copy a value from another channel at a certain time.
https://drive.google.com/drive/folders/1uxeylVigSNyvPkfSNe98R9woeF-XDsOp?usp=sharing
Thank u, BR
October 11, 2022 at 12:50 pm #11233Mikhail
ModeratorHi,
Using Cnl is incorrect for channel of the Calculated type. You should change channel type or change formula.
Signal field must be unique within channels of a device.October 11, 2022 at 4:12 pm #11239gabeirinhas
ParticipantOk, by listening to you, I have made the following formula for a discrete channel (890)
Cnl > 0 ? Cnl: Val(890)
When communication is lost, the value is saved and when restored, it continues to have the same value,
The problem I have is that when I change again having communication, it persists the value it had before the disconnection and does not update the value,
Can you help me,
Thanks
October 11, 2022 at 4:24 pm #11240gabeirinhas
ParticipantThe other formula I need is that when a discrete channel = 0
The value of a real channel is copied,
into another real channel,
That is if when the discrete channel (742) == 0
Copy, the value of the real channel (743)
In the real channel (1033), when this happens, an event is generated with the value of the copied channel,
What formula should I use in the real channel (1033) to perform this operation,
Thank you very much in advance
-
This reply was modified 2 years, 10 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.