On a KUKA KRC1 running KSS V4.1.7 SP08, direct access to $DATE.HOUR can produce the message Access to component inadmissible. Copy the complete $DATE structure into a declared DATE variable, then read the Hour component from that copy.
Identify the KRC1 access failure
The failing SPS logic accesses a component of the system variable directly:
IF ($DATE.HOUR==0) THEN
I[2]=I[1]
I[1]=0
ENDIF
This direct form is reported to work on KRC4, but KSS V4.1.7 SP08 on KRC1 rejects it. The evidence also reports successful direct access on a KRC2 running KSS 5.6.6, so do not treat the KRC1 result as behavior shared by every KSS generation.
Copy $DATE before selecting Hour
Declare a variable with the DATE data type, assign the complete system date structure to it, and access the component through the local copy:
DECL DATE _Date
_Date = $DATE
IF (_Date.Hour == 0) THEN
I[2]=I[1]
I[1]=0
ENDIF
The confirmed workaround changes only the access path: $DATE supplies the complete structure, while _Date.Hour supplies the hour value used by the condition.
Apply and verify the workaround
- Replace the direct
$DATE.HOURreference with a declaredDATEvariable. - Assign
$DATEto that variable before evaluating itsHourcomponent. - Confirm that KSS accepts the code without
Access to component inadmissible. - Verify that the intended assignments execute when
_Date.Hourequals0.
This evidence confirms the workaround for KRC1 with KSS V4.1.7 SP08. It does not establish which internal compiler or system-variable restriction causes the direct component-access failure.
FAQ
Why does $DATE.HOUR fail on KUKA KRC1?
On KSS V4.1.7 SP08, direct $DATE.HOUR access can return Access to component inadmissible. The available evidence confirms the behavior but does not identify its internal cause.
How do I read the current hour in KRC1 KRL?
Declare a DATE variable, execute _Date = $DATE, and then read _Date.Hour.
Does the KRC1 workaround also apply to KRC2 and KRC4?
It is required by the reported KRC1 KSS V4.1.7 SP08 case. Direct $DATE.HOUR access was reported working on KRC4 and on KRC2 with KSS 5.6.6, so test the syntax on the installed controller and KSS version.