Cancel
Showing results for 
Search instead for 
Did you mean: 

SetModelingScope and CreateLogicBehavior

Hi,

 

I'm experiencing some issues with setting modeling scope and creating logic behavior on TxDevices.

 

With a TxDevice called Device, and a TxPlcLogicBehavior called plb, I'm running the following lines:

Device.SetModelingScope();

plb = Device.CreateLogicBehavior(new TxPlcLogicBehaviorCreationData("Actions"));

After the first line, I would expect either that the modeling scope would be set, or an exception raised, which does not always appear to be the case. With the study I was using for development it worked, but in a subsequent study for each of the devices, checking Device.IsOpenForModeling returns false for every device.

 

Furthermore, after the second line, I would have expected either that the device would have a logic behaviour attached, or an exception should be raised. Again this appears not to always be the case, this time on a device-by-deice basis rather than a study-by-study basis. On investigation it appears that if Device.CanBeModified is false, CreateLogicBehavior fails but does not give any indication that it has done (i.e. no exception).

 

Any pointers as to what it is about the study that causes SetModelingScope it be ineffective would be appreciated.

3 REPLIES

Re: SetModelingScope and CreateLogicBehavior

Valued Contributor
Valued Contributor

Hi, Cypherspaceman!

 

After you have set the device in the modeling you can check the property IsOpenForModeling to verify, that the device really opened for modeling.

 

Best regards,

Witalij

Re: SetModelingScope and CreateLogicBehavior

Hi Witalij,

 

Yes, that is what I was doing, but I'd like to know why it sometimes works and sometimes does not, and what needs to be done to get it to work.

 

Best Regards,

 

Andrew

Re: SetModelingScope and CreateLogicBehavior

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi  Cypherspaceman,

 

If you manually try to open the problematic device for modelling, do you get any message?

 

Best Regards,

DianaG