Modelica nested/combined connectors - modelica

I have some Modelica components that need to be connected twice, with two different connectors (lets call them typeAconnector and typeBconnector). Is there a way to build a "super-connector" that internally uses the two connectors?
The goal would be to have
connect(component1.superconnector, component2.superconnector
automatically translated into
connect(component1.typeAconnector, component2.typeAconnector);
connect(component1.typeBconnector, component2.typeBconnector);
Ideally, it should still be possible to do connect(component3.typeAconnector, component2.superconnector); and only the typeA subconnector part will be used.
I assume this is not possible, at least I have no idea where to start, any hints or workarounds or partial solutions welcome. Thanks.

Related

Using expandable connector to build control bus in Dymola

I am learning about how to use the expandable connector in dymola.
I am wondering how to ensure the compatibility between two control buses. My guess is that if I define an input variable called X in one control bus, then in the other one, I need to define an output variable also called X. So that when connecting these two control buses, they are coherent.
Based on the above idea, I define the two expandable connectors which represent the control buses, here is the screenshot.
Here is the setting I used when testing my ideas.
But when translating the model, I got an error message like the following. It seems I got the logic wrong. My question is that how should I use the expandable connectors so that they are coherent.
The underlying problem is that there are two public expandable connectors (buses) at the top of the model; and both could in theory be connected from the outside.
The best option would be to not have two public buses at the top of model, e.g.:
Remove one of the two buses
Make one of the two buses protected
(Or more complicated hierarchical variants.)
The VehicleInterfaces library does this in a good way (alternatively you can look some of the commercial libraries).
However, simplest way of making this work is to not declare anything in the buses, i.e. remove the declaration of both 'x' variables.

Spring Batch: dynamic composite reader/processor/writer

I've seen this (2010) and this (SO, 2012), but still have not got the answer I need...
Is there an option in Spring Batch to have a dynamic composite reader/processor/writer?
The idea is to have the ability to replace processor at runtime, and in case of multiple processors (AKA composite-processor), to have the option to add/remove/replace/change order of processors. As mentioned, same for reader/writer.
I thought of something like reading the processors list from DB (using cache?) and there the items (beans' names) can be changed. Does this make sense?
EDIT - why do I need this?
There are cases that I use processors as "filters", and it may occur that the business (the client) may change the requirements (yes, it is very annoying) and ask to switch among filters (change the priority).
Other use case is having multiple readers to get the data from different data warehouse, and again - the client changes the warehouse from time to time (integration phase), and I do not want my app to be restarted each and every time. There are many other use cases, of course. plus this.
Thanks
I've started working on this project:
https://github.com/OhadR/spring-batch-dynamic-composite
that implements the requirements in the question above. If someone wanna contribute - feel free!

Quill and different options for contexts

using Quill+Scala in one project I am working with, but I find Quill's scala documentation very poor.
In their website, there are basically three context types for interacting with Cassandra: CassandraSynchContext, CassandraAsynchContext, and CassandraStreamContext. While names are suggestive, I need all the information I can get. E.g., what does stream mean here? What are the properties in async calls, how to get exceptions, etc.
So, in a sense, I am interested in any reliable documentation pointing out the key differences between all three contexts. Any help is useful at this point.
Thanks.

Generating sub-systems based on user input (MATLAB/SimMechanics)

The user in this webinar;
http://www.mathworks.com.au/videos/parameterizing-bodies-68850.html?form_seq=conf1134
can create new levels of links for the scissor lift by copy pasting the sub systems.
I was wondering if there was any way the number of subsystems and the joints could be automated via user input.
i.e a gui which allows the user to input the number of levels in the scissor lift and that number of levels (subsystems) is generated in SimMechanics.
If someone could provide a solution I could adapt it to the problem I'm trying to solve.
Thanks in advance!
Yes, you can automate it, as long as you know what susbsytems and what joints you want to add. The functions of interest are:
add_block(path_to_your_subsystem,path_to_destination_subsystem) (I assume your susbsystem is stored in a library). You probably want to specify the 'Position` parameter so that all blocks don't end up on top of each other. It will take some experimenting to find coordinates that work for your model and that are parameterised based on the number of susbystems to add.
add_line(path_to_subsystem_of_interest,path_to_output_port,path_to_input_port). You'll need to know which port you want to connect to which and figure out how many times you need to do this based on the number of subsystems to add. Simscape and SimMechanics are a special type of ports, and you need to refer to them correctly otherwise it won't work, see Programatically connect two subsystems for more details (note: this is undocumented as far as I know and is therefore likely to change in a future release).
So in short, yes it's possible (I've done it in the past), but it's by no means easy. See this blog for a very simple introduction.

How many IDL files are needed when there are multiple components in a distributed system?

This is the scenario.
There are three components, A, B and C.
Component A can access methods of component B.
Component B can access methods of component A and component C.
Component C can access methods of component B.
To implement this scenario how many interface description language (IDL) files are needed? How many stubs and skeletons do we require?
I was thinking four IDL files. But can we have multiple stubs and skeletons?
Depending on the size of your services/components (number of methods), I would rather try to split them into logical units rather than based on the number of computers you want to connect.
For example, it can make sense to have two different services implemented by the same server: One for internal purposes and one that is to be published. Or a service is split into two parts, because these two parts do not really belong together logically, although they are for some reason implemented by the same component. All of these services may or may not share the same IDL file.
Last not least, if you still want to minimize the amount of files, keep in mind that declaring, publishing and knowing about a certain service interface does not imply, that a given component must implement the service, must be able to reach the service, wants to use the service, or is allowed to call it.