Skip to content
Snippets Groups Projects

Add OPC to all SCIPPs commands.

Merged Karol Krizka requested to merge kk_scipps-opc into devel
All threads resolved!

Add SCPIPs::send/sendreceive function(s) whose job is to block until a power supply command finishes, as indicated by the Operation Complete command. This prevent the program from terminating while a command is still being processed, solving #36. I've also seen stability improvements with RS-232 mode on the Agilent PS's.

This approach is recommended by R&S. See section 4.2.1.

There are two variations of send added.

  • send(const std::string& cmd): Send *OPC?" to after cmd string and blocks until a response is received. If response other than 1 is seen, error is thrown.

  • command(const std::string& cmd, unsigned channel): Sends ":INST:NSEL "+channel+"" and then calls the first variation of send.

The sendreceive functions do not use *OPC? and are just a wrapper around m_com. They were added for symmetry.

All commands in SCPIPs are now done though this.

Edited by Karol Krizka

Merge request reports

Pipeline #2013145 passed

Pipeline passed for e7a8dda6 on kk_scipps-opc

Merged by Elisabetta PianoriElisabetta Pianori 4 years ago (Oct 27, 2020 9:39pm UTC)

Loading

Pipeline #2045756 passed

Pipeline passed for ce6fd4ab on devel

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added libPS label

  • Karol Krizka added 1 commit

    added 1 commit

    • bf6ac541 - Add SCIPIPs::command documentation. Remove temporary code.

    Compare with previous version

  • mentioned in issue #62 (closed)

  • Hi @kkrizka I have tested this branch on goosevulture where I have two power-supplies:

    1. R&S HMP4040
    2. Keysight E36313A

    I see no problem when running the powersupply utility or any of my own scripts when communicating with the Keysight E36313A. However, I see no response from the R&S HMP4040.

    I have opened #62 (closed) where I detail what I am seeing and what appears to be a fix. I am not sure why the fix I propose in #62 (closed) works, other than that it makes a call to sendreceive to query the PS. The fix in #62 (closed) is on setChannel, which is more or less called in every single command. So it may be more related to the implementation of sendreceive and querying the PS, as opposed to having anything to do with the command that selects the channel.

  • Karol Krizka added 1 commit

    added 1 commit

    • 3b3f82b0 - Change command to send/sendreceive and use *OPC? with send only. Also put it on a separate line.

    Compare with previous version

  • Karol Krizka changed the description

    changed the description

  • Hi @kkrizka with 3b3f82b0 I can indeed communicate with and control my R&S HMP4040, but I seem to have lost the ability to communicate and control the Agilent E36313A. All commands to this PS return:

    $  ./bin/powersupply -n <name> -e <config> power-on 1.5 1.8 -c 1 -dddd
    [DEBUG]   : Configuring power-supply.
    [DEBUG]   : Settings:
    [DEBUG]   :  PS channel: 1
    [DEBUG]   : Sending commend to power-supply.
    [DEBUG]   : Initializing power-supply.
    terminate called after throwing an instance of 'std::runtime_error'
      what():  SCPI command not completed
    Aborted (core dumped)

    I'll play around a bit. I've checked on devel that I can communicate with the Agilent PS just fine. The changes that we were toying around with yesterday worked for both PS so I'll take a closer look into the latest changes.

    Edited by Daniel Joseph Antrim
    • Resolved by Elisabetta Pianori

      It appears to be due to white space. In your check:

      if(opcreply!="1")

      I do indeed see that opcreply is 1, but it's string length is 2 and the strict equality fails. If I print out the raw characters, there is a \n being returned. So we should probably trim all replies of whitespace, e.g.:

      ...
      #include <locale>
      ...
      // in SCPIPs::send
      std::string opcreply=m_com->sendreceive("*OPC?");
      opcreply.erase(std::remove_if(opcreply.begin(), opcreply.end(),
                          [](char& c) { return std::isspace<char>(c, std::locale::classic()); }),
                      opcreply.end());
      ...
      Edited by Daniel Joseph Antrim
  • Karol Krizka added 16 commits

    added 16 commits

    • 3b3f82b0...e6440828 - 12 commits from branch devel
    • 6f08d39a - Add OPC to all SCIPPs commands.
    • 66046cb6 - Add SCIPIPs::command documentation. Remove temporary code.
    • 031d0e3a - Change command to send/sendreceive and use *OPC? with send only. Also put it on a separate line.
    • e7a8dda6 - Remove leading : from where it was not before.

    Compare with previous version

  • Elisabetta Pianori approved this merge request

    approved this merge request

  • Elisabetta Pianori resolved all threads

    resolved all threads

  • mentioned in commit ce6fd4ab

  • mentioned in issue #70

  • Please register or sign in to reply
    Loading