PDA

View Full Version : Controlling a MM440 drive with Visual Basic


Combo
March 16th, 2005, 03:02 PM
Hi,

I want to control a MM440 frequency drive from siemens. The Master is a 315-2DP PLC. The drive is coupled on profibus.

I have Simatic Net installed and The WOrkstation is configured, but I didn't check the data yet in OPC Scout.

I want to connect my laptop on profibus and use some scada with visual basic and the OPC server.

I have tried to program something, but now; how can I throw my value 0-100 to a DBx.DBxx.x or Merkerword and how can I send the start bit ?
How can I get the actual speed; same problem; I need to read to a DB, but does anyone has an example of how it's done ?

dchartier
March 16th, 2005, 10:14 PM
Hello Combo;

Have a look at the Downloads section of this forum (look at the menu bar under the Thread banner). You will find in the Siemens section a zipped project named MM4_Prof. Study it. Also, look at previous threads on Siemens drives on the forum.
In order to control a drive over Profibus, you must first understand addressing of the drive and PPOx profiles(this determines the amount and type of data to be exchanged between the master and the slave MM4 drive). You must also know where to write the speed setpoint and the bitwise command word (start/stop/ jog) [this is where Profibus configuration and addressing come in].
Once you understand the basic scheme, all you will need to do with your VB application is read/write correct values to the specific memory locations reserved for the drive.
Hope this helps,
Daniel Chartier

Combo
March 16th, 2005, 10:49 PM
well, I know the PPO types.

I use PPO1

My problem is related in Visual Basic and OPC

In the PLC my actual value is written in DB10.DBW20
The setpoint is written in DB10.DBW30

The on/off bit = DB10.dbx10.0


My problem is that I never worked with OPC, I don't know how to read and write data from a PLC in a Visual Basic program...

dchartier
March 16th, 2005, 11:19 PM
Hello combo;

In the same Downloads area (Siemens) you will find a document by seppoalanen called How to set up OPC with Simatic Net. It should help you with the first part of your problem. I am not able to help you with the VB programming side, but other ressources here can probably point you in the right direction once comms have been established with the OPC client.
hope this helps,
Daniel Chartier

JesperMP
March 17th, 2005, 01:03 AM
Ahem, that guide is by ME !

Oh never mind.
I have a few comments in addition to the instructions in the guide.

1. Because you want to have everything on the same Profibus net (PLC+HMI+MM440) I suggest that you do the whole thing as an "integrated" project in STEP7. The example in the guide assumes an online connection (MPI or Profibus) with nothing else on the network (no slaves), so it doesnt cover this situation.
The reason why this is important is that, for each master, the socalled "token rotation time" must be calculated. By integrating this into one project, this will be done automatically.
Sidenote: You have the option of either letting your PC be a Profibus slave or a Profibus master.
The easiest is to let it be a master, however this (multi-master) makes the entire Profibus network work slower by a factor 3-10. It may not be important at all as Profibus is quite potent at the typical 1.5 Mbaud. It may also be critically important. You decide.
You can also set the HMI up as i slave. For the 315-2DP the HMI will then appear as regular i/o on the network.

2. You CAN let the MM440 be controlled directly from the HMI software. But the "classical" approach is to let the PLC do all the interlocking and control, and let the HMI only be a kind of "pushbuttons and lamps" on a PC.
Good luck.

dchartier
March 17th, 2005, 01:16 AM
Hello Jesper;

Sorry about the misquote. By the way, the guide is remarquably well done and complete. Good show once again.
Later
Daniel Chartier

JesperMP
March 17th, 2005, 01:16 AM
Hello again combo.

It just occurred to me that the 315-2DP has an MPI port as well as the DP port.
You may want to connect your HMI PC via the MPI port and not the DP port, in that case the guide is quite complete.
I normally recommend to split i/o networks and higher level networks from each other. That mans that a goofup on one network will not lay waste to the other.
Of course the major disadvantage is that the MPI port on this CPU is limited to 187.5 kbaud.

edit:
Dont worry Roy, err.. I mean Daniel. ;)

Combo
March 17th, 2005, 02:26 AM
I know I can work integrated, and that an HMI device is a solution for controlling and reading variables.

But it's not a project, just a little test, I really want to control it with my written Visual Basic application. But what should I write i the code

OPC is configurated.

JesperMP
March 17th, 2005, 02:30 AM
For OPC and VB, try this:
http://www.opcconnect.com/tooltech.php#vb

Combo
March 17th, 2005, 05:19 AM
looks useful, I will try it, thanks