# Formulas in input channel

Forum Home Forums Understanding the Software Formulas in input channel

This topic contains 10 replies, has 2 voices, and was last updated by  Mikhail 2 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
• Author
Posts
• #2551

manraj
Participant

Hi there.I am having trouble running codes in the input channel of the Modbus.Basically I have a pipe modal whereby, an input channel is assumed and the assumed value would be calculated in the formula given below to get the output values which is the output channel as well.Please help me out with a simple coding that can be used.Let me know if any changes in to be made.

p2= output pressure (Output channel)
p1= input pressure(Input channel)
ρ=density of water(1000kg/m3)
f=friction factor ( 0.05)
L=length of pipe (12m)
v= velocity of water (3m/s)
D=pipe diameter (0.1m)

p2=p1-(ρ*f*L*v2/2D)

#2555

Mikhail
Moderator

Hi,
1. Add the constants to the Formulas table like this:
const double D = 0.1;

2. Create an additional input channel (number 2, for example) of the “Calculated real” type and specify a formula for this channel:
Val(1)-p*f*L… (I don’t understand the end of the formula)
1 – is the number of the input channel for p1.

and setup sending command on change of channel 2

#2558

manraj
Participant

1. Do you mean i should add the constants to the Formulas table like this:

const double p2= output pressure (Output channel)
const double p1= input pressure(Input channel)
const double ρ=1000;
const double f= 0.05;
const double L= 12;
const double v= 3;
const double D= 0.1;

Do i need to add on anything else at the start of the codes like “namespace” or “system” since its reads programming C#.Do you have any working example format of formulas so I can study how to insert formulas in the channel.

2.So I should have 2 input channels is it?.Input channel 1 should be the value is received from Modbus and channel 2 I should place in formulas in the SCADA administrator.?

Val(1)-(p*f*L*v^2)/2D–p multiply with f,l, and the square of v.Then divide 2*D
1 – is the number of the input channel for p1

Thank you!

• This reply was modified 2 months, 1 week ago by  manraj.
#2564

Mikhail
Moderator

const double p2= output pressure (Output channel)
const double p1= input pressure(Input channel)

const double ρ=1000;
const double f= 0.05;
const double L= 12;
const double v= 3;
const double D= 0.1;

#2565

Mikhail
Moderator

Do i need to add on anything else at the start of the codes like “namespace” or “system” since its reads programming C#.Do you have any working example format of formulas so I can study how to insert formulas in the channel.

You don’t need namespace and usings. The examples are already in the Formulas table.

#2566

Mikhail
Moderator

2.So I should have 2 input channels is it?.Input channel 1 should be the value is received from Modbus and channel 2 I should place in formulas in the SCADA administrator.?

Yes. The input channel 2 is the calculated value that is needed to be sent as a command.

#2567

manraj
Participant

I got it thank you very much.I will create the formulas and update here if there is any problem. Thank you!

#2579

manraj
Participant

Hi!

Is there away to place formulas in the condition of a dynamic picture? because i tried putting Val(input channel) but it only read real number.

#2581

Mikhail
Moderator

Hi,
You should create an input channel of calculated type and use its value for a dynamic picture.

#2583

manraj
Participant

So does this mean I only can put a calculated values in the conditions of the dynamic pictures and not the formula itself.

#2589

Mikhail
Moderator

Yes, you right.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.