asdfgdfsgdfsg 发表于 2012-9-18 22:57:13

pscad中与c语言接口的例子

这两个例子都是什么意思啊,麻烦给解释一下
/* Example 3 */

void test_cblck_one__(struct emtstor_* s, int* arg)
{
   s->storf[(s->nstorf)-1]=0.5;
   s->stori[(s->nstori)-1]=1;
   s->stori[(s->nstori)]=(*arg);
}

/* --------- */
/* Example 4 */

void test_cblck_two__(struct s0_* s, struct branches_* b, int* br, int* ss, real* out)
{
   int posA, posB;
   int pos;
   int na, nb;
   pos = ((*ss)-1)*2000 + (*br)-1;
   na = b->ief;
   nb = b->iet;
   posA = ((*ss)-1)*200 + (na)-1;
   posB = ((*ss)-1)*200 + (nb)-1;
   (*out) = 0.0;
   if (posA >=0)
   (*out) = (s->vdc);
   if (posB >= 0)
   (*out) = (*out)-(s->vdc);
}

redplum 发表于 2012-9-19 00:00:35

很感谢楼主

寥寮 发表于 2012-9-19 04:32:13

不懂呢,学习了

mingyu 发表于 2012-9-19 12:28:21

这个你要结合那个模型看。

asdfgdfsgdfsg 发表于 2012-9-19 19:30:15

回复 4# mingyu

asdfgdfsgdfsg 发表于 2012-9-19 19:31:24

回复 1# asdfgdfsgdfsg


   

liaoma010101 发表于 2012-9-19 21:03:02

没看明白~~~~~求解释

wpf0221 发表于 2012-9-22 06:17:26

看了看那个例子没看懂,貌似楼主应该看看example2之后,到example3之前的那些定义,然后在帮助里找找storf和stori这些东西...

int test_cfun__(int *arg)
{
   return 2*(*arg);
}


/* set of typedef's needed for
   compability purpose with -r8 option
   of Fortran compiler,
   used when gcc called without any options
   excecpt -c (gcc -c <filename>.c) */

typedef double real;
typedef long int integer;
typedef struct { real r, i; } complex;
typedef long int logical;


/* structure representing
   common block   'emtstor'*/

struct emtstor_ {
    complex storc;
    real    storf;
    integer stori;
    logical storl;
    integer nstorc, nstorf, nstori, nstorl, this;
};

/* structure representing
   common block   's1'*/

struct s1_ {
    real time, delt, print, fintim;
    logical timezero, firststep, laststep, onstep;
};

/* structure representing
   common block   's0'*/

struct s0_ {
    real rdc        /* was */;
    real ccin        /* was */;
    real vdc      /* was */;
    real gm        /* was */;
    real ccgm   /* was */;
    real ccgmd    /* was */;
    real ccli   /* was */;
    real ggin   /* was */;
    real ca;
    real cdctr        /* was */;
    real cdctro        /* was */;
    integer mbus;
    logical idealss;
    logical enabccin /* was */;
};


/* structure representing
   common block   'branches'*/

structbranches_ {
    real cbr        /* was */;
    real ccbr    /* was */;
    real ccbrd   /* was */;
    real ebr   /* was */;
    real ebrd        /* was */;
    real ebron        /* was */;
    real ebrof        /* was */;
    real swlevl        /* was */;
    real geq        /* was */;
    real geqon        /* was */;
    real geqof        /* was */;
    real geqd        /* was */;
    real rlg        /* was */;
    real rcg        /* was */;
    real rcl        /* was */;
    real rsc        /* was */;
    real rsl        /* was */;
    real ccl        /* was */;
    real ccld        /* was */;
    real ccc        /* was */;
    real cccd        /* was */;
    real g2l        /* was */;
    real g2c        /* was */;
    real v12l        /* was */;
    real v20l        /* was */;
    integer nsw;
    integer brnsw/* was */;
    integer iet          /* was */;
    integer ief          /* was */;
    integer thisbr /* was */;
    logical resistor        /* was */;
    logical inductor        /* was */;
    logical capacitr        /* was */;
    logical source        /* was */;
    logical switch__        /* was */;
    logical idealbr        /* was */;
    logical openbr        /* was */;
    logical defrdbr        /* was */;
    logical flipidlbr        /* was */;
    logical geqchange        /* was */;
};


/* --------- */
/* Example 3 */


void test_cblck_one__(struct emtstor_* s, int* arg)
{
   s->storf[(s->nstorf)-1]=0.5;
   s->stori[(s->nstori)-1]=1;
   s->stori[(s->nstori)]=(*arg);
}

大石头 发表于 2012-9-22 09:12:26

kanbumingbai

05syw 发表于 2012-9-22 09:30:38

zenme huihi
页: [1] 2
查看完整版本: pscad中与c语言接口的例子

招聘斑竹