Skip to content

Clean up confusing terminology in API #767

@kyllingstad

Description

@kyllingstad

As the libcosim API has grown, it has grown messy and unintuitive in places (as APIs tend to do). I am therefore opening this issue to highlight the current issues with it and to get feedback and suggestions for a possible future refactoring. This is by no means urgent, it's more on the “things to consider before a 1.0 release” list.

The most annoying part of it (to me, at least), is the whole simulator/slave stack. Here, we have two interfaces, simulator and slave, each of which has a purpose to serve, but the names do not make those purposes nor their differences evident in any way. Not to mention slave_simulator, the (only) implementation of the former interface, which only confuses things even more. Why the FMI-based slave implementation should be called slave_instance is not crystal clear either. Layer mix-ups aside, the names have their individual issues too. simulator represents a subsimulator, but the name would be equally good for the whole co-simulator. We have slave, but we don't have a master. And so on.

Then there is model, which is the blueprint for a slave. (That is, a slave is an instance of a model, and multiple instances can be created based on the same model.) But the term strongly suggests that the entity in question is based on a mathematical model, which need not be the case. For example, it could be an interface to a hardware device. A similar blueprint/instance relationship applies to functions, which were a late addition to the library. There, we use the names function_type and function, respectively. Perhaps something similar could be used for subsimulators?

FInally, I am not too fond of execution. If I remember correctly, we borrowed it from HLA terminology, but it does not seem to have caught on in the FMI sphere. And even though I wrote the code for that class and have been using it for years, it still feels strange to me.

I have some ideas for improvements, but I'll save them for the comments below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussion neededLet's have a discussion about thisenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions