Skip to content
Snippets Groups Projects
Commit c9d3445d authored by Alexander Ivanov's avatar Alexander Ivanov
Browse files

EpicsInput part with control; allows to set the input through the Epics CA or from the front-end.

git-svn-id: https://redoubt.ligo-wa.caltech.edu/svn/advLigoRTS/trunk@3346 6dcd42c9-f523-4c6d-aada-af552506706e
parent b34a3d11
No related branches found
No related tags found
No related merge requests found
package CDS::EpicsInCtrl;
use Exporter;
@ISA = ('Exporter');
#// \page EpicsInCtrl EpicsInCtrl.pm
#// Documentation for EpicsInCtrl.pm
#//
#// \n
sub partType {
my ($node, $i) = @_;
$desc = ${$node->{FIELDS}}{"Description"};
# Pull out all Epics fields from the description
$desc =~ s/\s//g;
# Get rid of backslashes inserted by Matlab in field name around quotes.
$desc =~ s/\\"/"/g;
my @l = $desc =~ m/(field\([^\)]*\))/g;
$::epics_fields[$i] = [@l];
return EpicsInCtrl;
}
# Print Epics communication structure into a header file
# Current part number is passed as first argument
sub printHeaderStruct {
my ($i) = @_;
print ::OUTH "\tdouble $::xpartName[$i];\n";
return "\tchar $::xpartName[$i]_mask;\n";
}
# Print Epics variable definitions
# Current part number is passed as first argument
sub printEpics {
my ($i) = @_;
print ::EPICS "INVARIABLE $::xpartName[$i] $::systemName\.$::xpartName[$i] double ai 0 field(PREC,\"3\")";
foreach $ef (@{$::epics_fields[$i]}) {
print ::EPICS " " . $ef;
}
print ::EPICS "\n";
}
# Print variable declarations int front-end file
# Current part number is passed as first argument
sub printFrontEndVars {
my ($i) = @_;
;
}
# Return front end initialization code
# Argument 1 is the part number
# Returns calculated code string
sub frontEndInitCode {
my ($i) = @_;
return "";
}
# Figure out part input code
# Argument 1 is the part number
# Argument 2 is the input number
# Returns calculated input code
sub fromExp {
my ($i, $j) = @_;
my $from = $::partInNum[$i][$j];
return "pLocalEpics->" . $::systemName . "\." . $::xpartName[$from];
}
# Return front end code
# Argument 1 is the part number
# Returns calculated code string
sub frontEndCode {
my ($i) = @_;
// Assign mask
$ret .= "pLocalEpics->$::systemName\.$::xpartName[$i]_mask = ";
$ret .= "$::fromExp[0];\n";
// Assign the value from the second input if masked
$ret .= "if ($::fromExp[0]) pLocalEpics->$::systemName\.$::xpartName[$i] = $::fromExp[1];\n";
return "";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment