Myomers (: PoweredSubsystem) -- locomotion muscle: seek-voltage drive table (scaled by the generator's rated voltage via ResolveVoltageSource), efficiency + heat-range members; MyomersSimulation staged. Condenser (: HeatSink) -- active refrigeration in a coolant loop; valveState/refrigerationFactor/condenserNumber. Both ctors chain their parents + init from resource; statics/dtor/test real. Heat/power subsystem family now COMPLETE (11 classes): MechSubsystem, HeatableSubsystem, HeatSink, PoweredSubsystem, Generator, Condenser, Sensor, Myomers, HeatWatcher, PowerWatcher, Gyroscope, HUD, Torso. BT: 31 ok. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
306 lines
8.8 KiB
C++
306 lines
8.8 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 ###############################
|
|
//###########################################################################
|
|
|
|
//###########################################################################
|
|
//################### HeatWatcher Model Resource #######################
|
|
//###########################################################################
|
|
|
|
struct HeatWatcher__SubsystemResource:
|
|
public MechSubsystem__SubsystemResource
|
|
{
|
|
int watchedSubsystem;
|
|
Scalar degradationTemperature;
|
|
Scalar failureTemperature;
|
|
};
|
|
|
|
//###########################################################################
|
|
//############################# HeatWatcher #############################
|
|
//###########################################################################
|
|
//
|
|
// Watches another subsystem's temperature and drives a 3-level alarm. A
|
|
// sibling branch to HeatableSubsystem (derives straight from MechSubsystem);
|
|
// PowerWatcher and the Torso/HUD/Gyroscope leaves descend from it.
|
|
//
|
|
class HeatWatcher:
|
|
public MechSubsystem
|
|
{
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
void
|
|
ResetToInitialState(Logical powered);
|
|
void
|
|
WatchSimulation(Scalar time_slice);
|
|
|
|
public:
|
|
typedef HeatWatcher__SubsystemResource SubsystemResource;
|
|
|
|
HeatWatcher(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
~HeatWatcher();
|
|
|
|
protected:
|
|
SubsystemConnection watchedLink;
|
|
int watchedSubsystem;
|
|
Scalar degradationTemperature;
|
|
Scalar failureTemperature;
|
|
AlarmIndicator heatAlarm;
|
|
};
|
|
|
|
class HeatSink:
|
|
public HeatableSubsystem
|
|
{
|
|
friend class Condenser;
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// 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;
|
|
};
|
|
|
|
//###########################################################################
|
|
//#################### Condenser Model Resource ########################
|
|
//###########################################################################
|
|
|
|
struct Condenser__SubsystemResource:
|
|
public HeatSink__SubsystemResource
|
|
{
|
|
Scalar refrigerationFactor;
|
|
};
|
|
|
|
//###########################################################################
|
|
//############################## Condenser #############################
|
|
//###########################################################################
|
|
//
|
|
// A HeatSink with active refrigeration (a coolant loop's condenser).
|
|
//
|
|
class Condenser:
|
|
public HeatSink
|
|
{
|
|
public:
|
|
static Derivation ClassDerivations;
|
|
static SharedData DefaultData;
|
|
|
|
static Logical
|
|
TestClass(Mech &);
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
public:
|
|
typedef Condenser__SubsystemResource SubsystemResource;
|
|
|
|
Condenser(
|
|
Mech *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data = DefaultData
|
|
);
|
|
~Condenser();
|
|
|
|
protected:
|
|
int valveState;
|
|
int condenserNumber;
|
|
Scalar refrigerationFactor;
|
|
};
|
|
|
|
#endif
|