MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / main

Function main

examples/CAN Bus Example/ecu_simulator.py:1174–1326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1172
1173
1174def main():
1175 import platform
1176 import sys
1177
1178 parser = argparse.ArgumentParser(
1179 description="CAN ECU Simulator for Serial Studio",
1180 epilog="Examples:\n"
1181 " python ecu_simulator.py -i pcan -c PCAN_USBBUS1\n"
1182 " python ecu_simulator.py -i socketcan -c vcan0\n"
1183 " python ecu_simulator.py --virtual",
1184 formatter_class=argparse.RawDescriptionHelpFormatter,
1185 )
1186 parser.add_argument(
1187 "-i",
1188 "--interface",
1189 default=None,
1190 choices=[
1191 "socketcan",
1192 "pcan",
1193 "vector",
1194 "systec",
1195 "tinycan",
1196 "passthru",
1197 "virtual",
1198 ],
1199 help="CAN interface type (auto-detects if not specified)",
1200 )
1201 parser.add_argument(
1202 "-c",
1203 "--channel",
1204 default=None,
1205 help="CAN channel name (auto-detects if not specified)",
1206 )
1207 parser.add_argument(
1208 "-b",
1209 "--bitrate",
1210 type=int,
1211 default=500000,
1212 help="CAN bus bitrate (default: 500000)",
1213 )
1214 parser.add_argument(
1215 "-r",
1216 "--rate",
1217 type=float,
1218 default=100.0,
1219 help="Simulation update rate in Hz (default: 100)",
1220 )
1221 parser.add_argument(
1222 "--virtual",
1223 action="store_true",
1224 help="Use Qt VirtualCAN (no hardware, works on all platforms)",
1225 )
1226 parser.add_argument(
1227 "--debug",
1228 action="store_true",
1229 help="Enable debug output showing raw CAN frame data",
1230 )
1231

Callers 1

ecu_simulator.pyFile · 0.70

Calls 7

set_can_senderMethod · 0.95
runMethod · 0.95
ECUSimulatorClass · 0.85
create_python_can_senderFunction · 0.85
disconnectMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected