Functions that assist with retrieving system information from the controller.
Name | Description |
---|---|
ReadState | Get the current state of the controller. |
ReadSystemInformation | Get System Information from the controller. This includes softwareVersion and modelName |
ReadOperatingTimes | Get times from the controller according to the specified time type. |
ReadSystemParam | Read a system parameter from the controller. |
Get the current state of the controller. This includes the cycle mode, if the controller is running, the control mode, if it is in hold, alarming or erroring, and the servo state.
StatusInfo ReadState(ControllerStateData& statusDataObject)
statusDataObject
[out] Contains the current state of the controller. See ControllerStateData.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
ControllerStateData stateData{};
status = c->Status->ReadState(stateData);
std::cout << status << std::endl;
std::cout << stateData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Running Mode: Cycle
Is Running: false
Control Mode: Remote
Is Program Pendant Hold: false
Is Alarming: false
Is Erroring: false
Is Servo On: false
Get System Information from the controller. This includes software version and model name. Corresponds to Version Information on the programming pendant.
StatusInfo ReadSystemInformation(SystemInfoId sysInfoId, SystemInfoData& systemInfo)
sysInfoId
[in] The type of system information to retrieve. See SystemInfoId.
systemInfo
[out] Contains the system information. The system software version is returned always. If sysInfoId is R1-R8
, the model name is returned. If S1-S24
is selected, modelName will be empty. Model name is limited to 16 characters.
Anything beyond that will be truncated. See SystemInfoData.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
SystemInfoData systemInfoData{};
status = c->Status->ReadSystemInformation(SystemInfoId::R1, systemInfoData);
std::cout << status << std::endl;
std::cout << systemInfoData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Software Version: YAS4.62.00A(JP/EN)-00
Model Name: 1-06VXH12-A0*(GP
Get times from the controller according to the specified time type.
StatusInfo ReadOperatingTimes(ControlGroupId controlGroupId, TimeType timeType, TimeData& timeData, ApplicationNumber appNumber = ApplicationNumber::ApplicationOne)
controlGroupId
[in] The control group to retrieve the time from. Specify for TimeTypes that are not totals or applications, otherwise pass R1. See ControlGroupId.
timeType
[in] The category of time to retrieve. See TimeType.
timeData
[out] Contains the time data if return is successful. See TimeData.
appNumber
[in] If timeType is ApplicationOperationTime, this is the application selection. See ApplicationNumber.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
TimeData timeData{};
status = c->Status->ReadOperatingTimes(ControlGroupId::R1, TimeType::ControllerOnTime, timeData);
std::cout << status << std::endl;
std::cout << timeData << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Start Time Epoch: 1690866000
Elapsed Time: 234 Hours : 44 Minutes : 0 Seconds.
Read out a system parameter from the controller. S1CxG
, AxP
and SxE
parameters require a group to be specified. Use the other overload for these.
StatusInfo ReadSystemParam(SystemParameterType parameterType, INT32 parameterNumber, INT32& parameterValue)
parameterType
[in] The type of parameter to retrieve. See SystemParameterType.
parameterNumber
[in] Index of the parameter to retrieve.
parameterValue
[out] The retrieved parameter value from the controller.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
INT32 parameterValue = 0;
status = c->Status->ReadSystemParam(SystemParameterType::RS, 2, parameterValue);
std::cout << status << std::endl;
std::cout << "Parameter value: " << parameterValue << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Parameter value: 0
Read out a system parameter from the controller with the ability to specify a group.
StatusInfo ReadSystemParam(SystemParameterType parameterType, INT32 parameterNumber, INT32 groupNumber, INT32& parameterValue)
parameterType
[in] The type of parameter to retrieve. See SystemParameterType.
parameterNumber
[in] Index of the parameter to retrieve.
groupNumber
[in] The group number of the parameter to retrieve.
parameterValue
[out] The retrieved parameter value from the controller.
0 if successful, otherwise a StatusInfo object with a description of error.
StatusInfo status{};
auto c = YMConnect::OpenConnection("192.168.1.31", status);
INT32 parameterValue = 0;
status = c->Status->ReadSystemParam(SystemParameterType::AP, 2, 1, parameterValue);
std::cout << status << std::endl;
std::cout << "Parameter value: " << parameterValue << std::endl;
YMConnect::CloseConnection(c);
Output
Code (0): OK
Parameter value: 0