Data Acquisition (DAQ) and Control from Microstar Laboratories

Knowledge Base: Processing

  • See the list of other topics for category Processing

Q10004 Applying different scaling factor to each channel

Tags: Help, DAP, DAPL, processing, pre-processing, scaling

Applies to: All DAP models and all DAP software

I have 10 channels, and I need to adjust the scaling factor on the data for each channel separately, to compensate for sensitivity differences in my sensors. What is a good way to do this?

For just a few channels, setting up scaling factor constants and applying them channel at a time works fine in your DAPL scripts.

  // Declare the scaling constants and scaled streams
  CONSTANT  cScale0f  float =  5.022
  CONSTANT  cScale1f  float =  4.919
  PIPES     pSc0 float, pSc1 float, ...
  // Apply the scaling factors in your processing section
  pSc0 = cScale0f * ip0
  pSc1 = cScale1f * ip1
  MERGE(pSc0, pSc1, ... , $BinOut)

For 10 or more channels, applying the scaling factors channel by channel is tedious to code, and task scheduling starts to become less efficient. Another way is to place all of your scaling factors in vector.

  VECTOR  vScaling float = (
    5.022, 4.919, ...  )
  PIPE    pRepScaling float
  PIPE    pScaled     float

Now, in your processing section you use one task to replicate the contents of the scaling vector to produce a data stream. Then you apply this list of scaling factor to your your multiplexed input sampling data, term by term. The extra MERGE command is a small inconvenience, to get around the problem that the default data type of the $BinOut pipe is word, not float.

  COPYVEC (vScaling, pRepScaling)
  pScaled = pRepScaling * ip(0..9)
  MERGE(pScaled, $BinOut)