# Help witch formula

Forum Home Forums Understanding the Software Using Formulas Help witch formula

Viewing 15 posts - 1 through 15 (of 38 total)
• Author
Posts
• #6604
Krzysztof
Participant

I need little help.

Cnl 1 real, possible values from 0 to 31
Cnl 2 calc discrete

Formula 1
public double if_S_S(double in1,double in2,double in3)
{
if(in1>in2 && in1<in3)
{
return 0;
}
else
{
return 1;
}
}

I put in Cnl 2 formula If_S_S(Val(1), 0, 16) when current Value of Cnl = 0
and I have error when I send to the server:

The name “If_S_S” does not exist in the current context.

What is wrong ?
I tried with Formula 2
public double if_S(double in1)
{
if(in1>0 && in1<16)
{
return 0;
}
else
{
return 1;
}
}

and I have the same error

#6606
Mikhail
Moderator

Could you make screenshots of formulas, channels and error?

#6609
Krzysztof
Participant

hmm, I don’t see my replay

#6611
Krzysztof
Participant
• This reply was modified 1 year, 6 months ago by Krzysztof.
#6613
Krzysztof
Participant
#6618
Mikhail
Moderator

#6610
Krzysztof
Participant

Formula

Chanel config

Server message

Calc log

#6608
#6607
Krzysztof
Participant

I hope you can get this image.

Furmula

Chanel conf

Message error

Calc_log

#6652
Krzysztof
Participant

I hope you can see images now

#6653
manjey73
Participant

The name of the formula is if_S_S not If_S_S

#6654
Krzysztof
Participant

Thanks a lot. I just corrected and works well ðŸ™‚

#6795
josef.novotny
Participant

Thank you very much too.

#7200
Participant

Dear Mr. Mikhail,
My project that controls electricity parameters likes Voltage, current, power… was created. I is running. Now i want to get a consume energy per 1 minute, per 1 hour, per 1 day. Channels of the Minute and Hourly types were created. But i can not know which formula will be used. Could you help me to resolve this?
Thanks and best regards
Han Hoang

#7201
Mikhail
Moderator

Hello,

To get energy consumption per hour and per day, I suggest using Elastic Report plugin.

To get minute difference, you need 2 additional channels:
1. Channel that stores a value minute ago. This is a channel of the Minute real type.
It uses formula like that:

``````double GetDif(int srcCnl, int difCnlNum)
{
double newVal = Val(srcCnl);
double curVal = Val();
SetVal(difCnlNum, newVal - curVal);
SetVal(CnlNum, newVal);
}``````

srcCnl – input channel that stores a source value.
difCnlNum – input channel that stores difference

2. Channel that stores difference.

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