public ScissorLift(Drive drive)
 {
     m_pot = new AnalogPotentiometer(5);
     m_pid = new PID(0.67, 0.225, 0.5659);
     PTOEnabled = false;
     m_drive = drive;
 }
 public static photo DownloadPhoto(PID pid)
 {
     IList<photo> PhotosWithAid = fbService.Photos.Get(null, null, new List<String> { pid.ToString() });
     if (PhotosWithAid.Count == 0)
     {
         throw new PhotoDoesNotExistException();
     }
     return PhotosWithAid[0];
 }
 public void Update(PID.PIDErrorController[] controllers)
 {
     foreach (SASList s in Enum.GetValues(typeof(SASList)))
     {
         PIDGains[(int)s, 0] = controllers[(int)s].PGain;
         PIDGains[(int)s, 1] = controllers[(int)s].IGain;
         PIDGains[(int)s, 2] = controllers[(int)s].DGain;
         PIDGains[(int)s, 3] = controllers[(int)s].Scalar;
     }
 }
Beispiel #4
0
        public override void Initialize(string opName, ActivityLog logActivity, params int[] Parameters)
        {
            base.Initialize(opName, logActivity, Parameters);

            // Initialize Heading Hold PID
            m_HhPID = new PID(1, 0, 0, 0, -80, 80);

            m_DesiredDistance = m_Parameters[0];
            m_RequestedDistance = m_Parameters[0];
            m_DesiredHeading = m_Parameters[1];
        }
 // used for adding a new preset, can clone the current values
 public SSASPreset(PID.PIDErrorController[] controllers, string Name)
 {
     name = Name;
     foreach (SASList s in Enum.GetValues(typeof(SASList)))
     {
         PIDGains[(int)s, 0] = controllers[(int)s].PGain;
         PIDGains[(int)s, 1] = controllers[(int)s].IGain;
         PIDGains[(int)s, 2] = controllers[(int)s].DGain;
         PIDGains[(int)s, 3] = controllers[(int)s].Scalar;
     }
 }
        public DriveBaseCommand(double _distance, double _TimeOut)
        {
            distance = _distance; //Add six inches, because of the stop condition of subclasses of execute.
            TimeOut = _TimeOut;

            movePID = new PID(Constants.Auton_Move_P, 0, Constants.Auton_Move_D, -0.125, 0.125);
            CorrectionPID = new PID(Constants.Auton_Correction_P, 0, Constants.Auton_Correction_D, -0.125, 0.125);

            movePID.setpoint = distance;
            CorrectionPID.setpoint = 0;

            firstExecute = true;
        }
        /// <summary>
        /// <c>RunExperiment</c> is the main method of the <c>ConductivityExperiment</c>, it manages 
        /// all instruments to reach the required functionality.
        /// </summary>
        /// <param name="expParms">Experiment parameters passed by the user interface and set by the user.</param>
        /// <param name="pidParms">PID parameters that can be changed by the user.</param>
        /// <returns>If the experiment terminates normally, <c>true</c> is returned.</returns>
        public bool RunExperiment(Parameters expParms, PID.Controller.Parameters pidParms)
        {
            this.runningExperiment = true;

            /* experiment always starts in the phase 1 */
            Contract.Requires(phase == Phases.PHASE1);

            //float T; /* temperature measured in the data acquisition */
            float lastT = 0; /* temperature before current one */
            //float rate; /* rate at which the temperature varies each time interval */
            float desiredRate = expParms.desiredRate;
            float envT = expParms.envTemperature;
            Limits Tlims = expParms.temperatureLims;
            float V_PowerSupply = 0; /* voltage value to be sent to the power supply */
            int time = 0, dt = 100; /* miliseconds */
            //float R = 0, i, V; /* resistance, current and voltage in the sample */
            float err = 0; /* error from desired rate */
            Measurement measure;

            System.Console.Write("Start Experiment\n");

            pid = new PID.Controller(pidParms);
            ExportToFile(fullpath, expParms.ToString()); //fileacq.Write(expParms);
            ExportToFile(fullpath, "\n" + Measurement.header); //fileacq.Write("\n" + Measurement.header);
            if (Init(expParms.amperimeterVoltage0))
            {
                do
                {
                    /*i = ampere.Read();
                    V = ampere.readVoltage();
                    T = data.Read();
                    rate = (T - lastT) / (dt * 60); /* Celsius degree / sec */
                    /*
                    Contract.Invariant(i > 0);
                    R = V / i;*/

                    measure = this.Read(lastT, time);

                    // list changes the status here, listeners are
                    // interested in this event
                    list.Add(measure);

                    fileacq.Write(measure);
                    System.Console.Write(measure);
                    /*
                     * In the freezing phase temperature is not controlled
                     * by PID because the rate of decreasing is very high
                     * and the power supply will change the voltage every
                     * time
                     */
                    if (phase != Phases.PHASE2 || phase != Phases.PHASE4)
                    {
                        err = desiredRate - measure.getRate();
                        lastT = measure.getT();

                        V_PowerSupply = V_PowerSupply * ((desiredRate - pid.output(err, dt * 60)) / desiredRate);
                        heater.Send(V_PowerSupply);
                    }
                    if ((measure.getT() > Tlims.max && (phase == Phases.PHASE1 || phase == Phases.PHASE3))
                           || (measure.getT() < Tlims.min && phase == Phases.PHASE2))
                        phase++;

                    System.Threading.Thread.Sleep(dt);
                    time += dt;
                } while (phase != Phases.PHASE4 && measure.getT() < envT && this.runningExperiment);

                fileacq.Close();
                Halt();
                this.runningExperiment = false;
                return true;
            }
            else return false;
        }
