HeatSink : public HeatableSubsystem (confirmed hierarchy) -- a thermal mass with a coolant loop. Added to HEAT.HPP/.CPP: the class + its SubsystemConnection slot helper + HeatSink__SubsystemResource. Ctor chains HeatableSubsystem and seeds the thermal state from the resource (startingTemperature/degradation/failure/ thermalConductance/thermalMass), heatAlarm(3) = AlarmIndicator, heatFilter = AverageOf<Scalar>(15). Statics, dtor, ResetToInitialState, TestClass/TestInstance real; the per-frame thermal sim (HeatSinkSimulation/DrawCoolant) staged. Also reconciled HeatableSubsystem to the 4.10 fields: its resource struct now carries startingTemperature/degradationTemperature/failureTemperature/ thermalConductance/thermalMass (was the BT411-mislabeled thermalMass/degrade/fail/ coolingLoop set), and degradationTemperature/failureTemperature are base members (HeatSink reads them). Verified slice now: MechSubsystem -> HeatableSubsystem -> HeatSink. Compile-verified (BT: 25 ok); tree links clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
205 lines
6.0 KiB
C++
205 lines
6.0 KiB
C++
//===========================================================================//
|
|
// File: heat.hpp //
|
|
// Project: BattleTech //
|
|
// Contents: Implementation details for heatable subsystems //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#if !defined(HEAT_HPP)
|
|
# define HEAT_HPP
|
|
|
|
# if !defined(MECHSUB_HPP)
|
|
# include <mechsub.hpp>
|
|
# endif
|
|
|
|
# if !defined(AVERAGE_HPP)
|
|
# include <average.hpp>
|
|
# endif
|
|
|
|
//##################### Forward Class Declarations #######################
|
|
class Mech;
|
|
|
|
//###########################################################################
|
|
//################## HeatableSubsystem Model Resource ###################
|
|
//###########################################################################
|
|
|
|
struct HeatableSubsystem__SubsystemResource:
|
|
public MechSubsystem::SubsystemResource
|
|
{
|
|
Scalar startingTemperature;
|
|
Scalar degradationTemperature;
|
|
Scalar failureTemperature;
|
|
Scalar thermalConductance;
|
|
Scalar thermalMass;
|
|
};
|
|
|
|
//###########################################################################
|
|
//######################## HeatableSubsystem ############################
|
|
//###########################################################################
|
|
|
|
class HeatableSubsystem:
|
|
public MechSubsystem
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Test Class Support
|
|
//
|
|
public:
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
void
|
|
ResetToInitialState();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef HeatableSubsystem__SubsystemResource SubsystemResource;
|
|
|
|
HeatableSubsystem(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
|
|
~HeatableSubsystem();
|
|
|
|
static int
|
|
CreateStreamedSubsystem(
|
|
NotationFile *model_file,
|
|
const char *model_name,
|
|
const char *subsystem_name,
|
|
SubsystemResource *subsystem_resource,
|
|
NotationFile *subsystem_file,
|
|
const ResourceDirectories *directories,
|
|
int passes = 1
|
|
);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data
|
|
//
|
|
protected:
|
|
Scalar currentTemperature;
|
|
Scalar heatLoad;
|
|
Scalar degradationTemperature;
|
|
Scalar failureTemperature;
|
|
};
|
|
|
|
//###########################################################################
|
|
//########################## SubsystemConnection ########################
|
|
//###########################################################################
|
|
//
|
|
// A slot linking a heat sink to its master / linked heat sink.
|
|
//
|
|
class SubsystemConnection
|
|
{
|
|
public:
|
|
SubsystemConnection() { linked = NULL; }
|
|
void Add(Subsystem *s) { linked = s; }
|
|
Subsystem* Resolve() const { return linked; }
|
|
void Clear() { linked = NULL; }
|
|
protected:
|
|
Subsystem *linked;
|
|
int reserved[2];
|
|
};
|
|
|
|
//###########################################################################
|
|
//####################### HeatSink Model Resource #######################
|
|
//###########################################################################
|
|
|
|
struct HeatSink__SubsystemResource:
|
|
public HeatableSubsystem__SubsystemResource
|
|
{
|
|
};
|
|
|
|
//###########################################################################
|
|
//############################## HeatSink ###############################
|
|
//###########################################################################
|
|
|
|
class HeatSink:
|
|
public HeatableSubsystem
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Test Class Support
|
|
//
|
|
public:
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
void
|
|
ResetToInitialState(Logical powered);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Simulation Support
|
|
//
|
|
public:
|
|
void
|
|
HeatSinkSimulation(Scalar time_slice);
|
|
virtual Scalar
|
|
DrawCoolant(Scalar requested);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
typedef HeatSink__SubsystemResource SubsystemResource;
|
|
|
|
HeatSink(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
|
|
~HeatSink();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Local Data
|
|
//
|
|
protected:
|
|
Scalar coolantEfficiency;
|
|
Scalar thermalCapacity;
|
|
Scalar coolantLevel;
|
|
Scalar coolantDraw;
|
|
int coolantAvailable;
|
|
int coolantActive;
|
|
Scalar startingTemperature;
|
|
Scalar thermalConductance;
|
|
Scalar filterDecay;
|
|
Scalar thermalMass;
|
|
Scalar heatEnergy;
|
|
Scalar coolantFlowScale;
|
|
Scalar massScale;
|
|
Scalar pendingHeat;
|
|
Scalar radiatedHeat;
|
|
SubsystemConnection linkedSinks;
|
|
AlarmIndicator heatAlarm;
|
|
AverageOf<Scalar> heatFilter;
|
|
};
|
|
|
|
#endif
|