LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using PLCSim ActiveX Control in LabVIEW

Hello.

 

I'd like to connect Simatic PLC Simulator (PLCSim) to LabVIEW via its ActiveX Control. I successfully inserted the ActiveX Object to VI using Automation Open object. I made a Invoke Node to read data from PLCSim. The ActiveX Control uses pointer method to give or get data. In C++ language, the function has defined as following:

STDMETHOD(CS7ProSim::ReadFlagValue)( long ByteIndex,
                                     long BitIndex,
                                     PointDataTypeConstants DataType,
                                     VARIANT* pData)

The first three inputs can be inserted correctly but the 4th input is a pointer. In ordinary languages like C++, you must first allocate memory for a variable and then use that variable as ReadFlagValue's 4th input to read data.

In LabVIEW, the pData in ReadFlagValue Invoke Node has one input and one output and colored in violet.

Now I don't know what I should I set as its input? Can LabVIEW handle pointer data in ActiveX Controls?

 

0 Kudos
Message 1 of 11
(3,821 Views)

Hi imanh,

 

Sorry for the delay in getting a response to you, I'm just letting you know that I'll be looking into this for you now, and will let you know if I find a solution for you. 

 

Whilst I'm trying to work this out for you, if you could provide me with what LabVIEW version you are using, that would be great. If you have any additional information to add please feel free to post back as I will be monitoring the thread now. 

 

Kind regards,

Matt H
Applications Engineer
National Instruments UK
0 Kudos
Message 2 of 11
(3,735 Views)

Dear Matt,

Thanks a lot.

I am using LabVIEW 2011.

0 Kudos
Message 3 of 11
(3,731 Views)

Hi imanh, 

 

would you mind attaching your VI as it currently stands so that I can open it in my LabVIEW environment? 

 

Many thanks,

Matt H
Applications Engineer
National Instruments UK
0 Kudos
Message 4 of 11
(3,711 Views)

I attached the vi. I also included the PLCSim DLL but I am doubted if it works without PLCSim being installed.

Thanks.

Download All
0 Kudos
Message 5 of 11
(3,705 Views)

Hi imanh,

 

By the sounds of it You're communcating using the feature s7prosim, Have you seen the documentation on this that can be found here?

 

That manual references pdata and what it is, and might be helpful in understanding its use. 

 

Kind regards,

Matt H
Applications Engineer
National Instruments UK
0 Kudos
Message 6 of 11
(3,688 Views)

I've read the documentation. I think there is a problem in variable declaration. I can not read data via S7prosim neither with LabVIEW nor with MATLAB. I think it should be used with middle-level languages such as VC++.

 

Thanks very much for your attention.

0 Kudos
Message 7 of 11
(3,665 Views)

Hi imanh,

 

There is a previous thread that is a discussion on how to connect to S7prosim, there are some links on this thread concerning connecting to a PLC that you may find useful. 

 

Kind regards,

Matt H
Applications Engineer
National Instruments UK
0 Kudos
Message 8 of 11
(3,600 Views)

Thanks!

 

I used OPC protocol instead and now everything is under control.

0 Kudos
Message 9 of 11
(3,597 Views)

Glad to know you got it working! If you have found any resources that you found useful in solving your particular problem, it would be great if you could post them on the forum so people can find this solution quickly in the future. 

 

Kind regards,

Matt H
Applications Engineer
National Instruments UK
0 Kudos
Message 10 of 11
(3,594 Views)