Beispiel #8
0
        /// <summary>
        /// Update the PID
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="pid"></param>
        private void UpdatePID(Person subject, PID pid, ISystemConfigurationService config)
        {
            var dec = new DeComponentUtility();

            // Alternate identifiers
            if (subject.AlternateIdentifiers != null)
            {
                if (!this.Target.NotificationDomain.Any(o => o.Domain == "*"))
                {
                    subject.AlternateIdentifiers.RemoveAll(ii => !this.Target.NotificationDomain.Exists(o => o.Domain.Equals(ii.Domain)));
                }
                List <String> alreadyAdded = new List <string>();
                foreach (var altId in subject.AlternateIdentifiers)
                {
                    String idS = String.Format("{0}^{1}", altId.Domain, altId.Identifier);
                    if (!alreadyAdded.Contains(idS))
                    {
                        var id = pid.GetPatientIdentifierList(pid.PatientIdentifierListRepetitionsUsed);
                        this.UpdateCX(altId, id, config);
                        alreadyAdded.Add(idS);
                    }
                }
            }


            // Populate Names
            if (subject.Names != null)
            {
                foreach (var name in subject.Names)
                {
                    var xpn = pid.GetPatientName(pid.PatientNameRepetitionsUsed);
                    this.UpdateXPN(name, xpn);
                }
            }

            // Birth time
            if (subject.BirthTime != null)
            {
                MARC.Everest.DataTypes.TS ts = new Everest.DataTypes.TS(subject.BirthTime.Value, dec.ReverseLookup(ComponentUtility.TS_PREC_MAP, subject.BirthTime.Precision));
                pid.DateTimeOfBirth.TimeOfAnEvent.Value = MARC.Everest.Connectors.Util.ToWireFormat(ts);
            }

            // Admin Sex
            if (subject.GenderCode != null)
            {
                pid.Sex.Value = subject.GenderCode;
            }

            // Address
            if (subject.Addresses != null)
            {
                foreach (var addr in subject.Addresses)
                {
                    var ad = pid.GetPatientAddress(pid.PatientAddressRepetitionsUsed);
                    this.UpdateAD(addr, ad);
                }
            }

            // Death
            if (subject.DeceasedTime != null)
            {
                pid.PatientDeathIndicator.Value = "Y";
                MARC.Everest.DataTypes.TS ts = new Everest.DataTypes.TS(subject.DeceasedTime.Value, dec.ReverseLookup(ComponentUtility.TS_PREC_MAP, subject.DeceasedTime.Precision));
                pid.PatientDeathDateAndTime.TimeOfAnEvent.Value = MARC.Everest.Connectors.Util.ToWireFormat(ts);
            }

            // MB Order
            if (subject.BirthOrder.HasValue)
            {
                pid.MultipleBirthIndicator.Value = "Y";
                pid.BirthOrder.Value             = subject.BirthOrder.ToString();
            }

            // Citizenship
            if (subject.Citizenship != null)
            {
                foreach (var cit in subject.Citizenship)
                {
                    if (cit.Status == SVC.Core.ComponentModel.Components.StatusType.Active)
                    {
                        var c = pid.GetCitizenship(pid.CitizenshipRepetitionsUsed);
                        this.UpdateCE(new CodeValue(cit.CountryCode, config.OidRegistrar.GetOid("ISO3166-1").Oid), c);
                    }
                }
            }

            // Language
            if (subject.Language != null)
            {
                foreach (var lang in subject.Language)
                {
                    if (lang.Type == LanguageType.Fluency)
                    {
                        this.UpdateCE(new CodeValue(lang.Language, config.OidRegistrar.GetOid("ISO639-1").Oid), pid.PrimaryLanguage);
                        break;
                    }
                }
            }

            // Mothers name
            var relations = subject.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.RepresentitiveOf);

            foreach (var r in relations)
            {
                if (r is MARC.HI.EHRS.SVC.Core.ComponentModel.Components.PersonalRelationship)
                {
                    var psn = r as MARC.HI.EHRS.SVC.Core.ComponentModel.Components.PersonalRelationship;
                    if (psn.RelationshipKind != "MTH")
                    {
                        continue;
                    }

                    if (psn.AlternateIdentifiers != null)
                    {
                        foreach (var altid in psn.AlternateIdentifiers)
                        {
                            var id = pid.GetMotherSIdentifier(pid.MotherSIdentifierRepetitionsUsed);
                            UpdateCX(altid, id, config);
                        }
                    }
                    if (psn.LegalName != null)
                    {
                        UpdateXPN(psn.LegalName, pid.GetMotherSMaidenName(0));
                    }
                    break;
                }
            }

            // Telecom addresses
            //if(subject.TelecomAddresses != null)
            //    foreach (var tel in subject.TelecomAddresses)
            //        if (tel.Use == "HP" && tel.Value.StartsWith("tel"))
            //            MessageUtil.XTNFromTel((MARC.Everest.DataTypes.TEL)tel.Value, pid.GetPhoneNumberHome(pid.PhoneNumberHomeRepetitionsUsed));
            //        else if (tel.Use == "HP")
            //            pid.GetPhoneNumberHome(pid.PhoneNumberHomeRepetitionsUsed).EmailAddress.Value = tel.Value;
            //        else if (tel.Use == "WP" && tel.Value.StartsWith("tel"))
            //            MessageUtil.XTNFromTel((MARC.Everest.DataTypes.TEL)tel.Value, pid.GetPhoneNumberBusiness(pid.PhoneNumberBusinessRepetitionsUsed));
            //        else if (tel.Use == "WP")
            //            pid.GetPhoneNumberBusiness(pid.PhoneNumberBusinessRepetitionsUsed).EmailAddress.Value = tel.Value;
        }
Beispiel #9
0
 ///<summary>
 ///Removes the given PID
 ///</summary>
 public void RemovePID(PID toRemove)
 {
     this.RemoveStructure("PID", toRemove);
 }
 public Endpoint(PID writer, PID watcher)
 {
     Writer  = writer;
     Watcher = watcher;
 }
 public CartActor(PID bank) => _bank = bank;
Beispiel #12
0
 public AdaptivePID()
 {
     pitchPID = new PID(pitchP, pitchI, pitchD);
     rollPID = new PID(rollP, rollI, rollD);
     yawPID = new PID(yawP, yawI, yawD);
 }
Beispiel #13
0
 public Controller(PID.Controller.Parameters parms)
 {
     this.parms = parms;
 }
 public static SupervisorDirective Decide(PID pid, Exception reason)
 {
     return(SupervisorDirective.Restart);
 }
Beispiel #15
0
        public Task ConnectedAsync(IContext context)
        {
            switch (context.Message)
            {
            case RemoteTerminate msg:
            {
                if (_watched.TryGetValue(msg.Watcher.Id, out var pidSet))
                {
                    pidSet.Remove(msg.Watchee);
                    if (pidSet.Count == 0)
                    {
                        _watched[msg.Watcher.Id] = null;
                    }
                }

                //create a terminated event for the Watched actor
                var t = new Terminated
                {
                    Who = msg.Watchee
                };
                //send the address Terminated event to the Watcher
                msg.Watcher.SendSystemMessage(t);
                break;
            }

            case EndpointTerminatedEvent _:
            {
                _logger.LogDebug($"Handle terminated address {_address}");

                foreach (var(id, pidSet) in _watched)
                {
                    var watcherPid = new PID(ProcessRegistry.Instance.Address, id);
                    var watcherRef = ProcessRegistry.Instance.Get(watcherPid);
                    if (watcherRef != DeadLetterProcess.Instance)
                    {
                        foreach (var pid in pidSet)
                        {
                            //create a terminated event for the Watched actor
                            var t = new Terminated
                            {
                                Who = pid,
                                AddressTerminated = true
                            };

                            //send the address Terminated event to the Watcher
                            watcherPid.SendSystemMessage(t);
                        }
                    }
                }

                _watched.Clear();
                _behavior.Become(TerminatedAsync);
                break;
            }

            case RemoteUnwatch msg:
            {
                if (_watched.TryGetValue(msg.Watcher.Id, out var pidSet))
                {
                    pidSet.Remove(msg.Watchee);
                    if (pidSet.Count == 0)
                    {
                        _watched[msg.Watcher.Id] = null;
                    }
                }

                var w = new Unwatch(msg.Watcher);
                Remote.SendMessage(msg.Watchee, w, -1);
                break;
            }

            case RemoteWatch msg:
            {
                if (_watched.TryGetValue(msg.Watcher.Id, out var pidSet))
                {
                    pidSet.Add(msg.Watchee);
                }
                else
                {
                    _watched[msg.Watcher.Id] = new FastSet <PID> {
                        msg.Watchee
                    };
                }

                var w = new Watch(msg.Watcher);
                Remote.SendMessage(msg.Watchee, w, -1);
                break;
            }

            case Stopped _:
            {
                _logger.LogDebug("Stopped EndpointWatcher");
                break;
            }
            }
            return(Actor.Done);
        }
Beispiel #16
0
        private static void SpawnActivator()
        {
            var props = Props.FromProducer(() => new Activator()).WithGuardianSupervisorStrategy(Supervision.AlwaysRestartStrategy);

            ActivatorPid = RootContext.Empty.SpawnNamed(props, "activator");
        }
Beispiel #17
0
 public Result(PID pid)
 {
     Pid = pid;
 }
 public void Remove(PID pid)
 {
     _originalInstance.Remove(pid);
 }
Beispiel #19
0
 private static void ConsiderNewTemp(PID.PID pid, double newTargetTemp)
 {
     var diff = Math.Abs(pid.GetPreferredTemperature - newTargetTemp);
     if (diff > 0.1)
     {
         if (pid.Started())
         {
             pid.Stop();
         }
         pid.Start((float)newTargetTemp);
     }
 }
Beispiel #20
0
 double getvelratio(PID pid, double velUp)
 {
     double test = 1 - velUp / pid.SetPoint;
     if (test < 0) test = Math.Abs(test * 2);
     return test;
 }
 public ProcessFrame Get(PID pid)
 {
     return(m_ProcessStore.GetByPID(pid));
 }
