-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SSP] Support linear transformations #451
Comments
#378 discussed some ways of doing this, but now I'm sitting here not seeing how it should be done. But how the heck can I access |
I'm going to make a PR using a connection type for this.. |
I think we need to have a discussion on how to go about this. The current architecture may not be be suitable for solving this in a good way. |
And this is a use case:) We need to solve this using FMUs today. |
I still think #379 was perfect for this use case, but lets discuss this next meeting. |
I agree. The problem necessarily extends to the CSE config format and |
I'm looking at the SSP standard now. The xml would seemingly look something like this: <ssd:Connection startElement="A" startConnector="out" endElement="B" endConnector="in">
<ssc:LinearTransformation factor="1.9" offset="3.5"/>
</ssd:Connection> The standard states that (automatic) unit conversions must be performed on the output, prior to applying any linear transformations. The standard does not seem to be clear on where any linear transformation should be performed, which creates some wiggle room for us. IMO, the concept presented in #379 tries to solve too many problems at once. Given the current architecture, implementing the transformation as a |
#include <cse/connection/linear_transformation_connection.hpp>
#include <cse/error.hpp>
namespace cse
{
linear_transformation_connection::linear_transformation_connection(variable_id source, variable_id destination, double offset, double factor)
: scalar_connection(source, destination)
, offset_(offset)
, factor_(factor)
{
CSE_INPUT_CHECK(source.type == variable_type::real);
}
void linear_transformation_connection::set_source_value(variable_id, std::variant<double, int, bool, std::string_view> value)
{
value_ = std::get<double>(value) * factor_ + offset_;
}
} // namespace cse
|
No description provided.
The text was updated successfully, but these errors were encountered: