09-02-2022 08:35 AM
I met an issue when i try to change the storage path for data access. In my project, VPB40 and hot-plug mPad are used. There are two ethernet adapter on VPB40, C Lan uses IP '10.172.10.120', S Lan uses IP '192.168.212.33'.
The default data storage path is '\\%PlcHost%\OpconData$\DocuData\', PlcHost is set as 10.172.10.120.
Since there is a hot plug mPad in this project and mPad is connected to S Lan, both HMI on mPad and VPB40 have to get access to OpconData folder. If i set storage path to be '\\%PlcHost%\OpconData$\DocuData\', HMI on mPad could not get access to the data folder. Thus, i tried to define a global variable MpadPlcHost which is initialized in Plc main function with '192.168.212.33'. At the same time, i change the storage path to be '\\%MpadPlcHost%\OpconData$\DocuData\'. However, neither HMI on VPB40 nor mPad could not get access to Data folder.
After that i tried to replace the storage path to be ' '\\192.168.212.33\OpconData$\DocuData\'', both HMI on VPB40 and mPad have access to data folder.
My question, why it did not work with the storage path '\\%MpadPlcHost%\OpconData$\DocuData\'?
09-02-2022 10:13 AM
The keyword %PlcHost% is replaced with the hostname or IP address configured for the target system where the PLC runtime is located by OES when exporting the HMI and DatAccess configuration, not at runtime. It has nothing to do with a PLC variable, and obviously inventing new keywords doesn't work.
Best practice is to configure the hostname instead of the IP address at the target system hosting the PLC. In this case, you can use %PlcHost%. But the way you did it should also work.