AnsweredAssumed Answered

Connect to PI using matlab when user is outside domain

Question asked by piotrszelag on Jun 8, 2016
Latest reply on Jun 17, 2016 by piotrszelag

Hello

I wrote script in matlab basing on White Paper - Using PI Data with MATLAB

It is working when I am at work (in domain), but when I am trying to connect (through VPN, using trust) from home script didn't work.

I searched information and I think that I know where the problem is but I can't how to write some code lines

so I will be grateful for your help.

 

Part of my script

 

% załadowanie sdk

afsdk = NET.addAssembly('OSIsoft.AFSDK');

import OSIsoft.AF.*

import OSIsoft.AF.Asset.*

import OSIsoft.AF.Time.*

import System.*

% stworzenie obiektu reprezentującego systemy AF

af_serwery = PISystems

%stworzenie pojedynczego serwera poprzez właściwość domyślnego serwera

af_serwer=af_serwery.DefaultPISystem

here is the problem because when I write  command af_serwer.IsConnected  the answer is 0

I found that I should connect using NetworkCredential PISystem.Connect Method (NetworkCredential)

but I don't know how use it in Matlab   (I can't find NetworkCredential object)

 

and mayby there is other way, for example setting trust to connect to PI AF

for now my trust looks like below (CZERWONY is the name of my laptop)

when I am starting PI System Explorer I must to write name and password every time (when I connect to server through VPN)

Outcomes