Forum Replies Created
-
AuthorPosts
-
May 15, 2023 at 3:20 am in reply to: V6 Formula to extract 2 int8_t values from a Modbus ushort register #12592MerdockParticipant
Add an overflow protection for the uint8_t value, so if it exceeds the value of 255 it will set the command to 255.
You could also make it not modify the output value if the limit of 255 is exceeded.public double InsertByte(double valueToInsert, double destinationValue, bool insertInMostSignificantByte) { // Protect against overflow of valueToInsert if (valueToInsert > 255) { valueToInsert = 255; } // Convert the input values to the corresponding types ushort val = Convert.ToUInt16(valueToInsert); ushort destVal = Convert.ToUInt16(destinationValue); ushort result; if (insertInMostSignificantByte) { result = (ushort)((destVal & 0x00FF) | (val << 8)); } else { result = (ushort)((destVal & 0xFF00) | val); } // Convert the result to double before returning it return Convert.ToDouble(result); }
Here the protection of the input value is that nothing is modified if the value exceeds 255
public double InsertByte(double valueToInsert, double destinationValue, bool insertInMostSignificantByte) { // We check if the value to insert is greater than 255 and we return the destination variable unchanged if (valueToInsert > 255) { return destinationValue; } // Convert the input values to the corresponding types ushort val = Convert.ToUInt16(valueToInsert); ushort destVal = Convert.ToUInt16(destinationValue); ushort result; if (insertInMostSignificantByte) { result = (ushort)((destVal & 0x00FF) | (val << 8)); } else { result = (ushort)((destVal & 0xFF00) | val); } // Convert the result to double before returning it return Convert.ToDouble(result); }
- This reply was modified 1 year, 5 months ago by Merdock.
May 15, 2023 at 2:52 am in reply to: V6 Formula to extract 2 int8_t values from a Modbus ushort register #12590MerdockParticipantFixed, full explanation:
Formula to read 2 int8_t data stored in 1 holding register.public byte GetUi8Byte(double val, int n) { int lVal = (int)val; return (byte)((lVal >> ((1 - n) * 8)) & 0xFF); }
Script to write uint8_t values to the output
public double InsertByte(double valueToInsert, double destinationValue, bool insertInMostSignificantByte) { // Convert the input values to the corresponding types ushort val = Convert.ToUInt16(valueToInsert); ushort destVal = Convert.ToUInt16(destinationValue); ushort result; if (insertInMostSignificantByte) { result = (ushort)((destVal & 0x00FF) | (val << 8)); } else { result = (ushort)((destVal & 0xFF00) | val); } // Convert the result to double before returning it return Convert.ToDouble(result); }
We create 3 input channels in the table:
Channel 101 = data of 16 uint16_t
Channel 102 = uint8_t data 1
Input formula for channel 102GetUi8Byte(Val(101),0); Stat(101)
Channel 103 = data 2 uint8_t
Input formula for channel 103GetUi8Byte(Val(101),1); Stat(101)
Formula to write to the output channel:
Channel 102InsertByte(Cmd, Val(101), true)
channel 103InsertByte(Cmd, Val(101), false)
- This reply was modified 1 year, 5 months ago by Merdock.
May 15, 2023 at 12:29 am in reply to: V6 Formula to extract 2 int8_t values from a Modbus ushort register #12588MerdockParticipantMerdockParticipantHere some threads about autologin. Perhaps in version 5. You only need to configure the Autologin.aspx as local access.3
https://forum.rapidscada.org/?action=bbp-search-request&bbp_search=Autologin
July 4, 2022 at 12:14 am in reply to: How to set the number after the comma to 2 digits (Elastic Report)? #10397MerdockParticipantWhat I see in the properties of channel 9405 is that it is configured to show the value without decimals.
You can double the channel and set it to 2 decimal places.MerdockParticipanthttps://www.hse.ru/en/edu/vkr/184623865
Here a two places in Russia Crowdfunding
or information about it.
I hope this takes place.
I also recommend you to enable donations in GitGub.
Greetings.- This reply was modified 2 years, 4 months ago by Mikhail.
MerdockParticipantHello, I have been very excited about this thread, is there any news about it?
this at the same time has given me an idea that you want the community to support.
Estimate costs of improvements or addition of functions.
Publish them on a site where one can donate in order to reach the cost of the project (some crowdfunding site) and thus accelerate its development with that financial aid.MerdockParticipantHello.
As a recommendation to speed up the readings I create a line for each device.
in this way, minimum times of 1 second between readings are achieved.
It is also recommended that you try to get the maximum number of records per request.
The minimum time between readings is 1 second, it is given by the writing in the Current Data file.
The Web interface takes data from this file.
This is in version 5x.
Layers that in version 6 this changed.
The Modbus Driver reads the 16 bit registers without problems.
For reading 32-bit registers, the bit order must be changed in the configuration since it does not transpose the LSBs with the MSBs and Rapid Scada reads the 2 16-bit registers consecutively.
in Default Byte Order you must put 2301.
in most cases, except device specifications.MerdockParticipantNow a question.
If webstation depends on the data recorded in current data.
and the minimum time is 1 second or when the value changes.
that is the minimum time to update what is seen in webstation.
Then set an update time of 500 ms.
is it completely irrelevant?MerdockParticipantThanks for your answer. I have no events scheduled.
0 events are generated.
Probe change the setting from 1 second to On change in:
Server / Saving Parameters / Current data = On change and it was solved.
Thanks for your help.MerdockParticipantSoon, my apologies.
MerdockParticipantI think it would be interesting to be able to edit the names and titles of the pages.
But I think it should have something like a watermark, with the text, Rapid Scada. -
AuthorPosts