[{"data":1,"prerenderedAt":1078},["ShallowReactive",2],{"docs-nav-docs_en":3,"docs-page-\u002Fen\u002Fexamples\u002Fbit-field-script":367,"docs-surround-\u002Fen\u002Fexamples\u002Fbit-field-script":1075},[4],{"title":5,"path":6,"stem":7,"children":8},"En","\u002Fen","en",[9,13,41,58,76,103,157,171,190,211,238,283,303],{"title":10,"path":6,"stem":11,"navTitle":12},"QInsight Documentation","en\u002Findex","Overview",{"title":14,"navTitle":15,"path":16,"stem":17,"children":18,"page":40},"Getting Started",null,"\u002Fen\u002Fgetting-started","en\u002F01.getting-started",[19,23,27,31,36],{"title":20,"path":21,"stem":22,"navTitle":20},"What is QENEX Suite","\u002Fen\u002Fgetting-started\u002Fwhat-is-qenex-suite","en\u002F01.getting-started\u002F1.what-is-qenex-suite",{"title":24,"path":25,"stem":26,"navTitle":24},"What is QInsight","\u002Fen\u002Fgetting-started\u002Fwhat-is-qinsight","en\u002F01.getting-started\u002F2.what-is-qinsight",{"title":28,"path":29,"stem":30,"navTitle":28},"Installation","\u002Fen\u002Fgetting-started\u002Finstallation","en\u002F01.getting-started\u002F3.installation",{"title":32,"path":33,"stem":34,"navTitle":35},"The QInsight user interface","\u002Fen\u002Fgetting-started\u002Fthe-qinsight-interface","en\u002F01.getting-started\u002F4.the-qinsight-interface","User interface",{"title":37,"path":38,"stem":39,"navTitle":37},"Licensing","\u002Fen\u002Fgetting-started\u002Flicensing","en\u002F01.getting-started\u002F5.licensing",false,{"title":42,"navTitle":15,"path":43,"stem":44,"children":45,"page":40},"First Project","\u002Fen\u002Ffirst-project","en\u002F02.first-project",[46,50,54],{"title":47,"path":48,"stem":49,"navTitle":47},"Create a project","\u002Fen\u002Ffirst-project\u002Fcreate-a-project","en\u002F02.first-project\u002F1.create-a-project",{"title":51,"path":52,"stem":53,"navTitle":51},"Project structure","\u002Fen\u002Ffirst-project\u002Fproject-structure","en\u002F02.first-project\u002F2.project-structure",{"title":55,"path":56,"stem":57,"navTitle":55},"Project password","\u002Fen\u002Ffirst-project\u002Fproject-password","en\u002F02.first-project\u002F3.project-password",{"title":59,"navTitle":15,"path":60,"stem":61,"children":62,"page":40},"Connecting a Device","\u002Fen\u002Fconnecting-a-device","en\u002F03.connecting-a-device",[63,67,71],{"title":64,"path":65,"stem":66,"navTitle":64},"Add a driver","\u002Fen\u002Fconnecting-a-device\u002Fadd-a-driver","en\u002F03.connecting-a-device\u002F1.add-a-driver",{"title":68,"path":69,"stem":70,"navTitle":68},"Add a protocol","\u002Fen\u002Fconnecting-a-device\u002Fadd-a-protocol","en\u002F03.connecting-a-device\u002F2.add-a-protocol",{"title":72,"path":73,"stem":74,"navTitle":75},"Link a driver and a protocol","\u002Fen\u002Fconnecting-a-device\u002Flink-driver-and-protocol","en\u002F03.connecting-a-device\u002F3.link-driver-and-protocol","Linking",{"title":77,"navTitle":15,"path":78,"stem":79,"children":80,"page":40},"Variables","\u002Fen\u002Fvariables","en\u002F04.variables",[81,85,90,94,99],{"title":82,"path":83,"stem":84,"navTitle":82},"What is a variable","\u002Fen\u002Fvariables\u002Fwhat-is-a-variable","en\u002F04.variables\u002F1.what-is-a-variable",{"title":86,"path":87,"stem":88,"navTitle":89},"Conversion and presentation","\u002Fen\u002Fvariables\u002Fconversion-and-presentation","en\u002F04.variables\u002F2.conversion-and-presentation","Conversion & presentation",{"title":91,"path":92,"stem":93,"navTitle":91},"Add a variable","\u002Fen\u002Fvariables\u002Fadd-a-variable","en\u002F04.variables\u002F3.add-a-variable",{"title":95,"path":96,"stem":97,"navTitle":98},"Matrix variable (array, curve, map)","\u002Fen\u002Fvariables\u002Fmatrix-variable","en\u002F04.variables\u002F4.matrix-variable","Matrix variable",{"title":100,"path":101,"stem":102,"navTitle":100},"Events","\u002Fen\u002Fvariables\u002Fevents","en\u002F04.variables\u002F5.events",{"title":104,"navTitle":15,"path":105,"stem":106,"children":107,"page":40},"Visualization","\u002Fen\u002Fvisualization","en\u002F05.visualization",[108,113,118,122,127,132,137,142,147,152],{"title":109,"path":110,"stem":111,"navTitle":112},"Create a workspace","\u002Fen\u002Fvisualization\u002Fcreate-a-workspace","en\u002F05.visualization\u002F1.create-a-workspace","Workspace",{"title":114,"path":115,"stem":116,"navTitle":117},"Writing values to the device","\u002Fen\u002Fvisualization\u002Fwrite-to-device","en\u002F05.visualization\u002F10.write-to-device","Writing to the device",{"title":119,"path":120,"stem":121,"navTitle":119},"Add a control","\u002Fen\u002Fvisualization\u002Fadd-a-control","en\u002F05.visualization\u002F2.add-a-control",{"title":123,"path":124,"stem":125,"navTitle":126},"Bind a control to a variable","\u002Fen\u002Fvisualization\u002Fbind-a-control","en\u002F05.visualization\u002F3.bind-a-control","Bind a control",{"title":128,"path":129,"stem":130,"navTitle":131},"Graph — signal time course","\u002Fen\u002Fvisualization\u002Fgraph-control","en\u002F05.visualization\u002F4.graph-control","Graph",{"title":133,"path":134,"stem":135,"navTitle":136},"XY Graph — signal versus signal","\u002Fen\u002Fvisualization\u002Fxy-graph-control","en\u002F05.visualization\u002F5.xy-graph-control","XY Graph",{"title":138,"path":139,"stem":140,"navTitle":141},"Gauge — instantaneous value indicator","\u002Fen\u002Fvisualization\u002Fgauge-control","en\u002F05.visualization\u002F6.gauge-control","Gauge",{"title":143,"path":144,"stem":145,"navTitle":146},"Single-Signal — a value with a caption","\u002Fen\u002Fvisualization\u002Fsignal-control","en\u002F05.visualization\u002F7.signal-control","Single-Signal",{"title":148,"path":149,"stem":150,"navTitle":151},"Watch Table — a table of variables","\u002Fen\u002Fvisualization\u002Fwatch-table-control","en\u002F05.visualization\u002F8.watch-table-control","Watch Table",{"title":153,"path":154,"stem":155,"navTitle":156},"Matrix control — maps and calibration","\u002Fen\u002Fvisualization\u002Fmatrix-control","en\u002F05.visualization\u002F9.matrix-control","Matrix control",{"title":158,"navTitle":15,"path":159,"stem":160,"children":161,"page":40},"Running and Monitoring","\u002Fen\u002Frunning","en\u002F06.running",[162,166],{"title":163,"path":164,"stem":165,"navTitle":163},"Start and stop","\u002Fen\u002Frunning\u002Fstart-and-stop","en\u002F06.running\u002F1.start-and-stop",{"title":167,"path":168,"stem":169,"navTitle":170},"Watching live data","\u002Fen\u002Frunning\u002Fwatching-live-data","en\u002F06.running\u002F2.watching-live-data","Live data",{"title":172,"navTitle":15,"path":173,"stem":174,"children":175,"page":40},"Logging and Replay","\u002Fen\u002Flogging-and-replay","en\u002F07.logging-and-replay",[176,180,185],{"title":177,"path":178,"stem":179,"navTitle":177},"Logging data","\u002Fen\u002Flogging-and-replay\u002Flogging-data","en\u002F07.logging-and-replay\u002F1.logging-data",{"title":181,"path":182,"stem":183,"navTitle":184},"Replaying a log","\u002Fen\u002Flogging-and-replay\u002Freplaying-a-log","en\u002F07.logging-and-replay\u002F2.replaying-a-log","Replay",{"title":186,"path":187,"stem":188,"navTitle":189},"Exporting data","\u002Fen\u002Flogging-and-replay\u002Fexporting-data","en\u002F07.logging-and-replay\u002F3.exporting-data","Export",{"title":191,"navTitle":15,"path":192,"stem":193,"children":194,"page":40},"Python Scripts","\u002Fen\u002Fpython-scripts","en\u002F08.python-scripts",[195,199,203,207],{"title":196,"path":197,"stem":198,"navTitle":12},"Scripts overview","\u002Fen\u002Fpython-scripts\u002Fscripts-overview","en\u002F08.python-scripts\u002F1.scripts-overview",{"title":200,"path":201,"stem":202,"navTitle":200},"Accessing variables","\u002Fen\u002Fpython-scripts\u002Faccessing-variables","en\u002F08.python-scripts\u002F2.accessing-variables",{"title":204,"path":205,"stem":206,"navTitle":204},"Example script","\u002Fen\u002Fpython-scripts\u002Fexample-script","en\u002F08.python-scripts\u002F3.example-script",{"title":208,"path":209,"stem":210,"navTitle":208},"CSV post-processing","\u002Fen\u002Fpython-scripts\u002Fcsv-post-processing","en\u002F08.python-scripts\u002F4.csv-post-processing",{"title":212,"navTitle":15,"path":213,"stem":214,"children":215,"page":40},"Custom extensions","\u002Fen\u002Fcustom-extensions","en\u002F09.custom-extensions",[216,220,224,228,233],{"title":217,"path":218,"stem":219,"navTitle":217},"Custom driver","\u002Fen\u002Fcustom-extensions\u002Fcustom-driver","en\u002F09.custom-extensions\u002F1.custom-driver",{"title":221,"path":222,"stem":223,"navTitle":221},"Custom protocol","\u002Fen\u002Fcustom-extensions\u002Fcustom-protocol","en\u002F09.custom-extensions\u002F2.custom-protocol",{"title":225,"path":226,"stem":227,"navTitle":225},"Custom Control","\u002Fen\u002Fcustom-extensions\u002Fcustom-control","en\u002F09.custom-extensions\u002F3.custom-control",{"title":229,"path":230,"stem":231,"navTitle":232},"Complete example — ISS position","\u002Fen\u002Fcustom-extensions\u002Fiss-example","en\u002F09.custom-extensions\u002F4.iss-example","Example ISS",{"title":234,"path":235,"stem":236,"navTitle":237},"Complete example — temperature sensor","\u002Fen\u002Fcustom-extensions\u002Ftemp-sensor-example","en\u002F09.custom-extensions\u002F5.temp-sensor-example","Example temp sensor",{"title":239,"navTitle":15,"path":240,"stem":241,"children":242,"page":40},"QFW SDK","\u002Fen\u002Fdevice-sdk","en\u002F10.device-sdk",[243,248,253,258,263,268,273,278],{"title":244,"path":245,"stem":246,"navTitle":247},"QFW SDK — introduction","\u002Fen\u002Fdevice-sdk\u002Fintroduction","en\u002F10.device-sdk\u002F1.introduction","Introduction",{"title":249,"path":250,"stem":251,"navTitle":252},"XCP in the QFW SDK","\u002Fen\u002Fdevice-sdk\u002Fxcp","en\u002F10.device-sdk\u002F2.xcp","XCP",{"title":254,"path":255,"stem":256,"navTitle":257},"Integration step by step: XCP on TCP with FreeRTOS + lwIP","\u002Fen\u002Fdevice-sdk\u002Fintegration-tcp","en\u002F10.device-sdk\u002F3.integration-tcp","Integration: XCP on TCP",{"title":259,"path":260,"stem":261,"navTitle":262},"XCP on classic CAN — what changes","\u002Fen\u002Fdevice-sdk\u002Fcan","en\u002F10.device-sdk\u002F4.can","XCP on classic CAN",{"title":264,"path":265,"stem":266,"navTitle":267},"Integration without an RTOS: XCP on TCP from the main loop","\u002Fen\u002Fdevice-sdk\u002Fbaremetal","en\u002F10.device-sdk\u002F5.baremetal","Integration without an RTOS",{"title":269,"path":270,"stem":271,"navTitle":272},"The engine contract","\u002Fen\u002Fdevice-sdk\u002Fengine-contract","en\u002F10.device-sdk\u002F6.engine-contract","Engine contract",{"title":274,"path":275,"stem":276,"navTitle":277},"Variable addresses for QInsight","\u002Fen\u002Fdevice-sdk\u002Fvariable-addresses","en\u002F10.device-sdk\u002F7.variable-addresses","Variable addresses",{"title":279,"path":280,"stem":281,"navTitle":282},"Troubleshooting the SDK integration","\u002Fen\u002Fdevice-sdk\u002Ftroubleshooting","en\u002F10.device-sdk\u002F8.troubleshooting","Troubleshooting",{"title":284,"navTitle":15,"path":285,"stem":286,"children":287,"page":40},"Reference","\u002Fen\u002Freference","en\u002F11.reference",[288,292,296,300],{"title":289,"path":290,"stem":291,"navTitle":289},"Drivers","\u002Fen\u002Freference\u002Fdrivers","en\u002F11.reference\u002F1.drivers",{"title":293,"path":294,"stem":295,"navTitle":293},"Protocols","\u002Fen\u002Freference\u002Fprotocols","en\u002F11.reference\u002F2.protocols",{"title":297,"path":298,"stem":299,"navTitle":297},"Controls","\u002Fen\u002Freference\u002Fcontrols","en\u002F11.reference\u002F3.controls",{"title":282,"path":301,"stem":302,"navTitle":282},"\u002Fen\u002Freference\u002Ftroubleshooting","en\u002F11.reference\u002F4.troubleshooting",{"title":304,"navTitle":15,"path":305,"stem":306,"children":307,"page":40},"Examples","\u002Fen\u002Fexamples","en\u002F12.examples",[308,312,317,322,327,331,335,339,343,347,352,357,362],{"title":309,"path":310,"stem":311,"navTitle":309},"Simulation: all signals","\u002Fen\u002Fexamples\u002Fsimulation-all-signals","en\u002F12.examples\u002F01.simulation-all-signals",{"title":313,"path":314,"stem":315,"navTitle":316},"Modbus RTU master over a serial line","\u002Fen\u002Fexamples\u002Fserial-modbus-master","en\u002F12.examples\u002F02.serial-modbus-master","Modbus RTU master",{"title":318,"path":319,"stem":320,"navTitle":321},"Modbus RTU slave with simulated sensors","\u002Fen\u002Fexamples\u002Fserial-modbus-slave","en\u002F12.examples\u002F03.serial-modbus-slave","Modbus RTU slave",{"title":323,"path":324,"stem":325,"navTitle":326},"Modbus TCP master over a TCP client","\u002Fen\u002Fexamples\u002Ftcp-client-modbus-master","en\u002F12.examples\u002F04.tcp-client-modbus-master","Modbus TCP master",{"title":328,"path":329,"stem":330,"navTitle":328},"Modbus TCP slave on the TCP Server","\u002Fen\u002Fexamples\u002Ftcp-server-modbus-slave","en\u002F12.examples\u002F05.tcp-server-modbus-slave",{"title":332,"path":333,"stem":334,"navTitle":332},"Bit field and a script","\u002Fen\u002Fexamples\u002Fbit-field-script","en\u002F12.examples\u002F08.bit-field-script",{"title":336,"path":337,"stem":338,"navTitle":336},"Two ECUs at once","\u002Fen\u002Fexamples\u002Ftwo-ecus","en\u002F12.examples\u002F09.two-ecus",{"title":340,"path":341,"stem":342,"navTitle":340},"ISS position live","\u002Fen\u002Fexamples\u002Fiss-live-tracking","en\u002F12.examples\u002F10.iss-live-tracking",{"title":344,"path":345,"stem":346,"navTitle":344},"Simulated thermometer","\u002Fen\u002Fexamples\u002Fsimul-temp-measure","en\u002F12.examples\u002F11.simul-temp-measure",{"title":348,"path":349,"stem":350,"navTitle":351},"JSON signals from a Python generator","\u002Fen\u002Fexamples\u002Fjson-signal-python","en\u002F12.examples\u002F12.json-signal-python","JSON signals from Python",{"title":353,"path":354,"stem":355,"navTitle":356},"Raw CAN frames from a Raspberry Pi","\u002Fen\u002Fexamples\u002Fraw-can-python","en\u002F12.examples\u002F13.raw-can-python","Raw CAN from a Raspberry Pi",{"title":358,"path":359,"stem":360,"navTitle":361},"XCP on TCP on a NUCLEO-H723ZG: measurement, stimulation and calibration maps","\u002Fen\u002Fexamples\u002Ftcp-client-xcp-nucleo-maps","en\u002F12.examples\u002F14.tcp-client-xcp-nucleo-maps","XCP on TCP on NUCLEO-H723ZG",{"title":363,"path":364,"stem":365,"navTitle":366},"XCP on CAN on a NUCLEO-H723ZG: measurement, stimulation and calibration maps","\u002Fen\u002Fexamples\u002Fcan-xcp-nucleo-maps","en\u002F12.examples\u002F15.can-xcp-nucleo-maps","XCP on CAN on NUCLEO-H723ZG",{"id":368,"title":332,"body":369,"description":1070,"extension":1071,"meta":1072,"navTitle":332,"navigation":886,"path":333,"seo":1073,"stem":334,"__hash__":1074},"docs_en\u002Fen\u002F12.examples\u002F08.bit-field-script.md",{"type":370,"value":371,"toc":1058},"minimark",[372,376,392,414,428,431,436,518,522,527,543,554,558,580,628,639,650,670,681,692,696,716,751,762,773,783,787,790,848,859,864,900,905,946,951,960,964,980,988,995,999,1030,1034,1054],[373,374,332],"h1",{"id":375},"bit-field-and-a-script",[377,378,379,380,384,385,387,388,391],"p",{},"The project ",[381,382,383],"code",{},"Qenex_Virtual_Virtual_BitfieldTest.qproj"," is in the ",[381,386,304],{},"\nfolder next to ",[381,389,390],{},"QInsight.exe",". It needs no hardware: both variables are\nhosted by the Virtual Variables Host driver and the status word is\ngenerated by a script.",[377,393,394,395,400,401,405,406,409,410,413],{},"This example shows the\n",[396,397,399],"a",{"href":398},"\u002Fvariables\u002Fadd-a-variable#bit-field-bit-shift-and-bit-mask","variable bit field","\nin action: out of a ",[402,403,404],"strong",{},"status word"," whose lower bits change every 20 ms,\ntwo variables cut a two-bit ",[402,407,408],{},"machine state"," (bits 7–8). One shows it\nas text through an enum conversion, the other as a number — and an\n",[402,411,412],{},"On-change trigger"," runs a script only when the extracted state\nchanges, not on every change of the word.",[377,415,416,423],{},[417,418],"img",{"alt":419,"className":420,"src":422},"The whole example window — state STARTING, the state staircase, and Script-Logs",[421],"img-light","\u002Fimg\u002FQInsight_tut_11_2_overview_light.png",[417,424],{"alt":419,"className":425,"src":427},[426],"img-dark","\u002Fimg\u002FQInsight_tut_11_2_overview_dark.png",[377,429,430],{},"This is exactly what status words of real ECUs look like: one word\ncarries flags, counters, and state machines at once, and each piece is\ncut out by a different shift + mask pair.",[432,433,435],"h2",{"id":434},"how-it-all-works","How it all works",[437,438,439,459,475,501],"ol",{},[440,441,442,443,446,447,450,451,454,455,458],"li",{},"The ",[381,444,445],{},"periodic.py"," script increments a 0–511 counter (9 bits) every\n20 ms and writes it ",[402,448,449],{},"as a whole word"," into the ",[381,452,453],{},"State"," and ",[381,456,457],{},"var1","\nvariables — simulating a device that sends a live status word.",[440,460,461,462,454,468,474],{},"Both variables have ",[402,463,464,465],{},"Bit Shift ",[381,466,467],{},">>7",[402,469,470,471],{},"Bit Mask ",[381,472,473],{},"0x03",": they\ncut bits 7–8 out of the whole word — a value 0–3 that changes once\nevery 2.56 s (128 counter ticks).",[440,476,477,479,480,483,484,487,488,487,491,487,494,497,498,500],{},[381,478,453],{}," has a presentation with an ",[402,481,482],{},"enum conversion"," — it shows the\nvalues 0–3 as ",[381,485,486],{},"STOP",", ",[381,489,490],{},"STARTING",[381,492,493],{},"RUNNING",[381,495,496],{},"STOPPING",". ",[381,499,457],{}," has a\n1:1 linear conversion and shows the same thing as a number.",[440,502,503,504,506,507,510,511,513,514,517],{},"An ",[402,505,412],{}," (source ",[402,508,509],{},"Eng",", threshold 0.8) hangs on\n",[381,512,453],{},": it runs the ",[381,515,516],{},"event.py"," script only when the extracted state\nchanges. The script prints the whole word in binary next to the\nengineering value — making it visible that raw stays the word and the\nstate is just its cut-out.",[432,519,521],{"id":520},"the-project-step-by-step","The project step by step",[523,524,526],"h3",{"id":525},"project-and-drivers","Project and drivers",[377,528,529,530,533,534,537,538,542],{},"The project is called ",[402,531,532],{},"Bit-Field",". The only driver + protocol pair is\n",[402,535,536],{},"Virtual Variables Host \u002F Virtual Variables"," — the carrier of\n",[396,539,541],{"href":540},"\u002Freference\u002Fprotocols#virtual-variables","virtual variables"," written by\nscripts. No events are needed: the pace is set by the periodic script.",[377,544,545,550],{},[417,546],{"alt":547,"className":548,"src":549},"The Drivers & Protocols section — Virtual Variables Host and Virtual Variables",[421],"\u002Fimg\u002FQInsight_tut_11_2_drivers_light.png",[417,551],{"alt":547,"className":552,"src":553},[426],"\u002Fimg\u002FQInsight_tut_11_2_drivers_dark.png",[523,555,557],{"id":556},"conversions-and-presentations","Conversions and presentations",[377,559,560,561,564,565,487,568,571,572,575,576,579],{},"Two conversions: ",[381,562,563],{},"linear"," (Linear, ",[381,566,567],{},"Multiplier = 1",[381,569,570],{},"Offset = 0",") and\n",[381,573,574],{},"engState"," — an ",[402,577,578],{},"Enum"," with four states:",[581,582,583,596],"table",{},[584,585,586],"thead",{},[587,588,589,593],"tr",{},[590,591,592],"th",{},"Name",[590,594,595],{},"Value",[597,598,599,607,614,621],"tbody",{},[587,600,601,604],{},[602,603,486],"td",{},[602,605,606],{},"0",[587,608,609,611],{},[602,610,490],{},[602,612,613],{},"1",[587,615,616,618],{},[602,617,493],{},[602,619,620],{},"2",[587,622,623,625],{},[602,624,496],{},[602,626,627],{},"3",[377,629,630,635],{},[417,631],{"alt":632,"className":633,"src":634},"The engState conversion — an enum with four states",[421],"\u002Fimg\u002FQInsight_tut_11_2_conv_enum_light.png",[417,636],{"alt":632,"className":637,"src":638},[426],"\u002Fimg\u002FQInsight_tut_11_2_conv_enum_dark.png",[377,640,641,646],{},[417,642],{"alt":643,"className":644,"src":645},"The linear conversion — 1:1",[421],"\u002Fimg\u002FQInsight_tut_11_2_conv_linear_light.png",[417,647],{"alt":643,"className":648,"src":649},[426],"\u002Fimg\u002FQInsight_tut_11_2_conv_linear_dark.png",[377,651,652,653,656,657,659,660,656,663,665,666,669],{},"Two presentations reference them: ",[381,654,655],{},"enum"," (conversion ",[381,658,574],{},", range\n0–4) and ",[381,661,662],{},"lin",[381,664,563],{},"). Both with the ",[381,667,668],{},"{0:F0}"," format.",[377,671,672,677],{},[417,673],{"alt":674,"className":675,"src":676},"The enum presentation",[421],"\u002Fimg\u002FQInsight_tut_11_2_pres_enum_light.png",[417,678],{"alt":674,"className":679,"src":680},[426],"\u002Fimg\u002FQInsight_tut_11_2_pres_enum_dark.png",[377,682,683,688],{},[417,684],{"alt":685,"className":686,"src":687},"The lin presentation",[421],"\u002Fimg\u002FQInsight_tut_11_2_pres_lin_light.png",[417,689],{"alt":685,"className":690,"src":691},[426],"\u002Fimg\u002FQInsight_tut_11_2_pres_lin_dark.png",[523,693,695],{"id":694},"variables-with-a-bit-field","Variables with a bit field",[377,697,698,699,702,703,454,707,711,712,715],{},"Both variables are ",[402,700,701],{},"UShort"," and both have the bit field filled in\ntheir detail: ",[402,704,464,705],{},[381,706,467],{},[402,708,470,709],{},[381,710,473],{}," — the\nextracted state is ",[381,713,714],{},"(raw >> 7) & 0x03",". They differ only in the\npresentation:",[717,718,719,744],"ul",{},[440,720,721,723,724,726,727,729,730,732,733,735,736,739,740,743],{},[381,722,453],{}," — the ",[402,725,655],{}," presentation: the extracted value is shown as a\nstate name. On the right side it carries the ",[402,728,412],{},":\nscript ",[381,731,516],{},", source ",[402,734,509],{},", mode ",[402,737,738],{},"Delta",", threshold ",[402,741,742],{},"0.8",".",[440,745,746,723,748,750],{},[381,747,457],{},[402,749,662],{}," presentation: the same value as a number 0–3.",[377,752,753,758],{},[417,754],{"alt":755,"className":756,"src":757},"The State variable — the bit field and the On-change trigger",[421],"\u002Fimg\u002FQInsight_tut_11_2_var_state_light_v2.png",[417,759],{"alt":755,"className":760,"src":761},[426],"\u002Fimg\u002FQInsight_tut_11_2_var_state_dark_v2.png",[377,763,764,769],{},[417,765],{"alt":766,"className":767,"src":768},"The var1 variable — the same bit field, a linear presentation",[421],"\u002Fimg\u002FQInsight_tut_11_2_var_var1_light_v2.png",[417,770],{"alt":766,"className":771,"src":772},[426],"\u002Fimg\u002FQInsight_tut_11_2_var_var1_dark_v2.png",[377,774,775,776,778,779,782],{},"The trigger threshold matters here: the ",[402,777,509],{}," source means the\ncomparison uses the ",[402,780,781],{},"extracted, converted value",", not the whole word.\nThe counter changes every 20 ms, but the engineering value only once per\n2.56 s — so the script runs only on a real state change. The threshold\n0.8 sits safely below the smallest state step (1) while filtering any\nnoise a real device might produce.",[523,784,786],{"id":785},"scripts","Scripts",[377,788,789],{},"The project has three scripts, each in a different execution mode:",[581,791,792,805],{},[584,793,794],{},[587,795,796,799,802],{},[590,797,798],{},"Script",[590,800,801],{},"Execution mode",[590,803,804],{},"Purpose",[597,806,807,820,836],{},[587,808,809,814,817],{},[602,810,811],{},[381,812,813],{},"init.py",[602,815,816],{},"Startup",[602,818,819],{},"zeroes the counter and the variables at runtime start",[587,821,822,826,833],{},[602,823,824],{},[381,825,445],{},[602,827,828,829,832],{},"Periodic (",[381,830,831],{},"period=20;unit=ms",")",[602,834,835],{},"the status-word generator",[587,837,838,842,845],{},[602,839,840],{},[381,841,516],{},[602,843,844],{},"On Value Changed",[602,846,847],{},"the reaction to a state change (run by the trigger)",[377,849,850,855],{},[417,851],{"alt":852,"className":853,"src":854},"The Scripts section — three scripts and their modes",[421],"\u002Fimg\u002FQInsight_tut_11_2_scripts_light.png",[417,856],{"alt":852,"className":857,"src":858},[426],"\u002Fimg\u002FQInsight_tut_11_2_scripts_dark.png",[377,860,861,863],{},[381,862,813],{}," prepares a deterministic start:",[865,866,871],"pre",{"className":867,"code":868,"language":869,"meta":870,"style":870},"language-python shiki shiki-themes github-light github-dark-default","inc = 0\n\nState.RawValue = 0\nvar1.RawValue = 0\n","python","",[381,872,873,881,888,894],{"__ignoreMap":870},[874,875,878],"span",{"class":876,"line":877},"line",1,[874,879,880],{},"inc = 0\n",[874,882,884],{"class":876,"line":883},2,[874,885,887],{"emptyLinePlaceholder":886},true,"\n",[874,889,891],{"class":876,"line":890},3,[874,892,893],{},"State.RawValue = 0\n",[874,895,897],{"class":876,"line":896},4,[874,898,899],{},"var1.RawValue = 0\n",[377,901,902,904],{},[381,903,445],{}," is the whole \"device simulator\" — a 0–511 counter written\nas a whole word into both variables:",[865,906,908],{"className":867,"code":907,"language":869,"meta":870,"style":870},"inc += 1\n\nif inc >= 512:\n    inc = 0\n\nState.RawValue = inc\nvar1.RawValue = inc\n",[381,909,910,915,919,924,929,934,940],{"__ignoreMap":870},[874,911,912],{"class":876,"line":877},[874,913,914],{},"inc += 1\n",[874,916,917],{"class":876,"line":883},[874,918,887],{"emptyLinePlaceholder":886},[874,920,921],{"class":876,"line":890},[874,922,923],{},"if inc >= 512:\n",[874,925,926],{"class":876,"line":896},[874,927,928],{},"    inc = 0\n",[874,930,932],{"class":876,"line":931},5,[874,933,887],{"emptyLinePlaceholder":886},[874,935,937],{"class":876,"line":936},6,[874,938,939],{},"State.RawValue = inc\n",[874,941,943],{"class":876,"line":942},7,[874,944,945],{},"var1.RawValue = inc\n",[377,947,948,950],{},[381,949,516],{}," is a single line — it prints the whole word in binary with\nthe engineering value next to it:",[865,952,954],{"className":867,"code":953,"language":869,"meta":870,"style":870},"print(f\"State changed: {State.RawValue:09b} \u002F {State.EngValue}\")\n",[381,955,956],{"__ignoreMap":870},[874,957,958],{"class":876,"line":877},[874,959,953],{},[432,961,963],{"id":962},"the-result","The result",[377,965,966,967,969,970,972,973,975,976,979],{},"After starting the runtime, the Single-Signal controls show the current\nstate — ",[381,968,453],{}," as text (",[381,971,490],{},"), ",[381,974,457],{}," as a number — and the graph\ndraws the 0 → 1 → 2 → 3 → 0… staircase stepping every 2.56 s. The\n",[402,977,978],{},"Script-Logs"," window gains a line on every state change:",[865,981,986],{"className":982,"code":984,"language":985,"meta":870},[983],"language-text","07:05:49.953  State changed: 010000000 \u002F 1.0\n07:05:52.512  State changed: 100000000 \u002F 2.0\n07:05:55.073  State changed: 110000000 \u002F 3.0\n07:05:57.632  State changed: 000000000 \u002F 0.0\n","text",[381,987,984],{"__ignoreMap":870},[377,989,990,991,994],{},"The binary printout tells the example's whole story: bits 7–8 of the\nwhole word change (",[381,992,993],{},"RawValue"," stays the word), the engineering value is\njust their cut-out.",[432,996,998],{"id":997},"what-to-take-away","What to take away",[717,1000,1001,1007,1013,1024],{},[440,1002,1003,1006],{},[402,1004,1005],{},"The bit field is a property of the variable"," — the protocol, the\nlog, and replay all work with the whole word; the cut-out is the first\nstep of the raw → engineering computation.",[440,1008,1009,1012],{},[402,1010,1011],{},"One word, several variables",": each field of a status word can be a\nseparate variable with its own presentation — with a real device they\nall point at the same address and the word is transferred once for\neach of them.",[440,1014,1015,1018,1019,1021,1022,743],{},[402,1016,1017],{},"An enum conversion gives the bits names"," — the ECU state machine\nshows up in controls as ",[381,1020,493],{},", not as ",[381,1023,620],{},[440,1025,1026,1029],{},[402,1027,1028],{},"An On-change trigger with the Eng source reacts to the field, not\nthe word"," — scripts run on a state change even when the word changes\na thousand times more often.",[432,1031,1033],{"id":1032},"next","Next",[717,1035,1036,1042,1048],{},[440,1037,1038,1041],{},[396,1039,1040],{"href":398},"Bit field (Bit Shift and Bit Mask)","\n— the exact extraction and write rules.",[440,1043,1044,1047],{},[396,1045,309],{"href":1046},"\u002Fexamples\u002Fsimulation-all-signals"," — virtual\nvariables and an on-change trigger with a Python filter in more detail.",[440,1049,1050,1053],{},[396,1051,196],{"href":1052},"\u002Fpython-scripts\u002Fscripts-overview"," — the Startup,\nPeriodic, and On Value Changed execution modes.",[1055,1056,1057],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":870,"searchDepth":890,"depth":890,"links":1059},[1060,1061,1067,1068,1069],{"id":434,"depth":883,"text":435},{"id":520,"depth":883,"text":521,"children":1062},[1063,1064,1065,1066],{"id":525,"depth":890,"text":526},{"id":556,"depth":890,"text":557},{"id":694,"depth":890,"text":695},{"id":785,"depth":890,"text":786},{"id":962,"depth":883,"text":963},{"id":997,"depth":883,"text":998},{"id":1032,"depth":883,"text":1033},"A complete project with a bit field — two variables cut a state out of one word, an enum names it, and an On-change trigger runs a script only when the state changes.","md",{},{"title":332,"description":1070},"h__j_P36c2GS4cNVxCttGXnsJbju38qlCJDK84XICxI",[1076,1077],{"title":328,"path":329,"stem":330,"navTitle":328,"children":-1},{"title":336,"path":337,"stem":338,"navTitle":336,"children":-1},1791554568268]