# How can I disable a Device in Cimplicity by Basic Control

Z
Thread Starter

#### Zuozh

In my project, I don't want the Operator use Work Bench to change something. But I found if there is any unable device in the run time, the speed that I set point will become slower than all the device avilible, if I make the unable device disabled in the Work Bench, the speed will become normal.

My problem is if I can make a script to disable some device instand of setting them disable in the Work Bench?

E

#### Eric J. Feight

You will need to work with the Cimplicity Object Model. Good Luck! I cannot find much documentation on the minute details for this. My best success (believe it or not) has been calling the Cimplicity Hotline. They usually have an app note that isn’t published that they will e-mail you. Sometimes it takes several calls to get the person who knows what you want to do.

Here’s a trick that I just learned recently. If you have several PLCs on the same port, Ethernet for example, define a separate port for each one even though they are all connected to the same physical NIC in your computer. This way if a device is not available it will not affect scan rates of other devices on the network.

Hope this helps.

Z

#### Zuo Zhihui

Thanks for Help! I have try the way you told me,
it works! But I don't know why it works? Do you know it?

E

#### Eric J. Feight

I’m glad it worked out for you! Yes, in general I do know why it works. It is my understanding that a “Port” will scan all “Devices” that are linked to that port. If the communications driver does not get a reply from a specific device, the scan will halt while several retries are made. I believe this is the “Retry Count” parameter set in the General tab of the Port Configuration dialog box. If a device is off line, this will happen continuously impacting the update time for all of the devices that are on-line. Cimplicity takes advantage of a multitasking architecture. Multiple ports can be scanned at the same time (in a virtual sort of way). If you have all of your devices on separate logical ports, a single device being off line will only affect the scan rate of the port it’s on, leaving the scan rate of all the other ports unaffected.

If you look at things in the minutest detail, your update rates are slightly slower if all devices are functioning properly and online all the time. Just more overhead to service all the ports. From what I’ve seen the difference is so slight that I have never been able to notice it. And, of course, you have already seen the impact of a device being unavailable when everything is on the same port. The benefits of multiple ports are worth it.

It would have been cool to find a way to disable it from a VB script. You may also have spent a lot of time going down a dead end. I did a project about a year or so ago where I wanted a way to be able to reassign the device and/or port that alarms were printed to. I was sure that this had to be a property or method of some kind of alarm or event object. After a lot of hours and several e-mails I was told that the properties were not exposed at runtime. Dead End. I had to give access to the Workbench. Not only that, but you have to stop the project do a configuration update and restart the project for the changes to take affect. The same may also be true in your case.

P

#### Pete Sage

That's pretty easy to do. But then again I was the guy who wrote the configuration object model for CIMPLICITY.

You'll need the lastest service pack of 4.0 or if on 5.0 your already all set.

The easiest way to run the script is going to be from the Event Editor in the project. You can do it directly from a viewer via scripting but this requires having DCOM working which can be a challenge (either it works or it don't.) What I'd recommend doing is having a virtual point that the user can set to enable or disable the device. In the event editor, trigger a script sort-of-like this one when it runs.

Sub Main()
Dim p as CimProject
set p = CreateObject("CimProject)
p.OpenLocalProject environ$("SITE_ROOT") & environ$("PROJECT")

' Enable dynamic configuration - you'll need
' some credentials.
p.ProjectUserName = "ADMINISTRATOR"
p.ProjectPassword = ""
p.DynamicMode = TRUE

Dim d as CimDevice
set d = P.Devices.Item("MyDevice")
d.Enable = FALSE ' Disable the device
' Save the changes dynamically
p.devices.Save d, TRUE
End Sub

End Sub

PS (look in the cimserver-odl.hlp file for the docs)

Y

#### YS Lee

I'm using Cimplicity in Windows 2000. Whenever I try to access properties of CimEvent such as ID, Enabled, TimeInterval...., the Program
Editor compiler will say "Error 57 in line xx: Id/Enabled/TimeInterval/... is not a property of the object". Can you please help?

YS Lee

Similar threads