/** * The main control loop for the vehicle. Within this function we mainly call the * periodic update functions for the various modules. */ void update(void *) { // Toggle LED just to let us know things are working led.toggle(); // Update the thrust and rudder control loops rudder.update(); thruster.update(); // Perform periodic updates for sensors teSensor.update(); doSensor.update(); // depthSensor.update(); // esSensor.update(); // monitorSensor.update(); // Decay the desired velocities slightly decayVelocity(); //Try reading analog sensor adcUpdate(); }
/** * The main setup function for the vehicle. Initalized the Amarino communications, * then calls the various setup functions for the various modules. */ void setup() { // Core board initialization initBoard(); // Arm thruster thruster.arm(); // Reset all PID values to zero resetPID(); // Load PID constants in from EEPROM eeprom_read_block(&pid, &pidEeprom, sizeof(pidConstants_t)); // Set up serial communications amarino.registerFunction(setVelocity, SET_VELOCITY_FN); amarino.registerFunction(setPID, SET_PID_FN); amarino.registerFunction(getPID, GET_PID_FN); // Configure ADC setupADC(); }
void GenericShip::fireThruster(const Thruster& thruster, double power) { applyBodyPointForce(thruster.getDirection() * power, thruster.getPosition()); }
//------------------------------------------------------------------------------ void EndFiniteBurn::ValidateThrusters() { thrusters.clear(); for (std::vector<Spacecraft*>::iterator current = sats.begin(); current != sats.end(); ++current) { #ifdef DEBUG_EFB_THRUSTER MessageInterface::ShowMessage ("EndFiniteBurn::ValidateThrusters() entered, checking Spacecraft " "<%p>'%s' for Thrusters\n", *current, (*current)->GetName().c_str()); #endif StringArray thrusterNames = (*current)->GetStringArrayParameter( (*current)->GetParameterID("Thrusters")); StringArray engines = (maneuver)->GetStringArrayParameter( (maneuver)->GetParameterID("Thrusters")); #ifdef DEBUG_EFB_THRUSTER MessageInterface::ShowMessage (" Spacecraft has %d Thrusters and FiniteBurn has %d thrusters\n", thrusterNames.size(), engines.size()); #endif for (StringArray::iterator i = engines.begin(); i != engines.end(); ++i) { if (find(thrusterNames.begin(), thrusterNames.end(), *i) == thrusterNames.end()) { thrusters.clear(); throw CommandException("EndFiniteBurn: Spacecraft " + (*current)->GetName() + " does not have a thruster named \"" + (*i) + "\""); } Thruster* th = (Thruster*)((*current)->GetRefObject( Gmat::THRUSTER, *i)); if (th) { #ifdef DEBUG_EFB_THRUSTER MessageInterface::ShowMessage ("EndFiniteBurn::ValidateThrusters() addding the Thruster " "<%p>'%s' to thrusters\n", th, th->GetName().c_str()); #endif thrusters.push_back(th); } else { thrusters.clear(); throw CommandException("EndFiniteBurn: Thruster object \"" + (*i) + "\" was not set on Spacecraft \"" + (*current)->GetName() + "\""); } } } #ifdef DEBUG_EFB_THRUSTER MessageInterface::ShowMessage ("EndFiniteBurn::ValidateThrusters() leaving\n"); #endif }
//------------------------------------------------------------------------------ bool EndFiniteBurn::Execute() { ValidateThrusters(); // Only do this if the FiniteBurn is the one this command controls... bool forceActive = false; for (std::vector<PhysicalModel*>::iterator j = transientForces->begin(); j != transientForces->end(); ++j) { if (((*j)->GetName()) == thrustName) { // ... and if it is set for the right spacecraft StringArray burnSatNames = (*j)->GetRefObjectNameArray(Gmat::SPACECRAFT); bool foundSats = false; UnsignedInt numberFound = 0; for (UnsignedInt i = 0; i < satNames.size(); ++i) { if (find(burnSatNames.begin(), burnSatNames.end(), satNames[i]) != burnSatNames.end()) { foundSats = true; ++numberFound; } } if (foundSats) { #ifdef DEBUG_TRANSIENT_FORCES MessageInterface::ShowMessage("EndFiniteBurn::Execute(): The burn " "is active\n"); #endif forceActive = true; if (numberFound != satNames.size()) MessageInterface::ShowMessage("*** WARNING *** Turning off the " "finite burn %s, but the EndFiniteBurn command did not " "list all of the spacecraft that are no longer " "maneuvering.\n", burnName.c_str()); break; } } } if (forceActive) { // Turn off all of the referenced thrusters for (std::vector<Thruster*>::iterator i = thrusters.begin(); i != thrusters.end(); ++i) { Thruster *th = *i; #ifdef DEBUG_END_MANEUVER_EXE MessageInterface::ShowMessage ("EndFiniteBurn::Execute() Deactivating engine <%p>'%s'\n", th, th->GetName().c_str()); #endif th->SetBooleanParameter(th->GetParameterID("IsFiring"), false); #ifdef DEBUG_END_MANEUVER_EXE MessageInterface::ShowMessage ("Checking to see if engine is inactive: returned %s\n", (th->GetBooleanParameter(th->GetParameterID("IsFiring")) ? "true" : "false")); #endif } // Tell active spacecraft that they are no longer firing for (std::vector<Spacecraft*>::iterator s=sats.begin(); s!=sats.end(); ++s) { #ifdef DEBUG_END_MANEUVER_EXE MessageInterface::ShowMessage ("EndFiniteBurn::Execute() Deactivating maneuvers on Spacecraft " "<%p>'%s'\n", *s, (*s)->GetName().c_str()); #endif /// todo: Be sure that no other maneuver has the spacecraft maneuvering; /// for R2013a this is not an issue since only 1 burn per spacecraft is /// allowed. We'll need to fix this when that restriction is removed. (*s)->IsManeuvering(false); } // Remove the force from the list of transient forces for (std::vector<PhysicalModel*>::iterator j = transientForces->begin(); j != transientForces->end(); ++j) { if (((*j)->GetName()) == thrustName) { #ifdef DEBUG_TRANSIENT_FORCES MessageInterface::ShowMessage ("EndFiniteBurn::Execute() Removing burnForce<%p>'%s' from " "transientForces\n", *j, (*j)->GetName().c_str()); #endif transientForces->erase(j); break; } } // Reset maneuvering to Publisher so that any subscriber can do its own action if (!sats.empty()) { Real epoch = sats[0]->GetEpoch(); publisher->SetManeuvering(this, false, epoch, satNames, "end of finite " "maneuver"); } #ifdef DEBUG_END_MANEUVER_EXE MessageInterface::ShowMessage("EndFiniteBurn::Execute() Current TransientForces list:\n"); for (std::vector<PhysicalModel*>::iterator j = transientForces->begin(); j != transientForces->end(); ++j) MessageInterface::ShowMessage(" %s\n", (*j)->GetName().c_str()); #endif } BuildCommandSummary(true); return true; }
//------------------------------------------------------------------------------ bool BeginFiniteBurn::Execute() { ValidateThrusters(); // Turn on all of the referenced thrusters #ifdef DEBUG_BEGIN_MANEUVER_EXE MessageInterface::ShowMessage ("BeginFiniteBurn::Execute() <%p>'%s' entered\n " "There are %d thruster(s) in use\n", this, GetGeneratingString(Gmat::NO_COMMENTS).c_str(), thrusters.size()); #endif for (std::vector<Thruster*>::iterator i = thrusters.begin(); i != thrusters.end(); ++i) { Thruster *th = *i; #ifdef DEBUG_BEGIN_MANEUVER_EXE MessageInterface::ShowMessage ("Activating engine <%p>'%s'\n", th, th->GetName().c_str()); #endif th->SetBooleanParameter(th->GetParameterID("IsFiring"), true); #ifdef DEBUG_BEGIN_MANEUVER_EXE MessageInterface::ShowMessage ("Checking to see if engine is active: returned %s\n", (th->GetBooleanParameter(th->GetParameterID("IsFiring")) ? "true" : "false")); #endif } // Tell active spacecraft that they are now firing for (std::vector<Spacecraft*>::iterator s=sats.begin(); s!=sats.end(); ++s) { (*s)->IsManeuvering(true); } if (transientForces == NULL) throw CommandException("Transient force list was NOT initialized; " "ABORTING RUN!!!\n\n"); // Insert the force into the list of transient forces if not found if (transientForces->size() == 0) { #ifdef DEBUG_TRANSIENT_FORCES MessageInterface::ShowMessage ("BeginFiniteBurn::Execute() Adding first burnForce<%p>'%s' to " "transientForces\n", burnForce, burnForce->GetName().c_str()); #endif transientForces->push_back(burnForce); } else { bool alreadyThere = false; for (std::vector<PhysicalModel*>::iterator i = transientForces->begin(); i !=transientForces->end(); ++i) { if ((*i)->IsOfType("FiniteThrust")) { FiniteThrust *transient = (FiniteThrust*)(*i); if (transient == burnForce) { alreadyThere = true; } if ((*transient) == (*burnForce)) { MessageInterface::ShowMessage("Burn activated by the line\n " "%s\noverlaps with an active finite burn. No new finite " "burn will be applied.\n", GetGeneratingString(Gmat::NO_COMMENTS).c_str()); alreadyThere = true; } } } if (alreadyThere == false) { #ifdef DEBUG_TRANSIENT_FORCES MessageInterface::ShowMessage("BeginFiniteBurn::Execute() Adding " "burnForce<%p>'%s' to transientForces\n", burnForce, burnForce->GetName().c_str()); #endif transientForces->push_back(burnForce); } } // Set maneuvering to Publisher so that any subscriber can do its own action if (!sats.empty()) { Real epoch = sats[0]->GetEpoch(); publisher->SetManeuvering(this, true, epoch, satNames, "begin of finite maneuver"); } #ifdef DEBUG_BEGIN_MANEUVER_EXE MessageInterface::ShowMessage ("There are %d transient force(s)\n", transientForces->size()); MessageInterface::ShowMessage("Current TransientForces list:\n"); for (std::vector<PhysicalModel*>::iterator j = transientForces->begin(); j != transientForces->end(); ++j) MessageInterface::ShowMessage(" %s\n", (*j)->GetName().c_str()); #endif BuildCommandSummary(true); return true; }
//------------------------------------------------------------------------------ bool FiniteBurn::Fire(Real *burnData, Real epoch) { #ifdef DEBUG_FINITEBURN_FIRE MessageInterface::ShowMessage ("FiniteBurn::Fire() this<%p>'%s' entered, epoch=%f, spacecraft=<%p>'%s'\n", this, instanceName.c_str(), epoch, spacecraft, spacecraft ? spacecraft->GetName().c_str() : "NULL"); #endif if (isInitialized == false) Initialize(); if (!spacecraft) throw BurnException("Maneuver initial state undefined (No spacecraft?)"); // Accumulate the individual accelerations from the thrusters Real dm = 0.0, tMass, tOverM, *dir, norm; deltaV[0] = deltaV[1] = deltaV[2] = 0.0; Thruster *current; tMass = spacecraft->GetRealParameter("TotalMass"); #ifdef DEBUG_BURN_ORIGIN Real *satState = spacecraft->GetState().GetState(); MessageInterface::ShowMessage ("FiniteBurn Vectors:\n " "Sat = [%.15f %.15f %.15f %.15f %.15f %.15f]\n " "Frame = [%.15f %.15f %.15f\n " " %.15f %.15f %.15f\n " " %.15f %.15f %.15f]\n\n", satState[0], satState[1], satState[2], satState[3], satState[4], satState[5], frameBasis[0][0], frameBasis[0][1], frameBasis[0][2], frameBasis[1][0], frameBasis[1][1], frameBasis[1][2], frameBasis[2][0], frameBasis[2][1], frameBasis[2][2]); #endif for (StringArray::iterator i = thrusterNames.begin(); i != thrusterNames.end(); ++i) { #ifdef DEBUG_FINITE_BURN MessageInterface::ShowMessage (" Accessing thruster '%s' from spacecraft <%p>'%s'\n", (*i).c_str(), spacecraft, spacecraft->GetName().c_str()); #endif current = (Thruster *)spacecraft->GetRefObject(Gmat::THRUSTER, *i); if (!current) throw BurnException("FiniteBurn::Fire requires thruster named \"" + (*i) + "\" on spacecraft " + spacecraft->GetName()); // Save current thruster so that GetRefObject() can return it (LOJ: 2009.08.28) thrusterMap[current->GetName()] = current; // FiniteBurn class is friend of Thruster class, so we can access // member data directly current->ComputeInertialDirection(epoch); dir = current->inertialDirection; norm = sqrt(dir[0]*dir[0] + dir[1]*dir[1] + dir[2]*dir[2]); #ifdef DEBUG_FINITE_BURN MessageInterface::ShowMessage (" Thruster Direction: %.15f %.15f %.15f\n" " norm: %.15f\n", dir[0], dir[1], dir[2], norm); #endif if (norm == 0.0) throw BurnException("FiniteBurn::Fire thruster " + (*i) + " on spacecraft " + spacecraft->GetName() + " has no direction."); dm += current->CalculateMassFlow(); //tOverM = current->thrust / (tMass * norm * 1000.0); //old code tOverM = current->thrust * current->thrustScaleFactor * current->dutyCycle / (tMass * norm * 1000.0); deltaV[0] += dir[0] * tOverM; deltaV[1] += dir[1] * tOverM; deltaV[2] += dir[2] * tOverM; #ifdef DEBUG_FINITE_BURN MessageInterface::ShowMessage(" Thruster %s = %s details:\n", (*i).c_str(), current->GetName().c_str()); MessageInterface::ShowMessage( " thrust = %.15f\n" " dM = %.15e\n Mass = %.15f\n" " TSF = %.15f\n |Acc| = %.15e\n " "Acc = [%.15e %.15e %.15e]\n", current->thrust, dm, tMass, current->thrustScaleFactor, tOverM, deltaV[0], deltaV[1], deltaV[2]); #endif } // Build the acceleration burnData[0] = deltaV[0]*frameBasis[0][0] + deltaV[1]*frameBasis[0][1] + deltaV[2]*frameBasis[0][2]; burnData[1] = deltaV[0]*frameBasis[1][0] + deltaV[1]*frameBasis[1][1] + deltaV[2]*frameBasis[1][2]; burnData[2] = deltaV[0]*frameBasis[2][0] + deltaV[1]*frameBasis[2][1] + deltaV[2]*frameBasis[2][2]; burnData[3] = dm; #ifdef DEBUG_FINITEBURN_FIRE MessageInterface::ShowMessage( "FiniteBurn::Fire() this<%p>'%s' returning\n" " Acceleration: %.15e %.15e %.15e dm: %.15e\n", this, GetName().c_str(), burnData[0], burnData[1], burnData[2], dm); #endif hasFired = true; epochAtLastFire = epoch; return true; }
void InterplanetarySC::createSubSystems() { /* Erstellung der Treibstofftanks. Es wurde hier bewusst darauf verzichtet die Treibstofftanks direkt in den Subsystemen zu erstellen, da Orbiter ohnehin nicht zwischen propellant und oxidant unterscheidet. Dennoch wird mitgerechnet mit einer stöchiometrischen Verbrennung, das heißt dass es je 2 Tanks mit propellant und oxidant gibt, einmal für das Haupttriebwerk und einmal für die Raktionsdüsen. */ double mainPropMass = 800000.0; double rcsPropMass = 6000.0; double stoechioMainHydro = mainPropMass * 2/10; double stoechioMainOxy = mainPropMass * 8/10; double stoechioRCSHydro = rcsPropMass * 2/10; double stoechioRCSOxy = rcsPropMass * 8/10; PROPELLANT_HANDLE orbiterMainTank = CreatePropellantResource(mainPropMass); PROPELLANT_HANDLE orbiterRCSTank = CreatePropellantResource(rcsPropMass); HydrogenTank *hydroMain = new HydrogenTank(this,"Wasserstoff Haupt",simTimePtr_,stoechioMainHydro,stoechioMainHydro); OxygenTank *oxyMain = new OxygenTank(this,"Sauerstoff Haupt",simTimePtr_,stoechioMainOxy,stoechioMainOxy); HydrogenTank *hydroRCS = new HydrogenTank(this,"WasserstoffTank1",simTimePtr_,stoechioMainHydro,stoechioMainHydro); OxygenTank *oxyRCS = new OxygenTank(this,"SauerstoffTank1",simTimePtr_,stoechioMainOxy,stoechioMainOxy); /* Erstellung der Main Engine */ THGROUP_TYPE mainEngineType[] = {THGROUP_ATT_FORWARD}; Thruster *mainEngine = new Thruster(this,"Main Engine",simTimePtr_,_V(0,0,-290),_V(0,0,1),350000,orbiterMainTank,8300,mainEngineType,1,200,10); /* Erstellung der RCS Thruster */ double rcsTh = 50; double rcsTh1 = 150; double rcsIsp = 20000; double rcsL = 20; double rcsW = 1; THGROUP_TYPE rcsGroup1[] = {THGROUP_ATT_PITCHUP}; THGROUP_TYPE rcsGroup2[] = {THGROUP_ATT_YAWRIGHT,THGROUP_ATT_BANKLEFT}; THGROUP_TYPE rcsGroup3[] = {THGROUP_ATT_YAWLEFT,THGROUP_ATT_BANKRIGHT}; THGROUP_TYPE rcsGroup4[] = {THGROUP_ATT_YAWLEFT,THGROUP_ATT_PITCHDOWN}; THGROUP_TYPE rcsGroup5[] = {THGROUP_ATT_YAWLEFT,THGROUP_ATT_PITCHUP,THGROUP_ATT_BANKLEFT}; THGROUP_TYPE rcsGroup6[] = {THGROUP_ATT_PITCHDOWN,THGROUP_ATT_BANKRIGHT}; THGROUP_TYPE rcsGroup7[] = {THGROUP_ATT_YAWRIGHT,THGROUP_ATT_PITCHDOWN}; THGROUP_TYPE rcsGroup8[] = {THGROUP_ATT_YAWRIGHT,THGROUP_ATT_PITCHUP,THGROUP_ATT_BANKRIGHT}; THGROUP_TYPE rcsGroup9[] = {THGROUP_ATT_PITCHDOWN,THGROUP_ATT_BANKLEFT}; THGROUP_TYPE rcsGroup10[] = {THGROUP_ATT_PITCHUP}; THGROUP_TYPE rcsGroup11[] = {THGROUP_ATT_YAWRIGHT,THGROUP_ATT_PITCHUP}; THGROUP_TYPE rcsGroup12[] = {THGROUP_ATT_YAWLEFT,THGROUP_ATT_PITCHUP}; THGROUP_TYPE rcsGroup13[] = {THGROUP_ATT_FORWARD}; THGROUP_TYPE rcsGroup14[] = {THGROUP_ATT_BACK}; THGROUP_TYPE rcsGroup15[] = {THGROUP_ATT_FORWARD}; THGROUP_TYPE rcsGroup16[] = {THGROUP_ATT_BACK}; THGROUP_TYPE rcsGroup17[] = {THGROUP_ATT_FORWARD}; THGROUP_TYPE rcsGroup18[] = {THGROUP_ATT_BACK}; Thruster *rcs1 = new Thruster(this,"RCS 1",simTimePtr_,_V(0,-30.9,52.9),_V(0,1,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup1,1,rcsL,rcsW); Thruster *rcs2 = new Thruster(this,"RCS 2",simTimePtr_,_V(-0.5,-30.5,52.9),_V(1,0,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup2,2,rcsL,rcsW); Thruster *rcs3 = new Thruster(this,"RCS 3",simTimePtr_,_V(0.5,-30.5,52.9),_V(-1,0,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup3,2,rcsL,rcsW); Thruster *rcs4 = new Thruster(this,"RCS 4",simTimePtr_,_V(26.7,15.4,52.9),_V(-0.86,-0.5,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup4,2,rcsL,rcsW); Thruster *rcs5 = new Thruster(this,"RCS 5",simTimePtr_,_V(26.7,14.8,52.9),_V(-0.5,0.86,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup5,3,rcsL,rcsW); Thruster *rcs6 = new Thruster(this,"RCS 6",simTimePtr_,_V(26.1,15.7,52.9),_V(0.5,-0.86,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup6,2,rcsL,rcsW); Thruster *rcs7 = new Thruster(this,"RCS 7",simTimePtr_,_V(-26.7,15.4,52.9),_V(0.86,-0.5,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup7,2,rcsL,rcsW); Thruster *rcs8 = new Thruster(this,"RCS 8",simTimePtr_,_V(-26.7,14.8,52.9),_V(0.5,0.86,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup8,3,rcsL,rcsW); Thruster *rcs9 = new Thruster(this,"RCS 9",simTimePtr_,_V(-26.1,15.7,52.9),_V(-0.5,-0.86,0),rcsTh,orbiterRCSTank,rcsIsp,rcsGroup9,2,rcsL,rcsW); Thruster *rcs10 = new Thruster(this,"RCS 10",simTimePtr_,_V(0,-1.5,-232.7),_V(0,-1,0),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup10,1,rcsL,rcsW); Thruster *rcs11 = new Thruster(this,"RCS 11",simTimePtr_,_V(1.3,0.7,-232.6),_V(-0.86,-0.5,0),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup11,2,rcsL,rcsW); Thruster *rcs12 = new Thruster(this,"RCS 12",simTimePtr_,_V(-1.3,0.7,-232.6),_V(0.86,-0.5,0),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup12,2,rcsL,rcsW); Thruster *rcs13 = new Thruster(this,"RCS 13",simTimePtr_,_V(0,-30.5,52.3),_V(0,0,1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup13,1,rcsL,rcsW); Thruster *rcs14 = new Thruster(this,"RCS 14",simTimePtr_,_V(0,-30.5,53.4),_V(0,0,-1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup14,1,rcsL,rcsW); Thruster *rcs15 = new Thruster(this,"RCS 15",simTimePtr_,_V(26.4,15.3,52.3),_V(0,0,1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup15,1,rcsL,rcsW); Thruster *rcs16 = new Thruster(this,"RCS 16",simTimePtr_,_V(26.4,15.3,53.4),_V(0,0,-1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup16,1,rcsL,rcsW); Thruster *rcs17 = new Thruster(this,"RCS 17",simTimePtr_,_V(-26.4,15.3,52.3),_V(0,0,1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup17,1,rcsL,rcsW); Thruster *rcs18 = new Thruster(this,"RCS 18",simTimePtr_,_V(-26.4,15.3,53.4),_V(0,0,-1),rcsTh1,orbiterRCSTank,rcsIsp,rcsGroup18,1,rcsL,rcsW); WaterTank *water1 = new WaterTank(this,"WasserTank1",simTimePtr_,4000,50000); FuelCell *fc1 = new FuelCell(this,"Brennstoffzelle1",simTimePtr_,0.4,4,3000); fc1->deactivate(); hydroMain->setStatus(STATUS_ACTIVE_WARNING); Battery *bat1 = new Battery(this,"Batterie1",simTimePtr_,50000,900000,1000,10000,0.9,0.9,300,270,320,5000,400,5); Radiator *radiator1 = new Radiator(this,"Radiator1",simTimePtr_,5000,1000000,100); Heater *heater1 = new Heater(this,"Heater1",simTimePtr_,5000000,0.8,0.8); subsys_.push_back(water1); subsys_.push_back(oxyMain); subsys_.push_back(hydroMain); subsys_.push_back(oxyRCS); subsys_.push_back(hydroRCS); subsys_.push_back(mainEngine); subsys_.push_back(fc1); subsys_.push_back(bat1); subsys_.push_back(radiator1); subsys_.push_back(heater1); // Diese zuweisungen sind auskommentiert, um die Visualisierung übersichtlicher zu machen //subsys_.push_back(rcs1); //subsys_.push_back(rcs2); //subsys_.push_back(rcs3); //subsys_.push_back(rcs4); //subsys_.push_back(rcs5); //subsys_.push_back(rcs6); //subsys_.push_back(rcs7); //subsys_.push_back(rcs8); //subsys_.push_back(rcs9); //subsys_.push_back(rcs10); //subsys_.push_back(rcs11); //subsys_.push_back(rcs12); //subsys_.push_back(rcs13); //subsys_.push_back(rcs14); //subsys_.push_back(rcs15); //subsys_.push_back(rcs16); //subsys_.push_back(rcs17); //subsys_.push_back(rcs18); //Links instanzieren Link *h2a = new Link("H2"); Link *h2b = new Link("H2"); Link *o2a = new Link("O2"); Link *o2b = new Link("O2"); Link *h2oa = new Link("H2O"); Link *h2ob = new Link("H2O"); Link *power1 = new Link("Energy[J]"); Link *power2 = new Link("Energy[J]"); Link *heat1 = new Link("Heat[J]"); Link *heat2 = new Link("Heat[J]"); Link *heat3 = new Link("Heat[J]"); links_.push_back(h2a); links_.push_back(h2b); links_.push_back(o2a); links_.push_back(o2b); links_.push_back(h2oa); links_.push_back(h2ob); links_.push_back(heat1); links_.push_back(power1); links_.push_back(power2); links_.push_back(heat2); links_.push_back(heat3); //Ports verbinden hydroMain->connectPortToOutput(h2a->getPort()); hydroMain->connectPortToOutput(h2b->getPort()); oxyMain->connectPortToOutput(o2a->getPort()); oxyMain->connectPortToOutput(o2b->getPort()); water1->connectPortToOutput(h2oa->getPort()); water1->connectPortToInput(h2ob->getPort()); mainEngine->connectPortToInput(h2a->getPort()); mainEngine->connectPortToInput(o2a->getPort()); //rcs1->connectPortToInput(h2a->getPort()); //rcs1->connectPortToInput(o2a->getPort()); //rcs2->connectPortToInput(h2a->getPort()); //rcs2->connectPortToInput(o2a->getPort()); //rcs3->connectPortToInput(h2a->getPort()); //rcs3->connectPortToInput(o2a->getPort()); //rcs4->connectPortToInput(h2a->getPort()); //rcs4->connectPortToInput(o2a->getPort()); //rcs5->connectPortToInput(h2a->getPort()); //rcs5->connectPortToInput(o2a->getPort()); //rcs6->connectPortToInput(h2a->getPort()); //rcs6->connectPortToInput(o2a->getPort()); //rcs7->connectPortToInput(h2a->getPort()); //rcs7->connectPortToInput(o2a->getPort()); //rcs8->connectPortToInput(h2a->getPort()); //rcs8->connectPortToInput(o2a->getPort()); //rcs9->connectPortToInput(h2a->getPort()); //rcs9->connectPortToInput(o2a->getPort()); //rcs10->connectPortToInput(h2a->getPort()); //rcs10->connectPortToInput(o2a->getPort()); //rcs11->connectPortToInput(h2a->getPort()); //rcs11->connectPortToInput(o2a->getPort()); //rcs12->connectPortToInput(h2a->getPort()); //rcs12->connectPortToInput(o2a->getPort()); //rcs13->connectPortToInput(h2a->getPort()); //rcs13->connectPortToInput(o2a->getPort()); //rcs14->connectPortToInput(h2a->getPort()); //rcs14->connectPortToInput(o2a->getPort()); //rcs15->connectPortToInput(h2a->getPort()); //rcs15->connectPortToInput(o2a->getPort()); //rcs16->connectPortToInput(h2a->getPort()); //rcs16->connectPortToInput(o2a->getPort()); //rcs17->connectPortToInput(h2a->getPort()); //rcs17->connectPortToInput(o2a->getPort()); //rcs18->connectPortToInput(h2a->getPort()); //rcs18->connectPortToInput(o2a->getPort()); fc1->connectPortToInput(h2b->getPort()); fc1->connectPortToInput(o2b->getPort()); fc1->connectPortToInput(h2oa->getPort()); fc1->connectPortToOutput(h2ob->getPort()); fc1->connectPortToOutput(power1->getPort()); fc1->connectPortToOutput(heat1->getPort()); fc1->connectPortToOutput(power2->getPort()); bat1->connectPortToInput(power1->getPort()); bat1->connectPortToInput(heat2->getPort()); bat1->connectPortToOutput(heat3->getPort()); heater1->connectPortToInput(power2->getPort()); heater1->connectPortToOutput(heat2->getPort()); radiator1->connectPortToInput(heat1->getPort()); radiator1->connectPortToInput(heat3->getPort()); }