Ewon TechForum
Providing technical solutions to technical requests


efficiency calculation in the BASIC IDE
dnwangu Offline
Junior Member
#1
Hi 


i am still fairly new to using the flexy 205, i need to calculate efficiency using the formula, i have created the Pump_efficiency Tag as MEM and the other parameters is data received from a PLC

Pump_efficiency@ = flow@ * pressure@ / power_used@

please can you kindly assist me
Reply

ziozetti Offline
Member
#2
I made a test on Flexy 201 with latest firmware using my tags.
This syntax works:

%test = flow@ * pressure@ / power_used@

Now I have problems with connection so I can't make other test, I'm sorry...

EDIT: it works also with mem tag.
Reply

ziozetti Offline
Member
#3
Uhm... let's considering you are totally new to eWON BASIC:
Create a section called calculation

In Init section write:
Code:
ONCHANGE "flow","GOTO calculate"
ONCHANGE "pressure","GOTO calculate"
ONCHANGE "power_used","GOTO calculate"

Then in calculation section write:


Code:
calculate:
Pump_efficiency@ = flow@ * pressure@ / power_used@
END
Reply

dnwangu Offline
Junior Member
#4
Hi Ziozetti


thanks alot, the solution works.
Reply

dblake Offline
Junior Member
#5
May I suggest that while Ziozetti's solution works, it needlessly burdens the processor.  The three monitored variables are analog and will likely change every code cycle.  That means that you will be calculating the efficiency 3x every cycle.  Why not calculate the efficiency on a fixed time period, say once every second.

Code:
// Replace the three ONCHANGE instructions with these TSET and ONTIMER instructions.
TSET 1, 1
ONTIMER 1, "GOTO calculate"

As an improvement to the calculate routine, you can smooth out the result by calculating a running average over a one-minute period (60 readings).
Reply



Possibly Related Threads…
02-07-2020, 08:49 PM
Last Post: NTA_JK
26-06-2020, 11:50 AM
Last Post: simon
  Console Basic script Started by Cst
1 Replies - 83 Views
24-06-2020, 09:45 AM
Last Post: simon
16-06-2020, 03:03 PM
Last Post: simon
16-06-2020, 02:58 PM
Last Post: simon
  Redirect via BASIC Script Started by bdoucet
1 Replies - 129 Views
04-06-2020, 02:12 PM
Last Post: simon
02-06-2020, 01:58 PM
Last Post: simon
  String type in basic Started by khaterchi
2 Replies - 186 Views
14-05-2020, 07:19 PM
Last Post: khaterchi
12-05-2020, 09:20 AM
Last Post: simon
22-04-2020, 04:09 PM
Last Post: simon



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy