Build-in unit conversion in SimBiology
4 views (last 30 days)
I wonder if you can provide resource with proper definition of units. What one gets with sbiowhos -builtin -unit does not make sense to me.
Below I extracted time related units - the 'Composition' column content would mean that e.g. 'hour' and 'second' are independent and no unit conversion is performed. Could you clarify how unit conversion works in SimBiology?
SimBiology Built-In Units:
Index: Name: Composition: Multiplier:
10 day day 1.000000
20 hour hour 1.000000
31 minute minute 1.000000
Arthur Goldsipe on 21 Jul 2022
You can see the relationship between two by using the function sbiounitcalculator, which shows you that 1 day is equal to 24 hours, that item and molecule are equivalent, and that mole and gram are not dimensionally consistent:
sbiounitcalculator('day', 'hour', 1)
sbiounitcalculator('molecule', 'item', 1)
sbiounitcalculator('mole', 'gram', 1)
I'm not realy sure how to answer the question "How does unit conversion work in SimBiology?" I'm a developer of SimBiology, so I know about all the internal details of how unit conversion currently works. But I hope that you don't need to know about all those details. And those details might change over time, so it's better if you don't learn to rely on them. I'd also like unit conversion to "just work" without your having to think about it or needing to ready any documentation.
But I do understand and agree that SimBiology's unit conversion is not always understandable. For example, I find it confusing when a unit like minute is defined in terms of itself. I believe you will only see this sort of circular defintion for a builtin unit that corresponds to either one of the 7 fundamental physical quantities (time, length, mass, temperature, current, light, and quantity of substance) OR is simply dimensionless. However, as you see we have several time units that can be interconverted. I think it would have been better if SimBiology had said that day is defined as 24 hour, hour is defined as 60 minutes, and so forth. We'd still need one unit for each fundamental quantity that could not be defined in terms of any other unit. If you think that would be a useful change, let me know.
If you want to check explicitly whether two units (or compound unit expressions like mole/liter) are dimensionally consistent and see how to convert between those units, then you can use the function sbiounitcalculator. This function will error if either unit expression is invalid or if the two unit expressions are not dimensionally consistent. Otherwise, it will convert a number from one unit to the other, such as converting 2 days to 48 hours.
If you have any remaining questions about unit conversion, please ask. It would help me if you can tell me a little more about the larger workflow of what you're trying to do. Then I will have a better idea of how we can improve SimBiology and its documentation.