How to reference a DUT from another PLC project - plc

I have created 2 PLC projects. On for the main logic, and the other for visualizations.
Data will be transferred between both projects using input/output. I want to create a motor HMI and have grouped the motor controls in a DUT in the main PLC project.
How can I now reference this DUT in the visualization project?

Just found out the answer myself.
External types
A DUT can be referenced from another project if it as an external type.
Local DUT's can easily be made external:
Right click on the DUT
Press 'Convert to Global Data Type'
The DUT will be moved from DUT-folder to External Types folder, and necessary attributes are automatically added.
See this example.

Related

Separation of the repository by content (separation of parsing and data processing)

The goal of the project is to create a recommender system in which I go through all the stages of building, training a model from collecting and processing data, creating a model to implementing it into a bot.
The problem is that I don't know if it's worth splitting the repository into two, one is responsible for collecting information, and the second for building a model. The resulting model will be used in the telegram bot, so this part of the project must also be placed in the same repository or create a separate one that will copy the model (one file) from their repository.
The first option is not to separate the repository and store parsing, processing and model building in separate folders, but this option is not always convenient, the second option is to create two separate repositories, but then the project building logic will collapse, that is, data collection, this is a strange part of the project, that it is in a separate repository. Does the community have certain rules in such a situation?

How to exclude (ignore) a GIS route programmatically in Anylogic?

While working with Anylogic user can open properties of some GIS route (or some other object) and push checkbox "Ignore". The GIS route will be excluded from the model and after running the model user wont see the object because it wont exist.
Is it possible to exclude some GIS routes in interactive mode? For example I drew in Anylogic big GIS network with many GIS routes and after running the model (!) I want to have a possibility to choose routes which should not be included in the network. E.g. it can be implemented in Simulation window.
I was looking for suitable JAVA code but I did not find anything except Visible-property.
you can not programmatically "ingore" something, this is not how Java works.
In your case, the only way is to create the GIS network programmatically as well at the start of the model. Now you have full control because you could decide to only create part of your network, depending on user choice.
Check the AnyLogic API on how to create GIS routes programmatically.
cheers

Make a pyramid app ready for standalone and embedded mode

I'm developing a wiki engine. Since this application can be usefull (at least for my company's private use) in its own it should be able to run as a standalone pyramid application, with its own graphical theme.
However a wiki feature could also be useful as part of a bigger project, and I would like to be able to include it into other pyramid applications.
I already found some pyramid features that could help me to achieve this but first I'm not sure whether it's the best way to do it and second some problems remain open.
Here are the potential issues I currently see:
templates: how to switch between the standalone mode and the hosted mode
host variables: event if we can reuse the host template, some variables may be needed to correctly render the templates but are not set by the guest (the wiki engine) application.
authentication: the guest app defines its own login system (based on pyramid_persona). Can the guest application reuse the host authentication system?
My current idea is to use the config.include() system of pyramid. In the wiki engine, in __init__.py I then define an include(config) method in addition the the main() method used for the standalone mode.
In the host application I then define a variable in the .ini file which points to the template file that the guest should use (ie base_template = hostapp:templates/wikibase.mako)
Inside the guest application, the includeme() method reads the base_template variable and overrides some global config.
Then each guest view work like this:
from pyramid.renderers import render
#view_config(route_name="display_wiki_page", renderer=Globals.base_template)
def view_wiki(request):
"""returns a formatted page content"""
page = request.matchdict['page']
content = get_raw_page_content_from_database(page)
page_formatted = render("wikiengine:templates/page_formatting_template.mako",
{'request': request, 'content': content} )
return {'page_formatted': page_formatted}
So from this point the base template can either be the one from the guest or the host application. Both will contain something like (in mako): ${page_formatted | n }
But this does not solve the problem of necessary host variables for the template to be rendered by the guest code. For example the host may need to have a hot_news variable that need to be displayed on each of the host pages, even the pages that host the wiki.
For this I plan use the event system, and add a subscriber for NewRequest or BeforeRender and set the needed variables here inside the request object.
Is this a correct approach ? Are there examples of what I'm trying to do?
Pyramid's configuration mechanisms make it very easy for clients of a module to override configuration. This is one of the most powerful parts of Pyramid compared to other popular web frameworks.
config.include() is a good approach to solving the problem. It allows the caller to override anything defined within the include.
Assets can be overridden using config.override_assets().
Sharing user information requires your module to either provide the user information or define a contract to which someone can conform allowing them to override your model.
Anyway this is obviously a huge topic. Highly modular apps written on top of pyramid include substanced, kotti, ptah, bookie, etc.

How to make an external requirement internal

I'm using version 8.0.858 of Enterprise Architect and I am hoping someone knows how to make an external requirement internal again.
I have searched thru the EA user guide, and this tells me how to make an internal requirement external, but is silent on how to reverse the process.
I have hundreds of requirements linked to Use Cases where the requirement is marked as external, but they shouldn't be as they each only relate to one Use Case.
Here's an example of what I'm talking about
This makes it difficult to get an overview of what the Use Case requires because when you click on an external requirement, the description does not show up in the textbox, and you have to double-click it to open in a separate window.
My only thought is to hack the database in Access, but I'd rather not if there is any UI functionality. That said, if you have know how to edit the database directly to achieve my goal, then that would be a valid solution too.
To my knowledge this isn't possible, for the reason #observer notes. External requirements are model elements in their own right and thus have far more information associated with them than internal requirements do.
External requirements (and other model elements) are stored in the t_objects table, while internal requirements are in t_objectrequires. Connectors are in t_connector.
I'd advise against trying to hack the database directly. Use the automation interface instead (it can be accessed from an in-EA script); look at the Element and ElementRequirement classes.

What do you mean by Export Change in Managed Exensibility Framework?

I'm new to MEF. In Managed Exensibility Framework, what do you mean by events exportschanging and exportschanged. How one can visualize it?
In the Managed Extensibility Framework, objects are wired together by matching imports with exports. I assume you already know about that. (If not, you should read through the MEF programming guide first and play with MEF a bit.)
In a typical scenario, exports are provided by a catalog of types. Some of these catalogs can be changed while the application is running, at which point the application might be recomposed.
Here are two examples of modifying a catalog:
DirectoryCatalog.Refresh() (this will rescan the directory and pick up new assemblies)
AggregateCatalog.Catalogs.Add
When this happens, the CatalogExportProvider based on the catalog will trigger the ExportsChanging event right before handling the change, and ExportsChanged right after.
Not all export providers have to be based on catalogs, but I hope you get the idea.