Beispiel #22
0
 public static SupervisorDirective Decide(PID pid, Exception reason)
 => reason switch
 {
Beispiel #23
0
        private void button1_Click(object sender, EventArgs e)
        {
            ORM_O01 orm = new ORM_O01();

            #region 组装消息头
            orm.MSH.MessageType.MessageType.Value      = "ORM";
            orm.MSH.MessageType.TriggerEvent.Value     = "O01";
            orm.MSH.MessageType.MessageStructure.Value = "ORM_O01";
            orm.MSH.FieldSeparator.Value = MessageConstant.FieldSeparator;
            orm.MSH.SendingApplication.NamespaceID.Value   = "SSMZ";
            orm.MSH.SendingFacility.NamespaceID.Value      = "SSMZ";
            orm.MSH.ReceivingApplication.NamespaceID.Value = "MediII";
            orm.MSH.ReceivingFacility.NamespaceID.Value    = "MediII";
            orm.MSH.EncodingCharacters.Value  = MessageConstant.EncodingCharacters;
            orm.MSH.VersionID.VersionID.Value = MessageConstant.VersionID;
            orm.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDateWithSecond(DateTime.Now);
            orm.MSH.MessageControlID.Value          = MediII.Common.GUIDHelper.NewGUID();
            orm.MSH.ProcessingID.ProcessingID.Value = MessageConstant.ProcessingID;

            #endregion
            for (int i = 0; i < messageList.Count; i++)
            {
                MessageNode node = messageList[i];

                #region 组装PID段
                PID pid = orm.PATIENT.PID;
                pid.PatientID.ID.Value = node.PIDList["PatientIdentifier"];
                pid.GetPatientIdentifierList(0).ID.Value = node.PIDList["PatientIdentifier"];
                pid.GetPatientIdentifierList(1).ID.Value = node.PIDList["jiuzhenkh"];
                pid.GetPatientIdentifierList(2).ID.Value = node.PIDList["binganhao"];
                pid.GetPatientIdentifierList(3).ID.Value = node.PIDList["shebaokh"];
                pid.GetPatientIdentifierList(4).ID.Value = node.PIDList["gongfeizh"];
                string bingRenXM = node.PIDList["bingrenxm"];
                #region 姓名转全拼
                StringBuilder sb = new StringBuilder();
                foreach (char c in bingRenXM)
                {
                    if (ChineseChar.IsValidChar(c))
                    {
                        ChineseChar pinYinConvert = new ChineseChar(c);
                        string      pinYin        = pinYinConvert.Pinyins[0];
                        if (!string.IsNullOrEmpty(pinYin))
                        {
                            string word = pinYin.Substring(0, pinYin.Length - 1);
                            //首字母大写,其他小写
                            StringBuilder sbW = new StringBuilder(word.Length);
                            for (int n = 0; n < word.Length; n++)
                            {
                                string s = word.Substring(n, 1);
                                if (n == 0)
                                {
                                    sbW.Append(s.ToUpper());
                                }
                                else
                                {
                                    sbW.Append(s.ToLower());
                                }
                            }
                            sb.Append(sbW.ToString());
                        }
                    }
                    else
                    {
                        sb.Append(c);
                    }
                }
                #endregion
                pid.GetPatientName(0).FamilyName.Surname.Value = sb.ToString();
                pid.GetPatientName(0).GivenName.Value          = bingRenXM;
                DateTime dtCHUSHENGRQ = DateTime.Parse(node.PIDList["chushengrq"]);
                pid.DateTimeOfBirth.TimeOfAnEvent.SetLongDateWithSecond((DateTime)dtCHUSHENGRQ);//出生日期
                //if (string.IsNullOrEmpty(bingRenXx.XINGBIE))    //性别
                //    pid.AdministrativeSex.Value = "O";
                //else if (bingRenXx.XINGBIE == "男")
                //    pid.AdministrativeSex.Value = "M";
                //else if (bingRenXx.XINGBIE == "女")
                pid.AdministrativeSex.Value = node.PIDList["sex"];

                XAD address = pid.GetPatientAddress(0);
                address.City.Value            = node.PIDList["city"];
                address.StateOrProvince.Value = node.PIDList["province"];
                address.StreetAddress.StreetOrMailingAddress.Value = node.PIDList["streetaddress"];
                address.ZipOrPostalCode.Value  = node.PIDList["postcode"];
                address.OtherDesignation.Value = node.PIDList["postcode"];
                pid.GetPhoneNumberHome(0).PhoneNumber.Value     = node.PIDList["homephone"];
                pid.GetPhoneNumberBusiness(0).PhoneNumber.Value = node.PIDList["workphone"];
                pid.MaritalStatus.Text.Value = node.PIDList["hunyin"];
                string hunYinDm = string.Empty;
                //if (bingRenXx.HUNYINDM == "0")
                //    hunYinDm = "S";
                //else if (bingRenXx.HUNYINDM == "1")
                //    hunYinDm = "M";
                //else
                hunYinDm = "O";                                //婚姻代码
                pid.MaritalStatus.Identifier.Value = hunYinDm; //婚姻代码
                pid.PatientAccountNumber.ID.Value  = node.PIDList["yibaokh"];
                pid.SSNNumberPatient.Value         = node.PIDList["idnumber"];

                pid.GetEthnicGroup(0).Identifier.Value = node.PIDList["EthicGroupID"];
                pid.GetEthnicGroup(0).Text.Value       = node.PIDList["EthicGroupName"];
                pid.BirthPlace.Value             = node.PIDList["BirthPlace"];
                pid.Nationality.Identifier.Value = node.PIDList["NationalityID"];
                pid.Nationality.Text.Value       = node.PIDList["NationalityName"];
                #endregion
                #region 组装PV1

                PV1    pv1 = orm.PATIENT.PATIENT_VISIT.PV1;
                string menZhenZhuYuanBZ = node.PV1List["menZhenZhuYuanBZ"];
                if (menZhenZhuYuanBZ == "0")
                {
                    //门诊
                    pv1.SetIDPV1.Value      = node.PV1List["SetID"];
                    pv1.AdmissionType.Value = "R";
                    pv1.PatientClass.Value  = "O"; //门诊O
                    pv1.GetAttendingDoctor(0).IDNumber.Value = node.PV1List["AdmittingDoctorID"];
                    pv1.HospitalService.Value             = node.PV1List["HospitalService"];
                    pv1.PatientType.Value                 = node.PV1List["PatientType"];
                    pv1.VisitNumber.ID.Value              = node.PV1List["VisitNumber"];
                    pv1.ServicingFacility.Value           = node.PV1List["ServicingFacility"]; //上下午标志 0-上午,1-下午,2-晚上
                    pv1.PendingLocation.PointOfCare.Value = node.PV1List["PendingLocation"];
                    DateTime dtZHIDANRQ = DateTime.Parse(node.PV1List["AdmitDate"]);
                    pv1.AdmitDateTime.TimeOfAnEvent.SetLongDateWithSecond((DateTime)dtZHIDANRQ);//制单医生日期 就诊日期
                    pv1.VisitIndicator.Value       = "V";
                    pv1.ChargePriceIndicator.Value = node.PV1List["ChargePriceIndicator"];
                }
                else
                {
                    //住院
                    pid.GetPatientIdentifierList(1).ID.Value = node.PIDList["jiuzhenkh"];
                    pid.GetAlternatePatientIDPID(0).ID.Value = node.PIDList["yingerbz"];//婴儿标志0非婴儿1婴儿
                    pid.GetMotherSIdentifier(0).ID.Value     = node.PIDList["MothersIdentifier"];
                    pv1.VisitNumber.ID.Value = node.PV1List["VisitNumber"];
                    pv1.SetIDPV1.Value       = node.PV1List["AlternateVisitID"]; //住医生院次数
                    pv1.PatientClass.Value   = "I";                              //住院病人
                    pv1.AssignedPatientLocation.PointOfCare.Value = node.PV1List["PointOfCare"];
                    pv1.AssignedPatientLocation.Bed.Value         = node.PV1List["Bed"];
                    pv1.AssignedPatientLocation.Room.Value        = node.PV1List["Room"];
                    if (!String.IsNullOrEmpty(node.PV1List["Facility"]))//当前科室,当前科室名称
                    {
                        pv1.AssignedPatientLocation.Facility.NamespaceID.Value = node.PV1List["Facility"];
                    }
                    pv1.GetAttendingDoctor(0).IDNumber.Value  = node.PV1List["AttendingDoctorID"];
                    pv1.GetAttendingDoctor(0).GivenName.Value = node.PV1List["AttendingDoctorFamilyName"];
                    DateTime dtRuYuanRQ = DateTime.Parse(node.PV1List["AdmitDate"]);
                    pv1.AdmitDateTime.TimeOfAnEvent.SetLongDateWithSecond((DateTime)dtRuYuanRQ); //入院日期
                    pv1.PendingLocation.PointOfCare.Value = node.PV1List["PendingLocation"];     //当前科室
                    pv1.PatientType.Value = node.PV1List["PatientType"];                         //费用类别
                    DateTime dtRuKeRQ = DateTime.Parse(node.PV1List["AdmitDate"]);
                    if (dtRuKeRQ != null)
                    {
                        pv1.GetContractEffectiveDate(0).Value = ((DateTime)dtRuKeRQ).ToString("yyyyMMddHHmmss");//入科日期
                    }
                    pv1.VisitIndicator.Value       = "V";
                    pv1.ChargePriceIndicator.Value = node.PV1List["ChargePriceIndicator"];
                    pv1.AlternateVisitID.ID.Value  = node.PV1List["AlternateVisitID"];//住院次数
                }
                #endregion
                #region 组装检验申请内容
                for (int j = 0; j < node.ORCList.Count; j++)
                {
                    ORC orc = orm.GetORDER(j).ORC;
                    orc.OrderControl.Value = "SC";
                    orc.PlacerOrderNumber.EntityIdentifier.Value = node.ORCList[j]["PlacerOrderNumber"];                                     //申请单ID
                    orc.FillerOrderNumber.EntityIdentifier.Value = node.ORCList[j]["FillterOrderNumber"];                                    //检查号
                    orc.OrderStatus.Value = "SC";
                    orc.DateTimeOfTransaction.TimeOfAnEvent.SetLongDateWithSecond(DateTime.Parse(node.ORCList[j]["DateTimeOfTransaction"])); //登记时间
                    orc.GetEnteredBy(0).IDNumber.Value         = node.ORCList[j]["EnteredBy"];                                               //录入者
                    orc.EnteringOrganization.Identifier.Value  = node.ORCList[j]["EnteringOrganizationIdentifier"];                          //申请科室ID
                    orc.EnteringOrganization.Text.Value        = node.ORCList[j]["EnteringOrganizationText"];                                //申请科室名称
                    orc.GetOrderingProvider(j).IDNumber.Value  = node.ORCList[j]["OrderingProviderID"];                                      //申请医生ID
                    orc.GetOrderingProvider(j).GivenName.Value = node.ORCList[j]["OrderingProviderName"];                                    //申请医生姓名
                    orc.OrderControlCodeReason.Text.Value      = node.ORCList[j]["OrderControlCodeReason"];                                  //检查目的

                    OBR obr = orm.GetORDER(j).ORDER_DETAIL.OBR;
                    obr.SetIDOBR.Value = (j + 1).ToString();
                    obr.PlacerOrderNumber.EntityIdentifier.Value    = node.OBRList[j]["PlacerOrderNumber"];          //申请单ID
                    obr.FillerOrderNumber.EntityIdentifier.Value    = node.OBRList[j]["FillterOrderNumber"];         //检查号
                    obr.UniversalServiceIdentifier.Identifier.Value = node.OBRList[j]["UniversalServiceIdentifier"]; //检查部位ID
                    obr.UniversalServiceIdentifier.Text.Value       = node.OBRList[j]["UniversalServiceText"];       //检查部位名称
                    obr.Priority.Value = node.OBRList[j]["Priority"];                                                //优先级
                    obr.DangerCode.Identifier.Value = node.OBRList[j]["DangerCodeIdentifier"];;                      //执行科室
                    obr.DangerCode.Text.Value       = node.OBRList[j]["DangerCodeText"];                             //执行科室名称
                }
                #endregion
            }
            #region 转换消息对象为字符串
            NHapi.Base.Parser.PipeParser parser = new PipeParser();
            message = parser.Encode(orm);
            this.txtOutput.AppendText(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            this.txtOutput.AppendText("构建消息内容完成,消息内容如下:");
            this.txtOutput.AppendText(System.Environment.NewLine);
            this.txtOutput.AppendText(message);
            this.txtOutput.AppendText(System.Environment.NewLine);
            #endregion
        }
Beispiel #24
0
 public bool HasPhoto(PID pid)
 {
     return AllPhotos.ContainsKey(pid);
 }
Beispiel #25
0
 /// <summary>
 /// The user selected a PID from the list, and this method presents the values for the PID.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SelectedPIDChanged(object sender, EventArgs e)
 {
     _currentPID = (PID)_pidSettings.PIDSetup.SelectedItem;
     _pidSettings.SetPID(_currentPID.P, _currentPID.I, _currentPID.D);
 }
Beispiel #26
0
 /// <summary>
 /// 贷方 变更帐户额
 /// </summary>
 /// <param name="amount"></param>
 /// <param name="replyTo"></param>
 public Credit(decimal amount, PID replyTo) : base(amount, replyTo)
 {
 }
        public ProcessDescriptor GetDescriptor(PID pid)
        {
            ProcessFrame processFrame = m_ProcessStore.GetByPID(pid);

            return(processFrame.Descriptor);
        }
Beispiel #28
0
 public ProcessFrame Get(PID pid) => Service.Get(pid);
 internal static void Spawn()
 {
     Pid = Actor.SpawnNamed(Actor.FromProducer(() => new MemberListActor()), "memberlist");
 }
Beispiel #30
0
 public ProcessDescriptor GetDescriptor(PID pid) => Service.GetDescriptor(pid);
Beispiel #31
0
 public static Action <XElement, DeviceInfo, ActorXmlDispatcher> Auslagerung(PID ksActor)
 {
     return((message, device, dispatcher) => {
         if (!TryGetPzn(message, out var pzn) || !TryGetMenge(message, out int menge))
         {
             return;
         }
         int auslagerungsmenge = ksActor.RequestAsync <int>(KSActor.Messages.Auslagerung(pzn, menge)).Result;
         dispatcher.Send(device, new XElement("auslagerungResponse", message.Attributes().Concat(new [] { new XAttribute("ausgelagerteMenge", auslagerungsmenge) })));
     });
 }
Beispiel #32
0
 private void SystemMessage(SystemMessage sys, PID target) =>
 // Logger.LogDebug(
 //     "[EndpointReader] Forwarding remote system message {@MessageType}:{@Message}",
 //     sys.GetType().Name, sys
 // );
 target.SendSystemMessage(_system, sys);
 public void HandleFailure(ISupervisor supervisor, PID child, RestartStatistics rs, Exception cause)
 {
     supervisor.RestartChildren(cause, child);
 }
Beispiel #34
0
        public override async Task Receive(
            IAsyncStreamReader <MessageBatch> requestStream,
            IServerStreamWriter <Unit> responseStream,
            ServerCallContext context
            )
        {
            using var cancellationTokenRegistration = _endpointManager.CancellationToken.Register(() => {
                Logger.LogDebug("[EndpointReader] Telling to {Address} to stop", context.Peer);

                try
                {
                    _ = responseStream.WriteAsync(new Unit());
                }
                catch (Exception e)
                {
                    Logger.LogError(e, "[EndpointReader] Didn't tell to {Address} to stop", context.Peer);
                }
            }
                                                                                                  );

            var targets = new PID[100];

            while (await requestStream.MoveNext(context.CancellationToken).ConfigureAwait(false))
            {
                if (_endpointManager.CancellationToken.IsCancellationRequested)
                {
                    // We read all the messages ignoring them to gracefully end the request
                    continue;
                }

                var batch = requestStream.Current;

                // Logger.LogDebug("[EndpointReader] Received a batch of {Count} messages from {Remote}",
                //     batch.TargetNames.Count, context.Peer
                // );

                //only grow pid lookup if needed
                if (batch.TargetNames.Count > targets.Length)
                {
                    targets = new PID[batch.TargetNames.Count];
                }

                for (var i = 0; i < batch.TargetNames.Count; i++)
                {
                    var pid = PID.FromAddress(_system.Address, batch.TargetNames[i]);
                    pid.Ref(_system);
                    targets[i] = pid;
                }

                var typeNames = batch.TypeNames.ToArray();

                var m = _system.Metrics.Get <RemoteMetrics>().RemoteDeserializedMessageCount;

                foreach (var envelope in batch.Envelopes)
                {
                    var target = targets[envelope.Target];

                    if (envelope.RequestId != default)
                    {
                        target = target.WithRequestId(envelope.RequestId);
                    }
                    var typeName = typeNames[envelope.TypeId];

                    if (!_system.Metrics.IsNoop)
                    {
                        m.Inc(new[] { _system.Id, _system.Address, typeName });
                    }

                    object message;

                    try
                    {
                        message =
                            _serialization.Deserialize(typeName, envelope.MessageData, envelope.SerializerId);

                        //translate from on-the-wire representation to in-process representation
                        //this only applies to root level messages, and never on nested child messages
                        if (message is IRootSerialized serialized)
                        {
                            message = serialized.Deserialize(_system);
                        }
                    }
                    catch (Exception)
                    {
                        Logger.Log(_deserializationErrorLogLevel, "[EndpointReader] Unable to deserialize message with {Type} from {Remote}",
                                   typeName, context.Peer
                                   );
                        continue;
                    }

                    switch (message)
                    {
                    case Terminated msg:
                        Terminated(msg, target);
                        break;

                    case SystemMessage sys:
                        SystemMessage(sys, target);
                        break;

                    default:
                        ReceiveMessages(envelope, message, target);
                        break;
                    }
                }
            }

            _system.Metrics.Get <RemoteMetrics>().RemoteEndpointDisconnectedCount.Inc(new[] { _system.Id, _system.Address, context.Peer });
            Logger.LogDebug("[EndpointReader] Stream closed by {Remote}", context.Peer);
        }
Beispiel #35
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Error processing request.");
                Console.WriteLine("");
                Console.WriteLine("Syntax:");
                Console.WriteLine("DFUDeploy [file] [options]");
                Console.WriteLine("");
                Console.WriteLine("Options:");
                Console.WriteLine("\t/c");
                Console.WriteLine("\tClears all memory.  By default only the bootloader memory is erased.");
                Console.WriteLine("\tWith this option your NETMF runtime and deployment will also be erased.");
                Console.WriteLine("");
                Console.WriteLine("\t/x");
                Console.WriteLine("\tExits DFU mode after updating the bootloader.");
                Console.WriteLine("");
                Console.WriteLine("\t/?");
                Console.WriteLine("\tLists devices memory map.");
                Console.WriteLine("");
                Console.WriteLine("WARNING: This tool will deploy to the first USB device found in DFU mode.");
                Console.WriteLine("");
                return;
            }

            try
            {
                if (!firmwareUpdate.IsDFUDeviceFound())
                {
                    throw new Exception("No devices in DFU mode were found.");
                }

                if (args.Contains("/c") || args.Contains("/C"))
                {
                    firmwareUpdate.OnFirmwareUpdateProgress += new FirmwareUpdateProgressEventHandler(firmwareUpdate_OnFirmwareUpdateProgress);

                    UInt16 VID;
                    UInt16 PID;
                    UInt16 Version;

                    try
                    {
                        firmwareUpdate.ParseDFU_File(args[0], out VID, out PID, out Version);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Error parsing DFU file. " + ex.Message, ex);
                    }

                    Console.WriteLine("Found VID: " + VID.ToString("X4") + " PID: " + PID.ToString("X4") + " Version: " + Version.ToString("X4"));
                }

                try
                {
                    bool eraseEveything = false;
                    bool exitDFUMode    = false;

                    //The cC switch erases everything from the chip
                    if (args.Contains("/c") || args.Contains("/C"))
                    {
                        eraseEveything = true;
                    }

                    //The xX switch exits the device from DFU mode
                    if (args.Contains("/x") || args.Contains("/X"))
                    {
                        exitDFUMode = true;
                    }

                    firmwareUpdate.UpdateFirmware(args[0], eraseEveything, exitDFUMode);
                }
                catch (Exception ex)
                {
                    throw new Exception("Error deploying DFU file. " + ex.Message, ex);
                }

                Console.WriteLine("Done.");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }
        }
