//===========================================================================// // File: reservr.hpp // // Project: BattleTech Brick: Mech subsystems // // Contents: Reservoir -- the coolant store // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(RESERVR_HPP) # define RESERVR_HPP # if !defined(HEAT_HPP) # include # endif //##################### Forward Class Declarations ####################### class Mech; //########################################################################### //#################### Reservoir Model Resource ######################### //########################################################################### // // CoolantCapacity overlays the inherited HeatSink thermalCapacity slot at // construction; CoolantSquirtMass is the per-second flush rate base. // struct Reservoir__SubsystemResource: public HeatSink::SubsystemResource { Scalar coolantCapacity; Scalar coolantSquirtMass; }; //########################################################################### //############################# Reservoir ############################### //########################################################################### // // The coolant store: a HeatSink that holds the mech's coolant charge and // "squirts" it into the other sinks on demand -- it is the DrawCoolant SOURCE // (every sink's UpdateCoolant top-up resolves here through the virtual), and // the manual coolant FLUSH (the InjectCoolant cockpit button) distributes // charge into the condensers / weapons / heatables, crediting each a negative // pending-heat chill. // class Reservoir: public HeatSink { public: static Derivation ClassDerivations; static SharedData DefaultData; static Logical TestClass(Mech &); Logical TestInstance() const; public: typedef Reservoir__SubsystemResource SubsystemResource; Reservoir( Mech *owner, int subsystem_ID, SubsystemResource *r, SharedData &shared_data = DefaultData ); ~Reservoir(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Messaging Support: the cockpit coolant-flush button (id 4, // "InjectCoolant"). Press starts the flush (raises the inject alarm); // release stops it. Novice-locked. // public: enum { InjectCoolantMessageID = HeatSink::NextMessageID, // 4 NextMessageID }; static const HandlerEntry MessageHandlerEntries[]; static MessageHandlerSet MessageHandlers; void InjectCoolantMessageHandler(ReceiverDataMessageOf *message); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The coolant-store interface. // public: // // The DrawCoolant SOURCE: hand out up to coolantLevel of the requested // amount and deduct it from the charge. // virtual Scalar DrawCoolant(Scalar requested); typedef void (Reservoir::*Performance)(Scalar time_slice); void SetPerformance(Performance performance) { Check(this); activePerformance = (Simulation::Performance)performance; } void CoolantSimulation(Scalar time_slice); void InjectCoolant(Scalar time_slice); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Local Data. The inject flag is the reservoir alarm's level (1 = flushing). // public: enum { ReservoirStateAttributeID = HeatSink::NextAttributeID, NextAttributeID }; static const IndexEntry AttributePointers[]; static AttributeIndexSet AttributeIndex; protected: AlarmIndicator reservoirAlarm; Scalar coolantSquirtMass; Scalar injectAccumulator; Scalar squirtEfficiency; }; #endif