/// <summary> /// Applies the stimulation parameter. /// If stimulationSetMe == Stimulation.Python-configured, the condition supplied by the Python script is used. /// </summary> private void setStimulation() { if (stimulationSetMe == Stimulation.Python_configured) { stimulation = (Stimulation)(int)Academy.Instance.FloatProperties.GetPropertyWithDefault("stimulation", 0f); } else { stimulation = stimulationSetMe; } }
public override void HandleSignal(Signal signal) { if (signal is Antigen <T> ) { double pampLevel; var antigen = signal as Antigen <T>; if (IsPAMP(antigen, out pampLevel)) { // engulf the pattern if have not any yet if (Stimulation == null) { // process the antigen to obtain its peptides pattern var peptide = ProcessAntigen(antigen); // generate stimulation signal using the antigen peptide Stimulation = new Stimulation(Parent.Address, peptide, 0); Log("Engulfed an antigen with peptide pattern: " + peptide, LogLevel.Minor); } pampSum += pampLevel; } } else if (signal is Sdamp) { double dangerLevel; var sdamp = signal as Sdamp; if (IsDamp(sdamp, out dangerLevel)) { // it's a danger signal dangerSum += dangerLevel; } else { // it's a safe signal safeSum += dangerLevel; } } if (Stimulation != null) { // update stimulation concentration (co-stimulation) Stimulation.Concentration = (Globals.DangerSignalWeight * dangerSum) + (Globals.SafeSignalWeight * safeSum) + (Globals.PAMPWeight * pampSum); } var parentType = ((ITissue)Parent).Type; // check APC activation // if dangerSum exceeds a threshold and there is an engulfed pattern if (dangerSum >= Globals.APCMigrationThreshold && Stimulation != null && !migrateRequestSent) { Log("APC activated in node " + Parent.Address); ActivatedIn = Parent.Address; // set costimulation secretion timer Log("Starting co-stimulation expression timer.", LogLevel.Minor); Scheduler.Schedule(ExpressCostimulation, CostimulationInterval); // migrate to a lymph node by asking my parent to send me to a lymph node Log("Migrating to a lymph node.", LogLevel.Minor); Secrete(new Cytokine(Address, CytokineType.IL1, 1)); migrateRequestSent = true; } base.HandleSignal(signal); }