PLUS+1 Software > Code sharing

How to implement an integral or sum-up

(1/2) > >>

power4:
I want to build a block to sum up all previous input and output the sum. It is a kind of numerical integral. Does anybody give an idea how to achieve that?
Thanks!

kdcommon:
If you just want a intergral  function rather tnan any other functions, the algrithem is very simple, isn't it? You can achieve that by using only one 'ADD' commponent.
If you consider Simple time  factor, the Input value must multiply the sample time value before 'ADD' function.

oiltronic:
That would blow up really fast.  I think you're going to want a two-input switch before that circuit to either add your value or 0, which is then triggered by a periodic timer or some such thing.

kdcommon:
You are right.

Marbek_Elektronik:
Also look to your loop-time.

I suggest 10ms for the most applications.
Please test if your controller don't needs more time.

It is important for the integral, that your loop time is constant.

Navigation

[0] Message Index

[#] Next page

Go to full version