Combining Signals

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
ldbrown
Posts: 1
Joined: Wed 10. Aug 2011, 16:32

Combining Signals

Post by ldbrown » Wed 10. Aug 2011, 16:41

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

M.Maidhof
Support
Support
Posts: 1291
Joined: Wed 22. Sep 2010, 14:00

Re: Combining Signals

Post by M.Maidhof » Fri 12. Aug 2011, 12:09

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

Post Reply