Simulated thermometer
The project Qenex_SimulTempMeasure.qproj is in the Examples folder next
to QInsight.exe. It uses the pair of example plugins whose source code is
explained in Example TempSensor:
the Temperature Sensor (example) driver and the Temperature Sensor
Protocol (example) protocol. The device is simulated inside the driver,
so the project runs without hardware.
What the example shows
- A custom driver with a write path: the driver hands the protocol text
lines
chN=valueand receives commands from it to re-base a channel. - Three data types on the same kind of signal: double in °C, float converted to °F by a linear conversion, and int rounded by the protocol.
- Operator writes from signal controls: the variables
Temp1SetandTemp2Setsend a new base value of channels 1 and 2 back to the device. - File logging through the File data logger driver and its replay.
What you need
Just QInsight. The plugins are part of the installation (the Drivers and Protocols folders next to QInsight.exe).
The project
Drivers and protocols
| Temperature Sensor (example) driver | Meaning |
|---|---|
periodMs=200 | period in which the simulator transmits all channels |
channels=3 | number of simulated channels (1 to 16) |
The protocol has no settings. An unknown key in the driver or protocol settings ends up as a warning in the log, the same as with the built-in plugins.
The project also has a File data logger driver
(file=DataLogs;append=true) and a File data replay driver
(file=DataLogs\values.qilog;mode=realtime) for recording and replaying
the measurement.
Variables
| Variable | Type | Comm params | Presentation |
|---|---|---|---|
Temp1 | double | direction="read";channel="ch1" | °C |
Temp2 | float | direction="read";channel="ch2" | °F, conversion eng = raw × 1.8 + 32 |
Temp3 | int | direction="read";channel="ch3" | °C, rounded by the protocol |
Temp1Set | double | direction="write";channel="ch1" | °C, a write re-bases channel 1 |
Temp2Set | double | direction="write";channel="ch2" | °C, a write re-bases channel 2 |
Workspace
A graph of the three channels, a gauge and five signal controls; Temp1Set
and Temp2Set are in write mode.
What you will see and what to try
- After Start the three channels slowly wander around their base
values,
Temp2in degrees Fahrenheit. - Write e.g. 40 into
Temp1Set: channel 1 jumps to the new base value and keeps wandering around it. The same withTemp2Setfor channel 2, shown in °F on the graph. - Change
channels=1andTemp3stops receiving data;periodMs=1000slows all channels down. - Enable logging on the variables and replay the record with the File data replay driver after Stop.
Related chapters
- Example TempSensor — the driver and protocol sources explained
- Custom driver and Custom protocol
- Logging data

