Forum Home › Forums › Uncategorized Issues › I want to display text from decimal numbers.
- This topic has 13 replies, 3 voices, and was last updated 4 weeks ago by Mikhail.
-
AuthorPosts
-
September 10, 2024 at 2:59 am #15352sabParticipant
Hello,
I am currently using Rapid SCADA version 5.
I am importing data as decimal numbers through Modbus TCP.
How can I convert those numbers into text and display them in the scheme view?September 10, 2024 at 9:57 am #15368MikhailModeratorHello,
Channel values are converted to strings automatically when displayed. If you face displaying issues, please provide screenshots.September 11, 2024 at 4:11 pm #15397sabParticipantHello Mikhail
This is the result I have achieved.
https://ibb.co/ZcYBWHj
https://ibb.co/sm09Btq
https://ibb.co/VYRyBKg
https://ibb.co/1GvbfMjSeptember 11, 2024 at 4:14 pm #15398sabParticipantI want to display text from decimal numbers, but I don’t know where I made a mistake. Could you please guide me?
September 12, 2024 at 5:36 am #15407manjey73ParticipantDo 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.September 12, 2024 at 7:28 am #15417sabParticipantHello manjey73
Do you have a sample script to extract the required data from the “number”?
- This reply was modified 1 month ago by sab.
September 12, 2024 at 8:31 am #15420manjey73ParticipantWell, do you want exactly what I assumed?
September 12, 2024 at 8:54 am #15421manjey73Participantpublic 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
September 12, 2024 at 8:59 am #15422manjey73Participantpublic 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
September 12, 2024 at 9:14 am #15423manjey73ParticipantSeptember 12, 2024 at 9:16 am #15424manjey73ParticipantThis 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 7September 12, 2024 at 9:42 am #15428MikhailModeratorDo you use MQTT or Modbus protocol?
Could you make a screenshot of a device data page from Communicator?September 16, 2024 at 2:45 pm #15475sabParticipantI am using Node-RED to send Modbus TCP data to Rapid SCADA.
https://ibb.co/zn2G3fG
https://ibb.co/17VGh2S
https://ibb.co/0Gj1LkW
Is this what you were asking about?September 17, 2024 at 8:55 am #15478MikhailModeratorData polling seems OK.
I recommend:
1. Use Rapid SCADA 6, because Rapid SCADA 5 is outdated.
2. Provide names for the elements in the Modbus template.
3. Create a simple table view to check data displaying. Then create a scheme view. -
AuthorPosts
- You must be logged in to reply to this topic.