Forum Home › Forums › Understanding the Software › Using Formulas › How can I do
- This topic has 31 replies, 5 voices, and was last updated 4 years, 9 months ago by manjey73.
-
AuthorPosts
-
September 26, 2017 at 9:06 am #2601MistralParticipant
If I get a temperature greater than 100 how can I pass the volt from 0 to 5? … (i\’m a neophyte with rapidscada plugs and an arduino mega 2560 with ethernet via modbus)
September 26, 2017 at 10:14 am #2602manjey73ParticipantYou need to do signal scaling from 0-100 to 0-5 ?
Describe the task more preciselyTo scale the signal, I used the formula
double Scaler (double input, double in_min, double in_max, double out_min, double out_max) { double out1 = 0; double out2 = 0; double output = 0; double diff = in_max - in_min; if (diff != 0) { if (input > in_max) out1 = in_max; else out1 = input; if (in_min > out1) out2 = in_min; else out2 = out1; output = (out_max - out_min) / diff * (out2 - in_min) + out_min; } return output; }
Scaler(Val(121), 0, 100, 0, 5)
If the value of the measured signal in channel 121 is higher than 100, the output signal will be equal to 5 in this example, below 0, the output signal will be equal to 0- This reply was modified 6 years, 7 months ago by manjey73.
September 26, 2017 at 10:47 am #2604MistralParticipantthanks … I apologize … I use an automatic translator … anyway I meant that I have a temperature input that if exceeded a certain value I have to activate a small engine connected to the plc that starts giving 5volt energy
September 26, 2017 at 12:13 pm #2605MikhailModeratorHi all,
You need Automatic Control Module.
Firstly, make sure that you can successfully send command manually, then use the module to do it automatically.September 26, 2017 at 12:29 pm #2606MistralParticipantHi Mikhail … I have the module but I do not know how to set the formula in rapidscada … in the arduino sketch i have implemented …
if (Mb.MbData[6]>1000)
{
voltageWrite(A0_5, 5000);
voltageWrite(A0_6, 0);
}
else
{
voltageWrite(A0_6, 5000);
voltageWrite(A0_5, 0);
}that works, can you help me?
September 26, 2017 at 12:40 pm #2607manjey73ParticipantIf you already implemented to work on the Arduino for input variable then you only need the Automatic Control Module to send data of temperature change using Modbus just multiplying it by 10
You scetch is compared with the value 1000
Then everything will make your program in ArduinoOr you want to make an analog program the Arduino directly on Rapid Scada ?
- This reply was modified 6 years, 7 months ago by manjey73.
September 26, 2017 at 12:53 pm #2609MistralParticipantThanks, but I would like to implement temperature control (swinging from 900 to 1100) on rapidscada so that if it exceeds 1000, “voltageWrite (A0_5, 5000) is activated”. I do not know how I could better clarify, sorry.
September 26, 2017 at 1:59 pm #2610manjey73ParticipantYou need a formula for Hysteresis ?
If it is difficult to explain in words, maybe draw a picture of what should be connected and put on the exchanger ?
September 26, 2017 at 6:23 pm #2611MistralParticipantHi manjey73, thanks for the availability and patience of a RapidScada neophyte, I include three images representing 1) electrical input and output PLCs, 2) input channel and ScadaCommunicator administrator table, 3) Scada Scheme I did for tests where I see the simulated temperature I receive in addition to a dynamic picture that changes when the temperature changes. Now I would like to realize with rapidscada that if the temperature exceeds a certain value rises to 5Volt A0.5. I hope that what’s said is useful to suggest a solution.
September 26, 2017 at 8:32 pm #2612manjey73ParticipantYou need Automatic Control Modul.
Do I understand correctly that you have a PC with RapidScada and modules input / output and you want to control directly from RapidScada ?
The module serves for automatic control of external devices.
To avoid permanent switching off of the desired additional channel with the formula of Hysteresis and already according of this channel to send a command to the output module.int[] HysNum = new int[1]; bool[] Hys = new bool[1]; public double Hysteresis(double inCnl, double low, double high) { bool q = Val(CnlNum) > 0; int res = Array.IndexOf(HysNum, CnlNum); if (res == -1) { res = HysNum.Length; Array.Resize(ref HysNum, res+1); Array.Resize(ref Hys, res+1); HysNum[res] = CnlNum; Hys[res] = q; } if (inCnl < low) Hys[res] = true; if (inCnl > high) Hys[res] = false; return Convert.ToDouble(Hys[res]); }
example – Hysteresis(Val(414),950,1050) —- Val(414) this sensor channel
The module configures for triggering the channel, with one value you pass to the device value to 5v the other to 0v the value
September 27, 2017 at 6:56 am #2613MikhailModeratorNote: the current version of the module includes the deadband option that is close to hysteresis.
September 27, 2017 at 6:59 am #2614MikhailModeratorMistral,
Try to configure Automatic Control Module and publish its screenshots here.September 27, 2017 at 7:30 am #2615MistralParticipantHi manjey73,
i have the “Automatic Control Module”, i have rapidscada’s pc.
I’m evaluating the script you sent me.
But to make sure I explained my intent to you, I am sending you a list of a simple Arduino sketch where I realized what I would like to get from rapidscada scheme.September 27, 2017 at 7:38 am #2616manjey73ParticipantYou are not using Arduino with RapidScada, and use some kind of analog output ?
Well, and send commands directly to the module output with Automatic Control ModulIn the presence of Hysteresis in the module you do not need any formula.
In manual mode you can force to work the module as you want ? Here’s the same commands send through an automatic how to activate or deactivate.
September 27, 2017 at 7:49 am #2617MistralParticipantHi Mikhail,
i send you the current setting of “Automatic Control Module” … i hope i have suggestions … thank you -
AuthorPosts
- You must be logged in to reply to this topic.