37 lines
608 B
C++
37 lines
608 B
C++
|
|
#pragma once
|
|
|
|
#include "fluid_holder.hpp"
|
|
|
|
namespace sim::coolant
|
|
{
|
|
|
|
class valve
|
|
{
|
|
const double max;
|
|
|
|
fluid_holder* const src;
|
|
fluid_holder* const dst;
|
|
|
|
double speed = 0;
|
|
double state = 0;
|
|
double flow = 0; // L/s
|
|
|
|
public:
|
|
|
|
valve(fluid_holder* src, fluid_holder* dst, double state, double max);
|
|
valve(const Json::Value& node, fluid_holder* src, fluid_holder* dst);
|
|
|
|
void update(double secs);
|
|
void add_open_speed(double v);
|
|
void clear_open_speed();
|
|
|
|
operator Json::Value() const;
|
|
|
|
constexpr double get_state() const { return state; }
|
|
constexpr double get_flow() const { return flow; }
|
|
};
|
|
|
|
};
|
|
|