Skip to content
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

Signal Input Ports constrained to default units. #2027

Open
OwenDavid opened this issue Dec 29, 2020 · 2 comments
Open

Signal Input Ports constrained to default units. #2027

OwenDavid opened this issue Dec 29, 2020 · 2 comments
Labels
components Code, XML, Animation, Libraries, Math Utilities simulation Simulator and core modeling capabilities and behavior

Comments

@OwenDavid
Copy link

When we modify the parameters of an object we are often able to choose the input units.

For example, the C_type_Pressure_Source has an input variable P, which can accept a pressure value in bar, psi, pascals, etc. This is very useful and thankfully extends across the library.

However, when we connect a signal source to the same object via a variable input port it only accepts the default unit.

So if I had setup my C_type_Pressure_Source with a pressure of 80 bar and then decided to ramp it with a signal I would have to send the ramp signal in Pascals. This gets complicated especially with flow rate conversions, ie. 80 l/min = 0.001333 m^3/s

Is it possible to add a feature that enables the signal input to be in the selected units and not the default units?

This would make the system setup and signal routing much more intuitive.

@robbr48 robbr48 added components Code, XML, Animation, Libraries, Math Utilities simulation Simulator and core modeling capabilities and behavior labels Jan 4, 2021
@robbr48
Copy link
Contributor

robbr48 commented Jan 4, 2021

This would indeed be useful. The problem is that components access the node data directly through pointers. There is no instance between the data storage and the component where the unit conversion can take place. Hence, the only solution I see would be to implement the unit conversion in the component source code. Not impossible in any way, but the available units would need to be hard-coded and it needs to be implemented individually for each component.

Perhaps we can do this only for certain components, like pressure sources and flow sources. This would be especially useful for people who are used to work with units that are not SI-compatible, like psi.

@peterNordin
Copy link
Member

I guess one way of doing it would be to automatically create a "semi-hidden" signal gain component in the "background".
Either on the input or output signal.
But we then need to figure out a way to visualize this, and prevent invalid connections where scaled units are mixed.

The only "easy" way right now is to put a Gain component on the signal line and manually set the scale value.
Then name the scale in a way that makes it obvious what input/output units are expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
components Code, XML, Animation, Libraries, Math Utilities simulation Simulator and core modeling capabilities and behavior
Projects
None yet
Development

No branches or pull requests

3 participants