# How can I do

Viewing 15 posts - 1 through 15 (of 32 total)
• Author
Posts
• #2601
Mistral
Participant

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)

#2602
manjey73
Participant

You need to do signal scaling from 0-100 to 0-5 ?

To 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 3 years, 1 month ago by manjey73.
#2604
Mistral
Participant

thanks … 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

#2605
Mikhail
Moderator

Hi all,
You need Automatic Control Module.
Firstly, make sure that you can successfully send command manually, then use the module to do it automatically.

#2606
Mistral
Participant

Hi 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?

#2607
manjey73
Participant

If 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 Arduino

Or you want to make an analog program the Arduino directly on Rapid Scada ?

• This reply was modified 3 years, 1 month ago by manjey73.
#2609
Mistral
Participant

Thanks, 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.

#2610
manjey73
Participant

You 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 ?

#2611
Mistral
Participant

Hi 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.

https://webmail.aruba.it/cgi-bin/ajaxems?ACT_FIL_DL=1&PUBLICUID=Y29tcGFueUBtaXN0cmFsaW5mb3JtYXRpY2EuaXQvNy4zLzE1MDY0NDg2NTA=

https://webmail.aruba.it/cgi-bin/ajaxems?ACT_FIL_DL=1&PUBLICUID=Y29tcGFueUBtaXN0cmFsaW5mb3JtYXRpY2EuaXQvNy4yLzE1MDY0NDg3MTc=

https://webmail.aruba.it/cgi-bin/ajaxems?ACT_FIL_DL=1&PUBLICUID=Y29tcGFueUBtaXN0cmFsaW5mb3JtYXRpY2EuaXQvNy4xLzE1MDY0NDg3NDA=

#2612
manjey73
Participant

You 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

#2613
Mikhail
Moderator

Note: the current version of the module includes the deadband option that is close to hysteresis.

#2614
Mikhail
Moderator

Mistral,
Try to configure Automatic Control Module and publish its screenshots here.

#2615
Mistral
Participant

Hi 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.

https://webmail.aruba.it/cgi-bin/ajaxems?ACT_FIL_DL=1&PUBLICUID=Y29tcGFueUBtaXN0cmFsaW5mb3JtYXRpY2EuaXQvNy40LzE1MDY0OTY0NTA=

#2616
manjey73
Participant

You 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 Modul

In 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.

#2617
Mistral
Participant

Hi Mikhail,
i send you the current setting of “Automatic Control Module” … i hope i have suggestions … thank you

https://webmail.aruba.it/cgi-bin/ajaxems?ACT_FIL_DL=1&PUBLICUID=Y29tcGFueUBtaXN0cmFsaW5mb3JtYXRpY2EuaXQvNy41LzE1MDY0OTgwODc=

Viewing 15 posts - 1 through 15 (of 32 total)
• You must be logged in to reply to this topic.