Tracking_自定义Profile筛选(1)

本文介绍如何通过自定义TackingProfile来精确控制工作流中的实例、活动及用户跟踪行为的状态记录,包括生成自定义配置文件的方法。
 1.Tacking服务所要记录的状态是可以通过自定义Tacking Pofile进行筛选的.

 2.默认Tacking服务对 [实例的各类状态]、[Activity的各类状态]、[用户跟踪行为]的所有状态进行记录,可以自定义自定义Tacking Pofile让Tacking服务只记录实际需要的状态.以下各类状态变化可被Tacking服务记录,也可用Tacking Pofile进行筛选:

实例的各类状态

Aborted、 Changed、 Completed、 Created、 Exception、 Idle、 
Loaded、 Persisted、 Resumed、 Started、 Suspended、 Terminated、 Unloaded

Activity的各类状态

一个工作流是由多个Activity组成的,每一个Activity都会有一个生命周期,在此期间,Activity会经历多种状态:Canceling、 Closed、 Compensating、 Executing、 Faulting、 Initialized

用户跟踪行为

可以在Activity代码中用TrackData方法向Tacking服务提交自定义状态点

 3.自定义Tacking Pofile将生成一个XML串,存入TrackingProfile表的TrackingProfileXml字段中

4.默认的Tacking Pofile以一个XML串的形式存于DefaultTrackingProfile表的TrackingProfileXml字段中

5.自定义Tacking Pofile只对指定的工作流有效,默认的Tacking Pofile对所有没有自定义Tacking Pofile的工作流有效。

6.如果所有工作流要使用同样的筛选,可以直接修改默认的Tacking Pofile,

7.如果同一对象已添加自定义的Tacking Pofile,使用默认方式再添加时,将出产生异常,该异常由UpdateTrackingProfile存储过程产生.

8.完全可以手工操作Pofile的XML串,也可以手工操作Tacking数据,而不使用本文的方式

 

生成自定义Pofile对象

该方法将生成一个自定义Pofile对象,并将该对象传行成一个XML串,然后调用后面的[插入Profile的XML串到数据库]方法将其存入数据库

None.gif private static void 建立并插入Profile()
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif{
InBlock.gif            
//生成Profile的XML字串,然后专给插入Profile方法
InBlock.gif

InBlock.gif            Version 自定义版本 
= new Version("4.3.2.1");
InBlock.gif            
//版本信息同时存在"TrackingProfile表Version字段"与"Profile的XML字串"中
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif            
/**////////////////////////////<TrackingProfile>////////////////////////////////////////////////////
InBlock.gif            TrackingProfile profile = new TrackingProfile();
InBlock.gif            
InBlock.gif
InBlock.gif            
//-----------<TrackingProfile> 节-------------
InBlock.gif
            profile.Version = 自定义版本;//此处用来写XML文件中的version="3.0.0.0"
InBlock.gif            
//效果如下
InBlock.gif            
//<TrackingProfile xmlns="http://schemas.microsoft.com/winfx/2006/workflow/trackingprofile" version="3.0.0.0">
InBlock.gif

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif            
/**////////////////////////////<ActivityTrackPoint>////////////////////////////////////////////////////
InBlock.gif
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif            
//       此段生成profile文件中,筛选Activity跟踪点的设置             //
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif
InBlock.gif            
//---------<ActivityTrackingLocation>节---------
InBlock.gif
            ActivityTrackingLocation ActivityTrackingLocation节 = new ActivityTrackingLocation(typeof(Activity));
InBlock.gif           
InBlock.gif            Console.WriteLine();
InBlock.gif            Console.WriteLine(
"已设置要监视的ActivityExecutionStatus :");
InBlock.gif            
foreach (ActivityExecutionStatus status in Enum.GetValues(typeof(ActivityExecutionStatus)))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.WriteLine(status.ToString()); 
//一个屏幕输出
InBlock.gif
                ActivityTrackingLocation节.ExecutionStatusEvents.Add(status);
ExpandedSubBlockEnd.gif            }

InBlock.gif           
InBlock.gif
InBlock.gif            
//----------<MatchingLocations>节---------------
InBlock.gif
            ActivityTrackingLocation节.MatchDerivedTypes = true;
InBlock.gif
InBlock.gif            
//----------<ActivityTrackPoint>节--------------
InBlock.gif
            ActivityTrackPoint ActivityTrackPoint节 = new ActivityTrackPoint();
InBlock.gif
InBlock.gif            ActivityTrackPoint节.MatchingLocations.Add(ActivityTrackingLocation节); 
//节入节
InBlock.gif

