Changeset 52

Show
Ignore:
Timestamp:
03/25/08 13:38:56 (16 years ago)
Author:
smidl
Message:

zprovozneni na linuxu

Location:
simulator_zdenek/ekf_example
Files:
6 moved

Legend:

Unmodified
Added
Removed
  • simulator_zdenek/ekf_example/pwm.cpp

    r50 r52  
    1212#define _USE_MATH_DEFINES 
    1313#include <math.h> 
     14#include <stdlib.h> 
    1415#include "pwm.h" 
    1516 
     
    225226  smer=D_smer; smer2=D_smer2; 
    226227  citac=citac_init; 
    227   citac2=citac_init-(DT/h); 
    228   citac_PR=1./4./fc/h; 
     228  citac2=citac_init-(int)(DT/h); 
     229  citac_PR=(int)(1./4./fc/h); 
    229230} 
    230231 
     
    241242  smer=D_smer; smer2=D_smer2; 
    242243  citac=citac_init; 
    243   citac2=abs(citac_init-(DT/h)); 
    244   citac_PR=1./2./fc/h; 
     244  citac2=abs(citac_init-(int)(DT/h)); 
     245  citac_PR=(int)(1./2./fc/h); 
    245246} 
    246247 
  • simulator_zdenek/ekf_example/regulace.cpp

    r50 r52  
    187187  if (fabs(rychlost)>prechod_1_2) ALGORITMUS=1; // prechod z algoritmu 1 na 2 
    188188  if (fabs(rychlost)<prechod_2_1) ALGORITMUS=0; // prechod z algortimu 2 na 1 
    189 //  ALGORITMUS=0;         // provozovana pouze definovana varianta algoritmu rizeni   
     189  ALGORITMUS=0;         // provozovana pouze definovana varianta algoritmu rizeni 
    190190 
    191191  Iqw_reg=pi_reg(Ww-rychlost,Kpw,Kpw*Treg/Tiw,MAXw,-MAXw,&Sw); 
  • simulator_zdenek/ekf_example/simul.cpp

    r50 r52  
    9494 
    9595//  REL[0]=600; REL[1]=12.0*sqrt(2); REL[2]=2*M_PI*200; REL[3]=3.14159; 
    96 //  REL[4]=17.8;REL[5]=1.0;       // parametry pro v�MSM 6kW!!! 
     96//  REL[4]=17.8;REL[5]=1.0;       // parametry pro v�kon PMSM 6kW!!! 
    9797 
    9898  Isx=0.;Isy=0.;theta=x[3];rychlost=x[2];Uc_mer=Uc; 
    9999} 
    100100 
    101 void main(void) 
     101int main(void) 
    102102{ 
    103103  h=1e-6; 
     
    115115  init_ekf(h_reg,param); 
    116116 
    117   fw=fopen("data\\graf1.txt","w"); 
     117  fw=fopen("data/graf1.txt","w"); 
    118118 
    119119  Idwf=0.; 
     
    146146                // jednoducha reverzace - cely dej cca 11s 
    147147                Ww+=k_rampa*2.*M_PI*0.125/2.;    //1000Hz/s 
    148                 if (Ww>2.*M_PI*250.) {Ww=2.*M_PI*250.; if (k_rampa_tmp<8000) k_rampa_tmp++; else {k_rampa=-1;k_rampa_tmp=0;}} 
    149                 if (Ww<-2.*M_PI*250.) Ww=-2.*M_PI*250.;   /* */ 
     148                if (Ww>2.*M_PI*150.) {Ww=2.*M_PI*150.; if (k_rampa_tmp<8000) k_rampa_tmp++; else {k_rampa=-1;k_rampa_tmp=0;}} 
     149                if (Ww<-2.*M_PI*150.) Ww=-2.*M_PI*150.;   /* */ 
    150150          // skokova zmena napeti troleje 
    151151//          Ut=500;       // nutno zadat konstantni Isdw pri startu 
     
    155155//        Iqwf=149.*sqrt(2.); 
    156156 
    157                 // pomal�ezd 10s do max. rychlosti 700rpm 
     157                // pomal� rozjezd 10s do max. rychlosti 700rpm 
    158158/*              Iqwf=149.*sqrt(2.);     // konst. Isqw = Imax 
    159159                x[2]+=2.*M_PI*0.004; 
     
    171171 
    172172                // vystup z EKF zaveden do regulatoru 
    173                 rychlost=ekf_estim[0]; theta=ekf_estim[1]; 
     173                // rychlost=ekf_estim[0]; theta=ekf_estim[1]; //VS 
    174174 
    175175                Urm_max=1.0; 
     
    186186 
    187187        reg_counter=0; 
    188         Isx=x[0];Isy=x[1];rychlost=x[2];theta=x[3]+CHYBA_POLOHY;Uc_mer=Uc;       // re��zorkov 
     188        Isx=x[0];Isy=x[1];rychlost=x[2];theta=x[3]+CHYBA_POLOHY;Uc_mer=Uc;       // re�ln� vzorkov�n 
    189189      } 
    190190      hpom_model=0; 
     
    216216//  printf("*** \n\n"); 
    217217  fclose(fw); 
     218        return 0; 
    218219 }