Template:DeviceTypeName: Difference between revisions

From RadiWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{#switch:{{{1|0}}}
{{#switch:{{{1|0}}}
|1=Signal Generator|2=Amplifier|4=Coupler|8=Power Meter|16=Antenna|32=Field Sensor|64=AD Converter|128=Injection Device|256=Current Sensor|512=Spectrum Analyser|1024=LISN|2048=Calibration Jig|4096=Turn Table|8192=Output Box|16384=Cable|32768=Pre-Amplifier|65536=Climat Chamber|131072=Antenna Tower|262144=ESD Generator|524288=EFT Burst Generator|1048576=Surge Generator|2097152=Absorbing Clamp|4194304=Clamp Positioner|8388608=Switch Matrix|16777216=EUT Controller|33554432=Oscilloscope|67108864=Resistor|134217728=Multimeter|268435456=Network Analyser|536870912=Modulation Source|1073741824=Voltage, dips and interrupts generator}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|1}}|1|Signal Generator}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|2}}|1|Amplifier}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|4}}|1|Coupler}}
|1=Signal Generator|2=Amplifier|4=Coupler|8=Power Meter|16=Antenna|32=Field Sensor|64=AD Converter|128=Injection Device|256=Current Sensor|512=Spectrum Analyser|1024=LISN|2048=Calibration Jig|4096=Turn Table|8192=Output Box|16384=Cable|32768=Pre-Amplifier|65536=Climat Chamber|131072=Antenna Tower|262144=ESD Generator|524288=EFT Burst Generator|1048576=Surge Generator|2097152=Absorbing Clamp|4194304=Clamp Positioner|8388608=Switch Matrix|16777216=EUT Controller|33554432=Oscilloscope|67108864=Resistor|134217728=Multimeter|268435456=Network Analyser|536870912=Modulation Source|1073741824=Voltage, dips and interrupts generator}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|1}}|1|Signal Generator}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|2}}|1|Amplifier}}{{#ifeq:{{HasBitValueSet|{{{1|0}}}|4}}|1|Coupler}}<noinclude>
<noinclude>
Converts the numeric value of a [[DeviceDriverType]] into a nice name
Converts the numeric value of a [[DeviceDriverType]] into a nice name



Revision as of 20:14, 28 June 2016

Converts the numeric value of a DeviceDriverType into a nice name

Only the basic values are detected, bit-combinations will not be splitted into several names! This is because it seems to be very difficult in MediaWiki to implement bit operations (or bitwise comparsion).

A possibility is to use a modulation operation of the double of the value, to determine if the value is present. 10 is bitvalue 8 and bitvalue 2. To check if bitvalue 2 is set double the bitvalue, and use it for the a modulo operation. Then with that result, do a modulo operation with the tested bitvalue. If it changes, then the bit was set.

  • 10 mod (2 * 2) => 2
  • 2 mod 2 => 0
  • 0 is different than the 2, so the bitvalue 2 was present in 10.