InBlock.gif            profile.ActivityTrackPoints.Add(ActivityTrackPoint节); 
//节入节
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif            
/**////////////////////<WorkflowTrackPoint>//////////////////////////////////////////////////////////
InBlock.gif
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif            
//       此段生成profile文件中,筛选实例跟踪点的设置                 //
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif
InBlock.gif
InBlock.gif            
//-----------<WorkflowTrackingLocation>节---------
InBlock.gif
            WorkflowTrackingLocation WorkflowTrackingLocation节 = new WorkflowTrackingLocation();
InBlock.gif
InBlock.gif            Console.WriteLine();
InBlock.gif            Console.WriteLine(
"已设置要监视的WorkflowEvent :");
InBlock.gif            
foreach (TrackingWorkflowEvent wEvent in Enum.GetValues(typeof(TrackingWorkflowEvent)))
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.WriteLine( wEvent.ToString());
//一个屏幕输出
InBlock.gif
                WorkflowTrackingLocation节.Events.Add(wEvent);
ExpandedSubBlockEnd.gif            }

InBlock.gif            Console.WriteLine();
InBlock.gif
InBlock.gif
InBlock.gif            
//-----------<WorkflowTrackPoint>节------------------
InBlock.gif
            WorkflowTrackPoint WorkflowTrackPoint节 = new WorkflowTrackPoint();
InBlock.gif
InBlock.gif            
//-----------<MatchingLocation>节------------------
InBlock.gif
            WorkflowTrackPoint节.MatchingLocation = WorkflowTrackingLocation节; //节入节
InBlock.gif
    
InBlock.gif            profile.WorkflowTrackPoints.Add(WorkflowTrackPoint节); 
//节入节
InBlock.gif

ExpandedSubBlockStart.gifContractedSubBlock.gif            
/**//////////////////////////<UserTrackPoint>///////////////////////////////////////////////////////
InBlock.gif
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif            
//       此段生成profile文件中,筛选用户跟踪点的设置                 //
InBlock.gif            
//------------------------------------------------------------------//
InBlock.gif
InBlock.gif            
//------------<UserTrackPoint>节---------------
InBlock.gif
            UserTrackPoint UserTrackPoint节 = new UserTrackPoint();
InBlock.gif
InBlock.gif
InBlock.gif            
//-----------<UserTrackingLocation>节-----------
InBlock.gif
  
InBlock.gif            UserTrackingLocation UserTrackingLocation节;
InBlock.gif           
InBlock.gif            Console.WriteLine();
InBlock.gif            Console.WriteLine(
"设置要监视的用户监视点:已设置");
InBlock.gif            UserTrackingLocation节 
= new UserTrackingLocation(typeof(string), typeof(CodeActivity));
InBlock.gif           
InBlock.gif            
//-----------<MatchingLocation>节------------------
InBlock.gif
            UserTrackingLocation节.MatchDerivedActivityTypes = true;
InBlock.gif
InBlock.gif            UserTrackPoint节.MatchingLocations.Add(UserTrackingLocation节);
InBlock.gif           
InBlock.gif            
//节入节
InBlock.gif
            profile.UserTrackPoints.Add(UserTrackPoint节);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif           
/**/////////////////////////////////////////////////////////////////////////////////////////////
InBlock.gif           //                                                                                        //
ExpandedSubBlockStart.gifContractedSubBlock.gif
           /**/////////////////////////////////////////////////////////////////////////////////////////////
InBlock.gif
InBlock.gif            
//---------------生成XML串-----------------------------
InBlock.gif
            TrackingProfileSerializer 串行化对象 = new TrackingProfileSerializer();
InBlock.gif            StringWriter StringWriter接收器 
= new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
InBlock.gif
InBlock.gif            串行化对象.Serialize(StringWriter接收器, profile);
InBlock.gif
InBlock.gif            String XML字串 
= StringWriter接收器.ToString();
InBlock.gif           
InBlock.gif            Console.WriteLine();
InBlock.gif            Console.WriteLine(
"生成完成,准备插入数据库");
InBlock.gif            Console.WriteLine();
InBlock.gif            
//---------------插入数据库------------------------
InBlock.gif
            插入Profile的XML串到数据库(XML字串, 自定义版本);
InBlock.gif
ExpandedBlockEnd.gif        }

None.gif