Beispiel #36
0
 public override string ToString()
 {
     return("PID:" + PID.ToString() + " Id:" + ID.ToString() + " Name: " + Name);
 }
Beispiel #37
0
        /// <summary>
        /// Notify the operation
        /// </summary>
        public void Notify(NotificationQueueWorkItem workItem)
        {
            // configuration service
            ISystemConfigurationService config = this.Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;
            ILocalizationService        locale = this.Context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            // Common message bits we need to update
            IMessage notificationMessage = null;
            MSH      msh = null;
            PID      pid = null;
            EVN      evn = null;
            PV1      pv1 = null;
            MRG      mrg = null;

            // Identify the work item action
            switch (workItem.Action)
            {
            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.Create:
            {
                ADT_A01 message = new ADT_A01();
                msh = message.MSH;
                pid = message.PID;
                evn = message.EVN;
                pv1 = message.PV1;
                notificationMessage = message;
                msh.MessageType.TriggerEvent.Value = "A04";

                break;
            }

            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.DuplicatesResolved:
            {
                ADT_A39 message = new ADT_A39();
                msh = message.MSH;
                msh.MessageType.TriggerEvent.Value = "A40";
                pid = message.GetPATIENT(0).PID;
                evn = message.EVN;
                pv1 = message.GetPATIENT(0).PV1;
                mrg = message.GetPATIENT(0).MRG;
                notificationMessage = message;
                break;
            };

            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.Update:
            {
                ADT_A01 message = new ADT_A01();
                msh = message.MSH;
                pid = message.PID;
                evn = message.EVN;
                pv1 = message.PV1;
                notificationMessage = message;
                msh.MessageType.TriggerEvent.Value = "A08";
                break;
            }
            }

            // Populate the MSH header first
            this.UpdateMSH(msh, config);

            // Populate the EVN segment
            evn.EventTypeCode.Value = workItem.Event.Mode.ToString();
            evn.RecordedDateTime.TimeOfAnEvent.Value = (TS)workItem.Event.Timestamp;

            // Populate the PID segment
            Person subject = workItem.Event.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;

            this.UpdatePID(subject, pid, config);
            pv1.PatientClass.Value = "I";

            // Populate MRG
            if (mrg != null)
            {
                var registration = this.Context.GetService(typeof(IDataRegistrationService)) as IDataRegistrationService;
                var persistence  = this.Context.GetService(typeof(IDataPersistenceService)) as IDataPersistenceService;
                var replacements = subject.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.ReplacementOf);

                foreach (PersonRegistrationRef rplc in replacements)
                {
                    // First, need to de-persist the identifiers
                    QueryParameters qp = new QueryParameters()
                    {
                        Confidence        = 1.0f,
                        MatchingAlgorithm = MatchAlgorithm.Exact,
                        MatchStrength     = MatchStrength.Exact
                    };
                    var queryEvent   = new QueryEvent();
                    var patientQuery = new RegistrationEvent();
                    queryEvent.Add(qp, "FLT", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.FilterOf, null);
                    patientQuery.Add(new Person()
                    {
                        AlternateIdentifiers = rplc.AlternateIdentifiers
                    }, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                    queryEvent.Add(patientQuery, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                    // Perform the query
                    var patientIdentifiers = registration.QueryRecord(queryEvent);
                    if (patientIdentifiers.Length == 0)
                    {
                        throw new InvalidOperationException();
                    }
                    var replacedPerson = (persistence.GetContainer(patientIdentifiers[0], true) as RegistrationEvent).FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;

                    foreach (var ii in replacedPerson.AlternateIdentifiers.FindAll(o => this.Target.NotificationDomain.Exists(d => d.Domain == o.Domain)))
                    {
                        var cx = mrg.GetPriorPatientIdentifierList(mrg.PriorAlternatePatientIDRepetitionsUsed);
                        cx.ID.Value = ii.Identifier;
                        if (String.IsNullOrEmpty(ii.AssigningAuthority))
                        {
                            cx.AssigningAuthority.NamespaceID.Value = config.OidRegistrar.FindData(ii.Domain).Attributes.Find(o => o.Key == "AssigningAuthorityName").Value;
                        }
                        else
                        {
                            cx.AssigningAuthority.NamespaceID.Value = ii.AssigningAuthority;
                        }
                        cx.AssigningAuthority.UniversalID.Value     = ii.Domain;
                        cx.AssigningAuthority.UniversalIDType.Value = "ISO";
                    }
                }
            }

            // Send
            var queueItem = new Hl7MessageQueue.MessageQueueWorkItem(this.Target, notificationMessage);

            if (!queueItem.TrySend())
            {
                Trace.TraceWarning(locale.GetString("NTFW005"));
                Hl7MessageQueue.Current.EnqueueMessageItem(queueItem);
            }
        }
Beispiel #38
0
 private async Task <int> RestartActorAndGetState(PID pid, Props props)
 {
     pid.Stop();
     pid = Actor.Spawn(props);
     return(await pid.RequestAsync <int>(new GetState(), TimeSpan.FromMilliseconds(500)));
 }
        /// <summary>
        /// <c>RunExperiment</c> is the main method of the <c>ConductivityExperiment</c>, it manages 
        /// all instruments to reach the required functionality.
        /// </summary>
        /// <param name="expParms">Experiment parameters passed by the user interface and set by the user.</param>
        /// <param name="pidParms">PID parameters that can be changed by the user.</param>
        /// <returns>If the experiment terminates normally, <c>true</c> is returned.</returns>
        public bool RunExperiment(Parameters expParms, PID.Controller.Parameters pidParms)
        {
            WindowsFormsApplication1.frmInterface mainform = new WindowsFormsApplication1.frmInterface();
               // WindowsFormsApplication1.ParserClass ParserClass_ = new WindowsFormsApplication1.ParserClass();

            this.runningExperiment = true;

            /* experiment always starts in the phase 1 */
            Contract.Requires(phase == Phases.PHASE1);

            //float T; /* temperature measured in the data acquisition */
            float lastT = 0; /* temperature before current one */
            //float rate; /* rate at which the temperature varies each time interval */
            float desiredRate = expParms.desiredRate;
            float envT = expParms.envTemperature;
            Limits Tlims = expParms.temperatureLims;
            float V_PowerSupply = 0; //expParms.amperimeterVoltage0;  /* voltage value to be sent to the power supply */
            int time = 0, dt = expParms.deltaTime; /* miliseconds */
            //float R = 0, i, V; /* resistance, current and voltage in the sample */
            float err = 0; /* error from desired rate */
            int counter = 0; /*counter*/
            Measurement measure;
            MessageBoxButtons buttons = MessageBoxButtons.OK;
            string caption = "Alerta";

            System.Console.Write("Start Experiment\n");

            pid = new PID.Controller(pidParms);
            file.Write(expParms);
            file.Write("\n"+Measurement.header);
            Init(expParms.amperimeterVoltage0);
            do {
                /*i = ampere.Read();
                V = ampere.readVoltage();
                T = data.Read();
                rate = (T - lastT) / (dt * 60); /* Celsius degree / sec */
                /*
                Contract.Invariant(i > 0);
                R = V / i;*/

                measure = this.Read(lastT, time);

                // list changes the status here, listeners are
                // interested in this event
                list.Add(measure);

                file.Write(measure);
               // System.Console.Write(measure);

                float Strtime = measure.getTime();
                float StrRate = measure.getRate();
                float StrT = measure.getT();
                float StrR = measure.getR();
                float[] measuresforChart = new float[] { measure.getTime(), measure.getRate(), measure.getT(), measure.getR() };
                float[] measuresforPIDChart = new float[] { measure.getTime(), (StrT - lastT) / dt };

                if (this.mainform != null)
                {

                    this.mainform.setStrValue(Strtime.ToString(), this.mainform.lblTime);
                    this.mainform.setStrValue(StrRate.ToString(), this.mainform.lblSampleCurrent);
                    this.mainform.setStrValue(StrT.ToString(), this.mainform.lblTemperature);
                    this.mainform.setStrValue(StrR.ToString(), this.mainform.lblResistorCurrent);

                    this.mainform.SetChartValues(measuresforChart, this.mainform.chart1, counter);
                    this.mainform.SetChartValues(measuresforPIDChart, this.mainform.chart2, counter);
                }

                /*
                 * In the freezing phase temperature is not controlled
                 * by PID because the rate of decreasing is very high
                 * and the power supply will change the voltage every
                 * time
                 */
                if (phase != Phases.PHASE2 || phase != Phases.PHASE4)
                {
                    err = desiredRate - measure.getRate();
                    lastT = measure.getT();

                    V_PowerSupply = V_PowerSupply * ( (desiredRate - pid.output(err, dt*60)) / desiredRate);
                    heater.Send(V_PowerSupply);
                }
                if ((measure.getT() > Tlims.max && (phase == Phases.PHASE1 || phase == Phases.PHASE3))
                       || (measure.getT() < Tlims.min && phase == Phases.PHASE2))
                    phase++;

                System.Threading.Thread.Sleep(dt);
                time += dt;
                counter++;

                if (phase != Phases.PHASE4 && measure.getT() >= Tlims.max)
                {
                    MessageBox.Show("Iniciar fase de resfriamento. Clique OK após o procedimento.", caption, buttons);
                }

            } while (this.runningExperiment);
            //while (phase != Phases.PHASE4 && measure.getT() < envT && this.runningExperiment);

            file.Close();
            Halt();
            this.runningExperiment = false;

            return true;
        }
Beispiel #40
0
        /// <summary>
        /// Updates a <see cref="PID"/> segment.
        /// </summary>
        /// <param name="patient">The patient to use to update the PID segment.</param>
        /// <param name="pid">The PID segment to update.</param>
        /// <param name="targetConfiguration">The target configuration.</param>
        internal static void UpdatePID(Patient patient, PID pid, TargetConfiguration targetConfiguration)
        {
            // ensure authenticated
            EnsureAuthenticated();

            tracer.TraceEvent(TraceEventType.Verbose, 0, "Start updating PID segment");

            if (patient.GenderConceptKey.HasValue)
            {
                UpdateGender(patient.GenderConceptKey.ToString(), pid);
            }

            if (patient.MultipleBirthOrder.HasValue)
            {
                if (patient.MultipleBirthOrder != 0)
                {
                    pid.BirthOrder.Value = patient.MultipleBirthOrder.ToString();
                }
                pid.MultipleBirthIndicator.Value = "Y";
            }

            if (patient.DateOfBirth.HasValue)
            {
                pid.DateTimeOfBirth.TimeOfAnEvent.Value = (TS)patient.DateOfBirth.Value;
            }

            if (patient.DeceasedDate.HasValue)
            {
                pid.PatientDeathDateAndTime.TimeOfAnEvent.Value = (TS)patient.DeceasedDate.Value;
                pid.PatientDeathIndicator.Value = "Y";
            }

            foreach (var address in patient.LoadCollection <EntityAddress>("Addresses"))
            {
                NotifierBase.UpdateAD(address, pid.GetPatientAddress(pid.PatientAddressRepetitionsUsed));
            }

            var pids = patient.LoadCollection <EntityIdentifier>("Identifiers").Where(item => assigningAuthorityRepositoryService.Find(a => a.DomainName == item.Authority.DomainName).FirstOrDefault() != null).ToArray();

            for (var i = 0; i < pids.Length; i++)
            {
                var patientIdentifier = pids[i];

                pid.GetPatientIdentifierList(i).ID.Value = patientIdentifier.Value;
                pid.GetPatientIdentifierList(i).AssigningAuthority.NamespaceID.Value     = patientIdentifier.Authority.DomainName;
                pid.GetPatientIdentifierList(i).AssigningAuthority.UniversalID.Value     = patientIdentifier.Authority.Oid;
                pid.GetPatientIdentifierList(i).AssigningAuthority.UniversalIDType.Value = "ISO";
                pid.GetPatientIdentifierList(i).IdentifierTypeCode.Value = "PI";
            }

            // Create the PI for the patient key
            var lastPid = pid.PatientIdentifierListRepetitionsUsed;

            pid.GetPatientIdentifierList(lastPid).ID.Value = patient.Key.ToString();
            pid.GetPatientIdentifierList(lastPid).AssigningAuthority.UniversalID.Value     = ApplicationContext.Current.Configuration?.Custodianship?.Id?.AssigningAuthority?.Oid;
            pid.GetPatientIdentifierList(lastPid).AssigningAuthority.UniversalIDType.Value = "ISO";
            pid.GetPatientIdentifierList(lastPid).IdentifierTypeCode.Value = "PI";

            foreach (var personLanguage in patient.LoadCollection <PersonLanguageCommunication>("LanguageCommunication").Where(l => l.IsPreferred))
            {
                pid.PrimaryLanguage.Identifier.Value = personLanguage.LanguageCode;
                //pid.PrimaryLanguage.NameOfCodingSystem.Value = "ISO639-1";
            }

            foreach (var mother in patient.LoadCollection <EntityRelationship>("Relationships").Where(r => (r.RelationshipTypeKey == EntityRelationshipTypeKeys.Mother ||
                                                                                                            r.RelationshipTypeKey == EntityRelationshipTypeKeys.NaturalMother) &&
                                                                                                      r.LoadProperty <Entity>("TargetEntity") is Person).Select(relationship => relationship.TargetEntity as Person))
            {
                mother.Identifiers.ForEach(c =>
                {
                    pid.GetMotherSIdentifier(pid.MotherSIdentifierRepetitionsUsed).ID.Value = c.Value;
                    pid.GetMotherSIdentifier(pid.MotherSIdentifierRepetitionsUsed).AssigningAuthority.NamespaceID.Value     = c.Authority.Oid;
                    pid.GetMotherSIdentifier(pid.MotherSIdentifierRepetitionsUsed).AssigningAuthority.UniversalIDType.Value = "ISO";
                    pid.GetPatientIdentifierList(pid.PatientIdentifierListRepetitionsUsed).IdentifierTypeCode.Value         = c.Authority.DomainName;
                });

                mother.Names.ForEach(c =>
                {
                    NotifierBase.UpdateXPN(c, pid.GetMotherSMaidenName(pid.MotherSMaidenNameRepetitionsUsed));
                });
            }

            foreach (var name in patient.LoadCollection <EntityName>("Names"))
            {
                NotifierBase.UpdateXPN(name, pid.GetPatientName(pid.PatientNameRepetitionsUsed));
            }
        }
Beispiel #41
0
 double getothervelratio(PID pid, Vector3D uh, Vector3D dir, double velUp, double MaxVel)
 {
     double test = (1 - velUp / (MaxVel * Vector3D.Dot(remote.WorldMatrix.Up, dir)));
     if (test < 0) test = Math.Abs(test * 2);
     return test;
 }
Beispiel #42
0
        public ISimpleScheduler ScheduleRequestRepeatedly(TimeSpan delay, TimeSpan interval, PID sender, PID target, object message, out CancellationTokenSource cancellationTokenSource)
        {
            CancellationTokenSource cts = new CancellationTokenSource();

            var _ = Task.Run(async() =>
            {
                await Task.Delay(delay, cts.Token);

                async void Trigger()
                {
                    while (true)
                    {
                        if (cts.IsCancellationRequested)
                        {
                            return;
                        }

                        //TODO: allow using sender
                        _context.Request(target, message);

                        await Task.Delay(interval, cts.Token);
                    }
                }

                Trigger();
            }, cts.Token);

            cancellationTokenSource = cts;

            return(this);
        }
Beispiel #43
0
 public Controller(PID pid)
 {
     this.pid = pid;
 }
Beispiel #44
0
 public ProcessFrame Get(PID pid)
 {
     return(ProcessControllerService.Instance.Get(pid));
 }
 public DriveTurnCommand(double _degrees, double _timeOut)
     : base(Utility.ToRadians(_degrees) * Constants.Robot_Width / 2, _timeOut)
 {
     movePID = new PID(Constants.Auton_Move_P, 0, 0, -2, 2);
 }
Beispiel #46
0
 public ProcessDescriptor GetDescriptor(PID pid)
 {
     return(ProcessControllerService.Instance.GetDescriptor(pid));
 }