Ymit24 / too-hot-to-prandtl-control-system

GNU General Public License v2.0
0 stars 0 forks source link

Create proper physical units #3

Closed Ymit24 closed 6 months ago

Ymit24 commented 6 months ago

What?

Create proper physical unit based types to represent input and control signals. Originally, some example types were created such as RPM and Voltage. These should be removed/updated to reflect what is actually useful. They should properly handle their respective legal state space. E.g. we don't support negative temperatures.

Why?

Using physical unit based types makes it easier to verify valid states and catch weird bugs like a sensor malfunctioning. It also provides more security, if you have access to an instance of a Temperature, than you know, for example, that it must not be negative.

How?

Remove and modify existing models/*.rs types and create new ones as needed. Basic type state tests should be implemented to confirm state space representation.

Ymit24 commented 6 months ago

Starting on this. Going to begin by deciding on list of physical unit types required.

Ymit24 commented 6 months ago

Added Rpm type to common/physical with state space representation tests. Need to write serialization tests to ensure it works as intended when used in a packet.

Ymit24 commented 6 months ago

RPM type works and is serializable. Generic arguments were removed.

Ymit24 commented 6 months ago

Going to add a basic voltage type and then will move on from this ticket.

Ymit24 commented 6 months ago

Completed the voltage struct with associated tests. This can now be reviewed, pulled, and closed.