PW8001
PW8001-01
PW8001-02
PW8001-03
PW8001-04
PW8001-05
PW8001-06
PW8001-11
PW8001-12
PW8001-13
PW8001-14
PW8001-15
PW8001-16
MATLAB Toolkit User's Manual
POWER ANALYZER
Dec. 2022 Edition 1
PW8001A970 -00 22-12H
EN
This instruction manual deals only with the parts related to commands.
Before using the PW8001, be sure to read the PW8001 Instruction Manual.
For information on the communication settings of the PW8001, please refer to section "9
Connection with PC" in the PW8001 Instruction Manual.
While every effort has been made to ensure the accuracy of the contents of this instruction
manual, if you have any questions or notice any errors, please contact our call center at the
head office or the nearest sales office.
Contents
1 Overview ......................................................................................................................................................................................... 1
2 Ready for use ................................................................................................................................................................................ 1
3 Control PW8001 on MATLAB via Ethernet connection ............................................................................................... 2
4 tcpipPW8001Class ....................................................................................................................................................................... 4
Member Functions ...................................................................................................................................................................... 4
1 Overview
This software consists of a MATLAB script (tcpipPW8001.p) to control our power analyzer PW8001 connected via
Ethernet with MATLAB.
It is recommended to use this toolkit with MATLAB R2022a or later. In addition, this toolkit cannot be used to
control PW8001 with MATLAB using a communication interface other than Ethernet (GPIB, RS-232C).
2 Ready for use
First, make sure you have this manual file (Power Analyzer PW8001 Matlab Toolkit User's Manual.pdf) and the
script file (tcpipPW8001.p) in MatlabToolkitForPW8001.zip and place them in an appropriate location.
And, add the location to the MATLAB search path.
*MATLAB is a registered trademark of The MathWorks, Inc.
3 Control PW8001 on MATLAB via Ethernet connection
By using the tcpipPW8001 class provided by this toolkit, communication commands (see next page for details) are
sent from MATLAB to the Ethernet-connected PW8001 and its response is received.
Examples of execution are shown in Figures 1 and 2. In Figure 1, analog waveform data is acquired. The procedure
is described below.
1. Sets the IP address of PW8001 and the communication timeout period in MATLAB and generates an object.
2. Establishes an Ethernet connection between the generated object and the PW8001.
3. Sends a communication command from MATLAB to PW8001 and receives a response from PW8001 to the
communication command.
4. Selects one analog waveform to be acquired from PW8001 and captures the maximum and minimum values of
the data.
5. Displays the acquired data with the plot function.
6. D isconnects the Ethernet connection.
Executes steps 1. through 6. in the command window of MATLAB, resulting in the following process.
>> [obj, flag] = tcpipPW8001("192.168.10.11", 15);
% Generates a TCP/IP object for Ethernet connection with IP address of PW8001 and timeout period set to 15
seconds
>> obj.open; %
>> obj.send("*IDN?"); %Sends the *IDN? command
>> obj.receive; %Receives command response
>> [samplingSpeed, storageLength, storageMode, waveDataMax,...
waveDataMin, flag] = obj.DownloadAnalogWaveData("U1"); %
>> plot(waveDataMax); %
>> obj.close; %Disconnects the Ethernet connection
Ethernet connection to PW8001
Captures voltage waveform data of U1
Plots the data sequence of the maximum value of the voltage waveform of U1
Figure1: Execution example of acquiring analog waveform data (controlling PW8001 with MATLAB via Ethernet
connection)
Next, in Figure 2, pulse waveform data is acquired. Pulse waveform acquisition is available only when the
PW8001 is equipped with the motor option. The procedure is described below.
1. Sets the IP address and communication timeout period of PW8001 in MATLAB and generates the object.
2. Establishes an Ethernet connection between the generated object and PW8001.
3. Sends a communication command from MATLAB to PW8001 and receives a response from PW8001 to the
communication command.
4. Captures information on the motor channels set for pulse input from PW8001, as well as the maximum and
minimum data values for all those channels.
5. Selects one channel from the data of the motor channels set for pulse input, selects the maximum or minimum
value of the pulse waveform data, and acquires it.
6. Displays the acquired data with the plot function.
7. Disconnects the Ethernet connection.
Executes steps 1. through 7. in the command window of MATLAB, resulting in the following process.
>> [obj, flag] = tcpipPW8001("192.168.10.11", 15);
% Generates a TCP/IP object for Ethernet connection with IP address of PW8001 and timeout period set to 15
seconds
>> obj.open; %
Ethernet connection to PW8001
>> obj.send("*IDN?"); %Sends the *IDN? command
>> obj.receive; %Receives command response
>> [samplingSpeed, storageLength, storageMode, logicCH,...
waveDataMax, waveDataMin, flag] = obj.DownloadLogicWaveData;
% Obtains data including all waveforms set for pulse input.
>> [chWaveData, flag] = obj.ExtractLogicChWaveData("CHA",waveDataMax);
% Captures the maximum value of CHA pulse waveform data
>> plot(chWaveData); %
>> obj.close; % Disconnects the Ethernet connection
Plots a data sequence of the maximum values of the voltage waveforms of CHA
Figure2: Execution example of acquiring pulse waveform data (controlling PW8001 with MATLAB via Ethernet
connection)
Member Functions
[obj, flag] = tcpipPW8001(ipAddr, timeOut)
obj
f
case of abnormal termination
[obj, flag] = tcpipPW8001("192.168.10.11", 15);
%
period set to 15
i
f
case of abnormal termination
aTime
f
case of abnormal termination
Returns the timeout time (in
Sets the timeout period (in seconds) for communi
4 tcpipPW8001Class
This class is used to control PW8001 with MATLAB via Ethernet connection. Through this class, communication
commands can be sent to and received from the PW8001 and waveform data can be acquired.
;
pAddr: String of IP address of PW8001
imeOut: Timeout time (seconds) value
: Generated tcpipPW8001 object
lag:”0" if the object could be generated, "1" or a predefined MATLAB error message in
ructor for tcpipPW8001 class object; creates a tcpipPW8001 object to connect to PW
flag.
Generates a TCP/IP object for Ethernet connection with IP address of PW8001 and timeout
seconds.
obj.ipAddr;
pAddress:String of IP address of PW8001
lag: "0" if IP address could be obtained, "1" or a predefined MATLAB error message in
the IP address string for PW8001 and the flag.
] = obj.timeout
: Timeout time for communication with PW8001 (sec)
lag: "0" if timeout time could be obtained, "1" or a predefined MATLAB error message in
seconds) for communication with PW8001 and the flag.
timeout;
obj.setTimeout(aTimeout)
Timeout: Variable that sets the timeout period for communication with PW8001
lag: "0" if timeout time could be set, "1" or a predefined MATLAB error message in case of
cation with PW8001 and returns the flag.
setTimeout(15);
Sets the timeout period for communication with PW8001 to 15 seconds
f
predefined MATLAB error message
Establishes a connection between the generated
f
"1" or a predefined MATLAB error message
Sends a communication comman
Receives the PW8001 response string
obj.open
lag:”0" if the connection between the generated object and PW8001 can be established, "1" or a
in case of abnormal termination
object and PW8001 and returns the flag.
obj.close
lag:”0" if the connection between the generated object and the PW8001 can be disconnected,
in case of abnormal termination
the generated object from PW8001 and returns the flag.
close;
obj.send(command)
: Communication command string to be sent to PW8001
lag: "0" if the command could be sent to PW8001, "1" or a predefined MATLAB error message in
abnormal termination
d string to PW8001 and returns the flag.
send(“*IDN?”);
Sends the communication command "*IDN?" to PW8001
obj.receive
: Responses string of PW8001 to a communication command sent from MATLAB
lag:”0" if a response is received from PW8001, "1" or a predefined MATLAB error message in
abnormal termination
to the communication command sent and returns the flag.
receive;
samplingSpeed
storageLength
storageMode
(
waveDataMax
waveDataMin
f
error message in case of
the PW8001
and returns the flag
[samplingSpeed,
obj.DownloadAnalogWaveData(”U1”);
%
samplingSpeed
storageLength
storageMode
(
logicCH
waveDataMax
channel set for pulse input
waveDataMin
channel set for pulse input
f
from PW8001, "1" or a predefined MATLAB error message is displayed in case of abnormal
termination.
Obtains data including all waveforms set for
storageLength, storageMode, waveDataMax,...
waveDataMin, flag] = obj.DownloadAnalogWaveData(chName)
hName: String of the following target waveform names to be retrieved from PW8001
(U1, U2, U3, U4, U5, U6, U7, U8, I1, I2, I3, I4, I5, I6, I7, I8, CHA, CHC, CHE, or CHG)
(However, CHA, CHC, CHE, and CHG are limited to analog waveforms)
:Sampling rate of waveform data
:Number of points of waveform data
:Storage mode of waveform data
Returns 0 for peak compression and 1 for simple thinning as a number.)
:Array to store the maximum value of the specified analog waveform data
:Array to store the minimum value of the specified analog waveform data
lag:”0" if analog waveform data could be obtained from PW8001, "1" or a predefined MATLAB
abnormal termination
aximum and minimum values of the specified analog waveform data from
.
storageLength, storageMode, waveDataMax, waveDataMin, flag] =
Captures the maximum and minimum voltage waveform data of U1
storageLength, storageMode, logicCH,...
waveDataMax, waveDataMin, flag] = obj,DownloadLogicWaveData
:Sampling rate of waveform data
:Number of points of waveform data
:Storage mode of waveform data
Returns 0 for peak compression and 1 for simple thinning as a number.)
: Motor channel set to pulse input
Bit correspondence between logicCH and motor channel
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
CHH CHG CHF CHE CHD CHC CHB CHA
:Array to store the maximum value of the data including all waveforms of the motor
:Array to store the minimum value of the data including all waveforms of the motor
Bit correspondence between waveDataMax, waveDataMin and motor channel
bit15 bit14 bit13 bit12 bit11 bit10 bit9 bit8
CHA CHB CHC CHD CHE CHF CHG CHH
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
- - - - - - - -
lag:”0" if data including all waveforms of the motor channel set for pulse input can be acquired
pulse input from PW8001 and returns the flag.
storageLength, storageMode, logicCH, waveDataMax, waveDataMin, flag] =
bj.DownloadLogicWaveData;
Obtains the maximum or mi
hannel from PW8001
and returns the
flag] = obj.ExtractLogicChWaveData(chName, waveData)
hName: String of motor channel name set for pulse input
(CHA, CHB, CHC, CHD, CHE, CHF. CHG. or CHH)
aveData: Either waveDataMax or waveDataMin obtained with the DownloadLogicWaveData function
hwaveData: Array to store the maximum or minimum pulse waveform data for the specified motor
lag:”0" if pulse waveform data of the specified motor channel could be acquired from PW8001, "1"
a predefined MATLAB error message in case of abnormal termination
nimum pulse waveform data of the specified motor c
flag.
flag] = ExtractLogicChWaveData(obj, ”CHA”, waveDataMax);
Captures the maximum value of CHA pulse waveform data
www.hioki.com/