Page 1 of 1

Combining Signals

Posted: Wed 10. Aug 2011, 16:41
by ldbrown
Hi

Is it possible to combine multiple signals?
For example: I have a signal for Voltage and a signal for Current and I would like to combine these two to give Power.
Is this possible?

If not is there another way in which I could produce a Power signal from the voltage and current messages?

ldbrown

Re: Combining Signals

Posted: Fri 12. Aug 2011, 12:09
by M.Maidhof
Hi,

yes thats possible with the help of a VBmacro. Here is an example:

Sub CalculatePower()
Dim voltage, current, power

Set voltage = Signals("Voltage")
Set current = Signals("Current")

Set power = Signals("Power")
If power Is Nothing Then
' Signal not found, create and initialize new one
Set power = Signals.Add("Power")
power.DataType = peDataTypeFloat
End If

While True
power.Value = voltage.Value * current.Value
Wait(10) ' Prevent 100% CPU load
Wend

End Sub


best regards

Michael