MCPcopy Create free account
hub / github.com/ange-yaghi/engine-sim / generate

Method generate

scripting/include/ignition_module_node.h:26–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24 virtual ~IgnitionModuleNode() { /* void */ }
25
26 void generate(Engine *engine, EngineContext *context) const {
27 IgnitionModule::Parameters params;
28 params.Crankshaft = engine->getCrankshaft(0);
29 params.CylinderCount = engine->getCylinderCount();
30 params.RevLimit = m_revLimit;
31 params.TimingCurve = m_timingCurve->generate(context);
32 params.CylinderCount = engine->getCylinderCount();
33 params.LimiterDuration = m_limiterDuration;
34 engine->getIgnitionModule()->initialize(params);
35
36 for (const Post &post : m_posts) {
37 std::set<IgnitionWireNode::Connection> connections =
38 post.wire->getConnections();
39 for (const IgnitionWireNode::Connection &connection : connections) {
40 const int index = context->getCylinderIndex(
41 connection.first,
42 connection.second
43 );
44
45 engine->getIgnitionModule()->setFiringOrder(index, post.angle);
46 }
47 }
48 }
49
50 void connect(IgnitionWireNode *wire, double angle) {
51 m_posts.push_back({ wire, angle });

Callers

nothing calls this directly

Calls 7

getIgnitionModuleMethod · 0.80
getConnectionsMethod · 0.80
setFiringOrderMethod · 0.80
getCrankshaftMethod · 0.45
getCylinderCountMethod · 0.45
initializeMethod · 0.45
getCylinderIndexMethod · 0.45

Tested by

no test coverage detected