Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Python_CANoe.py #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion CANoe/Python_CANoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ def get_SigVal(self, channel_num, msg_name, sig_name, bus_type="CAN"):
return result.Value
else:
raise RuntimeError("CANoe is not open,unable to GetVariable")

def set_SigVal(self, channel_num, msg_name, sig_name, bus_type="CAN", value):
"""
@summary Get the value of a raw CAN signal on the CAN simulation bus
@param channel_num - Integer value to indicate from which channel we will read the signal, usually start from 1,
Check with CANoe can channel setup.
@param msg_name - String value that indicate the message name to which the signal belong. Check DBC setup.
@param sig_name - String value of the signal to be read
@param value - set the CAN signal value
@param bus_type - String value of the bus type - e.g. "CAN", "LIN" and etc.
@return The CAN signal value in floating point value.
Even if the signal is of integer type, we will still return by
floating point value.
@exception None
"""
if (self.application != None):
result = self.application.GetBus(bus_type).GetSignal(channel_num, msg_name, sig_name)
result.Value = value
else:
raise RuntimeError("CANoe is not open,unable to GetVariable")

def get_SysVar(self, ns_name, sysvar_name):

Expand Down Expand Up @@ -252,4 +272,4 @@ def OnChange(self,value):
# print(app.get_SysVar("mfl","vol_plus"))
#
# vol_plus.stop()
# vol_minus.stop()
# vol_minus.stop()