Add OPC to all SCIPPs commands.
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 aftercmd
string and blocks until a response is received. If response other than1
is seen, error is thrown. -
command(const std::string& cmd, unsigned channel)
: Sends":INST:NSEL "+channel+""
and then calls the first variation ofsend
.
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.
Merge request reports
Activity
added libPS label
added 1 commit
- bf6ac541 - Add SCIPIPs::command documentation. Remove temporary code.
mentioned in issue #62 (closed)
Hi @kkrizka I have tested this branch on
goosevulture
where I have two power-supplies:R&S HMP4040
Keysight E36313A
I see no problem when running the
powersupply
utility or any of my own scripts when communicating with theKeysight E36313A
. However, I see no response from theR&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 onsetChannel
, which is more or less called in every single command. So it may be more related to the implementation ofsendreceive
and querying the PS, as opposed to having anything to do with the command that selects the channel.added 1 commit
- 3b3f82b0 - Change command to send/sendreceive and use *OPC? with send only. Also put it on a separate line.
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 theAgilent 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 theAgilent
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
is1
, 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
- Resolved by Elisabetta Pianori
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.
Toggle commit list-
3b3f82b0...e6440828 - 12 commits from branch
mentioned in commit ce6fd4ab
mentioned in issue #70