2 Engineering
2.1 Configuration in the TIA Portal
The enclosed TIA Portal project does not require any further configuration.
If you create your own project, make the following settings in order to simulate with S7-PLCSIM Advanced.
你下载的博图项目不需要做任何设置。
但是如果你创建的博图新项目,则需要做下面图片所示的设置。
1.通过右键单击项目,打开项目的上下文菜单。
2.单击“属性”。
1.选择“保护”标签。
2.启用“块编译期间的支持模拟”选项框。
3.确认为“OK”
2.2 Programming in Visual Studio
2.2 Programming in Visual Studio
The Visual Studio project included facilitates your access to programming a S7-PLCSIM Advanced application with a co-simulation.
In the Visual Studio project some basic functions are already programmed, for example,
switching on virtual controller and exchanging I/O data.
With this Visual Studio project you can develop your applications further.
In chapter 2.2.2 to 2.2.4 you find an overview of the C#- and API functions that are programmed in this application example.
Visual Studio项目有助于编程S7-PLCSIM Advanced应用程序,并且与协同仿真一起使用。
Visual Studio项目中已经编程了一些基本功能,例如启动虚拟控制器和交换I/O数据。
此外,在第2.2.2到2.2.4章节中,您将找到本应用示例中编程的C#和API函数的概述。
这表明文档提供了关于如何使用Visual Studio项目进一步开发应用程序的详细信息。
功能 | 描述 |
---|---|
启动虚拟控制器 | 通过Visual Studio项目中的代码可以启动虚拟控制器。 |
交换I/O数据 | 项目中已经包含了交换输入/输出数据的代码。 |
C#和API函数概述 | 第2.2.2到2.2.4章节提供了关于如何使用这些函数的详细信息。 |
2.2.1 Integrating the API library
Note
For the path to be updated in the included project you have to delete the existing reference to the library “Siemens.Simatic.Simulation.Runtime.Api.x64” and integrate it again.
Table 2-2: Integrating the API library
2.2.2 Overview user interface
In graphical user interface of the external application,
commands (1) are integrated to interact with the virtual controller (PLC Instance) and the co-simulation. The list box (2) shows info and error messages.
The text field (3) shows the respective status.
Figure 2-1: GUI
Table 2-3: Commands
2.2.3 Programming the PLC instance
Creating an instance
Table 2-4: Class “MainWindowViewModel.cs”
Table 2-5: Class “PLCInstance.cs”
2.2 Programming in Visual Studio
Unregistering instance
Table 2-6: Class “MainWindow.xaml.cs”
The application is closed with the “EXIT” button or with the “close” icon of the user interface.
This triggers the “Window_Closing” event
Switching on instance
Table 2-7: Class “MainWindowViewModel.cs”
Table 2-8: Class “PLCInstance.cs”
Switching off instance
Table 2-9: Class “MainWindowViewModel.cs”
Table 2-10: Class “PLCInstance.cs”
Starting instance
Table 2-11: Class “MainWindowViewModel.cs”
Table 2-12: Class “PLCInstance.cs”
Stopping instance
Table 2-13: Class “MainWindowViewModel.cs”
Table 2-14: Class “PLCInstance.cs”
Exchanging I/O data
Table 2-15: Class “PLCInstance.cs”
2.2.4 Programming the co-simulation
Simulation parameters
Table 2-16: Class “MainWindowViewModel.cs”
Data exchange
Table 2-17: Class “MainWindowViewModel.cs”
Table 2-18: Class “PLCInstance.cs”
Simulation program
Table 2-19: Class “Cosimulation.cs”

