Jump to content

Recommended Posts

Hi guys,

I'm a newbie to the unitronics world and I was wondering could any of you help me with the following:

I am currently developing a system for my college project that allows me to control a wind turbine in order to charge a battery and then release that charge to a DC-AC inverter. I have displaying on the V570 the voltage, current and power of each the turbine, battery and inverter. My question, is it possible to somehow implement a formula in order to display the energy of each and then the total energy of the system.

Energy = Power x Time but my problem is the time factor and incorporating this into the formula.

Thanking you in advance,


Link to comment
Share on other sites

Unitronics OPLCs are supporting complicated formula calculation.

Knowing a formula and dependences of formula members from time will allove you to calculate charge/discharge as function of input energy, battery capacity,battery charge level, output load and time.

OPLCs have different Time functions to choice from.

You will find Formula Element in a VisiLogic Math->Formula menu.

Link to comment
Share on other sites

  • MVP 2014

Strictly speaking, energy is the integral of power with respect to time. This is approximated by measuring the average power over a time interval and multipying that average power by the time interval over which it was measured.

The first question to ask is what time interval do you want to use? Or, how fast do you want the energy to be updated?

The simplest setup (IMHO) would be to make the energy calulation every second, based on 10 power readings, taken every 100ms.

You can perform the energy calcuation each second using SB13 as a trigger.

You can calculate average power over each second for 10 readings using the Filter FB, set for Dynamic Average, length of 10, zero discard values and triggering it with SB15.

Then add the results for each energy calcuation to get your cumulative result.

Longer timeframes could be implemented using the counters and/or timers in the V570.

This is a very basic discussion. Since the energy is being integrated over time, any small errors in each calcuation will also accumulate over time. You should test your method thoroughly and if possible compare with measurements from external instruments. How far you go with the test and verification would be determined by the final accuracy required in your system.

You will probably also experience some head-scratching over the size of numbers you encounter when trying to scale the values to engineering units. Deinfitely start out with ML values, they should give you the dynamic range you need but there are also a limited number of Floats if required.

Link to comment
Share on other sites

Simon and Alex,

Thank you for your reply.

Simon, this is definetely the road in which I need to go. I was wondering if you could post some sample code as to your explanation?. I configured the filter as you described but I was unable to display the average power output. Also I am having difficulty in understanding the time interval I need to multiply by the average power and how this is implemented in the program.

Please forgive my lack of knowledge, this is my first project using any PLC!

Many thanks


Link to comment
Share on other sites

  • MVP 2014

Hi Brian,

Glad you could configure the filter OK.

As for the units, if your power is in Watts, and your time interval is 1 second, it is easiest to give the answer in Joules, as the multiplier is 1. To get to kWh you divide the Joules values by 3,600,000 (see http://www.calculate...s/ToJoules.htm)

If your power is in kW then your intermediate value is in kJ and the conversion from kJ to kWh is to divide by 3,600.

Once again, watch for rounding and overflow errors, that is the main problem to be solved when implementing these types of scaling functions in any digital computing device (PLC, PC, microcontroller, etc)

I hope this helps. I have limited time to create special examples, but feel free to post back with specific questions.

Link to comment
Share on other sites

Hi Simon,

What I have decided to do is develop a formula using the FB formula. I am going to increment a MI using SB3 1 second pulse. I would like to be able to display my energy output every minute so I am going to use a 1 minute timer to store the MI value into the energy formula. So at minute 1: Energy = Power x (60/3600), minute 2: power x (120/3600) and so on.

I was wondering how I can get my timer to count to the minute and then automatically loop to start again for the second, third, fourth minute, etc;

Your input is very much appreciated.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...