接下篇


 
#include <ti/driverlib/m0p/dl_interrupt.h> #include “ti_msp_dl_config.h” #include “oled_hardware_i2c.h” volatile uint32_t S2, S3; volatile uint32_t S1,S4; void TB662L_f(uint8_t a,uint8_t b){ if( a== 0&&b == 0){ DL_GPIO_clearPins(TB662L_PORT, TB662L_BIN2_PIN |TB662L_AIN2_PIN); DL_GPIO_setPins(TB662L_PORT, TB662L_BIN1_PIN |TB662L_AIN1_PIN); } if(a == 1&&b == 1) { DL_GPIO_setPins(TB662L_PORT, TB662L_BIN2_PIN |TB662L_AIN2_PIN); DL_GPIO_clearPins(TB662L_PORT, TB662L_BIN1_PIN |TB662L_AIN1_PIN); } if(a == 1&&b == 0) { DL_GPIO_setPins(TB662L_PORT, TB662L_BIN2_PIN |TB662L_AIN2_PIN); DL_GPIO_setPins(TB662L_PORT, TB662L_BIN1_PIN |TB662L_AIN1_PIN); } } void PWM(uint32_t h,uint32_t f){ DL_TimerA_setCaptureCompareValue(PWM_0_INST, h, DL_TIMER_CC_1_INDEX); DL_TimerA_setCaptureCompareValue(PWM_0_INST, f, DL_TIMER_CC_0_INDEX); } void Motor(){ if(((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0) ==0&((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0) == 0){ TB662L_f(1,0); while (1) { TB662L_f(1,1); PWM(0,150); if(((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0) == 1&&((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0) == 1) break; } TB662L_f(1,0); delay_cycles(32000000/500); TB662L_f(1,1); } if(((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0) == 0&&((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0) == 1){ PWM(400,300); } if(((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0) == 1&&((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0) == 0){ PWM(300,400); } if(((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0) == 1&&((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0) == 1){ PWM(250,250); } if(((DL_GPIO_readPins(Tracking_S1_PORT,Tracking_S1_PIN) & Tracking_S1_PIN)? 1:0) == 1&&((DL_GPIO_readPins(Tracking_S4_PORT,Tracking_S4_PIN) & Tracking_S4_PIN)? 1:0) == 0){ PWM(300,400); } if(((DL_GPIO_readPins(Tracking_S1_PORT,Tracking_S1_PIN) & Tracking_S1_PIN)? 1:0) == 0&&((DL_GPIO_readPins(Tracking_S4_PORT,Tracking_S4_PIN) & Tracking_S4_PIN)? 1:0) == 1){ PWM(400,300); } } void Key1(void){ while(((DL_GPIO_readPins(Key_PORT,Key_Key1_PIN) & Key_Key1_PIN )? 1:0)) { OLED_ShowString(40,0,(uint8_t *)“Motor1”,16); OLED_ShowString(0,2,(uint8_t *)“S2:”,16); OLED_ShowString(0,4,(uint8_t *)“S3:”,16); OLED_ShowNum(20,2,S3,1,16); OLED_ShowNum(20,4,S2,1,16); } } int main(void) { SYSCFG_DL_init(); //清除定时器中断标志 //使能定时器中断 NVIC_EnableIRQ(TIMER_0_INST_INT_IRQN); DL_TimerG_startCounter(PWM_0_INST); TB662L_f(1,1); OLED_Init(); DL_GPIO_setPins(LED_PORT , LED_PIN_0_PIN); Key1(); while (1) { S1 = ((DL_GPIO_readPins(Tracking_S1_PORT,Tracking_S1_PIN) & Tracking_S1_PIN)? 1:0); S2 = ((DL_GPIO_readPins(Tracking_S2_PORT,Tracking_S2_PIN) & Tracking_S2_PIN)? 1:0); S3 = ((DL_GPIO_readPins(Tracking_S3_PORT,Tracking_S3_PIN) & Tracking_S3_PIN)? 1:0); S4 = ((DL_GPIO_readPins(Tracking_S4_PORT,Tracking_S4_PIN) & Tracking_S4_PIN)? 1:0); Motor(); } } @c:\Users\33225\Desktop\empty_driverlib_src_LP_MSPM0G3507_nortos_ticlang/ 设计制作一个简易自行瞄准装置,该装置包括自动寻迹小车及瞄准模块两部 分。自动寻迹小车行驶必须采用TI MSPM0系列MCU(简称MSPM0)控制(包 括巡迹、电机控制);要求MSPM0 小车行驶轨迹外沿为 100cm×100cm 的正方形,边线为黑色,线宽 1.8cm±0.2cm。正方形四个外顶点为 A、B、C 和 D 点。小车可沿行驶轨迹自动 寻迹逆时针方向行驶。 二、 要求 基本要求 (1)小车可以沿行驶轨迹自动寻迹行驶,行驶圈数N可在1~5之间设定, 行驶时间t ≤20s。此时瞄准模块电源开关断开。请在原代码的基础上在ccs环境改写MSPM0G3507芯片的代码写出第一问代码,要求评委任意指定小车行驶圈数,小车行驶完指定圈数后停止在起点。基本要求(1)中,行驶圈数可设1-5通键盘设定来控制圈数。代码下发和下面原代码一致,请将新添加的引脚指出来并用sysconfig图形化工具配置,原代码的引脚配置不变,只写循迹小车部分完成基本要求(1),瞄准模块不用管。四路灰度传感器循迹就用原代码方式实现。只在原代码基础上改动完成第一问,写在empty.c里面,其中不可以在赛道做任何标记。若想增加一个按键就Key2,引脚为PA21
08-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值